From c28cf398fd956eb467612eec4b31e1df371b9636 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Thu, 20 Dec 2007 05:59:34 +0000 Subject: Introduce some kind of versioning --- Makefile | 28 ++++++++++++++++++++++++++-- opentracker.c | 8 ++++++-- opentracker.xcodeproj/project.pbxproj | 5 +++-- ot_accesslist.c | 6 +++++- ot_accesslist.h | 4 +++- ot_clean.c | 6 +++++- ot_clean.h | 4 +++- ot_fullscrape.c | 6 +++++- ot_fullscrape.h | 4 +++- ot_http.c | 6 +++++- ot_http.h | 4 +++- ot_iovec.c | 6 +++++- ot_iovec.h | 4 +++- ot_mutex.c | 6 +++++- ot_mutex.h | 4 +++- ot_stats.c | 17 ++++++++++++++++- ot_stats.h | 5 ++++- ot_sync.c | 6 +++++- ot_sync.h | 4 +++- ot_udp.c | 12 +++++++++--- ot_udp.h | 4 +++- ot_vector.c | 6 +++++- ot_vector.h | 4 +++- scan_urlencoded_query.c | 6 +++++- scan_urlencoded_query.h | 6 ++++-- trackerlogic.c | 6 +++++- trackerlogic.h | 4 +++- 27 files changed, 148 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 3a5ac12..12c89d7 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,24 @@ +# $Id$ + CC?=gcc + +# Linux flavour +# PREFIX?=/opt/diet +# LIBOWFAT_HEADERS=$(PREFIX)/include +# LIBOWFAT_LIBRARY=$(PREIFX)/lib + +# BSD flavour +PREFIX?=/usr/local +LIBOWFAT_HEADERS=$(PREFIX)/include/libowfat +LIBOWFAT_LIBRARY=$(PREIFX)/lib + +# Debug flavour +# PREFIX?=.. +# LIBOWFAT_HEADERS=$(PREFIX)/libowfat +# LIBOWFAT_LIBRARY=$(PREFIX)/libowfat + +BINDIR?=$(PREFIX)/bin + #FEATURES =-DWANT_TRACKER_SYNC #FEATURES+=-DWANT_BLACKLISTING #FEATURES+=-DWANT_CLOSED_TRACKER @@ -9,8 +29,9 @@ CC?=gcc OPTS_debug=-g -ggdb #-pg # -fprofile-arcs -ftest-coverage OPTS_production=-Os -CFLAGS+=-I../libowfat -Wall -pipe -Wextra #-pedantic -ansi -LDFLAGS+=-L../libowfat/ -lowfat -pthread -lz + +CFLAGS+=-I$(LIBOWFAT_HEADERS) -Wall -pipe -Wextra #-pedantic -ansi +LDFLAGS+=-L$(LIBOWFAT_LIBRARY) -lowfat -pthread -lz BINARY =opentracker HEADERS=trackerlogic.h scan_urlencoded_query.h ot_mutex.h ot_stats.h ot_sync.h ot_vector.h ot_clean.h ot_udp.h ot_iovec.h ot_fullscrape.h ot_accesslist.h ot_http.h @@ -40,3 +61,6 @@ $(BINARY).debug: $(OBJECTS_debug) $(HEADERS) clean: rm -rf opentracker opentracker.debug *.o *~ + +install: + install -m 755 opentracker $(BINDIR) diff --git a/opentracker.c b/opentracker.c index 6867946..a3aa827 100644 --- a/opentracker.c +++ b/opentracker.c @@ -1,7 +1,8 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. Some of the stuff below is stolen from Fefes example libowfat httpd. -*/ + + $Id$ */ /* System */ #include @@ -250,7 +251,7 @@ int main( int argc, char **argv ) { #endif while( scanon ) { - switch( getopt( argc, argv, ":i:p:A:P:d:r:" + switch( getopt( argc, argv, ":i:p:A:P:d:r:v" #ifdef WANT_BLACKLISTING "b:" #elif defined( WANT_CLOSED_TRACKER ) @@ -273,6 +274,7 @@ int main( int argc, char **argv ) { accesslist_blessip( tmpip, 0xffff ); /* Allow everything for now */ break; case 'h': help( argv[0] ); exit( 0 ); + case 'v': write( 2, static_inbuf, stats_return_tracker_version( static_inbuf )); exit( 0 ); default: case '?': usage( argv[0] ); exit( 1 ); } @@ -312,3 +314,5 @@ int main( int argc, char **argv ) { return 0; } + +const char *g_version_opentracker_c = "$Source$: $Revision$\n"; diff --git a/opentracker.xcodeproj/project.pbxproj b/opentracker.xcodeproj/project.pbxproj index bedcc9b..7068fa5 100644 --- a/opentracker.xcodeproj/project.pbxproj +++ b/opentracker.xcodeproj/project.pbxproj @@ -39,10 +39,10 @@ /* Begin PBXFileReference section */ 6520B7520D036AAF00A43B1F /* libowfat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libowfat.a; path = ../libowfat/libowfat.a; sourceTree = SOURCE_ROOT; }; + 6520B8110D0E011000A43B1F /* liblibowfat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibowfat.a; sourceTree = BUILT_PRODUCTS_DIR; }; 653A320A0CE7F475007F0D03 /* ot_accesslist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ot_accesslist.h; sourceTree = ""; }; 653A320B0CE7F475007F0D03 /* ot_accesslist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ot_accesslist.c; sourceTree = ""; }; 653A56AC0CE201FF000CF140 /* opentracker */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = opentracker; sourceTree = BUILT_PRODUCTS_DIR; }; - 653A56AF0CE201FF000CF140 /* liblibowfat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = liblibowfat.a; path = /Users/erdgeist/Coding/opentracker/build/Debug/liblibowfat.a; sourceTree = ""; }; 653A56B30CE28EC5000CF140 /* ot_iovec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ot_iovec.h; sourceTree = ""; }; 653A56B40CE28EC5000CF140 /* ot_iovec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ot_iovec.c; sourceTree = ""; }; 654A80840CD832FC009035DE /* opentracker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = opentracker.c; sourceTree = ""; }; @@ -124,6 +124,7 @@ children = ( 653A56AC0CE201FF000CF140 /* opentracker */, 6520B7520D036AAF00A43B1F /* libowfat.a */, + 6520B8110D0E011000A43B1F /* liblibowfat.a */, ); name = Products; sourceTree = ""; @@ -182,7 +183,7 @@ ); name = libowfat; productName = libowfat; - productReference = 653A56AF0CE201FF000CF140 /* liblibowfat.a */; + productReference = 6520B8110D0E011000A43B1F /* liblibowfat.a */; productType = "com.apple.product-type.library.static"; }; 8DD76FA90486AB0100D96B5E /* opentracker */ = { diff --git a/ot_accesslist.c b/ot_accesslist.c index 38b1bdf..df3d64c 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -116,3 +118,5 @@ int accesslist_isblessed( char *ip, ot_permissions permissions ) { return 1; return 0; } + +const char *g_version_accesslist_c = "$Source$: $Revision$\n"; diff --git a/ot_accesslist.h b/ot_accesslist.h index d0d674a..6adefd9 100644 --- a/ot_accesslist.h +++ b/ot_accesslist.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_ACCESSLIST_H__ #define __OT_ACCESSLIST_H__ diff --git a/ot_clean.c b/ot_clean.c index 308c848..a45a3dc 100644 --- a/ot_clean.c +++ b/ot_clean.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -129,3 +131,5 @@ void clean_init( void ) { void clean_deinit( void ) { pthread_cancel( thread_id ); } + +const char *g_version_clean_c = "$Source$: $Revision$\n"; diff --git a/ot_clean.h b/ot_clean.h index 8ad1ae8..a06891e 100644 --- a/ot_clean.h +++ b/ot_clean.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_CLEAN_H__ #define __OT_CLEAN_H__ diff --git a/ot_fullscrape.c b/ot_fullscrape.c index d40e471..f9129e4 100644 --- a/ot_fullscrape.c +++ b/ot_fullscrape.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -223,3 +225,5 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas /* Release unused memory in current output buffer */ iovec_fixlast( iovec_entries, iovector, r ); } + +const char *g_version_fullscrape_c = "$Source$: $Revision$\n"; diff --git a/ot_fullscrape.h b/ot_fullscrape.h index 7666e6c..ccd39f4 100644 --- a/ot_fullscrape.h +++ b/ot_fullscrape.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_FULLSCRAPE_H__ #define __OT_FULLSCRAPE_H__ diff --git a/ot_http.c b/ot_http.c index a377e84..232911b 100644 --- a/ot_http.c +++ b/ot_http.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -568,3 +570,5 @@ ssize_t http_handle_request( const int64 client_socket, char *data, size_t recv_ http_senddata( client_socket, static_outbuf + reply_off, reply_size ); return reply_size; } + +const char *g_version_http_c = "$Source$: $Revision$\n"; diff --git a/ot_http.h b/ot_http.h index a64cf19..3570042 100644 --- a/ot_http.h +++ b/ot_http.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_HTTP_H__ #define __OT_HTTP_H__ diff --git a/ot_iovec.c b/ot_iovec.c index f71d4d7..70e017c 100644 --- a/ot_iovec.c +++ b/ot_iovec.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -71,3 +73,5 @@ size_t iovec_length( int *iovec_entries, struct iovec **iovector ) { length += ((*iovector)[i]).iov_len; return length; } + +const char *g_version_iovec_c = "$Source$: $Revision$\n"; diff --git a/ot_iovec.h b/ot_iovec.h index d7105bd..02373e7 100644 --- a/ot_iovec.h +++ b/ot_iovec.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_IOVEC_H__ #define __OT_IOVEC_H__ diff --git a/ot_mutex.c b/ot_mutex.c index 6bcaf12..5f51299 100644 --- a/ot_mutex.c +++ b/ot_mutex.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -316,3 +318,5 @@ void mutex_deinit( ) { pthread_cond_destroy(&tasklist_being_filled); byte_zero( all_torrents, sizeof( all_torrents ) ); } + +const char *g_version_mutex_c = "$Source$: $Revision$\n"; diff --git a/ot_mutex.h b/ot_mutex.h index c098343..063eb08 100644 --- a/ot_mutex.h +++ b/ot_mutex.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_MUTEX_H__ #define __OT_MUTEX_H__ diff --git a/ot_stats.c b/ot_stats.c index 417e194..fa783d8 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -334,6 +336,18 @@ static size_t stats_httperrors_txt ( char * reply ) { ot_failed_request_counts[6] ); } +extern const char +*g_version_opentracker_c, *g_version_accesslist_c, *g_version_clean_c, *g_version_fullscrape_c, *g_version_http_c, +*g_version_iovec_c, *g_version_mutex_c, *g_version_stats_c, *g_version_sync_c, *g_version_udp_c, *g_version_vector_c, +*g_version_scan_urlencoded_query_c, *g_version_trackerlogic_c; + +size_t stats_return_tracker_version( char *reply ) { + return sprintf( reply, "%s%s%s%s%s%s%s%s%s%s%s%s%s", + g_version_opentracker_c, g_version_accesslist_c, g_version_clean_c, g_version_fullscrape_c, g_version_http_c, + g_version_iovec_c, g_version_mutex_c, g_version_stats_c, g_version_sync_c, g_version_udp_c, g_version_vector_c, + g_version_scan_urlencoded_query_c, g_version_trackerlogic_c ); +} + size_t return_stats_for_tracker( char *reply, int mode, int format ) { format = format; switch( mode ) { @@ -418,3 +432,4 @@ void stats_deinit( ) { } +const char *g_version_stats_c = "$Source$: $Revision$\n"; diff --git a/ot_stats.h b/ot_stats.h index 8ea8668..c07a950 100644 --- a/ot_stats.h +++ b/ot_stats.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_STATS_H__ #define __OT_STATS_H__ @@ -34,6 +36,7 @@ enum { void stats_issue_event( ot_status_event event, int is_tcp, size_t event_data ); size_t return_stats_for_tracker( char *reply, int mode, int format ); +size_t stats_return_tracker_version( char *reply ); void stats_init( ); void stats_deinit( ); diff --git a/ot_sync.c b/ot_sync.c index ac1664d..5f772fb 100644 --- a/ot_sync.c +++ b/ot_sync.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -160,3 +162,5 @@ void sync_deliver( int64 socket ) { } #endif + +const char *g_version_sync_c = "$Source$: $Revision$\n"; diff --git a/ot_sync.h b/ot_sync.h index af7db8f..210d9d7 100644 --- a/ot_sync.h +++ b/ot_sync.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_SYNC_H__ #define __OT_SYNC_H__ diff --git a/ot_udp.c b/ot_udp.c index 786855b..e1af2fe 100644 --- a/ot_udp.c +++ b/ot_udp.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -22,19 +24,21 @@ static const uint8_t g_static_connid[8] = { 0x23, 0x42, 0x05, 0x17, 0xde, 0x41, static void udp_make_connectionid( uint32_t * connid, const char * remoteip ) { /* Touch unused variable */ - remoteip = remoteip; + (void)remoteip; /* Use a static secret for now */ memcpy( connid, g_static_connid, 8 ); } +#if 0 static int udp_test_connectionid( const uint32_t * const connid, const char * remoteip ) { /* Touch unused variable */ - remoteip = remoteip; + (void)remoteip; /* Test against our static secret */ return !memcmp( connid, g_static_connid, 8 ); } +#endif /* UDP implementation according to http://xbtt.sourceforge.net/udp_tracker_protocol.html */ void handle_udp4( int64 serversocket ) { @@ -133,3 +137,5 @@ void handle_udp4( int64 serversocket ) { break; } } + +const char *g_version_udp_c = "$Source$: $Revision$\n"; diff --git a/ot_udp.h b/ot_udp.h index 437e8ad..364c9d0 100644 --- a/ot_udp.h +++ b/ot_udp.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_UDP_H__ #define __OT_UDP_H__ diff --git a/ot_vector.c b/ot_vector.c index 1cfa4df..2a6d1b3 100644 --- a/ot_vector.c +++ b/ot_vector.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -108,3 +110,5 @@ void vector_remove_torrent( ot_vector *vector, ot_torrent *match ) { vector->data = realloc( vector->data, vector->space * sizeof( ot_torrent ) ); } } + +const char *g_version_vector_c = "$Source$: $Revision$\n"; diff --git a/ot_vector.h b/ot_vector.h index ed235a3..8f3143b 100644 --- a/ot_vector.h +++ b/ot_vector.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_VECTOR_H__ #define __OT_VECTOR_H__ diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c index e0c2e30..85f0d82 100644 --- a/scan_urlencoded_query.c +++ b/scan_urlencoded_query.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #include "scan.h" #include "scan_urlencoded_query.h" @@ -134,3 +136,5 @@ ssize_t scan_fixed_ip( char *data, size_t len, unsigned char ip[4] ) { } return len; } + +const char *g_version_scan_urlencoded_query_c = "$Source$: $Revision$\n"; diff --git a/scan_urlencoded_query.h b/scan_urlencoded_query.h index f0ad781..a253aaa 100644 --- a/scan_urlencoded_query.h +++ b/scan_urlencoded_query.h @@ -1,6 +1,8 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ - + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ + #ifndef __SCAN_URLENCODED_QUERY_H__ #define __SCAN_URLENCODED_QUERY_H__ diff --git a/trackerlogic.c b/trackerlogic.c index 69bcaf8..f4bdf0b 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ /* System */ #include @@ -354,3 +356,5 @@ void trackerlogic_deinit( void ) { clean_deinit( ); mutex_deinit( ); } + +const char *g_version_trackerlogic_c = "$Source$: $Revision$\n"; diff --git a/trackerlogic.h b/trackerlogic.h index eefc038..3525421 100644 --- a/trackerlogic.h +++ b/trackerlogic.h @@ -1,5 +1,7 @@ /* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ + It is considered beerware. Prost. Skol. Cheers or whatever. + + $id$ */ #ifndef __OT_TRACKERLOGIC_H__ #define __OT_TRACKERLOGIC_H__ -- cgit v1.2.3