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
dee85e94
Commit
dee85e94
authored
Oct 28, 2008
by
Browse files
Fixed PoS
git-svn-id:
file:///home/svn/mapi/trunk@1435
8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent
add33d00
Changes
2
Show whitespace changes
Inline
Side-by-side
src/extraflib/expiredflowshash.h
View file @
dee85e94
...
...
@@ -10,6 +10,7 @@ typedef struct eflow_data {
u_char
ptcl
;
u_char
ttl_pkt1
;
unsigned
long
long
epoch
;
unsigned
int
valid
;
}
eflow_data
;
typedef
struct
flow_data
{
...
...
src/extraflib/exprflow.c
View file @
dee85e94
...
...
@@ -317,7 +317,7 @@ void poll_expired_flows(mapidflib_function_instance_t *instance) {
tmp
->
previous
->
next
=
tmp
->
next
;
// if packets_count is worth to add
if
(
tmp
->
flow
.
packets_count
>=
((
struct
exfl_data
*
)
instance
->
internal_data
)
->
packets_count_min
)
{
if
(
tmp
->
flow
.
valid
&&
tmp
->
flow
.
packets_count
>=
((
struct
exfl_data
*
)
instance
->
internal_data
)
->
packets_count_min
)
{
if
(
data
->
expired_flows_list_size
<
data
->
expired_flows_list_size_max
)
{
// if buffer not full
//add node to expired flows list
data
->
expired_flows_list_size
++
;
...
...
@@ -346,7 +346,7 @@ void poll_expired_flows(mapidflib_function_instance_t *instance) {
}
else
{
// shm not full
// if packets_count is worth to add
if
(
tmp
->
flow
.
packets_count
>=
((
struct
exfl_data
*
)
instance
->
internal_data
)
->
packets_count_min
)
{
if
(
tmp
->
flow
.
valid
&&
tmp
->
flow
.
packets_count
>=
((
struct
exfl_data
*
)
instance
->
internal_data
)
->
packets_count_min
)
{
// Add the expired flow from temporal sorted list directly into shared memory table
pthread_mutex_lock
(
shm_struct
.
smmutex
);
memcpy
(
&
(
shm_struct
.
Table
[
*
(
shm_struct
.
size
)]),
&
(
tmp
->
flow
),
sizeof
(
struct
flow_data
));
...
...
@@ -384,6 +384,9 @@ static int exprflow_instance(mapidflib_function_instance_t *instance,
instance
->
def
->
shm_size
=
sizeof
(
flows_stat
)
+
sizeof
(
struct
flow_data
)
*
shm_flows
+
sizeof
(
pthread_mutex_t
);
// 0 shm (instance->result.data) DIMAPI_DATA_SIZE
// | mapi_result_type | flows_stat | shm_flows * flow_data | pthread_mutex_t |
return
0
;
}
...
...
@@ -503,7 +506,7 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED
p
+=
sizeof
(
struct
hdlc_header
);
len
-=
sizeof
(
struct
hdlc_header
);
ethertype
=
ntohs
(
hp
->
ctrl
);
ethertype
=
ntohs
(
hp
->
proto
);
if
(
ethertype
!=
ETHERTYPE_IP
)
{
return
0
;
...
...
@@ -527,6 +530,7 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED
record
.
dport
=
ntohs
(
tcp
->
dport
);
record
.
timestamp
=
pkt_head
->
ts
;
record
.
epoch
=
data
->
epoch
;
record
.
valid
=
data
->
epoch
>
TIMEOUT
;
record
.
ptcl
=
ip
->
ptcl
;
record
.
bytes_count
=
pkt_head
->
wlen
-
headerlenoverplus
;
record
.
ttl_pkt1
=
ip
->
ttl
;
...
...
@@ -541,6 +545,7 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED
record
.
dport
=
ntohs
(
udp
->
dport
);
record
.
timestamp
=
pkt_head
->
ts
;
record
.
epoch
=
data
->
epoch
;
record
.
valid
=
data
->
epoch
>
TIMEOUT
;
record
.
ptcl
=
ip
->
ptcl
;
record
.
bytes_count
=
pkt_head
->
wlen
-
headerlenoverplus
;
record
.
ttl_pkt1
=
ip
->
ttl
;
...
...
@@ -553,6 +558,7 @@ static int exprflow_process(mapidflib_function_instance_t *instance, MAPI_UNUSED
record
.
sport
=
record
.
dport
=
ntohs
(
0
);
record
.
timestamp
=
pkt_head
->
ts
;
record
.
epoch
=
data
->
epoch
;
record
.
valid
=
data
->
epoch
>
TIMEOUT
;
record
.
ptcl
=
ip
->
ptcl
;
record
.
bytes_count
=
pkt_head
->
wlen
-
headerlenoverplus
;
record
.
ttl_pkt1
=
ip
->
ttl
;
...
...
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