• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/transmission/transmission-2.73/libtransmission/

Lines Matching defs:io

10  * $Id: peer-io.h 12365 2011-04-17 05:22:50Z jordan $
59 typedef ReadState ( *tr_can_read_cb )( struct tr_peerIo * io,
63 typedef void ( *tr_did_write_cb )( struct tr_peerIo * io,
68 typedef void ( *tr_net_error_cb )( struct tr_peerIo * io,
143 tr_peerIo * io );
145 #define tr_peerIoRef(io) tr_peerIoRefImpl( __FILE__, __LINE__, (io) );
149 tr_peerIo * io );
151 #define tr_peerIoUnref(io) tr_peerIoUnrefImpl( __FILE__, __LINE__, (io) );
156 tr_isPeerIo( const tr_peerIo * io )
158 return ( io != NULL )
159 && ( io->magicNumber == PEER_IO_MAGIC_NUMBER )
160 && ( io->refCount >= 0 )
161 && ( tr_isBandwidth( &io->bandwidth ) )
162 && ( tr_address_is_valid( &io->addr ) );
169 static inline void tr_peerIoEnableFEXT( tr_peerIo * io, bool flag )
171 io->fastExtensionSupported = flag;
173 static inline bool tr_peerIoSupportsFEXT( const tr_peerIo * io )
175 return io->fastExtensionSupported;
178 static inline void tr_peerIoEnableLTEP( tr_peerIo * io, bool flag )
180 io->extendedProtocolSupported = flag;
182 static inline bool tr_peerIoSupportsLTEP( const tr_peerIo * io )
184 return io->extendedProtocolSupported;
187 static inline void tr_peerIoEnableDHT( tr_peerIo * io, bool flag )
189 io->dhtSupported = flag;
191 static inline bool tr_peerIoSupportsDHT( const tr_peerIo * io )
193 return io->dhtSupported;
196 static inline bool tr_peerIoSupportsUTP( const tr_peerIo * io )
198 return io->dhtSupported;
205 static inline tr_session* tr_peerIoGetSession ( tr_peerIo * io )
207 assert( tr_isPeerIo( io ) );
208 assert( io->session );
210 return io->session;
216 const char* tr_peerIoGetAddrStr( const tr_peerIo * io );
218 const struct tr_address * tr_peerIoGetAddress( const tr_peerIo * io,
221 const uint8_t* tr_peerIoGetTorrentHash( tr_peerIo * io );
223 int tr_peerIoHasTorrentHash( const tr_peerIo * io );
225 void tr_peerIoSetTorrentHash( tr_peerIo * io,
228 int tr_peerIoReconnect( tr_peerIo * io );
230 static inline bool tr_peerIoIsIncoming( const tr_peerIo * io )
232 return io->isIncoming;
235 static inline int tr_peerIoGetAge( const tr_peerIo * io )
237 return tr_time() - io->timeCreated;
245 void tr_peerIoSetPeersId( tr_peerIo * io,
248 static inline const uint8_t* tr_peerIoGetPeersId( const tr_peerIo * io )
250 assert( tr_isPeerIo( io ) );
251 assert( io->peerIdIsSet );
253 return io->peerId;
260 void tr_peerIoSetIOFuncs ( tr_peerIo * io,
266 void tr_peerIoClear ( tr_peerIo * io );
272 void tr_peerIoWriteBytes ( tr_peerIo * io,
277 void tr_peerIoWriteBuf ( tr_peerIo * io,
285 static inline tr_crypto * tr_peerIoGetCrypto( tr_peerIo * io )
287 return &io->crypto;
290 void tr_peerIoSetEncryption( tr_peerIo * io, tr_encryption_type encryption_type );
293 tr_peerIoIsEncrypted( const tr_peerIo * io )
295 return ( io != NULL ) && ( io->encryption_type == PEER_ENCRYPTION_RC4 );
319 void tr_peerIoReadBytesToBuf( tr_peerIo * io,
324 void tr_peerIoReadBytes( tr_peerIo * io,
329 static inline void tr_peerIoReadUint8( tr_peerIo * io,
333 tr_peerIoReadBytes( io, inbuf, setme, sizeof( uint8_t ) );
336 void tr_peerIoReadUint16( tr_peerIo * io,
340 void tr_peerIoReadUint32( tr_peerIo * io,
344 void tr_peerIoDrain( tr_peerIo * io,
352 size_t tr_peerIoGetWriteBufferSpace( const tr_peerIo * io, uint64_t now );
354 static inline void tr_peerIoSetParent( tr_peerIo * io,
357 assert( tr_isPeerIo( io ) );
359 tr_bandwidthSetParent( &io->bandwidth, parent );
362 void tr_peerIoBandwidthUsed( tr_peerIo * io,
368 tr_peerIoHasBandwidthLeft( const tr_peerIo * io, tr_direction dir )
370 return tr_bandwidthClamp( &io->bandwidth, dir, 1024 ) > 0;
374 tr_peerIoGetPieceSpeed_Bps( const tr_peerIo * io, uint64_t now, tr_direction dir )
376 return tr_bandwidthGetPieceSpeed_Bps( &io->bandwidth, now, dir );
383 void tr_peerIoSetEnabled( tr_peerIo * io,
387 int tr_peerIoFlush( tr_peerIo * io,
391 int tr_peerIoFlushOutgoingProtocolMsgs( tr_peerIo * io );
397 static inline struct evbuffer * tr_peerIoGetReadBuffer( tr_peerIo * io )
399 return io->inbuf;