secgateway/Platform/modules/conntrack_api/api/conntrack_api.h

55 lines
1.5 KiB
C
Executable File

#ifndef _CONNTRACK_API_H
#define _CONNTRACK_API_H
#include <net/netfilter/nf_conntrack.h>
extern seqcount_t nf_conntrack_generation;
extern u32 cmhi_seed;
#define CMHI_EXT_ERR -1
#define CMHI_EXT_OK 0
typedef enum{
USER_ID,
USER_VERSION,
NODE_INDEX,
APP_ID,
POLICY_VERSION,
ACTION,
}cmhi_ext_type;
//modify cmhi_ext_info u_int32_t status
typedef enum{
/*skb pass or not*/
//CMHI_EXT_PASS_BIT = 0,
CMHI_EXT_PASS = (1 << 0),
/*skb go to dpi or not*/
//CMHI_EXT_GOTO_DPI_BIT = 1,
CMHI_EXT_GOTO_DPI = (1 << 1),
}cmhi_ext_action_bit;
struct dpi_tuple{
__be32 sip;
__be32 dip;
__be16 sport;
__be16 dport;
u_int8_t protonum;
};
struct dpi{
struct dpi_tuple tuple; /* dpi???a¡Á¨¦ */
uint16_t aid; /* app id */
};
int cmhi_set_conntrack_u16(const struct sk_buff *skb, uint16_t value, cmhi_ext_type type);
int cmhi_set_conntrack_u32(const struct sk_buff *skb, uint32_t value, cmhi_ext_type type);
int cmhi_set_conntrack_action_by_bit(const struct sk_buff *skb, cmhi_ext_action_bit abit);
int cmhi_get_conntrack_u16(const struct sk_buff *skb, uint16_t *value, cmhi_ext_type type);
int cmhi_get_conntrack_u32(const struct sk_buff *skb, uint32_t *value, cmhi_ext_type type);
int cmhi_del_conntrack(const struct sk_buff *skb, cmhi_ext_type type);
int cmhi_del_conntrack_action_by_bit(const struct sk_buff *skb, cmhi_ext_action_bit abit);
struct nf_conn *get_conntrack_from_tuple(struct dpi_tuple *dpi_tuple);
int set_aid_by_dpi_tuple(struct dpi *dpi);
#endif /* _CONNTRACK_API_H */