summaryrefslogtreecommitdiff
path: root/src/AV_interface.h
blob: 6eadfa772620c55a4b6c1231ca55fd066505f6d0 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
#ifndef _AV_INTERFACE_H
#define _AV_INTERFACE_H

#define PROTO_VERSION  					3
#define PROTO_MAGICNUM 					0x5641

/*META_OPT_* same with av_master ����ǰ��*/
#define META_OPT_LAYER_ADDR				0x52   //META_OPT_LAYER_ADDR
#define	META_OPT_SINGLE_KEY				0x68
#define	META_OPT_LAYER_URL				0x61
#define META_OPT_ETAG					0x62
#define META_OPT_LAST_MODIFY			0x63
#define	META_OPT_REFERER				0x64   //AV_IdentifyFormatDoc
#define	META_OPT_USER_AGENT				0x65 
#define	META_OPT_C2S_CONT_TYPE			0x66  //cache and send because of boundary
#define	META_OPT_S2C_CONT_TYPE			0x67  //cache and send because of boundary
#define META_OPT_SERVICE_ID				0x71  /*��Ƭ��ʹ�ã�����*/
#define	META_OPT_C2S_CONT				0x72  /*��Ƭ��ʹ�ã�����*/
#define	META_OPT_S2C_CONT				0x73  /*��Ƭ��ʹ�ã�����*/
#define META_OPT_CONT_DISPOSITION 		0x74  /*��Ƭ��ʹ�ã�����*/
#define META_OPT_SIP_DIADATA_ID			0x81  /*VOIPʹ��*/
#define META_OPT_SIP_DATA_DIR			0x82 
#define META_OPT_SIP_RATE_INFO 			0x83
#define META_OPT_OFFSET 				0x69  /*offset��ѡ��,��ǰ��һ��*/
#define META_OPT_SERVER 				0x6A

/*���͸����ݷ��������ѡ��*/
#define OPT_SOURCE_IP					0x41  /*localIPѡ��*/
#define META_OPT_SIP_SEND_RATE_INFO 	0x71  /*VOIPҵ��*/

/*��Դ����£���ƿװ���͸�������ƿװ��ѡ��*/
#define META_OPT_INFO_BEFORE_MULTISRC 	0x91  /*��Դ���֮ǰ�Ľ�Ŀ��Ϣ������MID��capIP���ڲ�����*/

#define	FILE_OSMF						0xA1
#define	FILE_HLS						0xA2
#define	FILE_IOS						0xA3
#define	FILE_ANDRIOD					0xA4
#define	FILE_APP						0xA5
#define	FILE_FRAG						0xA6  /*��ƬԤ��ʶ���,����url�������ƫ�����ģ�����iqiyi*/
#define	FILE_MAYBE_FRAG 				0xA7  /*ǰ�˻ش��Ŀ�������Ƭ������Ƶ*/
#define	FILE_AV							0x00  /*��ƬԤ��ʶ���ý������ת��Ϊ0x00*/

#define	VOIP_UNKNOWN_MEDIA_TYPE			0xB0

/*from papp*/
#define MSG_DATA_META	 				0x31
#define MSG_DATA_BODY 					0x32
#define MSG_DATA_TAIL 					0x33

/*live*/
#define MSG_LIVE_CHECK 					0x41   //from sapp 
#define MSG_LIVE_RESPONS 				0x42   //to sapp

/*from av_analyse*/
#define MSG_RESP_CHECKRESULT 			0x11	// Check Result notification
#define MSG_RESP_REJECT					0x12	// Reject Message notification, not proc now
#define MSG_RESP_CHARACTER				0x13	// Character notification, 1. wins ack, 2. send to sapp
#define MSG_RESP_CHECKRESULT_ACK      	0x14	//not send now
#define MSG_PROG_SYNC					0x15	//

/*prog sync*/
#define SYNC_SENDER_VIDEO_ANALYZER		0x01
#define	SYNC_SENDER_AUDIO_ANALYZER		0x02
#define	SYNC_ACTION_STOP_TO_SUBSYSTEM	0x01
#define	SYNC_ACTION_STOP_TO_MAINSYSTEM	0x02
#define	SYNC_ACTION_ELIMINATE_PROGRAM	0x03

/*FD������Ƭ��GK����ѡ��*/
#define OPT_FRAG_ORIGIN_URL				0x11
#define OPT_FRAG_CTRL_SUBSTR			0x12
#define OPT_FRAG_INDEX_URL				0x13

/*FD����: ͼƬ����set opt_num=0*/
#define	SURVEY_PIC_TYPE					0x31
#define	SURVEY_PIC_MONITOR_TYPE			0xB1
#define	SURVEY_PIC_KEYWORD_TYPE			0xB2

#define	SURVER_VOIP_COLLECT_TPYE        0xA4//for K voip_collect

// FD����, 0��ʾblacklist��1��ʾstatic configures��2��ʾcontent hit��
#define	FD_TYPE_DYNAMIC_LIST			0
#define	FD_TYPE_STATIC_CONF				1
#define	FD_TYPE_ANALYSE					2


