diff options
author | Florin Coras <fcoras@cisco.com> | 2023-02-07 17:36:17 -0800 |
---|---|---|
committer | Dave Barach <vpp@barachs.net> | 2023-02-20 18:50:52 +0000 |
commit | eff5f7aea8c7ca8a63c88624bf962c43b3f8bdd3 (patch) | |
tree | 5ea812f27cf5da59498cb5d2c69e6009852e7cca /src/vcl/vppcom.h | |
parent | 7c7231fc30d9da81bc1311966fe8b9d8720c1623 (diff) |
vcl: ldp support for ip_pktinfo
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I3c15f38a4a3f5e92506059277948e7fca9cd8b55
Diffstat (limited to 'src/vcl/vppcom.h')
-rw-r--r-- | src/vcl/vppcom.h | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h index 81a6634a8a3..71a49ab3480 100644 --- a/src/vcl/vppcom.h +++ b/src/vcl/vppcom.h @@ -22,12 +22,12 @@ #include <poll.h> #include <sys/epoll.h> -/* *INDENT-OFF* */ +/* clang-format off */ + #ifdef __cplusplus extern "C" { #endif -/* *INDENT-ON* */ /* * VPPCOM Public API Definitions, Enums, and Data Structures @@ -46,49 +46,56 @@ extern "C" #define VPPCOM_ENV_VPP_API_SOCKET "VCL_VPP_API_SOCKET" #define VPPCOM_ENV_VPP_SAPI_SOCKET "VCL_VPP_SAPI_SOCKET" - typedef enum - { - VPPCOM_PROTO_TCP = 0, - VPPCOM_PROTO_UDP, - VPPCOM_PROTO_NONE, - VPPCOM_PROTO_TLS, - VPPCOM_PROTO_QUIC, - VPPCOM_PROTO_DTLS, - VPPCOM_PROTO_SRTP, - } vppcom_proto_t; - - typedef enum - { - VPPCOM_IS_IP6 = 0, - VPPCOM_IS_IP4, - } vppcom_is_ip4_t; +typedef enum vppcom_proto_ +{ + VPPCOM_PROTO_TCP = 0, + VPPCOM_PROTO_UDP, + VPPCOM_PROTO_NONE, + VPPCOM_PROTO_TLS, + VPPCOM_PROTO_QUIC, + VPPCOM_PROTO_DTLS, + VPPCOM_PROTO_SRTP, +} vppcom_proto_t; + +typedef enum +{ + VPPCOM_IS_IP6 = 0, + VPPCOM_IS_IP4, +} vppcom_is_ip4_t; + +typedef struct vppcom_endpt_tlv_t_ +{ + uint32_t data_type; + uint32_t data_len; + uint8_t data[0]; +} vppcom_endpt_tlv_t; + +typedef struct vppcom_endpt_t_ +{ + uint8_t unused; /**< unused */ + uint8_t is_ip4; /**< flag set if if ip is ipv4 */ + uint8_t *ip; /**< pointer to ip address */ + uint16_t port; /**< transport port */ + uint64_t unused2; /**< unused */ + uint32_t app_tlv_len; /**< length of app provided tlvs */ + vppcom_endpt_tlv_t *app_tlvs; /**< array of app provided tlvs */ +} vppcom_endpt_t; #define VCL_UDP_OPTS_BASE (VPPCOM_PROTO_UDP << 16) #define VCL_UDP_SEGMENT (VCL_UDP_OPTS_BASE + 0) - typedef struct vppcom_endpt_tlv_t_ - { - uint32_t data_type; - uint32_t data_len; - union - { - /* data */ - uint64_t value; - uint32_t as_u32[2]; - uint16_t as_u16[4]; - uint8_t as_u8[8]; - }; - } vppcom_endpt_tlv_t; - - typedef struct vppcom_endpt_t_ - { - uint8_t is_cut_thru; - uint8_t is_ip4; - uint8_t *ip; - uint16_t port; - uint64_t parent_handle; - vppcom_endpt_tlv_t app_data; - } vppcom_endpt_t; +/* By convention we'll use 127 for IP since we don't support IP as protocol */ +#define VCL_IP_OPTS_BASE (127 << 16) +#define VCL_IP_PKTINFO (VCL_IP_OPTS_BASE + 1) + +#define VCL_EP_APP_TLV_LEN(tlv_) (sizeof (vppcom_endpt_tlv_t) + tlv->data_len) +#define VCL_EP_APP_TLV_POS(ep_, tlv_) ((void *)ep_->app_tlvs - (void *)tlv_) +#define VCL_EP_APP_TLV_LEN_LEFT(ep_, tlv_) \ + (ep_->app_tlv_len - VCL_EP_APP_TLV_POS (ep_, tlv_)) +#define VCL_EP_NEXT_APP_TLV(ep_, tlv_) \ + (VCL_EP_APP_TLV_LEN (tlv_) < VCL_EP_APP_TLV_POS (ep_, tlv_) ? ( \ + (vppcom_endpt_tlv_t *)((uint8_t *)tlv_ + VCL_EP_APP_TLV_LEN (tlv_))) \ + : 0) typedef uint32_t vcl_session_handle_t; @@ -167,6 +174,8 @@ typedef enum VPPCOM_ATTR_GET_DOMAIN, VPPCOM_ATTR_SET_ENDPT_EXT_CFG, VPPCOM_ATTR_SET_DSCP, + VPPCOM_ATTR_SET_IP_PKTINFO, + VPPCOM_ATTR_GET_IP_PKTINFO, } vppcom_attr_op_t; typedef struct _vcl_poll @@ -299,11 +308,10 @@ extern int vppcom_session_get_error (uint32_t session_handle); */ extern int vppcom_worker_is_detached (void); -/* *INDENT-OFF* */ #ifdef __cplusplus } #endif -/* *INDENT-ON* */ +/* clang-format on */ #endif /* included_vppcom_h */ |