1 | /****************************************************************************** |
---|
2 | * $Id: net.h 261 2006-05-29 21:27:31Z titer $ |
---|
3 | * |
---|
4 | * Copyright (c) 2005-2006 Transmission authors and contributors |
---|
5 | * |
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
---|
7 | * copy of this software and associated documentation files (the "Software"), |
---|
8 | * to deal in the Software without restriction, including without limitation |
---|
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
10 | * and/or sell copies of the Software, and to permit persons to whom the |
---|
11 | * Software is furnished to do so, subject to the following conditions: |
---|
12 | * |
---|
13 | * The above copyright notice and this permission notice shall be included in |
---|
14 | * all copies or substantial portions of the Software. |
---|
15 | * |
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
22 | * DEALINGS IN THE SOFTWARE. |
---|
23 | *****************************************************************************/ |
---|
24 | |
---|
25 | |
---|
26 | /*********************************************************************** |
---|
27 | * DNS resolution |
---|
28 | **********************************************************************/ |
---|
29 | int tr_netResolve( char *, struct in_addr * ); |
---|
30 | |
---|
31 | #define TR_RESOLVE_WAIT 0 |
---|
32 | #define TR_RESOLVE_ERROR 1 |
---|
33 | #define TR_RESOLVE_OK 2 |
---|
34 | typedef struct tr_resolve_s tr_resolve_t; |
---|
35 | void tr_netResolveThreadInit(); |
---|
36 | void tr_netResolveThreadClose(); |
---|
37 | tr_resolve_t * tr_netResolveInit( char * ); |
---|
38 | int tr_netResolvePulse( tr_resolve_t *, struct in_addr * ); |
---|
39 | void tr_netResolveClose( tr_resolve_t * ); |
---|
40 | |
---|
41 | |
---|
42 | /*********************************************************************** |
---|
43 | * TCP sockets |
---|
44 | **********************************************************************/ |
---|
45 | int tr_netOpen ( struct in_addr addr, in_port_t port ); |
---|
46 | int tr_netBind ( int ); |
---|
47 | int tr_netAccept ( int s, struct in_addr *, in_port_t * ); |
---|
48 | void tr_netClose ( int s ); |
---|
49 | |
---|
50 | #define TR_NET_BLOCK 0x80000000 |
---|
51 | #define TR_NET_CLOSE 0x40000000 |
---|
52 | int tr_netSend ( int s, uint8_t * buf, int size ); |
---|
53 | int tr_netRecv ( int s, uint8_t * buf, int size ); |
---|
54 | |
---|