FD.io VPP  v16.09
Vector Packet Processing
cnat_pcp_server.h File Reference
+ Include dependency graph for cnat_pcp_server.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcp_debug_counters
 
struct  pcp_show_counters_resp_t
 
struct  pcp_request
 
struct  pcp_response
 
struct  pcp_options_hdr
 
struct  pcp_map_option_specific_data
 
struct  pcp_peer_option_specific_data
 
struct  pcp_prefer_fail_option
 
struct  pcp_3rd_party_option
 
struct  pcp_pipeline_data
 

Macros

#define PCP_DBG(debug, ...)
 
#define PCP_DUMP_PDATA
 
#define PCP_DUMP_PACKET(ip, len)   pcp_hex_dump(ip, len)
 
#define PCP_INCR(counter)
 
#define PCP_DISABLED   0
 
#define PCP_ENABLED   1
 
#define PCP_DROP   1
 
#define PCP_STATIC_LIFETIME   0xFFFFFFFF
 
#define PCP_MAX_LIFETIME   0x00015180 /* 24 hours = 86400 seconds*/
 
#define PCP_VERSION_SUPPORTED   1
 
#define PCP_NO_PREF_FAIL_OPTION   0
 
#define PCP_PREF_FAIL_OPTION   1
 
#define CNAT_DEF_PCP_PORT   5351
 
#define PCP_REQ_RESP_BIT   0x80
 
#define PCP_RESPONSE(r_opcode)   (r_opcode & PCP_REQ_RESP_BIT)
 
#define PCP_REQUEST(r_opcode)   !(PCP_RESPONSE(r_opcode))
 
#define PCP_REQ_OPCODE(r_opcode)   (r_opcode & 0x7F)
 
#define PCP_COMMON_HDR_LEN   sizeof(pcp_request_t)
 
#define UDP_HDR_LEN   sizeof(udp_hdr_type_t)
 
#define PCP_PREF_FAIL_OPTION_SIZE   sizeof(pcp_prefer_fail_option_t)
 
#define PCP_3RD_PARTY_OPTION_SIZE   sizeof(pcp_3rd_party_option_t)
 
#define PCP_MIN_LEN   PCP_COMMON_HDR_LEN
 
#define PCP_MIN_UDP_LEN   (PCP_MIN_LEN + UDP_HDR_LEN)
 
#define PCP_MAX_LEN   1024
 
#define PCP_MAX_UDP_LEN   (PCP_MAX_LEN + UDP_HDR_LEN)
 
#define PCP_MAP_OPCODE_MIN_LEN
 
#define PCP_PEER_OPCODE_MIN_LEN
 
#define PCP_MAP_OPCODE_MIN_UDP_LEN
 
#define PCP_GET_MAP_OPTION_OFFSET(req)   ((u8*)req + PCP_MAP_OPCODE_MIN_LEN)
 
#define PCP_GET_PEER_OPTION_OFFSET(req)   ((u8*)req + PCP_PEER_OPCODE_MIN_LEN)
 
#define PCP_REQ_TOTAL_LEN(udp)
 
#define PCP_MAP_OPCODE_PREF_FAIL_OPTION_LEN
 
#define PCP_PEER_OPCODE_MIN_UDP_LEN
 
#define PCP_MUST_OPTION(option_code)   (option_code & 0x80)
 
#define PCP_DSLITE_MAP_OPCODE_MIN_UDP_LEN
 
#define PCP_DSLITE_MAP_OPCODE_MAX_UDP_LEN
 
#define PCP_DSLITE_PEER_OPCODE_MIN_UDP_LEN
 
#define PCP_SET_CNAT_PROTO(proto)
 
#define PCP_SET_REQ_LIFETIME()
 
#define PCP_THROTTLE_LIMIT   2
 
#define PCP_SERVICE_NAT44   1
 
#define PCP_SERVICE_DSLITE   2
 
#define PCP_SERVICE_NAT64   3
 
#define PCP_REQ_ENTRY_PRESENT   1
 
#define PCP_REQ_EXT_MAP_PRESENT   1
 

Typedefs

typedef struct pcp_debug_counters pcp_debug_counters_t
 
typedef enum pcp_opcode pcp_opcode_t
 
typedef enum pcp_options pcp_options_t
 
typedef enum pcp_result_codes pcp_result_codes_t
 
typedef struct pcp_request pcp_request_t
 
typedef struct pcp_response pcp_response_t
 
typedef struct pcp_options_hdr pcp_options_hdr_t
 
typedef struct pcp_map_option_specific_data pcp_map_option_specific_data_t
 
typedef struct pcp_peer_option_specific_data pcp_peer_option_specific_data_t
 
typedef struct pcp_prefer_fail_option pcp_prefer_fail_option_t
 
typedef struct pcp_3rd_party_option pcp_3rd_party_option_t
 
typedef struct pcp_pipeline_data pcp_pipeline_data_t
 

Enumerations

enum  pcp_opcode { PCP_OPCODE_MAP = 1, PCP_OPCODE_PEER = 2 }
 
enum  pcp_options { PCP_OPTION_3RD_PARTY = 1, PCP_OPTION_PREF_FAIL = 2, PCP_OPTION_FILTER = 3 }
 
enum  pcp_result_codes {
  PCP_SUCCESS = 0, PCP_ERR_UNSUPP_VERSION = 1, PCP_ERR_NOT_AUTHORIZED = 2, PCP_ERR_MALFORMED_REQUEST = 3,
  PCP_ERR_UNSUPP_OPCODE = 4, PCP_ERR_UNSUPP_OPTION = 5, PCP_ERR_MALFORMED_OPTION = 6, PCP_ERR_NETWORK_FAILURE = 7,
  PCP_ERR_NO_RESOURCES = 8, PCP_ERR_UNSUPP_PROTOCOL = 9, PCP_ERR_USER_EX_QUOTA = 10, PCP_ERR_CANNOT_PROVIDE_EXTERNAL = 11,
  PCP_ERR_ADDRESS_MISMATCH = 12, PCP_ERR_EXCESSIVE_REMOTE_PEERS = 13
}
 

Macro Definition Documentation

#define CNAT_DEF_PCP_PORT   5351

Definition at line 175 of file cnat_pcp_server.h.

#define PCP_3RD_PARTY_OPTION_SIZE   sizeof(pcp_3rd_party_option_t)

Definition at line 192 of file cnat_pcp_server.h.

#define PCP_COMMON_HDR_LEN   sizeof(pcp_request_t)

Definition at line 184 of file cnat_pcp_server.h.

#define PCP_DBG (   debug,
  ... 
)
Value:
if(PREDICT_FALSE(cnat_pcp_debug_flag >= debug)) { \
printf("%s:%s:%d - ", \
__FILE__, __FUNCTION__, __LINE__);\
printf(__VA_ARGS__);\
printf("\n"); \
}
#define PREDICT_FALSE(x)
Definition: clib.h:97

Definition at line 26 of file cnat_pcp_server.h.

#define PCP_DISABLED   0

Definition at line 162 of file cnat_pcp_server.h.

#define PCP_DROP   1

Definition at line 165 of file cnat_pcp_server.h.

#define PCP_DSLITE_MAP_OPCODE_MAX_UDP_LEN
Value:

Definition at line 246 of file cnat_pcp_server.h.

#define PCP_DSLITE_MAP_OPCODE_MIN_UDP_LEN
Value:
#define PCP_MAP_OPCODE_MIN_UDP_LEN
#define PCP_3RD_PARTY_OPTION_SIZE

Definition at line 241 of file cnat_pcp_server.h.

#define PCP_DSLITE_PEER_OPCODE_MIN_UDP_LEN
Value:
#define PCP_3RD_PARTY_OPTION_SIZE
#define PCP_PEER_OPCODE_MIN_UDP_LEN

Definition at line 251 of file cnat_pcp_server.h.

#define PCP_DUMP_PACKET (   ip,
  len 
)    pcp_hex_dump(ip, len)

Definition at line 54 of file cnat_pcp_server.h.

