Move ipc parsing code into libt.
This commit is contained in:
parent
2e1773a974
commit
8d61b3e49e
|
@ -30,11 +30,71 @@
|
||||||
|
|
||||||
#include "bsdtree.h"
|
#include "bsdtree.h"
|
||||||
#include "ipc.h"
|
#include "ipc.h"
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
#include "transmission.h"
|
#include "transmission.h"
|
||||||
#include "bencode.h"
|
#include "bencode.h"
|
||||||
|
|
||||||
|
/* begin copy-paste from daemon/misc.h */
|
||||||
|
|
||||||
|
#define ARRAYLEN( ary ) ( sizeof( ary ) / sizeof( (ary)[0] ) )
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN( aa, bb ) ( (aa) < (bb) ? (aa) : (bb) )
|
||||||
|
#endif
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX( aa, bb ) ( (aa) > (bb) ? (aa) : (bb) )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef NULL
|
||||||
|
#define NULL ( ( void * )0 )
|
||||||
|
|
||||||
|
#define TORRENT_ID_VALID( id ) ( 0 < (id) && INT_MAX > (id) )
|
||||||
|
|
||||||
|
#define SAFEFREE( ptr ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
int saved = errno; \
|
||||||
|
free( ptr ); \
|
||||||
|
errno = saved; \
|
||||||
|
} \
|
||||||
|
while( 0 )
|
||||||
|
#define SAFEFREESTRLIST( ptr ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
int saved = errno; \
|
||||||
|
FREESTRLIST( ptr ); \
|
||||||
|
errno = saved; \
|
||||||
|
} \
|
||||||
|
while( 0 )
|
||||||
|
#define SAFEBENCFREE( val ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
int saved = errno; \
|
||||||
|
tr_bencFree( val ); \
|
||||||
|
errno = saved; \
|
||||||
|
} \
|
||||||
|
while( 0 )
|
||||||
|
|
||||||
|
#define INTCMP_FUNC( name, type, id ) \
|
||||||
|
int \
|
||||||
|
name( struct type * _icf_first, struct type * _icf_second ) \
|
||||||
|
{ \
|
||||||
|
if( _icf_first->id < _icf_second->id ) \
|
||||||
|
{ \
|
||||||
|
return -1; \
|
||||||
|
} \
|
||||||
|
else if( _icf_first->id > _icf_second->id ) \
|
||||||
|
{ \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
return 0; \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end copy-paste from daemon/misc.h */
|
||||||
|
|
||||||
/* IPC protocol version */
|
/* IPC protocol version */
|
||||||
#define PROTO_VERS_MIN ( 1 )
|
#define PROTO_VERS_MIN ( 1 )
|
||||||
#define PROTO_VERS_MAX ( 2 )
|
#define PROTO_VERS_MAX ( 2 )
|
|
@ -3,7 +3,7 @@
|
||||||
include ../mk/config.mk
|
include ../mk/config.mk
|
||||||
include ../mk/common.mk
|
include ../mk/common.mk
|
||||||
|
|
||||||
COMSRCS = errors.c ipc.c misc.c
|
COMSRCS = errors.c misc.c
|
||||||
SRVSRCS = daemon.c server.c torrents.c
|
SRVSRCS = daemon.c server.c torrents.c
|
||||||
CLISRCS = client.c remote.c
|
CLISRCS = client.c remote.c
|
||||||
PXYSRCS = proxy.c
|
PXYSRCS = proxy.c
|
||||||
|
|
|
@ -6,7 +6,7 @@ include ../mk/common.mk
|
||||||
SRCS = transmission.c bencode.c net.c tracker.c peer.c inout.c \
|
SRCS = transmission.c bencode.c net.c tracker.c peer.c inout.c \
|
||||||
metainfo.c sha1.c utils.c fdlimit.c clients.c completion.c \
|
metainfo.c sha1.c utils.c fdlimit.c clients.c completion.c \
|
||||||
platform.c ratecontrol.c choking.c natpmp.c upnp.c http.c xml.c \
|
platform.c ratecontrol.c choking.c natpmp.c upnp.c http.c xml.c \
|
||||||
shared.c torrent.c strlcpy.c strlcat.c
|
shared.c torrent.c strlcpy.c strlcat.c ipc.c
|
||||||
|
|
||||||
OBJS = $(SRCS:%.c=%.o)
|
OBJS = $(SRCS:%.c=%.o)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue