29 #include "../session/application_interface.h" 48 s =
format (s,
"UDP4_URI_INPUT: session %d, disposition %d, thread %d",
60 #define _(sym,string) string, 69 u32 n_left_from, *from, *to_next;
75 u32 *session_indices_to_enqueue;
76 static u32 serial_number;
79 my_enqueue_epoch = ++smm->current_enqueue_epoch[my_thread_index];
85 while (n_left_from > 0)
91 while (n_left_from > 0 && n_left_to_next > 0)
96 u32 error0 = SESSION_ERROR_ENQUEUED;
126 SESSION_TYPE_IP4_UDP, my_thread_index);
131 error0 = SESSION_ERROR_NO_LISTENER;
135 f0 = s0->server_rx_fifo;
140 udp_len0 = clib_net_to_host_u16 (udp0->
length);
144 error0 = SESSION_ERROR_FIFO_FULL;
149 udp_len0 -
sizeof (*udp0),
155 if (s0->enqueue_epoch != my_enqueue_epoch)
157 s0->enqueue_epoch = my_enqueue_epoch;
159 vec_add1 (smm->session_indices_to_enqueue_by_thread
161 s0 - smm->sessions[my_thread_index]);
170 error0 = SESSION_ERROR_NOT_READY;
175 pool_get (um->udp_sessions[my_thread_index], us);
183 us->c_proto = SESSION_TYPE_IP4_UDP;
184 us->c_c_index = us - um->udp_sessions[my_thread_index];
190 SESSION_TYPE_IP4_UDP,
199 error0 = SESSION_ERROR_NOT_READY;
214 t->
session = s0 - smm->sessions[my_thread_index];
221 to_next, n_left_to_next,
230 session_indices_to_enqueue =
231 smm->session_indices_to_enqueue_by_thread[my_thread_index];
233 for (i = 0; i <
vec_len (session_indices_to_enqueue); i++)
235 session_fifo_event_t evt;
242 session_indices_to_enqueue[i]);
248 evt.fifo = s0->server_rx_fifo;
250 evt.event_id = serial_number++;
254 if (server0->cb_fns.builtin_server_rx_callback)
256 server0->cb_fns.builtin_server_rx_callback (s0, &evt);
261 q = server0->event_queue;
270 SESSION_ERROR_FIFO_FULL, 1);
276 .format =
"evt-enqueue: id %d length %d",.format_args =
"i4i4",};
282 ed->data[0] = evt.event_id;
283 ed->data[1] = evt.enqueue_length;
289 smm->session_indices_to_enqueue_by_thread[my_thread_index] =
290 session_indices_to_enqueue;
sll srl srl sll sra u16x4 i
int svm_fifo_enqueue_nowait(svm_fifo_t *f, int pid, u32 max_bytes, u8 *copy_from_here)
int stream_session_accept(transport_connection_t *tc, u32 listener_index, u8 sst, u8 notify)
Accept a stream session.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
struct _vlib_node_registration vlib_node_registration_t
static u32 svm_fifo_max_enqueue(svm_fifo_t *f)
vlib_error_t * errors
Vector of errors for this node.
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
struct _stream_session_t stream_session_t
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
stream_session_t * stream_session_lookup4(ip4_address_t *lcl, ip4_address_t *rmt, u16 lcl_port, u16 rmt_port, u8 proto, u32 my_thread_index)
Looks up a session based on the 5-tuple passed as argument.
struct _udp_uri_main udp_uri_main_t
int unix_shared_memory_queue_add(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
static session_manager_main_t * vnet_get_session_manager_main()
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
vlib_main_t vlib_global_main
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
struct _session_manager_main session_manager_main_t
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
vlib_error_t error
Error code for buffers to be enqueued to error handler.
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_BUFFER_IS_TRACED
struct _application application_t
#define ELOG_TYPE_DECLARE(f)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
#define VLIB_NODE_FLAG_TRACE
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
transport_connection_t connection
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
application_t * application_get(u32 index)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define foreach_session_input_error
#define VLIB_REGISTER_NODE(x,...)
u16 flags
Copy of main node flags.
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static udp_uri_main_t * vnet_get_udp_main()
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
struct _unix_shared_memory_queue unix_shared_memory_queue_t