#define PCP_DUMP_PDATA
Value:
if(PREDICT_FALSE(cnat_pcp_debug_flag >= 100)) { \
printf("%s:%s:%d - \n", \
__FILE__, __FUNCTION__, __LINE__);\
printf("src - ip = %X, proto = %d, port = %d i_vrf = %d, o_vrf = %d\n", \
pcp_data.src_ip[3], pcp_data.proto, pcp_data.src_port, pcp_data.i_vrf, pcp_data.o_vrf); \
printf(" third party ip = %X\n", pcp_data.third_party_ip[3]); \
printf("map - ip = %X, port = %d \n", \
pcp_data.ext_ip[3], pcp_data.ext_port);\
printf("remote - ip = %X, port = %d \n", \
pcp_data.peer_ip[3], pcp_data.peer_port); \
printf("req life time = %d \n", pcp_data.req_lifetime); \
printf("drop = %d \n", pcp_data.drop);\
printf("udp_len = %d \n", pcp_data.udp_len); \
printf("pm = %p \n", pcp_data.pm); \
printf("cnat_proto = %X \n", pcp_data.cnat_proto); \
printf("inst_id = %X \n", pcp_data.inst_id); \
printf("======================================================\n"); \
}
#define PREDICT_FALSE(x)
Definition: clib.h:97

Definition at line 34 of file cnat_pcp_server.h.

#define PCP_ENABLED   1

Definition at line 163 of file cnat_pcp_server.h.

#define PCP_GET_MAP_OPTION_OFFSET (   req)    ((u8*)req + PCP_MAP_OPCODE_MIN_LEN)

Definition at line 217 of file cnat_pcp_server.h.

#define PCP_GET_PEER_OPTION_OFFSET (   req)    ((u8*)req + PCP_PEER_OPCODE_MIN_LEN)

Definition at line 220 of file cnat_pcp_server.h.

#define PCP_INCR (   counter)

Definition at line 59 of file cnat_pcp_server.h.

#define PCP_MAP_OPCODE_MIN_LEN
Value:

Definition at line 206 of file cnat_pcp_server.h.

#define PCP_MAP_OPCODE_MIN_UDP_LEN
Value:
#define UDP_HDR_LEN
#define PCP_MAP_OPCODE_MIN_LEN

Definition at line 214 of file cnat_pcp_server.h.

#define PCP_MAP_OPCODE_PREF_FAIL_OPTION_LEN
Value:

Definition at line 227 of file cnat_pcp_server.h.

#define PCP_MAX_LEN   1024

Definition at line 200 of file cnat_pcp_server.h.

#define PCP_MAX_LIFETIME   0x00015180 /* 24 hours = 86400 seconds*/

Definition at line 168 of file cnat_pcp_server.h.

#define PCP_MAX_UDP_LEN   (PCP_MAX_LEN + UDP_HDR_LEN)

Definition at line 203 of file cnat_pcp_server.h.

#define PCP_MIN_LEN   PCP_COMMON_HDR_LEN

Definition at line 195 of file cnat_pcp_server.h.

#define PCP_MIN_UDP_LEN   (PCP_MIN_LEN + UDP_HDR_LEN)

Definition at line 198 of file cnat_pcp_server.h.

#define PCP_MUST_OPTION (   option_code)    (option_code & 0x80)

Definition at line 236 of file cnat_pcp_server.h.

#define PCP_NO_PREF_FAIL_OPTION   0

Definition at line 172 of file cnat_pcp_server.h.

#define PCP_PEER_OPCODE_MIN_LEN
#define PCP_PEER_OPCODE_MIN_UDP_LEN
Value:
#define UDP_HDR_LEN
#define PCP_PEER_OPCODE_MIN_LEN

Definition at line 233 of file cnat_pcp_server.h.

#define PCP_PREF_FAIL_OPTION   1

Definition at line 173 of file cnat_pcp_server.h.

#define PCP_PREF_FAIL_OPTION_SIZE   sizeof(pcp_prefer_fail_option_t)

Definition at line 189 of file cnat_pcp_server.h.

#define PCP_REQ_ENTRY_PRESENT   1

Definition at line 393 of file cnat_pcp_server.h.

#define PCP_REQ_EXT_MAP_PRESENT   1

Definition at line 394 of file cnat_pcp_server.h.

#define PCP_REQ_OPCODE (   r_opcode)    (r_opcode & 0x7F)

Definition at line 181 of file cnat_pcp_server.h.

#define PCP_REQ_RESP_BIT   0x80

Definition at line 177 of file cnat_pcp_server.h.

#define PCP_REQ_TOTAL_LEN (   udp)
Value:
(udp->udp_length - \
#define UDP_HDR_LEN

Definition at line 224 of file cnat_pcp_server.h.

#define PCP_REQUEST (   r_opcode)    !(PCP_RESPONSE(r_opcode))

Definition at line 179 of file cnat_pcp_server.h.

#define PCP_RESPONSE (   r_opcode)    (r_opcode & PCP_REQ_RESP_BIT)

Definition at line 178 of file cnat_pcp_server.h.

#define PCP_SERVICE_DSLITE   2

Definition at line 389 of file cnat_pcp_server.h.

#define PCP_SERVICE_NAT44   1

Definition at line 388 of file cnat_pcp_server.h.

#define PCP_SERVICE_NAT64   3

Definition at line 390 of file cnat_pcp_server.h.

#define PCP_SET_CNAT_PROTO (   proto)
Value:
pcp_data.cnat_proto = (proto == TCP_PROT) ? CNAT_TCP: \
(proto == UDP_PROT)? CNAT_UDP : CNAT_ICMP;
#define UDP_PROT
#define CNAT_UDP
Definition: cnat_db.h:93
#define CNAT_ICMP
Definition: cnat_db.h:95
#define TCP_PROT
#define CNAT_TCP
Definition: cnat_db.h:94

Definition at line 256 of file cnat_pcp_server.h.

#define PCP_SET_REQ_LIFETIME ( )
Value:
if(pcp_data.db->flags & CNAT_DB_FLAG_STATIC_PORT) { \
pcp_data.db->proto_data.seq_pcp.pcp_lifetime = \
pcp_data.req_lifetime = PCP_STATIC_LIFETIME; \
} else { \
pcp_data.db->proto_data.seq_pcp.pcp_lifetime = \
pcp_data.req_lifetime + cnat_current_time ; \
}
u32 cnat_current_time
Definition: cnat_global.c:29
#define CNAT_DB_FLAG_STATIC_PORT
Definition: cnat_db.h:164
#define PCP_STATIC_LIFETIME

Definition at line 260 of file cnat_pcp_server.h.

#define PCP_STATIC_LIFETIME   0xFFFFFFFF

Definition at line 167 of file cnat_pcp_server.h.

#define PCP_THROTTLE_LIMIT   2

Definition at line 276 of file cnat_pcp_server.h.

#define PCP_VERSION_SUPPORTED   1

Definition at line 170 of file cnat_pcp_server.h.

#define UDP_HDR_LEN   sizeof(udp_hdr_type_t)

Definition at line 187 of file cnat_pcp_server.h.

Typedef Documentation

typedef enum pcp_opcode pcp_opcode_t
typedef enum pcp_options pcp_options_t
typedef struct pcp_request pcp_request_t
typedef struct pcp_response pcp_response_t

Enumeration Type Documentation

enum pcp_opcode
Enumerator
PCP_OPCODE_MAP 
PCP_OPCODE_PEER 

Definition at line 131 of file cnat_pcp_server.h.

Enumerator
PCP_OPTION_3RD_PARTY 
PCP_OPTION_PREF_FAIL 
PCP_OPTION_FILTER 

Definition at line 138 of file cnat_pcp_server.h.

Enumerator
PCP_SUCCESS 
PCP_ERR_UNSUPP_VERSION 
PCP_ERR_NOT_AUTHORIZED 
PCP_ERR_MALFORMED_REQUEST 
PCP_ERR_UNSUPP_OPCODE 
PCP_ERR_UNSUPP_OPTION 
PCP_ERR_MALFORMED_OPTION 
PCP_ERR_NETWORK_FAILURE 
PCP_ERR_NO_RESOURCES 
PCP_ERR_UNSUPP_PROTOCOL 
PCP_ERR_USER_EX_QUOTA 
PCP_ERR_CANNOT_PROVIDE_EXTERNAL 
PCP_ERR_ADDRESS_MISMATCH 
PCP_ERR_EXCESSIVE_REMOTE_PEERS 

Definition at line 145 of file cnat_pcp_server.h.