/*=================================monitor service===============================================*/

#define	SERVICE_AUDIO_LANG				0x97	//��ѧ������������ʶ����
#define	SERVICE_AUDIO_LANG_FULL			0x98	//��ƴװ�����������������ȫ�ļ�JC��־

/*=================================ack msg===============================================*/
typedef struct msg_data_ack_s 
{
	char						prog_id[8];
	uint16_t					pad;
	uint64_t					ack_offset:48; 	
}msg_data_ack_t; 

/*=================================data msg===============================================*/
#define MSG_HEADER_LEN	sizeof(msg_header_t)
typedef struct msg_header_s 
{
	uint16_t  					magic_num; 
	uint8_t 					version;	 	
	uint8_t						msg_type; 		// msg data type
	uint32_t 					cont_len; 	
}msg_header_t; /* sizeof = 8B */

#define MSG_MEDIAINFO_HEAD_LEN	 (sizeof(msg_metainfo_t))
/*Data_flag defination*/
typedef struct msg_metainfo_s
{
	char						prog_id[8];	
	char    					flag;	
#if K_PROJECT
    uint8_t   					pad[3];
    int		   					hitservice;
	uint64_t  					prog_len;
#else
	uint8_t   					hitservice;
	uint64_t  					prog_len:48;
#endif
	uint32_t					cap_IP;
	uint8_t						protocol;		
	uint8_t						media_type;	
	uint8_t						data_flag;	
	uint8_t						opt_num;      
}msg_metainfo_t;

typedef struct msg_data_s
{
	char						prog_id[8];	
	union
	{
		struct
		{
			uint8_t				pad;          
			uint8_t				flags;       
		};
		uint16_t 				frag_seq;
	};	
	uint64_t  					offset:48;	   
}msg_data_t;
#define MSG_DATA_HEAD_LEN	(sizeof(msg_data_t))

/*==============================response msg==================================================*/
typedef struct msg_prog_sync_s
{
	char						prog_id[8];
	uint8_t						sender;		//0:reserved,1: video analyzer,2:audio analyzer
	char						action;		//0:reserved,1:stop send to subsystem,2:stop send to main system,3:eliminate this programm
}msg_prog_sync_t;

#define MSG_RESP_CHECKRESULT_LEN	(sizeof(resp_checkresult_t))
typedef struct resp_checkresult_s 
{
	char						prog_id[8];		
#if K_PROJECT
	int							service;	
	char						level;					//the level of check result 
	uint8_t 					opt_num;				// ������ѡ����
	uint8_t 					pad[6];					// Ԥ����������0ֵ
#else
	uint8_t						service;	
	char						level;					//the level of check result 
	uint8_t 					opt_num;				// ������ѡ����
	uint8_t 					pad;					// Ԥ����������0ֵ
#endif
	uint32_t					cfg_id;					//config ID
	uint32_t					file_header_size;	
	uint32_t					file_packet_size;
}resp_checkresult_t;

typedef struct msg_log_s
{
    char  						prog_id[8];			//  program rule id;
    uint32_t					cfg_id;				//	hitted rule id;
    uint32_t					fount_time;			//	found time
    uint32_t					server_ip;			//	server ip;
    uint32_t					client_ip;			//	client ip;
    uint16_t					server_port;		//	server port;
    uint16_t					client_port;		//	client port;
    uint8_t						protocol;			//  translation protocol num; 
    uint8_t						service;			//	service type;
    uint8_t						level;				//	result level;
    uint8_t  					fd_type;			
}msg_log_t;

typedef enum
{
	RECV_RESP=0,
	RECV_RESP_WHITELIST,
	RESP_MEDIA_NOFOUND,
	RESP_REPEAT,
	RESP_AUDIO_LANG_MONITOR_NEW,
	RESP_AUDIO_LANG_MONITOR_OLD,
	RESP_SEND_BLOCK,
	RESP_SEND_BLOCK_MULTI,

	RECV_PROG_SYNC,
	RECV_PROG_SYNC_NOFOUND,	
	RECV_PROG_SYNC_AUDIO_STOP,
	RECV_PROG_SYNC_VIDEO_STOP,
	RECV_PROG_SYNC_UNKNOW,
	
	SEND_CONFIG_MONITOR,
	SEND_LANG_MONITOR,
}RESP_LOG_TYPE;

/*VOIP �����־��ַ��ʽ*/
typedef struct layer_addr_v4_s
{
	uint8_t 	layer_cnt;	
	uint8_t 	reserved[3];	
	uint32_t 	client_addr; 	/* network order, client IP */
	uint32_t 	server_addr; 	/* network order, server IP */
	uint16_t 	client_port;		/* network order */
	uint16_t 	server_port;		/* network order */
}layer_addr_v4_t;

void resp_write_to_log(int type, resp_checkresult_t* check_res, void* param1, void* param2, uint64_t param3);


#endif