#ifndef _NET_PFPOLICY_H
#define _NET_PFPOLICY_H
#ifdef __cplusplus
extern "C" {
#endif
#define PF_POLICY_V1 1
#define PF_POLICY_REVISION 200304L
typedef struct spd_msg
{
uint8_t spd_msg_version;
uint8_t spd_msg_type;
uint8_t spd_msg_errno;
uint8_t spd_msg_spdid;
uint16_t spd_msg_len;
uint16_t spd_msg_diagnostic;
union {
struct {
uint32_t spd_msg_useq;
uint32_t spd_msg_upid;
} spd_msg_actual;
uint64_t spd_msg_alignment;
} spd_msg_u;
#define spd_msg_seq spd_msg_u.spd_msg_actual.spd_msg_useq
#define spd_msg_pid spd_msg_u.spd_msg_actual.spd_msg_upid
} spd_msg_t;
#define SPD_RESERVED 0
#define SPD_MIN 1
#define SPD_FLUSH 1
#define SPD_ADDRULE 2
#define SPD_DELETERULE 3
#define SPD_FLIP 4
#define SPD_LOOKUP 5
#define SPD_DUMP 6
#define SPD_CLONE 7
#define SPD_ALGLIST 8
#define SPD_DUMPALGS 9
#define SPD_UPDATEALGS 10
#define SPD_MAX 10
#define SPD_ACTIVE 0
#define SPD_STANDBY 1
typedef struct spd_ext
{
union {
struct {
uint16_t spd_ext_ulen;
uint16_t spd_ext_utype;
} spd_ext_actual;
uint64_t spd_ext_alignment;
} spd_ext_u;
#define spd_ext_len spd_ext_u.spd_ext_actual.spd_ext_ulen
#define spd_ext_type spd_ext_u.spd_ext_actual.spd_ext_utype
} spd_ext_t;
#define SPD_EXT_LCLPORT 1
#define SPD_EXT_REMPORT 2
#define SPD_EXT_PROTO 3
#define SPD_EXT_LCLADDR 4
#define SPD_EXT_REMADDR 5
#define SPD_EXT_ACTION 6
#define SPD_EXT_RULE 7
#define SPD_EXT_RULESET 8
#define SPD_EXT_ICMP_TYPECODE 9
#define SPD_EXT_TUN_NAME 10
#define SPD_EXT_MAX 10
struct spd_rule
{
uint16_t spd_rule_len;
uint16_t spd_rule_type;
uint32_t spd_rule_priority;
uint32_t spd_rule_flags;
uint32_t spd_rule_unused;
uint64_t spd_rule_index;
};
#define SPD_RULE_FLAG_INBOUND 0x0001
#define SPD_RULE_FLAG_OUTBOUND 0x0002
#define SPD_RULE_FLAG_TUNNEL 0x0004
typedef struct spd_address {
union {
struct {
uint16_t spd_address_ulen;
uint16_t spd_address_uexttype;
uint8_t spd_address_uaf;
uint8_t spd_address_uprefixlen;
uint16_t spd_address_ureserved2;
} spd_address_actual;
uint64_t spd_address_alignment;
} spd_address_u;
#define spd_address_len \
spd_address_u.spd_address_actual.spd_address_ulen
#define spd_address_exttype \
spd_address_u.spd_address_actual.spd_address_uexttype
#define spd_address_af \
spd_address_u.spd_address_actual.spd_address_uaf
#define spd_address_prefixlen \
spd_address_u.spd_address_actual.spd_address_uprefixlen
#define spd_address_reserved2 \
spd_address_u.spd_address_actual.spd_address_ureserved2
} spd_address_t;
struct spd_proto
{
union {
struct {
uint16_t spd_proto_ulen;
uint16_t spd_proto_uexttype;
uint8_t spd_proto_unumber;
uint8_t spd_proto_ureserved1;
uint16_t spd_proto_ureserved2;
} spd_proto_actual;
uint64_t spd_proto_alignment;
} spd_proto_u;
#define spd_proto_len spd_proto_u.spd_proto_actual.spd_proto_ulen
#define spd_proto_exttype spd_proto_u.spd_proto_actual.spd_proto_uexttype
#define spd_proto_number spd_proto_u.spd_proto_actual.spd_proto_unumber
#define spd_proto_reserved1 spd_proto_u.spd_proto_actual.spd_proto_ureserved1
#define spd_proto_reserved2 spd_proto_u.spd_proto_actual.spd_proto_ureserved2
};
struct spd_portrange
{
union {
struct {
uint16_t spd_ports_ulen;
uint16_t spd_ports_uexttype;
uint16_t spd_ports_uminport;
uint16_t spd_ports_umaxport;
} spd_ports_actual;
uint64_t spd_ports_alignment;
} spd_ports_u;
#define spd_ports_len spd_ports_u.spd_ports_actual.spd_ports_ulen
#define spd_ports_exttype spd_ports_u.spd_ports_actual.spd_ports_uexttype
#define spd_ports_minport spd_ports_u.spd_ports_actual.spd_ports_uminport
#define spd_ports_maxport spd_ports_u.spd_ports_actual.spd_ports_umaxport
};
struct spd_typecode
{
union {
struct {
uint16_t spd_typecode_ulen;
uint16_t spd_typecode_uexttype;
uint8_t spd_typecode_utype;
uint8_t spd_typecode_utype_end;
uint8_t spd_typecode_ucode;
uint8_t spd_typecode_ucode_end;
} spd_typecode_actual;
uint64_t spd_typecode_alignment;
} spd_typecode_u;
#define spd_typecode_len \
spd_typecode_u.spd_typecode_actual.spd_typecode_ulen
#define spd_typecode_exttype \
spd_typecode_u.spd_typecode_actual.spd_typecode_uexttype
#define spd_typecode_type \
spd_typecode_u.spd_typecode_actual.spd_typecode_utype
#define spd_typecode_type_end \
spd_typecode_u.spd_typecode_actual.spd_typecode_utype_end
#define spd_typecode_code \
spd_typecode_u.spd_typecode_actual.spd_typecode_ucode
#define spd_typecode_code_end \
spd_typecode_u.spd_typecode_actual.spd_typecode_ucode_end
};
struct spd_ext_actions
{
union {
struct {
uint16_t spd_actions_ulen;
uint16_t spd_actions_uexttype;
uint16_t spd_actions_ucount;
uint16_t spd_actions_ureserved;
} spd_actions_actual;
uint64_t spd_actions_alignment;
} spd_actions_u;
#define spd_actions_len \
spd_actions_u.spd_actions_actual.spd_actions_ulen
#define spd_actions_exttype \
spd_actions_u.spd_actions_actual.spd_actions_uexttype
#define spd_actions_count \
spd_actions_u.spd_actions_actual.spd_actions_ucount
#define spd_actions_reserved \
spd_actions_u.spd_actions_actual.spd_actions_ureserved
};
struct spd_attribute
{
union {
struct {
uint32_t spd_attr_utag;
uint32_t spd_attr_uvalue;
} spd_attribute_actual;
uint64_t spd_attribute_alignment;
} spd_attribute_u;
#define spd_attr_tag spd_attribute_u.spd_attribute_actual.spd_attr_utag
#define spd_attr_value spd_attribute_u.spd_attribute_actual.spd_attr_uvalue
};
#define ALG_FLAG_VALID 0x01
#define ALG_FLAG_COUNTERMODE 0x02
#define ALG_FLAG_COMBINED 0x04
#define ALG_FLAG_CCM 0x08
#define ALG_FLAG_GCM 0x10
#define ALG_FLAG_KERNELCHECKED 0x80000000
#define SPD_ATTR_NOP 0x00000000
#define SPD_ATTR_END 0x00000001
#define SPD_ATTR_EMPTY 0x00000002
#define SPD_ATTR_NEXT 0x00000003
#define SPD_ATTR_TYPE 0x00000100
#define SPD_ATTR_FLAGS 0x00000101
#define SPD_ATTR_AH_AUTH 0x00000102
#define SPD_ATTR_ESP_ENCR 0x00000103
#define SPD_ATTR_ESP_AUTH 0x00000104
#define SPD_ATTR_ENCR_MINBITS 0x00000105
#define SPD_ATTR_ENCR_MAXBITS 0x00000106
#define SPD_ATTR_AH_MINBITS 0x00000107
#define SPD_ATTR_AH_MAXBITS 0x00000108
#define SPD_ATTR_LIFE_SOFT_TIME 0x00000109
#define SPD_ATTR_LIFE_HARD_TIME 0x0000010a
#define SPD_ATTR_LIFE_SOFT_BYTES 0x0000010b
#define SPD_ATTR_LIFE_HARD_BYTES 0x0000010c
#define SPD_ATTR_KM_PROTO 0x0000010d
#define SPD_ATTR_KM_COOKIE 0x0000010e
#define SPD_ATTR_REPLAY_DEPTH 0x0000010f
#define SPD_ATTR_ESPA_MINBITS 0x00000110
#define SPD_ATTR_ESPA_MAXBITS 0x00000111
#define SPD_ATTR_ENCR_DEFBITS 0x00000112
#define SPD_ATTR_ENCR_INCRBITS 0x00000113
#define SPD_ATTR_AH_DEFBITS 0x00000114
#define SPD_ATTR_AH_INCRBITS 0x00000115
#define SPD_ATTR_ESPA_DEFBITS 0x00000116
#define SPD_ATTR_ESPA_INCRBITS 0x00000117
#define SPD_ATTR_ALG_ID 0x00000118
#define SPD_ATTR_ALG_PROTO 0x00000119
#define SPD_ATTR_ALG_INCRBITS 0x0000011a
#define SPD_ATTR_ALG_NKEYSIZES 0x0000011b
#define SPD_ATTR_ALG_KEYSIZE 0x0000011c
#define SPD_ATTR_ALG_NBLOCKSIZES 0x0000011d
#define SPD_ATTR_ALG_BLOCKSIZE 0x0000011e
#define SPD_ATTR_ALG_MECHNAME 0x0000011f
#define SPD_ATTR_PROTO_ID 0x00000120
#define SPD_ATTR_PROTO_EXEC_MODE 0x00000121
#define SPD_ATTR_ALG_NPARAMS 0x00000122
#define SPD_ATTR_ALG_PARAMS 0x00000123
#define SPD_ATTR_ALG_FLAGS 0x00000124
typedef struct spd_if_s {
union {
struct {
uint16_t spd_if_ulen;
uint16_t spd_if_uexttype;
union {
uint8_t spd_if_iuname[4];
uint32_t spd_if_iuindex;
} spd_if_iu;
} spd_if_actual;
uint64_t spd_if_alignment;
} spd_if_u;
#define spd_if_len spd_if_u.spd_if_actual.spd_if_ulen
#define spd_if_exttype spd_if_u.spd_if_actual.spd_if_uexttype
#define spd_if_name spd_if_u.spd_if_actual.spd_if_iu.spd_if_iuname
#define spd_if_index spd_if_u.spd_if_actual.spd_if_iu.spd_if_iuindex
} spd_if_t;
#define SPD_MIN_MINBITS 0x0000
#define SPD_MAX_MAXBITS 0xffff
#define SPD_ACTTYPE_DROP 0x0001
#define SPD_ACTTYPE_PASS 0x0002
#define SPD_ACTTYPE_IPSEC 0x0003
#define SPD_APPLY_AH 0x0001
#define SPD_APPLY_ESP 0x0002
#define SPD_APPLY_SE 0x0004
#define SPD_APPLY_COMP 0x0008
#define SPD_APPLY_UNIQUE 0x0010
#define SPD_APPLY_BYPASS 0x0020
#define SPD_APPLY_ESPA 0x0040
#define SPD_ALG_EXEC_MODE_SYNC 1
#define SPD_ALG_EXEC_MODE_ASYNC 2
typedef struct spd_ruleset_ext
{
uint16_t spd_ruleset_len;
uint16_t spd_ruleset_type;
uint32_t spd_ruleset_count;
uint64_t spd_ruleset_version;
} spd_ruleset_ext_t;
#define SPD_DIAGNOSTIC_NONE 0
#define SPD_DIAGNOSTIC_UNKNOWN_EXT 1
#define SPD_DIAGNOSTIC_BAD_EXTLEN 2
#define SPD_DIAGNOSTIC_NO_RULE_EXT 3
#define SPD_DIAGNOSTIC_BAD_ADDR_LEN 4
#define SPD_DIAGNOSTIC_MIXED_AF 5
#define SPD_DIAGNOSTIC_ADD_NO_MEM 6
#define SPD_DIAGNOSTIC_ADD_WRONG_ACT_COUNT 7
#define SPD_DIAGNOSTIC_ADD_BAD_TYPE 8
#define SPD_DIAGNOSTIC_ADD_BAD_FLAGS 9
#define SPD_DIAGNOSTIC_ADD_INCON_FLAGS 10
#define SPD_DIAGNOSTIC_MALFORMED_LCLPORT 11
#define SPD_DIAGNOSTIC_DUPLICATE_LCLPORT 12
#define SPD_DIAGNOSTIC_MALFORMED_REMPORT 13
#define SPD_DIAGNOSTIC_DUPLICATE_REMPORT 14
#define SPD_DIAGNOSTIC_MALFORMED_PROTO 15
#define SPD_DIAGNOSTIC_DUPLICATE_PROTO 16
#define SPD_DIAGNOSTIC_MALFORMED_LCLADDR 17
#define SPD_DIAGNOSTIC_DUPLICATE_LCLADDR 18
#define SPD_DIAGNOSTIC_MALFORMED_REMADDR 19
#define SPD_DIAGNOSTIC_DUPLICATE_REMADDR 20
#define SPD_DIAGNOSTIC_MALFORMED_ACTION 21
#define SPD_DIAGNOSTIC_DUPLICATE_ACTION 22
#define SPD_DIAGNOSTIC_MALFORMED_RULE 23
#define SPD_DIAGNOSTIC_DUPLICATE_RULE 24
#define SPD_DIAGNOSTIC_MALFORMED_RULESET 25
#define SPD_DIAGNOSTIC_DUPLICATE_RULESET 26
#define SPD_DIAGNOSTIC_INVALID_RULE_INDEX 27
#define SPD_DIAGNOSTIC_BAD_SPDID 28
#define SPD_DIAGNOSTIC_BAD_MSG_TYPE 29
#define SPD_DIAGNOSTIC_UNSUPP_AH_ALG 30
#define SPD_DIAGNOSTIC_UNSUPP_ESP_ENCR_ALG 31
#define SPD_DIAGNOSTIC_UNSUPP_ESP_AUTH_ALG 32
#define SPD_DIAGNOSTIC_UNSUPP_AH_KEYSIZE 33
#define SPD_DIAGNOSTIC_UNSUPP_ESP_ENCR_KEYSIZE 34
#define SPD_DIAGNOSTIC_UNSUPP_ESP_AUTH_KEYSIZE 35
#define SPD_DIAGNOSTIC_NO_ACTION_EXT 36
#define SPD_DIAGNOSTIC_ALG_ID_RANGE 37
#define SPD_DIAGNOSTIC_ALG_NUM_KEY_SIZES 38
#define SPD_DIAGNOSTIC_ALG_NUM_BLOCK_SIZES 39
#define SPD_DIAGNOSTIC_ALG_MECH_NAME_LEN 40
#define SPD_DIAGNOSTIC_ALG_IPSEC_NOT_LOADED 41
#define SPD_DIAGNOSTIC_MALFORMED_ICMP_TYPECODE 42
#define SPD_DIAGNOSTIC_DUPLICATE_ICMP_TYPECODE 43
#define SPD_DIAGNOSTIC_NOT_GLOBAL_OP 44
#define SPD_DIAGNOSTIC_NO_TUNNEL_SELECTORS 45
#define SPD_64TO8(x) ((x) << 3)
#define SPD_8TO64(x) ((x) >> 3)
#define SPD_8TO1(x) ((x) << 3)
#define SPD_1TO8(x) ((x) >> 3)
#ifdef __cplusplus
}
#endif
#endif