app/testpmd: use existing checksum API in flowgen engine
[dpdk.git] / examples / pipeline / conn.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4
5 #ifndef __INCLUDE_CONN_H__
6 #define __INCLUDE_CONN_H__
7
8 #include <stdint.h>
9
10 struct conn;
11
12 #ifndef CONN_WELCOME_LEN_MAX
13 #define CONN_WELCOME_LEN_MAX                               1024
14 #endif
15
16 #ifndef CONN_PROMPT_LEN_MAX
17 #define CONN_PROMPT_LEN_MAX                                16
18 #endif
19
20 typedef void
21 (*conn_msg_handle_t)(char *msg_in,
22                      char *msg_out,
23                      size_t msg_out_len_max,
24                      void *arg);
25
26 struct conn_params {
27         const char *welcome;
28         const char *prompt;
29         const char *addr;
30         uint16_t port;
31         size_t buf_size;
32         size_t msg_in_len_max;
33         size_t msg_out_len_max;
34         conn_msg_handle_t msg_handle;
35         void *msg_handle_arg;
36 };
37
38 struct conn *
39 conn_init(struct conn_params *p);
40
41 void
42 conn_free(struct conn *conn);
43
44 int
45 conn_poll_for_conn(struct conn *conn);
46
47 int
48 conn_poll_for_msg(struct conn *conn);
49
50 #endif