Commit 32ede150 authored by 's avatar
Browse files

Updated Torrent tracker


git-svn-id: file:///home/svn/mapi/trunk@537 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 163c9181
......@@ -57,7 +57,7 @@ struct list{
int isIRC(mapidflib_function_instance_t *instance, unsigned char *pkt, unsigned int len);
char *irc_strings[STRING_NUM]={"PRIVMSG", "NOTICE", "ACTION", ":DOWN//", ":EFTP//"};
char *irc_strings[STRING_NUM]={"PRIVMSG ", "NOTICE ", " :DOWN// ", " :EFTP// ", "ACTION"};
int irc_string_len[STRING_NUM] = {0};
......
......@@ -54,10 +54,12 @@ struct list{
};
#define HASHTABLESIZE 1024
#define TOR_STRINGS_NO 14
char *torrent_strings[5]={"BitTorrent protocol","GET /scrape?info_hash=","GET /announce?info_hash=", "d1:rd2:id20:", "d1:ad2:id20:"};
char *torrent_strings[TOR_STRINGS_NO]={"BitTorrent protocol","GET /scrape?info_hash=","GET /announce?info_hash=", "d1:rd2:id20:", "d1:ad2:id20:", "BT_PIECE"
, "BT_REQUEST", "BT_CHOKE", "BT_UNCHOKE", "BT_HAVE", "BT_UNINTERESTED", "BT_INTERESTER", "BT_BITFIELD", "BT_CANCEL"};
int torrent_lens[5]={20, 100, 100, 20, 20};
int torrent_lens[TOR_STRINGS_NO]={20, 100, 100, 20, 20, 50, 50, 50, 50, 50, 50, 50, 50 , 50};
int isTorrent(mapidflib_function_instance_t *, unsigned char *, unsigned int );
......@@ -80,7 +82,7 @@ static int torrent_init(mapidflib_function_instance_t *instance, MAPI_UNUSED int
((struct mapid_torrent*)instance->internal_data)->torlist[i]->head = NULL;
((struct mapid_torrent*)instance->internal_data)->torlist[i]->tail = NULL;
}
for(i=0;i<5;i++) {
for(i=0;i<TOR_STRINGS_NO;i++) {
((struct mapid_torrent*)instance->internal_data)->shift[i] = make_shift(torrent_strings[i],strlen(torrent_strings[i]));
((struct mapid_torrent*)instance->internal_data)->skip[i] = make_skip(torrent_strings[i], strlen(torrent_strings[i]));
((struct mapid_torrent*)instance->internal_data)->search_len[i] = torrent_lens[i];
......@@ -96,7 +98,7 @@ int isTorrent(mapidflib_function_instance_t *instance, unsigned char *pkt, unsig
if(pkt[0] == 19 && (memcmp(&pkt[1], torrent_strings[0], 19) == 0))
return 0;
for(i=1;i<5;i++) {
for(i=1;i<TOR_STRINGS_NO;i++) {
if(len < strlen(torrent_strings[i]))
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment