summaryrefslogtreecommitdiff
path: root/inc/stream_internal.h
blob: fa1b352eac5fc49bb943938ea3f7bc3b5a60d1b8 (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
63
64
65
66
67
68
69
70
#ifndef _APP_STREAM_INTERNAL_H_
#define _APP_STREAM_INTERNAL_H_ 

#include "stream_inc/stream_base.h"
#include "stream_inc/stream_project.h"
#include "stream_inc/stream_proxy.h"
#include "stream_inc/stream_tunnel.h"
#include "stream_inc/stream_inject.h"
#include "stream_inc/stream_rawpkt.h"
#include "stream_inc/stream_control.h"

/* ԭʼ���ṹ */
typedef struct {
    unsigned int magic_num;
    int offset_to_raw_pkt_hdr;          /* ����ص���Ӧ��������raw_pkt_data��ƫ���� */
    enum addr_type_t low_layer_type;    /* ԭʼ����ײ�Э�������, ������MAC(pcap����), Ҳ������IPv4(pag����) */
    int __lib_raw_pkt_len;      /* �ײ㲶�����ṩ�İ���ʵԭʼ���� */
    int raw_pkt_len;            /* ���ϲ�Ӧ�ÿ���ԭʼ���ܳ���, �п��ܲ�����ʵ��, ����������Ethernet�� */
    unsigned int hd_hash; /* ����Ӳ���������Ԫ��HASH, ����ƽ̨CPU�������� */
    const void *__lib_raw_pkt_data; /* �ײ㲶�����ṩ����ʵԭʼ��ָ�� */
    const void *raw_pkt_data;   /* ���ϲ�Ӧ�ÿ���ԭʼ��ͷָ��, �п���������Ethernet��, ����low_layer_type�ж�Э������ */
    struct timeval raw_pkt_ts;  /* ԭʼ������ʱ���, ���ȫΪ0��֧�ִ˹���(��pagģʽ) */
    const void *io_lib_pkt_reference; /* ���õײ�I/O���ԭʼ�������ṹ, ����:����marsio��˵, ���ײ��mbuf�ṹ */
}raw_pkt_t;

struct streaminfo_private
{
	/* ����ṹ�����ڽṹ����ǰ, ָ���ַ���Ի���ǿת */
	struct streaminfo stream_public;
	/* ���±���Ϊƽ̨�ڲ�˽��, ���ⲻ�ɼ� */
	void   *pproject;		//ÿ�����̿����Զ���ʹ�ã�

	/* ---8 bytes-- */
	UCHAR  layer_dir:2;   /* ������Ч, ��ǰ��ĵ�ַ�Ƿ��Ĭ�Ϲ���"��˿��ǿͻ���"��ͬ */	
	UCHAR  stream_dir:2; /* ��������������Ч, ���Ĵ洢�ĵ�ַ�Ƿ��Ĭ�Ϲ���"��˿��ǿͻ���"��ͬ  */		
	UCHAR  addr_use_as_hash:1; /* �����addr�Ƿ���ΪHASH����ͱȽϵIJ���, ��:MAC��ַ��������� */
	UCHAR  addr_skip_for_layer_cmp:1;/*�����addr�Ƿ���Ϊ��ַ�ȽϵIJ㼶���磺MPLS��ַ����Ϊ�������㣬ֱ����������ֵĬ��Ϊ0������Ҫ�Ƚ�*/
	UCHAR  need_update_opposite_addr:1;/*�����addr�Ƿ��ڶԲ�����ʱ���£��磺MPLS��ǩ�ǶԳ�ʱ��Ҫ��S2C���һ������¼�����ǩ,��ֵĬ��Ϊ0��������Ҫ����*/
	UCHAR  stream_killed_flag:1; /* 2014-08-22 lijia add, ����ģʽ��, �Ѿ������Kill, ֮�������ֱ��Drop��Kill, �����ٸ��ϲ��� */
	UCHAR  dirreverse;	     /* ��������ʱ�Ƿ������ip��ַ��ת, ����"��˿��ǿͻ���"�����෴ */
	UINT16 timeout;/* ÿ�����ӵĶ��г�ʱʱ��, ��ֵ��������;, 1:���ھ�����̭��ʱ���ް��������, �Խ�Լ�ڴ�; 2:���ڱ�����ʱ���ް�����, ����IM�೤ʱ���ް������Ӳ�δ����, �����ýϴ��timeout */
	unsigned short offset_to_raw_pkt_hdr; /* ����ͷ�����ԭʼ������ʼ��ַ��ƫ���� */
	unsigned short offset_to_ip_hdr; /* 2015-12-07 lijia add, UDP/TCP ��ͷ����ڳ��ص�IP��ͷƫ���� */
	/* ===8 bytes=== */
	const raw_pkt_t *raw_pkt; /* 2014-12-30 lijia add, ��Щ�ص�������֧��ԭʼ��, ����������Ҫ, �洢��private�ṹ�� */

	/* ---8 bytes-- */
	unsigned int hash_slave; /* 2015-12-14 lijia add, ʹ��linux_jhash����ʱ, ����ͬʱ�õ��������ϵ�HASHֵ, ��HASH����ȷ����HASH����SLOTλ��, slave_HASH���ڿ��ٱȽϵ�ַ�Ƿ���� */
	unsigned char hash_not_head_times;/* 2015-12-15 lijia add, ��ǰindex����HASH SLOT�ĵ�һλ�Ĵ��� */
	unsigned char cur_layer_raw_hdr_len; /* 2017-10-31 lijia add, ��ǰ���ԭʼ����ַ����, ��pppͷ��ѹ��, ԭ���汾�޷��������״̬, ����ʱҲ�޷���֪��ַ������ */
	char __pad:4;
	unsigned char stream_close_reason:4; /* 2019-02-14 lijia add, ����TCPʹ��tcpdetail_private��link_state����, ����UDP֮ǰû��, ���pad�����˱��� */
	unsigned char gdev_block_timer;
	/* ===8 bytes=== */

	/* ---8 bytes-- */
	unsigned short stream_low_layer_tunnel_type; /* 2016-07-25 lijia add, ��¼�����ײ���������, 0Ϊ������, �������:enum stream_carry_tunnel_t */
	unsigned short stream_carry_up_layer_tunnel_type; /* ��ǰ���ϲ����������, ���統ǰ��ΪUDP, ���صĿ�����teredo������L2TP���� */
	/* 2016-07-08 lijia add, for janus hijack, ��Ӧ�ô洢��half_stream, �����յ�SYNʱ, ��û�д���half_streamʵ��, �����ݴ���streaminfo_private */
	unsigned short syn_opt_num;
	unsigned short synack_opt_num;
	/* ===8 bytes=== */
	
	struct tcp_option *syn_opt_array;
	struct tcp_option *synack_opt_array;
};


#endif