Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arne Øslebø
mapi
Commits
c6f6f6f6
Commit
c6f6f6f6
authored
Mar 07, 2006
by
Browse files
timeout added
git-svn-id:
file:///home/svn/mapi/trunk@385
8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent
113d19dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
tracklib/dc.c
View file @
c6f6f6f6
...
...
@@ -40,6 +40,7 @@ struct filters {
unsigned
int
daddr
;
uint16_t
sp
;
uint16_t
dp
;
struct
timeval
ts
;
struct
filters
*
next
;
};
...
...
@@ -103,7 +104,8 @@ static int dc_process(mapidflib_function_instance_t *instance,
struct
filters
*
temp
=
NULL
,
*
prev
=
NULL
,
*
new
=
NULL
;
int
len
=
pkt_head
->
caplen
;
unsigned
char
*
p
=
NULL
;
struct
timeval
ts
;
struct
list
*
dclist
=
((
struct
mapid_dc
*
)
instance
->
internal_data
)
->
dclist
;
uint16_t
ethertype
;
struct
ether_header
*
ep
=
NULL
;
...
...
@@ -157,6 +159,8 @@ static int dc_process(mapidflib_function_instance_t *instance,
return
0
;
}
gettimeofday
(
&
ts
,
NULL
);
for
(
temp
=
dclist
->
head
,
prev
=
dclist
->
head
;
temp
!=
NULL
;
prev
=
temp
,
temp
=
temp
->
next
)
{
if
(
temp
->
protocol
==
iph
->
protocol
&&
...
...
@@ -166,6 +170,8 @@ static int dc_process(mapidflib_function_instance_t *instance,
(
temp
->
saddr
==
daddr
&&
temp
->
daddr
==
saddr
&&
temp
->
sp
==
dp
&&
temp
->
dp
==
sp
))
)
{
gettimeofday
(
&
(
temp
->
ts
),
NULL
);
if
(
iph
->
protocol
==
6
&&
tcph
->
fin
)
{
if
(
temp
==
dclist
->
head
){
dclist
->
head
=
temp
->
next
;
...
...
@@ -179,6 +185,16 @@ static int dc_process(mapidflib_function_instance_t *instance,
return
1
;
}
else
if
(
ts
.
tv_sec
-
temp
->
ts
.
tv_sec
>
1
)
{
if
(
temp
==
dclist
->
head
){
dclist
->
head
=
temp
->
next
;
}
else
{
prev
->
next
=
temp
->
next
;
}
temp
->
next
=
NULL
;
free
(
temp
);
}
}
if
(
isDc
(
instance
,
pkt
,
len
)
==
1
)
...
...
tracklib/edonkey.c
View file @
c6f6f6f6
...
...
@@ -35,6 +35,7 @@ struct filters {
unsigned
int
daddr
;
uint16_t
sp
;
uint16_t
dp
;
struct
timeval
last_timestamp
;
struct
filters
*
next
;
};
...
...
@@ -236,7 +237,8 @@ static int edonkey_process(mapidflib_function_instance_t *instance,
struct
tcphdr
*
tcph
=
NULL
;
struct
udphdr
*
udph
=
NULL
;
int
ether_len
=
0
,
ip_len
=
0
,
tcp_len
=
0
,
udp_len
=
0
;
struct
timeval
ts
;
struct
edonkey_header
*
edonkey_h
;
unsigned
int
saddr
,
daddr
;
...
...
@@ -289,6 +291,8 @@ static int edonkey_process(mapidflib_function_instance_t *instance,
return
0
;
}
gettimeofday
(
&
ts
,
NULL
);
for
(
temp
=
edonkeylist
->
head
,
prev
=
edonkeylist
->
head
;
temp
!=
NULL
;
prev
=
temp
,
temp
=
temp
->
next
)
{
if
(
temp
->
protocol
==
iph
->
protocol
&&
...
...
@@ -298,6 +302,8 @@ static int edonkey_process(mapidflib_function_instance_t *instance,
(
temp
->
saddr
==
daddr
&&
temp
->
daddr
==
saddr
&&
temp
->
sp
==
dp
&&
temp
->
dp
==
sp
))
)
{
gettimeofday
(
&
(
temp
->
last_timestamp
),
NULL
);
if
(
iph
->
protocol
==
6
&&
tcph
->
fin
)
{
if
(
temp
==
edonkeylist
->
head
)
{
edonkeylist
->
head
=
temp
->
next
;
...
...
@@ -311,6 +317,16 @@ static int edonkey_process(mapidflib_function_instance_t *instance,
return
1
;
}
else
if
(
ts
.
tv_sec
-
temp
->
last_timestamp
.
tv_sec
>
1
)
{
if
(
temp
==
edonkeylist
->
head
)
{
edonkeylist
->
head
=
temp
->
next
;
}
else
{
prev
->
next
=
temp
->
next
;
}
temp
->
next
=
NULL
;
free
(
temp
);
}
}
if
(
iph
->
protocol
==
6
)
...
...
@@ -365,6 +381,8 @@ static int edonkey_process(mapidflib_function_instance_t *instance,
new
->
daddr
=
daddr
;
new
->
sp
=
sp
;
new
->
dp
=
dp
;
gettimeofday
(
&
(
new
->
last_timestamp
),
NULL
);
/*
for(temp = edonkeylist->head; temp != NULL; temp = temp->next)
{
...
...
tracklib/gnutella.c
View file @
c6f6f6f6
...
...
@@ -40,6 +40,7 @@ struct filters {
unsigned
int
daddr
;
uint16_t
sp
;
uint16_t
dp
;
struct
timeval
ts
;
struct
filters
*
next
;
};
...
...
@@ -99,7 +100,8 @@ static int gnutella_process(mapidflib_function_instance_t *instance,
struct
filters
*
temp
=
NULL
,
*
prev
=
NULL
,
*
new
=
NULL
;
int
len
=
pkt_head
->
caplen
;
unsigned
char
*
p
=
NULL
;
struct
timeval
ts
;
struct
list
*
gnulist
=
((
struct
mapid_gnutella
*
)
instance
->
internal_data
)
->
gnulist
;
uint16_t
ethertype
;
struct
ether_header
*
ep
=
NULL
;
...
...
@@ -152,6 +154,8 @@ static int gnutella_process(mapidflib_function_instance_t *instance,
return
0
;
}
gettimeofday
(
&
ts
,
NULL
);
for
(
temp
=
gnulist
->
head
,
prev
=
gnulist
->
head
;
temp
!=
NULL
;
prev
=
temp
,
temp
=
temp
->
next
)
{
if
(
temp
->
protocol
==
iph
->
protocol
&&
...
...
@@ -161,6 +165,8 @@ static int gnutella_process(mapidflib_function_instance_t *instance,
(
temp
->
saddr
==
daddr
&&
temp
->
daddr
==
saddr
&&
temp
->
sp
==
dp
&&
temp
->
dp
==
sp
))
)
{
gettimeofday
(
&
(
temp
->
ts
),
NULL
);
if
(
iph
->
protocol
==
6
&&
tcph
->
fin
)
{
if
(
temp
==
gnulist
->
head
)
{
gnulist
->
head
=
temp
->
next
;
...
...
@@ -174,6 +180,16 @@ static int gnutella_process(mapidflib_function_instance_t *instance,
return
1
;
}
else
if
(
ts
.
tv_sec
-
temp
->
ts
.
tv_sec
>
1
)
{
if
(
temp
==
gnulist
->
head
)
{
gnulist
->
head
=
temp
->
next
;
}
else
{
prev
->
next
=
temp
->
next
;
}
temp
->
next
=
NULL
;
free
(
temp
);
}
}
if
(
isGnutella
(
instance
,
pkt
,
len
)
==
1
)
...
...
tracklib/torrent.c
View file @
c6f6f6f6
...
...
@@ -40,6 +40,7 @@ struct filters {
unsigned
int
daddr
;
uint16_t
sp
;
uint16_t
dp
;
struct
timeval
ts
;
struct
filters
*
next
;
};
...
...
@@ -100,7 +101,8 @@ static int torrent_process(mapidflib_function_instance_t *instance,
struct
filters
*
temp
=
NULL
,
*
prev
=
NULL
,
*
new
=
NULL
;
int
len
=
pkt_head
->
caplen
;
unsigned
char
*
p
=
NULL
;
struct
timeval
ts
;
struct
list
*
torlist
=
((
struct
mapid_torrent
*
)
instance
->
internal_data
)
->
torlist
;
uint16_t
ethertype
;
struct
ether_header
*
ep
=
NULL
;
...
...
@@ -156,6 +158,8 @@ static int torrent_process(mapidflib_function_instance_t *instance,
return
0
;
}
gettimeofday
(
&
ts
,
NULL
);
for
(
temp
=
torlist
->
head
,
prev
=
torlist
->
head
;
temp
!=
NULL
;
prev
=
temp
,
temp
=
temp
->
next
)
{
if
(
temp
->
protocol
==
iph
->
protocol
&&
...
...
@@ -165,6 +169,8 @@ static int torrent_process(mapidflib_function_instance_t *instance,
(
temp
->
saddr
==
daddr
&&
temp
->
daddr
==
saddr
&&
temp
->
sp
==
dp
&&
temp
->
dp
==
sp
))
)
{
gettimeofday
(
&
(
temp
->
ts
),
NULL
);
if
(
iph
->
protocol
==
6
&&
tcph
->
fin
)
{
if
(
temp
==
torlist
->
head
)
{
torlist
->
head
=
temp
->
next
;
...
...
@@ -178,6 +184,17 @@ static int torrent_process(mapidflib_function_instance_t *instance,
return
1
;
}
else
if
(
ts
.
tv_sec
-
temp
->
ts
.
tv_sec
>
1
)
{
if
(
temp
==
torlist
->
head
)
{
torlist
->
head
=
temp
->
next
;
}
else
{
prev
->
next
=
temp
->
next
;
}
temp
->
next
=
NULL
;
free
(
temp
);
}
}
if
(
isTorrent
(
instance
,
pkt
,
len
)
==
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment