📄 dealpacket.h
字号:
#ifndef _DEAL_PACKET_H_#define _DEAL_PACKET_H_#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <time.h>#include <netinet/ip.h>#include <netinet/tcp.h>#include <net/ethernet.h>#include <pthread.h>#include "myfunc.h"#include "daoutil.h"#include "decode.h"#define PATH_MAXLEN 256#define TEMP_PATH "/usr/local/mbond/eml/" //注意将该目录的权限改为 drwxr-xr-x apache:apache,这样可以避免网页没有权限访问该目录#define MAIL_LINE 512#define MAIL_FROM_LEN 256#define MAIL_TO_LEN 256#define MAIL_SUBJECT_LEN 512#define DB_MAIL_TABLE_NAME "nbemail"#define CHK_END_TIME 10 //连接被检查的超时时间#define TIME_OUT 120 //连接被强制关闭的超时时间#define POP3_UNLINKED 0//pop3通讯状态--未连接#define POP3_LINKED 1//pop3通讯状态--连接#define POP3_UNKNOW 0//pop3状态--未知#define POP3_LIST 1//pop3状态--LIST#define POP3_RETR 2//pop3状态--RETRtypedef struct s_pop3_mail{ u_int32_t id; time_t stime; time_t etime; u_int32_t mail_len; char *from; char *to; char *cc; char *subject; u_int32_t fp; char path[PATH_MAXLEN]; u_int32_t fp_open; u_int32_t ok_flag; u_int32_t b_flag; u_int32_t e_flag; struct s_pop3_mail *next;}pop3_mail;typedef struct s_tcp_stream{ u_int16_t source; u_int16_t dest;}tcp_stream;typedef struct s_tcp_stream_node{ u_int32_t hash; u_int8_t smac[ETH_ALEN]; u_int8_t dmac[ETH_ALEN]; u_int32_t saddr; u_int32_t daddr; u_int32_t seq_beg; u_int32_t ack_beg; tcp_stream req_stream; tcp_stream res_stream; time_t stime; time_t etime; pop3_mail *mail_list; u_int32_t link_state; u_int32_t pop3_state; struct s_tcp_stream_node *next;}tcp_stream_node;u_int32_t POP3_THREAD_STATUS;tcp_stream_node *tcp_stream_head;int create_pop3_thread(pthread_t *pid);int deal_packet(const char *packet, int len);void pop3_thread(void);int close_pop3_thread(pthread_t pid);char * create_sql(tcp_stream_node *stream_node, pop3_mail *mail);void write_database(tcp_stream_node *stream_node, pop3_mail *mail);void analysis_pop3(pop3_mail *mail);void analysis_subject(char **subject);int get_address(char **p, char *temp);int find_receiver(char **p, char *temp, int *find_to);void free_pop3_mail_list(pop3_mail *head_pop3_mail);void free_stream_node(tcp_stream_node *stream_node);tcp_stream_node *find_node_by_hash(tcp_stream_node *tcp_stream_head, u_int32_t hash);#endif//_DEAL_PACKET_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -