summaryrefslogtreecommitdiff
path: root/ip_reset_plug.h
blob: 8647b401cc47c676bd117364c83e668ac6cede00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <stdio.h>  
#include <signal.h>  
#include <string.h>  
#include <stdlib.h>
#include <netinet/in.h>
#include <time.h>
#include <stdarg.h>
#include <rdkafka.h>
#include <stream.h>
#include <cJSON.h>
#include "MESA_prof_load.h"
#include "MESA_handle_logger.h"
#include <netdb.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <linux/if_ether.h>
#include "MESA_htable.h"
#include <assert.h>

#define IPRESET_CONFIG_FILE  "./resetconf/ip_reset_plug.conf"

#define SIZE 128 
#define BUFSIZE 1024
#define STRSIZE 1024
#define	MAX_PATH_LENGTH	256
#define	MAX_LENGTH	4096
//#define	MAX_MACIP_NUM	4096

#define HASH_THREAD_NUM 32
//#define HASH_THREAD_NUM 10

typedef struct hash_set_t{
	int hash_num;
	MESA_htable_handle htable;
}hash_set_t;

typedef struct common_module_t {
    void *log_handle;
    char config_path[MAX_PATH_LENGTH];
    char log_path[MAX_PATH_LENGTH];
    char kafka_servers[MAX_LENGTH];
    char kafka_topic[MAX_LENGTH];
    int batch_send_number;
    rd_kafka_t *kafka_producer;            /*Producer instance handle*/
    rd_kafka_topic_t *rd_kafka_topic;     /*topic对象*/
    char errstr[512];          
    char buf[512];
    char clj_ip[16]; 	
    char send_type[32];
    int send_types; /*rst:1,syn+ack:2,53port:3,all:0*/
//    char macip[MAX_MACIP_NUM][17];
 //   char cljip[MAX_MACIP_NUM][32];

// MESA_htable_handle htable; //add by 20190722,htable
	hash_set_t *hashset;
}common_module_t;


int ipreset_init();
void ipreset_destroy();
char ipreset_ip_entry(struct streaminfo *f_stream,unsigned char routedir,int thread_seq,struct ip * a_packet);