64030302c4b4da6f0e0185852f811ae9013d9043
[vpp.git] / src / vnet / tcp / builtin_client.h
1
2 /*
3  * tclient.h - skeleton vpp engine plug-in header file
4  *
5  * Copyright (c) <current-year> <your-organization>
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #ifndef __included_tclient_h__
19 #define __included_tclient_h__
20
21 #include <vnet/vnet.h>
22 #include <vnet/ip/ip.h>
23 #include <vnet/ethernet/ethernet.h>
24
25 #include <vppinfra/hash.h>
26 #include <vppinfra/error.h>
27 #include <vlibmemory/unix_shared_memory_queue.h>
28 #include <svm/svm_fifo_segment.h>
29 #include <vnet/session/session.h>
30 #include <vnet/session/application_interface.h>
31
32 typedef struct
33 {
34   u32 bytes_to_send;
35   u32 bytes_sent;
36   u32 bytes_to_receive;
37   u32 bytes_received;
38
39   svm_fifo_t *server_rx_fifo;
40   svm_fifo_t *server_tx_fifo;
41
42   u32 vpp_session_index;
43   u32 vpp_session_thread;
44 } session_t;
45
46 typedef struct
47 {
48   /* API message ID base */
49   u16 msg_id_base;
50
51   /* vpe input queue */
52   unix_shared_memory_queue_t *vl_input_queue;
53
54   /* API client handle */
55   u32 my_client_index;
56
57   /* The URI we're playing with */
58   u8 *uri;
59
60   /* Session pool */
61   session_t *sessions;
62
63   /* Hash table for disconnect processing */
64   uword *session_index_by_vpp_handles;
65
66   /* intermediate rx buffer */
67   u8 *rx_buf;
68
69   /* URI for slave's connect */
70   u8 *connect_uri;
71
72   u32 connected_session_index;
73
74   int i_am_master;
75
76   /* drop all packets */
77   int drop_packets;
78
79   /* Our event queue */
80   unix_shared_memory_queue_t *our_event_queue;
81
82   /* $$$ single thread only for the moment */
83   unix_shared_memory_queue_t *vpp_event_queue;
84
85   pid_t my_pid;
86
87   /* For deadman timers */
88   clib_time_t clib_time;
89
90   /* Connection counts */
91   u32 expected_connections;
92   volatile u32 ready_connections;
93
94   /* Signal variables */
95   volatile int run_test;
96
97   /* Number of iterations */
98   int n_iterations;
99
100   /* Bytes to send */
101   u32 bytes_to_send;
102
103   u32 configured_segment_size;
104
105   /* VNET_API_ERROR_FOO -> "Foo" hash table */
106   uword *error_string_by_error_number;
107
108   u8 *connect_test_data;
109   pthread_t client_thread_handle;
110   u32 client_bytes_received;
111   u8 test_return_packets;
112
113   /* convenience */
114   vlib_main_t *vlib_main;
115   vnet_main_t *vnet_main;
116   ethernet_main_t *ethernet_main;
117 } tclient_main_t;
118
119 tclient_main_t tclient_main;
120
121 vlib_node_registration_t tclient_node;
122
123 #endif /* __included_tclient_h__ */
124
125 /*
126  * fd.io coding-style-patch-verification: ON
127  *
128  * Local Variables:
129  * eval: (c-set-style "gnu")
130  * End:
131  */