Changeset 7455 for branches/1.4x/libtransmission/peer-io.h
- Timestamp:
- Dec 22, 2008, 12:51:14 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4x/libtransmission/peer-io.h
r7176 r7455 1 1 /* 2 * This file Copyright (C) 2007-2008 Charles Kerr <charles@ rebelbase.com>2 * This file Copyright (C) 2007-2008 Charles Kerr <charles@transmissionbt.com> 3 3 * 4 4 * This file is licensed by the GPL version 2. Works owned by the … … 18 18 #define TR_PEER_IO_H 19 19 20 /** 21 ***22 ** /23 24 struct in_addr; 20 #include "net.h" /* tr_address */ 21 /** 22 *** 23 **/ 24 25 25 struct evbuffer; 26 26 struct tr_bandwidth; 27 27 struct tr_crypto; 28 struct tr_iobuf;29 28 typedef struct tr_peerIo tr_peerIo; 30 29 … … 33 32 **/ 34 33 35 tr_peerIo* tr_peerIoNewOutgoing( struct tr_handle * session, 36 const struct in_addr * addr, 37 int port, 38 const uint8_t * torrentHash ); 39 40 tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session, 41 const struct in_addr * addr, 42 uint16_t port, 43 int socket ); 44 45 void tr_peerIoFree( tr_peerIo * io ); 46 47 tr_session* tr_peerIoGetSession( tr_peerIo * io ); 48 49 /** 50 *** 51 **/ 52 53 void tr_peerIoEnableLTEP( tr_peerIo * io, 54 int flag ); 55 56 void tr_peerIoEnableFEXT( tr_peerIo * io, 57 int flag ); 58 59 int tr_peerIoSupportsLTEP( const tr_peerIo * io ); 60 61 int tr_peerIoSupportsFEXT( const tr_peerIo * io ); 62 63 /** 64 *** 65 **/ 66 67 const char* tr_peerIoAddrStr( const struct in_addr * addr, 68 uint16_t port ); 69 70 const char* tr_peerIoGetAddrStr( const tr_peerIo * io ); 71 72 const struct in_addr*tr_peerIoGetAddress( const tr_peerIo * io, 73 uint16_t * port ); 34 tr_peerIo* tr_peerIoNewOutgoing( tr_session * session, 35 const tr_address * addr, 36 tr_port port, 37 const uint8_t * torrentHash ); 38 39 tr_peerIo* tr_peerIoNewIncoming( tr_session * session, 40 const tr_address * addr, 41 tr_port port, 42 int socket ); 43 44 void tr_peerIoFree ( tr_peerIo * io ); 45 46 tr_bool tr_isPeerIo ( const tr_peerIo * io ); 47 48 49 /** 50 *** 51 **/ 52 53 void tr_peerIoEnableLTEP( tr_peerIo * io, tr_bool flag ); 54 55 tr_bool tr_peerIoSupportsLTEP( const tr_peerIo * io ); 56 57 void tr_peerIoEnableFEXT( tr_peerIo * io, tr_bool flag ); 58 59 tr_bool tr_peerIoSupportsFEXT( const tr_peerIo * io ); 60 61 /** 62 *** 63 **/ 64 65 tr_session* tr_peerIoGetSession ( tr_peerIo * io ); 66 67 const char* tr_peerIoAddrStr( const tr_address * addr, 68 tr_port port ); 69 70 const char* tr_peerIoGetAddrStr( const tr_peerIo * io ); 71 72 const tr_address * tr_peerIoGetAddress( const tr_peerIo * io, 73 tr_port * port ); 74 74 75 75 const uint8_t* tr_peerIoGetTorrentHash( tr_peerIo * io ); … … 82 82 int tr_peerIoReconnect( tr_peerIo * io ); 83 83 84 int tr_peerIoIsIncoming( const tr_peerIo * io ); 85 86 void tr_peerIoSetTimeoutSecs( tr_peerIo * io, 87 int secs ); 84 tr_bool tr_peerIoIsIncoming( const tr_peerIo * io ); 88 85 89 86 int tr_peerIoGetAge( const tr_peerIo * io ); … … 111 108 ReadState; 112 109 113 typedef ReadState ( *tr_can_read_cb )( struct tr_iobuf * iobuf,110 typedef ReadState ( *tr_can_read_cb )( tr_peerIo * io, 114 111 void * user_data, 115 112 size_t * setme_piece_byte_count ); … … 120 117 void * userData ); 121 118 122 typedef void ( *tr_net_error_cb )( struct tr_iobuf * ev,119 typedef void ( *tr_net_error_cb )( tr_peerIo * io, 123 120 short what, 124 121 void * userData ); … … 157 154 EncryptionMode; 158 155 159 void tr_peerIoSetEncryption( tr_peerIo * io, 160 int encryptionMode ); 161 162 int tr_peerIoIsEncrypted( const tr_peerIo * io ); 163 164 void tr_peerIoWriteBytes( tr_peerIo * io, 165 struct evbuffer * outbuf, 166 const void * bytes, 167 size_t byteCount ); 168 169 void tr_peerIoWriteUint8( tr_peerIo * io, 170 struct evbuffer * outbuf, 171 uint8_t writeme ); 172 173 void tr_peerIoWriteUint16( tr_peerIo * io, 174 struct evbuffer * outbuf, 175 uint16_t writeme ); 176 177 void tr_peerIoWriteUint32( tr_peerIo * io, 178 struct evbuffer * outbuf, 179 uint32_t writeme ); 180 181 void tr_peerIoReadBytes( tr_peerIo * io, 182 struct evbuffer * inbuf, 183 void * bytes, 184 size_t byteCount ); 185 186 void tr_peerIoReadUint8( tr_peerIo * io, 187 struct evbuffer * inbuf, 188 uint8_t * setme ); 189 190 void tr_peerIoReadUint16( tr_peerIo * io, 191 struct evbuffer * inbuf, 192 uint16_t * setme ); 193 194 void tr_peerIoReadUint32( tr_peerIo * io, 195 struct evbuffer * inbuf, 196 uint32_t * setme ); 197 198 void tr_peerIoDrain( tr_peerIo * io, 199 struct evbuffer * inbuf, 200 size_t byteCount ); 201 202 /** 203 *** 204 **/ 205 206 size_t tr_peerIoGetWriteBufferSpace( const tr_peerIo * io ); 207 208 void tr_peerIoSetBandwidth( tr_peerIo * io, 209 struct tr_bandwidth * bandwidth ); 210 211 void tr_peerIoBandwidthUsed( tr_peerIo * io, 212 tr_direction direction, 213 size_t byteCount, 214 int isPieceData ); 156 void tr_peerIoSetEncryption( tr_peerIo * io, 157 int encryptionMode ); 158 159 int tr_peerIoIsEncrypted( const tr_peerIo * io ); 160 161 void tr_peerIoWriteBytes( tr_peerIo * io, 162 struct evbuffer * outbuf, 163 const void * bytes, 164 size_t byteCount ); 165 166 void tr_peerIoWriteUint8( tr_peerIo * io, 167 struct evbuffer * outbuf, 168 uint8_t writeme ); 169 170 void tr_peerIoWriteUint16( tr_peerIo * io, 171 struct evbuffer * outbuf, 172 uint16_t writeme ); 173 174 void tr_peerIoWriteUint32( tr_peerIo * io, 175 struct evbuffer * outbuf, 176 uint32_t writeme ); 177 178 void tr_peerIoReadBytes( tr_peerIo * io, 179 struct evbuffer * inbuf, 180 void * bytes, 181 size_t byteCount ); 182 183 void tr_peerIoReadUint8( tr_peerIo * io, 184 struct evbuffer * inbuf, 185 uint8_t * setme ); 186 187 void tr_peerIoReadUint16( tr_peerIo * io, 188 struct evbuffer * inbuf, 189 uint16_t * setme ); 190 191 void tr_peerIoReadUint32( tr_peerIo * io, 192 struct evbuffer * inbuf, 193 uint32_t * setme ); 194 195 void tr_peerIoDrain( tr_peerIo * io, 196 struct evbuffer * inbuf, 197 size_t byteCount ); 198 199 /** 200 *** 201 **/ 202 203 size_t tr_peerIoGetWriteBufferSpace( const tr_peerIo * io ); 204 205 void tr_peerIoSetBandwidth( tr_peerIo * io, 206 struct tr_bandwidth * bandwidth ); 207 208 void tr_peerIoBandwidthUsed( tr_peerIo * io, 209 tr_direction direction, 210 size_t byteCount, 211 int isPieceData ); 212 213 /** 214 *** 215 **/ 216 217 tr_bool tr_peerIoHasBandwidthLeft( const tr_peerIo * io, 218 tr_direction direction ); 219 220 void tr_peerIoSetEnabled( tr_peerIo * io, 221 tr_direction dir, 222 tr_bool isEnabled ); 223 224 int tr_peerIoFlush( tr_peerIo * io, 225 tr_direction dir, 226 size_t byteLimit ); 227 228 struct evbuffer * tr_peerIoGetReadBuffer( tr_peerIo * io ); 229 215 230 216 231
Note: See TracChangeset
for help on using the changeset viewer.