-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use C99 sized integer types to store ip/port
- Loading branch information
Showing
4 changed files
with
23 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ | |
* SOFTWARE. | ||
*/ | ||
|
||
#include <stdint.h> | ||
|
||
#define __SOURCE_VERSION__ "1.2" | ||
#define __AUTHOR__ "X. Chen ([email protected])" | ||
#define __GLOBAL_NAME__ "pkt2flow" | ||
|
@@ -68,8 +70,8 @@ struct pkt_dump_file { | |
}; | ||
|
||
struct ip_pair { | ||
unsigned int ip1, ip2; | ||
unsigned short port1, port2; | ||
uint32_t ip1, ip2; | ||
uint16_t port1, port2; | ||
struct pkt_dump_file pdf; | ||
struct ip_pair *next; | ||
}; | ||
|
@@ -82,8 +84,8 @@ extern struct ip_pair *pairs[]; | |
/* | ||
* Generate a new file name for flow with 4-tuple and timestamp | ||
*/ | ||
char *new_file_name(unsigned int src_ip, unsigned int dst_ip, | ||
unsigned short src_tcp, unsigned short dst_tcp, | ||
char *new_file_name(uint32_t src_ip, uint32_t dst_ip, | ||
uint16_t src_tcp, uint16_t dst_tcp, | ||
unsigned long timestamp); | ||
|
||
/* flow_db.c */ | ||
|
@@ -99,17 +101,17 @@ void init_hash_table(void); | |
* returned. | ||
* Otherwise, NULL returned; | ||
*/ | ||
struct ip_pair *find_ip_pair(unsigned int src_ip, unsigned int dst_ip, | ||
unsigned short src_tcp, unsigned short dst_tcp); | ||
struct ip_pair *find_ip_pair(uint32_t src_ip, uint32_t dst_ip, | ||
uint16_t src_tcp, uint16_t dst_tcp); | ||
|
||
/* | ||
* To register a new flow item in the flow hash table. This is uaually called | ||
* after finding the flow item with NULL returned. | ||
* The pointer to the new registerd ip_pair will be returned; and the pdf will | ||
* be reset as empty. | ||
*/ | ||
struct ip_pair *register_ip_pair(unsigned int src_ip, unsigned int dst_ip, | ||
unsigned short src_tcp, unsigned short dst_tcp); | ||
struct ip_pair *register_ip_pair(uint32_t src_ip, uint32_t dst_ip, | ||
uint16_t src_tcp, uint16_t dst_tcp); | ||
|
||
/* | ||
* Reset the packet dump file (pdf) for: 1) a new ip_pair created; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters