16 #ifndef SRC_VNET_SESSION_SESSION_TYPES_H_ 17 #define SRC_VNET_SESSION_SESSION_TYPES_H_ 22 #define SESSION_INVALID_INDEX ((u32)~0) 23 #define SESSION_INVALID_HANDLE ((u64)~0) 24 #define SESSION_CTRL_MSG_MAX_SIZE 84 26 #define foreach_session_endpoint_fields \ 27 foreach_transport_endpoint_cfg_fields \ 28 _(u8, transport_proto) \ 30 typedef struct _session_endpoint
32 #define _(type, name) type name; 37 typedef struct _session_endpoint_cfg
39 #define _(type, name) type name; 50 #define SESSION_IP46_ZERO \ 57 #define TRANSPORT_ENDPOINT_NULL \ 59 .sw_if_index = ENDPOINT_INVALID_INDEX, \ 60 .ip = SESSION_IP46_ZERO, \ 61 .fib_index = ENDPOINT_INVALID_INDEX, \ 65 #define SESSION_ENDPOINT_NULL \ 67 .sw_if_index = ENDPOINT_INVALID_INDEX, \ 68 .ip = SESSION_IP46_ZERO, \ 69 .fib_index = ENDPOINT_INVALID_INDEX, \ 72 .peer = TRANSPORT_ENDPOINT_NULL, \ 73 .transport_proto = 0, \ 75 #define SESSION_ENDPOINT_CFG_NULL \ 77 .sw_if_index = ENDPOINT_INVALID_INDEX, \ 78 .ip = SESSION_IP46_ZERO, \ 79 .fib_index = ENDPOINT_INVALID_INDEX, \ 82 .peer = TRANSPORT_ENDPOINT_NULL, \ 83 .transport_proto = 0, \ 84 .app_wrk_index = ENDPOINT_INVALID_INDEX, \ 85 .opaque = ENDPOINT_INVALID_INDEX, \ 87 .parent_handle = SESSION_INVALID_HANDLE \ 90 #define session_endpoint_to_transport(_sep) ((transport_endpoint_t *)_sep) 91 #define session_endpoint_to_transport_cfg(_sep) \ 92 ((transport_endpoint_cfg_t *)_sep) 125 #define foreach_session_state \ 126 _(CREATED, "created") \ 127 _(LISTENING, "listening") \ 128 _(CONNECTING, "connecting") \ 129 _(ACCEPTING, "accepting") \ 131 _(OPENED, "opened") \ 132 _(TRANSPORT_CLOSING, "transport-closing") \ 133 _(CLOSING, "closing") \ 134 _(APP_CLOSED, "app-closed") \ 135 _(TRANSPORT_CLOSED, "transport-closed") \ 136 _(CLOSED, "closed") \ 137 _(TRANSPORT_DELETED, "transport-deleted") \ 141 #define _(sym, str) SESSION_STATE_ ## sym, 202 return (proto << 1 | is_ip4);
267 return handle & 0xFFFFFFFF;
284 static inline session_handle_t
287 return (((
u64) thread_index << 32) | (
u64) session_index);
320 #define foreach_session_ctrl_evt \ 322 _(LISTEN_URI, listen_uri) \ 324 _(UNLISTEN, unlisten) \ 325 _(UNLISTEN_REPLY, unlisten_reply) \ 326 _(ACCEPTED, accepted) \ 327 _(ACCEPTED_REPLY, accepted_reply) \ 328 _(CONNECT, connect) \ 329 _(CONNECT_URI, connect_uri) \ 330 _(CONNECTED, connected) \ 331 _(DISCONNECT, disconnect) \ 332 _(DISCONNECTED, disconnected) \ 333 _(DISCONNECTED_REPLY, disconnected_reply) \ 334 _(RESET_REPLY, reset_reply) \ 335 _(REQ_WORKER_UPDATE, req_worker_update) \ 336 _(WORKER_UPDATE, worker_update) \ 337 _(WORKER_UPDATE_REPLY, worker_update_reply) \ 338 _(APP_DETACH, app_detach) \ 342 #define FIFO_EVENT_APP_RX SESSION_IO_EVT_RX 343 #define FIFO_EVENT_APP_TX SESSION_IO_EVT_TX 344 #define FIFO_EVENT_DISCONNECT SESSION_CTRL_EVT_CLOSE 345 #define FIFO_EVENT_BUILTIN_RX SESSION_IO_EVT_BUILTIN_RX 346 #define FIFO_EVENT_BUILTIN_TX SESSION_IO_EVT_BUILTIN_TX 376 } __clib_packed session_event_t;
378 #define SESSION_MSG_NULL { } 397 #define SESSION_CONN_ID_LEN 37 398 #define SESSION_CONN_HDR_LEN 45 401 "session conn id wrong length");
u32 al_index
App listener index in app's listener pool if a listener.
u32 connection_index
Index of the transport connection associated to the session.
u8 pad[3]
log2 (size of the packing page block)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
struct session_ session_t
session_type_t session_type
Type built from transport and network protocol types.
static u8 session_tx_is_dgram(session_t *s)
u32 session_index
Index in thread pool where session was allocated.
svm_fifo_t * rx_fifo
Pointers to rx/tx buffers.
static transport_proto_t session_get_transport_proto(session_t *s)
transport_tx_fn_type_t transport_protocol_tx_fn_type(transport_proto_t tp)
static u8 session_endpoint_fib_proto(session_endpoint_t *sep)
static void session_parse_handle(session_handle_t handle, u32 *index, u32 *thread_index)
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
static session_handle_t session_handle(session_t *s)
struct _svm_fifo svm_fifo_t
struct _session_endpoint_cfg session_endpoint_cfg_t
static session_type_t session_type_from_proto_and_ip(transport_proto_t proto, u8 is_ip4)
static transport_tx_fn_type_t session_transport_tx_fn_type(session_t *s)
transport_service_type_t transport_protocol_service_type(transport_proto_t tp)
u32 app_index
Index of application that owns the listener.
#define SESSION_CONN_ID_LEN
enum session_flags_ session_flags_t
enum transport_service_type_ transport_service_type_t
session_handle_t listener_handle
Parent listener session index if the result of an accept.
#define foreach_session_endpoint_fields
static transport_proto_t session_type_transport_proto(session_type_t st)
static u32 session_thread_from_handle(session_handle_t handle)
static u32 session_index_from_handle(session_handle_t handle)
static session_handle_t session_make_handle(u32 session_index, u32 thread_index)
static fib_protocol_t session_get_fib_proto(session_t *s)
#define foreach_session_state
STATIC_ASSERT(sizeof(session_dgram_hdr_t)==(SESSION_CONN_ID_LEN+8), "session conn id wrong length")
enum _transport_proto transport_proto_t
u8 thread_index
Index of the thread that allocated the session.
u8 ip_is_zero(ip46_address_t *ip46_address, u8 is_ip4)
static u8 session_type_is_ip4(session_type_t st)
volatile u8 session_state
State in session layer state machine.
u32 opaque
Opaque, for general use.
static u8 session_endpoint_is_zero(session_endpoint_t *sep)
u8 ip_is_local_host(ip46_address_t *ip46_address, u8 is_ip4)
static u8 session_has_transport(session_t *s)
u32 app_wrk_index
Index of the app worker that owns the session.
static u8 session_endpoint_is_local(session_endpoint_t *sep)
struct _session_endpoint session_endpoint_t
struct session_dgram_pre_hdr_ session_dgram_pre_hdr_t
static transport_service_type_t session_transport_service_type(session_t *s)
enum transport_dequeue_type_ transport_tx_fn_type_t
struct session_dgram_header_ session_dgram_hdr_t
vl_api_fib_path_nh_proto_t proto