(trunk libT) copyediting: peer-io's "EncryptionMode" type had a name too similar to tr_encryption_mode... rename it to reduce potential confusion

This commit is contained in:
Jordan Lee 2011-03-31 16:41:52 +00:00
parent e6c0bdef6a
commit 65f0f3effd
2 changed files with 18 additions and 17 deletions

View File

@ -956,13 +956,13 @@ tr_peerIoGetWriteBufferSpace( const tr_peerIo * io, uint64_t now )
**/
void
tr_peerIoSetEncryption( tr_peerIo * io, uint32_t encryptionMode )
tr_peerIoSetEncryption( tr_peerIo * io, tr_encryption_type encryption_type )
{
assert( tr_isPeerIo( io ) );
assert( encryptionMode == PEER_ENCRYPTION_NONE
|| encryptionMode == PEER_ENCRYPTION_RC4 );
assert( encryption_type == PEER_ENCRYPTION_NONE
|| encryption_type == PEER_ENCRYPTION_RC4 );
io->encryptionMode = encryptionMode;
io->encryption_type = encryption_type;
}
/**
@ -995,7 +995,7 @@ evbuffer_peek_all( struct evbuffer * buf, size_t * setme_vecCount )
static void
maybeEncryptBuffer( tr_peerIo * io, struct evbuffer * buf )
{
if( io->encryptionMode == PEER_ENCRYPTION_RC4 )
if( io->encryption_type == PEER_ENCRYPTION_RC4 )
{
size_t i, n;
struct evbuffer_iovec * iovec = evbuffer_peek_all( buf, &n );
@ -1066,7 +1066,7 @@ tr_peerIoReadBytes( tr_peerIo * io, struct evbuffer * inbuf, void * bytes, size_
assert( tr_isPeerIo( io ) );
assert( evbuffer_get_length( inbuf ) >= byteCount );
switch( io->encryptionMode )
switch( io->encryption_type )
{
case PEER_ENCRYPTION_NONE:
evbuffer_remove( inbuf, bytes, byteCount );

View File

@ -47,6 +47,15 @@ typedef enum
}
ReadState;
typedef enum
{
/* these match the values in MSE's crypto_select */
PEER_ENCRYPTION_NONE = ( 1 << 0 ),
PEER_ENCRYPTION_RC4 = ( 1 << 1 )
}
tr_encryption_type;
typedef ReadState ( *tr_can_read_cb )( struct tr_peerIo * io,
void * user_data,
size_t * setme_piece_byte_count );
@ -76,7 +85,7 @@ typedef struct tr_peerIo
int magicNumber;
uint32_t encryptionMode;
tr_encryption_type encryption_type;
bool isSeed;
tr_port port;
@ -278,20 +287,12 @@ static inline struct tr_crypto * tr_peerIoGetCrypto( tr_peerIo * io )
return io->crypto;
}
typedef enum
{
/* these match the values in MSE's crypto_select */
PEER_ENCRYPTION_NONE = ( 1 << 0 ),
PEER_ENCRYPTION_RC4 = ( 1 << 1 )
}
EncryptionMode;
void tr_peerIoSetEncryption( tr_peerIo * io, uint32_t encryptionMode );
void tr_peerIoSetEncryption( tr_peerIo * io, tr_encryption_type encryption_type );
static inline bool
tr_peerIoIsEncrypted( const tr_peerIo * io )
{
return ( io != NULL ) && ( io->encryptionMode == PEER_ENCRYPTION_RC4 );
return ( io != NULL ) && ( io->encryption_type == PEER_ENCRYPTION_RC4 );
}
void evbuffer_add_uint8 ( struct evbuffer * outbuf, uint8_t byte );