Introduce some kind of versioning

dynamic-accesslists
erdgeist 17 years ago
parent d9ed6c22bd
commit c28cf398fd

@ -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)

@ -1,7 +1,8 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever.
Some of the stuff below is stolen from Fefes example libowfat httpd.
*/
$Id$ */
/* System */
#include <string.h>
@ -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";

@ -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 = "<group>"; };
653A320B0CE7F475007F0D03 /* ot_accesslist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ot_accesslist.c; sourceTree = "<group>"; };
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 = "<absolute>"; };
653A56B30CE28EC5000CF140 /* ot_iovec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ot_iovec.h; sourceTree = "<group>"; };
653A56B40CE28EC5000CF140 /* ot_iovec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ot_iovec.c; sourceTree = "<group>"; };
654A80840CD832FC009035DE /* opentracker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = opentracker.c; sourceTree = "<group>"; };
@ -124,6 +124,7 @@
children = (
653A56AC0CE201FF000CF140 /* opentracker */,
6520B7520D036AAF00A43B1F /* libowfat.a */,
6520B8110D0E011000A43B1F /* liblibowfat.a */,
);
name = Products;
sourceTree = "<group>";
@ -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 */ = {

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <stdlib.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <stdlib.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <sys/uio.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <sys/types.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <sys/types.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <pthread.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <stdlib.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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( );

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <sys/types.h>
@ -160,3 +162,5 @@ void sync_deliver( int64 socket ) {
}
#endif
const char *g_version_sync_c = "$Source$: $Revision$\n";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <string.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <stdlib.h>
@ -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";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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";

@ -1,6 +1,8 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
It is considered beerware. Prost. Skol. Cheers or whatever. */
It is considered beerware. Prost. Skol. Cheers or whatever.
$id$ */
/* System */
#include <stdlib.h>
@ -354,3 +356,5 @@ void trackerlogic_deinit( void ) {
clean_deinit( );
mutex_deinit( );
}
const char *g_version_trackerlogic_c = "$Source$: $Revision$\n";

@ -1,5 +1,7 @@
/* This software was written by Dirk Engling <erdgeist@erdgeist.org>
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__

Loading…
Cancel
Save