/*
- * ip/udp.h: udp protocol
- *
- * Copyright (c) 2013 Cisco and/or its affiliates.
+ * Copyright (c) 2017 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#ifndef included_udp_h
-#define included_udp_h
+#ifndef __included_udp_h__
+#define __included_udp_h__
#include <vnet/vnet.h>
-#include <vnet/ip/udp_packet.h>
+#include <vnet/udp/udp_packet.h>
#include <vnet/ip/ip.h>
#include <vnet/ip/ip4.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/pg/pg.h>
#include <vnet/ip/format.h>
+#include <vnet/ip/ip.h>
+#include <vnet/session/transport.h>
+
+typedef struct
+{
+ transport_connection_t connection; /** must be first */
+
+ /** ersatz MTU to limit fifo pushes to test data size */
+ u32 mtu;
+} udp_connection_t;
+
+typedef struct _udp_uri_main
+{
+ /* Per-worker thread udp connection pools */
+ udp_connection_t **udp_sessions;
+ udp_connection_t *udp_listeners;
+
+ /* convenience */
+ vlib_main_t *vlib_main;
+ vnet_main_t *vnet_main;
+ ip4_main_t *ip4_main;
+ ip6_main_t *ip6_main;
+} udp_uri_main_t;
+
+extern udp_uri_main_t udp_uri_main;
+extern vlib_node_registration_t udp4_uri_input_node;
+
+always_inline udp_uri_main_t *
+vnet_get_udp_main ()
+{
+ return &udp_uri_main;
+}
+
+always_inline udp_connection_t *
+udp_connection_get (u32 conn_index, u32 thread_index)
+{
+ return pool_elt_at_index (udp_uri_main.udp_sessions[thread_index],
+ conn_index);
+}
+
+always_inline udp_connection_t *
+udp_listener_get (u32 conn_index)
+{
+ return pool_elt_at_index (udp_uri_main.udp_listeners, conn_index);
+}
+
typedef enum
{
#define udp_error(n,s) UDP_ERROR_##n,
-#include <vnet/ip/udp_error.def>
+#include <vnet/udp/udp_error.def>
#undef udp_error
UDP_N_ERROR,
} udp_error_t;
udp_dst_port_t dst_port,
u32 node_index, u8 is_ip4);
+void
+udp_unregister_dst_port (vlib_main_t * vm,
+ udp_dst_port_t dst_port, u8 is_ip4);
+
void udp_punt_unknown (vlib_main_t * vm, u8 is_ip4, u8 is_add);
always_inline void
}
}
-#endif /* included_udp_h */
-
/*
* fd.io coding-style-patch-verification: ON
*
* eval: (c-set-style "gnu")
* End:
*/
+
+#endif /* __included_udp_h__ */