blob: d5d79e53a22e88b68bd0b4b052652d254b3e4d47 [file] [log] [blame]
Florin Coras6792ec02017-03-13 03:49:51 -07001
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
32typedef struct
33{
Dave Barach0194f1a2017-05-15 10:11:39 -040034 u64 bytes_to_send;
35 u64 bytes_sent;
36 u64 bytes_to_receive;
37 u64 bytes_received;
Florin Coras6792ec02017-03-13 03:49:51 -070038
39 svm_fifo_t *server_rx_fifo;
40 svm_fifo_t *server_tx_fifo;
41
Florin Coras6cf30ad2017-04-04 23:08:23 -070042 u64 vpp_session_handle;
Florin Coras6792ec02017-03-13 03:49:51 -070043} session_t;
44
45typedef struct
46{
47 /* API message ID base */
48 u16 msg_id_base;
49
50 /* vpe input queue */
51 unix_shared_memory_queue_t *vl_input_queue;
52
53 /* API client handle */
54 u32 my_client_index;
55
56 /* The URI we're playing with */
57 u8 *uri;
58
59 /* Session pool */
60 session_t *sessions;
61
62 /* Hash table for disconnect processing */
63 uword *session_index_by_vpp_handles;
64
65 /* intermediate rx buffer */
66 u8 *rx_buf;
67
68 /* URI for slave's connect */
69 u8 *connect_uri;
70
71 u32 connected_session_index;
72
73 int i_am_master;
74
75 /* drop all packets */
76 int drop_packets;
77
78 /* Our event queue */
79 unix_shared_memory_queue_t *our_event_queue;
80
81 /* $$$ single thread only for the moment */
82 unix_shared_memory_queue_t *vpp_event_queue;
83
84 pid_t my_pid;
85
Dave Barach10d8cc62017-05-30 09:30:07 -040086 f64 test_start_time;
87 f64 test_end_time;
Florin Coras6792ec02017-03-13 03:49:51 -070088
Florin Coras6792ec02017-03-13 03:49:51 -070089 u32 expected_connections;
Dave Barach10d8cc62017-05-30 09:30:07 -040090 u32 **connection_index_by_thread;
Florin Coras6792ec02017-03-13 03:49:51 -070091 volatile u32 ready_connections;
Dave Barach10d8cc62017-05-30 09:30:07 -040092 volatile u32 finished_connections;
Florin Coras6792ec02017-03-13 03:49:51 -070093
Dave Barach10d8cc62017-05-30 09:30:07 -040094 volatile u64 rx_total;
95 u32 cli_node_index;
96
97 /* Signal variable */
Florin Coras6792ec02017-03-13 03:49:51 -070098 volatile int run_test;
99
Florin Coras6792ec02017-03-13 03:49:51 -0700100 /* Bytes to send */
Dave Barach0194f1a2017-05-15 10:11:39 -0400101 u64 bytes_to_send;
Florin Coras6792ec02017-03-13 03:49:51 -0700102
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;
Dave Barach0194f1a2017-05-15 10:11:39 -0400110 u64 client_bytes_received;
Florin Coras6792ec02017-03-13 03:49:51 -0700111 u8 test_return_packets;
112
Florin Coras6cf30ad2017-04-04 23:08:23 -0700113 u8 is_init;
Dave Barach10d8cc62017-05-30 09:30:07 -0400114 u8 test_client_attached;
Florin Coras6cf30ad2017-04-04 23:08:23 -0700115
116 u32 node_index;
117
Florin Coras6792ec02017-03-13 03:49:51 -0700118 /* convenience */
119 vlib_main_t *vlib_main;
120 vnet_main_t *vnet_main;
121 ethernet_main_t *ethernet_main;
122} tclient_main_t;
123
124tclient_main_t tclient_main;
125
126vlib_node_registration_t tclient_node;
127
128#endif /* __included_tclient_h__ */
129
130/*
131 * fd.io coding-style-patch-verification: ON
132 *
133 * Local Variables:
134 * eval: (c-set-style "gnu")
135 * End:
136 */