115 lines
3.2 KiB
C
Executable File
115 lines
3.2 KiB
C
Executable File
#ifndef _UAPI__LINUX_COMMNETLINK_H
|
||
#define _UAPI__LINUX_COMMNETLINK_H
|
||
|
||
|
||
#include <linux/types.h>
|
||
#include <linux/netlink.h>
|
||
//#include <uapi/linux/netlink.h>
|
||
|
||
|
||
|
||
/**********************NETLINK MODULE CONFIG:being**************************/
|
||
//#define NLDEBUG_ACK_COOKIES
|
||
/**********************NETLINK MODULE CONFIG:end****************************/
|
||
|
||
/* netlink proto*/
|
||
#define NETLINK_COMMMAX_MIN_FAMILY 21
|
||
#define NETLINK_COMMCFG 22
|
||
#define NETLINK_PDELIVERY 23
|
||
#define NETLINK_COMMMAX_MAX_FAMILY 24
|
||
|
||
|
||
/*NETLINK_PDELIVERY groups,keep userspace and kernel the same */
|
||
#define PDNLGRP_ALLRAW 0x01 /*上送DPI的报文*/
|
||
#define PDNLGRP_PKT1 0X02 /*保留*/
|
||
#define PDNLGRP_PKT2 0X04 /*保留*/
|
||
#define PDNLGRP_PKT3 0X08 /*保留*/
|
||
|
||
enum pdeliverynetlink_groups {
|
||
PDELIVERY_NLGRP_NONE=0,/*代表单播*/
|
||
#define PDELIVERY_NLGRP_NONE PDELIVERY_NLGRP_NONE
|
||
PDELIVERY_NLGRP_ALLRAW=1,
|
||
#define PDELIVERY_NLGRP_ALLRAW PDELIVERY_NLGRP_ALLRAW
|
||
PDELIVERY_NLGRP_PKT1,
|
||
#define PDELIVERY_NLGRP_PKT1 PDELIVERY_NLGRP_PKT1
|
||
PDELIVERY_NLGRP_PKT2,
|
||
#define PDELIVERY_NLGRP_PKT2 PDELIVERY_NLGRP_PKT2
|
||
PDELIVERY_NLGRP_PKT3,
|
||
#define PDELIVERY_NLGRP_PKT3 PDELIVERY_NLGRP_PKT3
|
||
__PDELIVERY_NLGRP_MAX,
|
||
};
|
||
#define PDELIVERY_NLGRP_MAX (__PDELIVERY_NLGRP_MAX - 1)
|
||
|
||
#define COMMLIBNLGRP_MAX 16 /*支持的最大组数量*/
|
||
|
||
#define DEBUGFS_PRK_ONOFF 0
|
||
|
||
/*netlink pdelivery msg type*/
|
||
enum pdelivmsgtype{
|
||
PDNL_BASE = 0x10,/*netlink 保留控制消息*/
|
||
NLMSG_PDELIV_DEBUGFS = 0x11, /*用户态发送给内核态的请求消息,用于查看pdiliv模块本身的状态及配置,与业务无关*/
|
||
NLMSG_RECV_RAW_PKT = 0x12,/*上送DPI的报文消息*/
|
||
PDNLGRP_REQUEST,
|
||
NK_DEBUGFS_PRK_ONOFF = 0X16,/*DEBUGFS PRINTK ON 0R OFF: 1->ON; 0->OFF */
|
||
|
||
/*for trace*/
|
||
TRACE_CFG_POLICY_REQ = 0x20,
|
||
TRACE_CFG_POLICY_REPLY,
|
||
NLMGS_PDELIVERY_MAX_TYPE,
|
||
};
|
||
|
||
|
||
/* PDELIVERY msg attr */
|
||
enum pdelivattr{
|
||
PDELIVERY_UNSPEC_ATTR,
|
||
PDELIVERY_PKT_ATTR,
|
||
PDELIVERY_DUMP_PKTNUM_ATTR,
|
||
__PDELIVERY_MAX_ATTR
|
||
};
|
||
|
||
#define PDELIVERY_MAX_MAX (__PDELIVERY_MAX_ATTR - 1)
|
||
|
||
/**********************************************************************/
|
||
/*becareful end :keep userspace and kernel the same . */
|
||
/**********************************************************************/
|
||
|
||
|
||
/****
|
||
* common cfg messages type.
|
||
****/
|
||
|
||
/* Types of messages */
|
||
|
||
enum commcfgmsgtype{
|
||
//COMMMSGNL_BASE = NLMSG_MIN_TYPE,/*netlink 保留控制消息*/
|
||
COMMMSGNL_BASE = 0x10,/*netlink 保留控制消息*/
|
||
COMMNMSG_CFG_DEBUGFS = 0x11,/*keep the same with NLMSG_PDELIV_DEBUGFS */
|
||
FREEAUTH_CFG = 0x13, /*用户态发送给内核态的免认证规则消息*/
|
||
COMMNMSG_POLICYCONF,
|
||
|
||
NK_DEBUGFS_PRK_ONOFF_CFG = 0X16,/*keep the same with DEBUGFS PRINTK ON OR OFF */
|
||
|
||
/*add your msg type here:*/
|
||
|
||
/*commcfg nsmsg max type,must :add your msg type before this */
|
||
COMMCFG_NLMSG_MAX_TYPE,
|
||
};
|
||
|
||
|
||
struct netlink_debugfs {
|
||
unsigned int rev_total;
|
||
unsigned int rev_cb_sucess;
|
||
unsigned int rev_cb_fail;
|
||
unsigned int rev_drop_total;
|
||
unsigned int rev_drop_nodoit;
|
||
|
||
|
||
unsigned int send_succ;
|
||
unsigned int send_fail;
|
||
int send_fail_reason;
|
||
|
||
};
|
||
|
||
#endif /* _UAPI__LINUX_COMMNETLINK_H */
|
||
|