#ifndef _AV_LOG_H_ #define _AV_LOG_H_ #ifndef __cplusplus #error("This file should be compiled with C++ compiler") #endif #include #include #include "AV_types.h" #include "AV_rule.h" // FD类型, 0表示动态黑白名单,1表示静态配置命中,2表示二级分析节点命中。 #define FD_TYPE_DYNAMIC_LIST 0 #define FD_TYPE_STATIC_CONF 1 #define FD_TYPE_ANALYSE 2 #define OPT_ACC_CNT 0x01 #define OPT_SERVICE 0x02 #define OPT_MEDIA_TYPE 0x03 #define OPT_CHECK_FLAG 0x04 #define OPT_DROP_RATE 0x05 #define OPT_ID 0x06 #define OPT_IDC 0x07 #define OPT_LOG_MSG 0x08 #define OPT_SINGLE_KEY 0x09 #define AV_LOG_OPT_IMG_FP 0x10 #define AV_LOG_OPT_FRAG_ORIGION_URL 0x11 #define AV_LOG_OPT_FRAG_SUBSTR 0x12 #define AV_LOG_OPT_FRAG_INDEX_URL 0x13 #define AV_LOG_OPT_IMG_LENGTH 0x14 #define AV_LOG_OPT_IMG_FP_STR 0x15 #define AV_LOG_OPT_HTTP_COOKIE 0x19 #define AV_LOG_OPT_LOG_URI 0x20 /* == OPT_FRAG_URL */ #define AV_LOG_OPT_PROTO_URL 0x21 /* == OPT_PROG_URL */ #define AV_LOG_OPT_PROTO_REFERER 0x22 #define AV_LOG_OPT_HTTP_SESSION_SEQ 0x23 #define AV_LOG_OPT_HTTP_UA 0x24 #define AV_LOG_OPT_HTTP_PROXY_FLAG 0x25 #define AV_LOG_OPT_TCP_CLIENT_SEQ 0x26 #define AV_LOG_OPT_HTTP_PROXY_DOMAIN 0x27 #define AV_LOG_OPT_HTTP_DOMAIN 0x28 #define AV_DST_TYPE 0x29 #define OPT_FRAG_URL 0x20 #define OPT_PROG_URL 0x21 #define OPT_USERNAME 0x2A #define OPT_PASSWORD 0x2B #define OPT_LOG_REFER 0x2C #define OPT_LAYER_ADDR_V4 0x2D #define OPT_LAYER_ADDR_V6 0x2E #define OPT_VOIP_RECV_TIME 0x2F #define OPT_VOIP_DUATION 0x30 #define OPT_VOIP_PROTCOL 0x31 #define OPT_VOIP_CALLING_ACCOUNT 0x32 #define OPT_VOIP_CALLED_ACCOUNT 0x33 #define OPT_VOIP_CALLING_NUMBER 0x34 #define OPT_VOIP_CALLED_NUMBER 0x35 #define OPT_VOIP_FROM_TO_STORE_IP 0x36 #define OPT_VOIP_FROM_TO_STORE_URL 0x37 #define OPT_VOIP_TO_FROM_STORE_IP 0x38 #define OPT_VOIP_TO_FROM_STORE_URL 0x39 typedef struct _av_log_t { PROG_ID_t pid; unsigned char fd_type; //define at this file FD_TYPE_** unsigned char protocol; //define at AV_types.h's AV_PROTOCOL_** struct streaminfo *a_stream; AV_rule_t* cfg; }AV_log_t; //return 0 if SUCCESS, otherwise return -1 int AV_init_log(const char* server_ip,unsigned short port, unsigned int sendlog_mode);//ONLY used by AV Master Controller int AV_send_log(const AV_log_t* log_msg,struct opt_unit_t* log_opt,int opt_num); int AV_send_log_to(const AV_log_t* log_msg,struct opt_unit_t* opt,int opt_num, int av_type); //INPUT: // protocol define as AV_types.h 's AV_PROTOCOL_XXX // url could be "null" if not accquired,MUST end with '\0' typedef struct _av_info_t { const struct streaminfo* a_stream; PROG_ID_t pid; const char* url; unsigned long long length; unsigned char protocol; }AV_info_t; void AV_log_prog_local(const AV_info_t* p); #define LOCAL_LOG_TYPE_FRAG_FIND_PROG 0 #define LOCAL_LOG_TYPE_FENGDU_ACTION 1 #define LOCAL_LOG_TYPE_FENGDU_MSG 2 #define LOCAL_LOG_TYPE_MEDIA_INFO 3 #define LOCAL_LOG_TYPE_DROP_RATE 4 #define LOCAL_LOG_TYPE_FD_TYPE2 5 #define LOCAL_LOG_TYPE_VOIP_ACTION 6 #define LOCAL_LOG_TYPE_AV_FIND_PROG 7 #define LOCAL_LOG_TYPE_FRAG_SERVER_IP 8 int AV_kafka_init(int thread_num); void AV_local_log_convert_json(const AV_info_t* p, int local_log_type, opt_unit_t *opt, int opt_num); extern screen_stat_handle_t g_av_stat_handle; #endif