blob: e770dc817c414906c09a3452c325cf558498ab31 [file] [log] [blame]
#ifndef _L5MIPC_STRUCT_H_
#define _L5MIPC_STRUCT_H_
#include "l5_common.h"
/** Filter rule */
#define IPC_FILTER_BY_PROTOCOL (0x0001 << 0)
#define IPC_FILTER_BY_SRC_PORT (0x0001 << 1)
#define IPC_FILTER_BY_DST_PORT (0x0001 << 2)
#define IPC_FILTER_BY_SRC_IPV4 (0x0001 << 3)
#define IPC_FILTER_BY_DST_IPV4 (0x0001 << 4)
#define IPC_FILTER_BY_SRC_IPV6 (0x0001 << 5)
#define IPC_FILTER_BY_DST_IPV6 (0x0001 << 6)
#define IPC_FILTER_BY_ICMPV4_TYPE (0x0001 << 7)
#define IPC_FILTER_BY_ICMPV6_TYPE (0x0001 << 8)
#define IPC_FILTER_BY_EBI (0x0001 << 9)
#define IPC_FILTER_BY_PDN_ID (0x0001 << 10)
#define IPC_FILTER_BY_NETIF_ID (0x0001 << 11)
#define IPC_FILTER_BY_TCP_FLAGS (0x0001 << 12)
#define IPC_FILTER_BY_SPI (0x0001 << 13)
#define IPC_IP_TYPE_IPV4 1
#define IPC_IP_TYPE_IPV6 2
/*
* IANA IP Protocol Numbers.
* Ref: http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
*/
#define IPC_HDR_PROT_IPV6_HOP 0 /* IPv6 Hop-by-Hop Option */
#define IPC_HDR_PROT_ICMP 1 /* Internet Control Message */
#define IPC_HDR_PROT_IPV4_ENC 4 /* IPv4 encapsulation */
#define IPC_HDR_PROT_TCP 6 /* Transmission Control */
#define IPC_HDR_PROT_UDP 17 /* User Datagram */
#define IPC_HDR_PROT_IPV6_ENC 41 /* IPv6 encapsulation */
#define IPC_HDR_PROT_IPV6_ROUTE 43 /* Routing Header for IPv6 */
#define IPC_HDR_PROT_IPV6_FRAG 44 /* Fragment Header for IPv6 */
#define IPC_HDR_PROT_ESP 50 /* Encap Security Payload */
#define IPC_HDR_PROT_AH 51 /* Authentication Header */
#define IPC_HDR_PROT_ICMPV6 58 /* ICMP for IPv6 */
#define IPC_HDR_PROT_IPV6_NONEXT 59 /* No Next Header for IPv6 */
#define IPC_HDR_PROT_IPV6_DEST 60 /* Destination Options for IPv6 */
/*
* TCP_FLAG.
*/
#define IPC_HDR_TCP_FLAG_FIN 0x01
#define IPC_HDR_TCP_FLAG_SYN 0x02
#define IPC_HDR_TCP_FLAG_RST 0x04 // Reset
#define IPC_HDR_TCP_FLAG_PUSH 0x08
#define IPC_HDR_TCP_FLAG_ACK 0x10
#define IPC_HDR_TCP_FLAG_URG 0x20 // Urgent
#define IPC_HDR_TCP_FLAG_ECE 0x40 // ECN Echo
#define IPC_HDR_TCP_FLAG_CWR 0x80 // Congestion Window Reduced
#define IPC_HDR_TCP_FLAG_NS 0x100 // ECN-nonce concealment protection (added to header by RFC 3540)
typedef struct {
L5IO_L5U_LOCAL_PARA_HDR
kal_uint8 nccmni_net_if; //kal_uint8
kal_uint8 reserve1;
kal_uint16 nccmni_seq;
kal_uint32 valid_field; //mandatory, a bitmap, refer to IPC_FILTER_BY_XXX
kal_uint8 ip_type; //IPC_IP_TYPE_IPV4 or IPC_IP_TYPE_IPV6
kal_uint8 ctrl_protocol; //IPC_HDR_PROT_XXX
kal_uint16 src_port;
kal_uint16 dst_port;
kal_uint16 tcp_flags; //IPC_HDR_TCP_FLAG_XXX
kal_uint32 spi; //
union{
kal_uint8 addr8[4];
kal_uint32 addr32;
} src_ipv4; // Source IPv4 address to filter.
union{
kal_uint8 addr8[4];
kal_uint32 addr32;
} dst_ipv4; // Destination IPv4 address to filter.
union{
kal_uint8 addr8[16];
kal_uint32 addr32[4];
} src_ipv6; // Source IPv6 address to filter.
union{
kal_uint8 addr8[16];
kal_uint32 addr32[4];
} dst_ipv6; // Destination IPv6 address to filter.
kal_uint8 icmpv4_type; // Type field of ICMPv4 header to filter.
kal_uint8 icmpv6_type; // Type field of ICMPv6 header to filter.
kal_uint16 reserve2;
kal_uint32 features;
} l5io_set_filter_req_struct;
typedef struct {
L5IO_L5U_LOCAL_PARA_HDR
kal_uint8 nccmni_net_if; //kal_uint8
kal_uint8 reserve1;
kal_uint16 nccmni_seq;
kal_int32 filter_id; //>=0: filter id, <0: set failed
} l5io_set_filter_cnf_struct;
typedef struct {
L5IO_L5U_LOCAL_PARA_HDR
kal_uint8 nccmni_net_if; //kal_uint8
kal_uint8 reserve1;
kal_uint16 nccmni_seq;
kal_int32 is_deregister_all_filter; //0: deregister the filter id only, 1: deregister all filter
kal_int32 filter_id; //filter id to deregister
} l5io_reset_filter_req_struct;
typedef struct {
L5IO_L5U_LOCAL_PARA_HDR
kal_uint8 nccmni_net_if; //kal_uint8
kal_uint8 reserve1;
kal_uint16 nccmni_seq;
kal_int32 is_success; //1: succes
} l5io_reset_filter_cnf_struct;
#endif