NAT44: fix ICMP error translation for endpoint dependent sessions (VPP-1150)
[vpp.git] / src / vnet / sctp / builtin_client.h
1 /*
2  * Copyright (c) 2018 SUSE LLC.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_tclient_h__
16 #define __included_tclient_h__
17
18 #include <vnet/vnet.h>
19 #include <vnet/ip/ip.h>
20 #include <vnet/ethernet/ethernet.h>
21
22 #include <vppinfra/hash.h>
23 #include <vppinfra/error.h>
24 #include <svm/queue.h>
25 #include <svm/svm_fifo_segment.h>
26 #include <vnet/session/session.h>
27 #include <vnet/session/application_interface.h>
28
29 typedef struct
30 {
31   u64 bytes_to_send;
32   u64 bytes_sent;
33   u64 bytes_to_receive;
34   u64 bytes_received;
35
36   svm_fifo_t *server_rx_fifo;
37   svm_fifo_t *server_tx_fifo;
38
39   u64 vpp_session_handle;
40 } session_t;
41
42 typedef struct
43 {
44   /*
45    * Application setup parameters
46    */
47   svm_queue_t *vl_input_queue;          /**< vpe input queue */
48   svm_queue_t **vpp_event_queue;
49
50   u32 cli_node_index;                   /**< cli process node index */
51   u32 my_client_index;                  /**< loopback API client handle */
52   u32 app_index;                        /**< app index after attach */
53
54   /*
55    * Configuration params
56    */
57   u8 *connect_uri;                      /**< URI for slave's connect */
58   u64 bytes_to_send;                    /**< Bytes to send */
59   u32 configured_segment_size;
60   u32 fifo_size;
61   u32 expected_connections;             /**< Number of clients/connections */
62   u32 connections_per_batch;            /**< Connections to rx/tx at once */
63   u32 private_segment_count;            /**< Number of private fifo segs */
64   u32 private_segment_size;             /**< size of private fifo segs */
65
66   /*
67    * Test state variables
68    */
69   session_t *sessions;                  /**< Session pool, shared */
70   clib_spinlock_t sessions_lock;
71   u8 **rx_buf;                          /**< intermediate rx buffers */
72   u8 *connect_test_data;                /**< Pre-computed test data */
73   u32 **connection_index_by_thread;
74   u32 **connections_this_batch_by_thread; /**< active connection batch */
75   pthread_t client_thread_handle;
76
77   volatile u32 ready_connections;
78   volatile u32 finished_connections;
79   volatile u64 rx_total;
80   volatile u64 tx_total;
81   volatile int run_test;                /**< Signal start of test */
82
83   f64 test_start_time;
84   f64 test_end_time;
85   u32 prev_conns;
86   u32 repeats;
87   /*
88    * Flags
89    */
90   u8 is_init;
91   u8 test_client_attached;
92   u8 no_return;
93   u8 test_return_packets;
94   int i_am_master;
95   int drop_packets;             /**< drop all packets */
96   u8 prealloc_fifos;            /**< Request fifo preallocation */
97   u8 no_output;
98   u8 test_bytes;
99   u8 test_failed;
100
101   /*
102    * Convenience
103    */
104   vlib_main_t *vlib_main;
105   vnet_main_t *vnet_main;
106   ethernet_main_t *ethernet_main;
107 } tclient_main_t;
108
109 extern tclient_main_t tclient_main;
110
111 vlib_node_registration_t tclient_node;
112
113 #endif /* __included_tclient_h__ */
114
115 /*
116  * fd.io coding-style-patch-verification: ON
117  *
118  * Local Variables:
119  * eval: (c-set-style "gnu")
120  * End:
121  */