aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_interface.h8
-rw-r--r--src/vnet/session/session.c10
-rw-r--r--src/vnet/session/session.h4
-rwxr-xr-xsrc/vnet/session/session_api.c14
-rw-r--r--src/vnet/session/transport.c33
-rw-r--r--src/vnet/session/transport.h19
6 files changed, 40 insertions, 48 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index f6091c51698..3e6abdbec86 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -284,9 +284,7 @@ typedef struct session_accepted_msg_
uword server_tx_fifo;
u64 segment_handle;
uword vpp_event_queue_address;
- u16 port;
- u8 is_ip4;
- u8 ip[16];
+ transport_endpoint_t rmt;
} __clib_packed session_accepted_msg_t;
typedef struct session_accepted_reply_msg_
@@ -315,9 +313,7 @@ typedef struct session_connected_msg_
u32 segment_size;
u8 segment_name_length;
u8 segment_name[64];
- u8 lcl_ip[16];
- u8 is_ip4;
- u16 lcl_port;
+ transport_endpoint_t lcl;
} __clib_packed session_connected_msg_t;
typedef struct session_disconnected_msg_
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index c1d02ab8f09..aaf252be257 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1292,17 +1292,15 @@ session_get_transport (session_t * s)
}
void
-session_get_endpoint (session_t * s, ip46_address_t * ip, u16 * port,
- u8 * is_ip4, u8 is_lcl)
+session_get_endpoint (session_t * s, transport_endpoint_t * tep, u8 is_lcl)
{
if (s->session_state != SESSION_STATE_LISTENING)
return transport_get_endpoint (session_get_transport_proto (s),
- s->connection_index, s->thread_index, ip,
- port, is_ip4, is_lcl);
+ s->connection_index, s->thread_index, tep,
+ is_lcl);
else
return transport_get_listener_endpoint (session_get_transport_proto (s),
- s->connection_index, ip, port,
- is_ip4, is_lcl);
+ s->connection_index, tep, is_lcl);
}
transport_connection_t *
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 375b47a60cd..4e63d42de83 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -338,8 +338,8 @@ void session_send_rpc_evt_to_thread (u32 thread_index, void *fp,
void session_send_rpc_evt_to_thread_force (u32 thread_index, void *fp,
void *rpc_args);
transport_connection_t *session_get_transport (session_t * s);
-void session_get_endpoint (session_t * s, ip46_address_t * ip, u16 * port,
- u8 * is_ip4, u8 is_lcl);
+void session_get_endpoint (session_t * s, transport_endpoint_t * tep,
+ u8 is_lcl);
u8 *format_session (u8 * s, va_list * args);
uword unformat_session (unformat_input_t * input, va_list * args);
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index d0af0fac279..0a7781f2876 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -212,8 +212,7 @@ mq_send_session_accepted_cb (session_t * s)
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
mp->handle = session_handle (s);
- session_get_endpoint (s, (ip46_address_t *) mp->ip, &mp->port,
- &mp->is_ip4, 0 /* is_lcl */ );
+ session_get_endpoint (s, &mp->rmt, 0 /* is_lcl */ );
}
else
{
@@ -223,9 +222,9 @@ mq_send_session_accepted_cb (session_t * s)
listener = listen_session_get (s->listener_index);
al = app_listener_get (app, listener->al_index);
mp->listener_handle = app_listener_handle (al);
- mp->is_ip4 = session_type_is_ip4 (listener->session_type);
+ mp->rmt.is_ip4 = session_type_is_ip4 (listener->session_type);
+ mp->rmt.port = ct->c_rmt_port;
mp->handle = session_handle (s);
- mp->port = ct->c_rmt_port;
vpp_queue = session_main_get_vpp_event_queue (0);
mp->vpp_event_queue_address = pointer_to_uword (vpp_queue);
}
@@ -348,8 +347,7 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
mp->handle = session_handle (s);
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
- session_get_endpoint (s, (ip46_address_t *) mp->lcl_ip, &mp->lcl_port,
- &mp->is_ip4, 1 /* is_lcl */ );
+ session_get_endpoint (s, &mp->lcl, 1 /* is_lcl */ );
mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
mp->server_tx_fifo = pointer_to_uword (s->tx_fifo);
@@ -362,8 +360,8 @@ mq_send_session_connected_cb (u32 app_wrk_index, u32 api_context,
cct = (ct_connection_t *) session_get_transport (s);
mp->handle = session_handle (s);
- mp->lcl_port = cct->c_lcl_port;
- mp->is_ip4 = cct->c_is_ip4;
+ mp->lcl.port = cct->c_lcl_port;
+ mp->lcl.is_ip4 = cct->c_is_ip4;
vpp_mq = session_main_get_vpp_event_queue (0);
mp->vpp_event_queue_address = pointer_to_uword (vpp_mq);
mp->server_rx_fifo = pointer_to_uword (s->rx_fifo);
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 9efe0e17307..0679eaa1079 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -321,52 +321,49 @@ transport_protocol_is_cl (transport_proto_t tp)
always_inline void
default_get_transport_endpoint (transport_connection_t * tc,
- ip46_address_t * ip, u16 * port, u8 * is_ip4,
- u8 is_lcl)
+ transport_endpoint_t * tep, u8 is_lcl)
{
if (is_lcl)
{
- *port = tc->lcl_port;
- *is_ip4 = tc->is_ip4;
- clib_memcpy_fast (ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
+ tep->port = tc->lcl_port;
+ tep->is_ip4 = tc->is_ip4;
+ clib_memcpy_fast (&tep->ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
}
else
{
- *port = tc->rmt_port;
- *is_ip4 = tc->is_ip4;
- clib_memcpy_fast (ip, &tc->rmt_ip, sizeof (tc->rmt_ip));
+ tep->port = tc->rmt_port;
+ tep->is_ip4 = tc->is_ip4;
+ clib_memcpy_fast (&tep->ip, &tc->rmt_ip, sizeof (tc->rmt_ip));
}
}
void
transport_get_endpoint (transport_proto_t tp, u32 conn_index,
- u32 thread_index, ip46_address_t * ip, u16 * port,
- u8 * is_ip4, u8 is_lcl)
+ u32 thread_index, transport_endpoint_t * tep,
+ u8 is_lcl)
{
if (tp_vfts[tp].get_transport_endpoint)
- tp_vfts[tp].get_transport_endpoint (conn_index, thread_index, ip, port,
- is_ip4, is_lcl);
+ tp_vfts[tp].get_transport_endpoint (conn_index, thread_index, tep,
+ is_lcl);
else
{
transport_connection_t *tc;
tc = transport_get_connection (tp, conn_index, thread_index);
- default_get_transport_endpoint (tc, ip, port, is_ip4, is_lcl);
+ default_get_transport_endpoint (tc, tep, is_lcl);
}
}
void
transport_get_listener_endpoint (transport_proto_t tp, u32 conn_index,
- ip46_address_t * ip, u16 * port, u8 * is_ip4,
- u8 is_lcl)
+ transport_endpoint_t * tep, u8 is_lcl)
{
if (tp_vfts[tp].get_transport_listener_endpoint)
- tp_vfts[tp].get_transport_listener_endpoint (conn_index, ip, port, is_ip4,
- is_lcl);
+ tp_vfts[tp].get_transport_listener_endpoint (conn_index, tep, is_lcl);
else
{
transport_connection_t *tc;
tc = transport_get_listener (tp, conn_index);
- default_get_transport_endpoint (tc, ip, port, is_ip4, is_lcl);
+ default_get_transport_endpoint (tc, tep, is_lcl);
}
}
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index 73d7fba3c49..0aaaf7482d3 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -62,10 +62,14 @@ typedef struct _transport_proto_vft
u8 *(*format_listener) (u8 * s, va_list * args);
u8 *(*format_half_open) (u8 * s, va_list * args);
- /* External API response */
-
- void (*get_transport_endpoint) (u32 conn_index, u32 thread_index, ip46_address_t * ip, u16 * port, u8 * is_ip4, u8 is_lcl);
- void (*get_transport_listener_endpoint) (u32 conn_index, ip46_address_t * ip, u16 * port, u8 * is_ip4, u8 is_lcl);
+ /*
+ * Properties retrieval
+ */
+ void (*get_transport_endpoint) (u32 conn_index, u32 thread_index,
+ transport_endpoint_t *tep, u8 is_lcl);
+ void (*get_transport_listener_endpoint) (u32 conn_index,
+ transport_endpoint_t *tep,
+ u8 is_lcl);
/*
* Properties
@@ -92,11 +96,10 @@ u32 transport_stop_listen (transport_proto_t tp, u32 conn_index);
void transport_cleanup (transport_proto_t tp, u32 conn_index,
u8 thread_index);
void transport_get_endpoint (transport_proto_t tp, u32 conn_index,
- u32 thread_index, ip46_address_t * ip,
- u16 * port, u8 * is_ip4, u8 is_lcl);
+ u32 thread_index, transport_endpoint_t * tep,
+ u8 is_lcl);
void transport_get_listener_endpoint (transport_proto_t tp, u32 conn_index,
- ip46_address_t * ip, u16 * port,
- u8 * is_ip4, u8 is_lcl);
+ transport_endpoint_t * tep, u8 is_lcl);
static inline transport_connection_t *
transport_get_connection (transport_proto_t tp, u32 conn_index,