FD.io VPP
v18.07.1-19-g511ce25
Vector Packet Processing
Main Page
Related Pages
Modules
Namespaces
Data Structures
Source
Files
Symbols
socket_api.h
Go to the documentation of this file.
1
/*
2
*------------------------------------------------------------------
3
* Copyright (c) 2018 Cisco and/or its affiliates.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at:
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*------------------------------------------------------------------
16
*/
17
18
#ifndef SRC_VLIBMEMORY_SOCKET_API_H_
19
#define SRC_VLIBMEMORY_SOCKET_API_H_
20
21
#include <
vlibapi/api_common.h
>
22
#include <
svm/ssvm.h
>
23
#include <
vppinfra/file.h
>
24
25
#define API_SOCKET_FILE "/run/vpp-api.sock"
26
27
typedef
struct
28
{
29
clib_file_t
*
clib_file
;
30
vl_api_registration_t
*
regp
;
31
u8
*
data
;
32
}
vl_socket_args_for_process_t
;
33
34
typedef
struct
35
{
36
/* Server port number */
37
u8
*
socket_name
;
38
39
/* By default, localhost... */
40
u32
bind_address
;
41
42
/*
43
* (listen, server, client) registrations. Shared memory
44
* registrations are in shared memory
45
*/
46
vl_api_registration_t
*
registration_pool
;
47
/*
48
* Chain-drag variables, so message API handlers
49
* (generally) don't know whether they're talking to a socket
50
* or to a shared-memory connection.
51
*/
52
vl_api_registration_t
*
current_rp
;
53
clib_file_t
*
current_uf
;
54
/* One input buffer, shared across all sockets */
55
i8
*
input_buffer
;
56
57
/* pool of process args for socket clients */
58
vl_socket_args_for_process_t
*
process_args
;
59
60
/* Listen for API connections here */
61
clib_socket_t
socksvr_listen_socket
;
62
}
socket_main_t
;
63
64
extern
socket_main_t
socket_main
;
65
66
void
vl_socket_free_registration_index
(
u32
pool_index);
67
clib_error_t
*
vl_socket_read_ready
(
struct
clib_file
*uf);
68
void
vl_socket_add_pending_output
(
struct
clib_file
*uf,
69
struct
vl_api_registration_
*rp,
70
u8
* buffer,
uword
buffer_bytes);
71
void
vl_socket_add_pending_output_no_flush
(
struct
clib_file
*uf,
72
struct
vl_api_registration_
*rp,
73
u8
* buffer,
uword
buffer_bytes);
74
clib_error_t
*
vl_socket_write_ready
(
struct
clib_file
*uf);
75
void
vl_socket_api_send
(
vl_api_registration_t
* rp,
u8
* elem);
76
void
vl_socket_process_api_msg
(
clib_file_t
* uf,
vl_api_registration_t
* rp,
77
i8
* input_v);
78
void
vl_sock_api_dump_clients
(
vlib_main_t
*
vm
,
api_main_t
* am);
79
clib_error_t
*
vl_sock_api_init
(
vlib_main_t
*
vm
);
80
clib_error_t
*
vl_sock_api_send_fd_msg
(
int
socket_fd,
int
fd_to_share);
81
clib_error_t
*
vl_sock_api_recv_fd_msg
(
int
socket_fd,
int
*fd_to_share,
82
u32
wait);
83
84
#endif
/* SRC_VLIBMEMORY_SOCKET_API_H_ */
85
86
/*
87
* fd.io coding-style-patch-verification: ON
88
*
89
* Local Variables:
90
* eval: (c-set-style "gnu")
91
* End:
92
*/
vl_sock_api_recv_fd_msg
clib_error_t * vl_sock_api_recv_fd_msg(int socket_fd, int *fd_to_share, u32 wait)
Definition:
socket_client.c:180
vl_socket_args_for_process_t::regp
vl_api_registration_t * regp
Definition:
socket_api.h:30
vl_socket_free_registration_index
void vl_socket_free_registration_index(u32 pool_index)
Definition:
socket_api.c:120
socket_main_t::registration_pool
vl_api_registration_t * registration_pool
Definition:
socket_api.h:46
vl_socket_process_api_msg
void vl_socket_process_api_msg(clib_file_t *uf, vl_api_registration_t *rp, i8 *input_v)
Definition:
socket_api.c:144
vl_sock_api_dump_clients
void vl_sock_api_dump_clients(vlib_main_t *vm, api_main_t *am)
Definition:
socket_api.c:51
vl_socket_read_ready
clib_error_t * vl_socket_read_ready(struct clib_file *uf)
Definition:
socket_api.c:158
socket_main_t::process_args
vl_socket_args_for_process_t * process_args
Definition:
socket_api.h:58
socket_main_t::current_uf
clib_file_t * current_uf
Definition:
socket_api.h:53
vl_socket_args_for_process_t::clib_file
clib_file_t * clib_file
Definition:
socket_api.h:29
u8
unsigned char u8
Definition:
types.h:56
file.h
socket_main_t::input_buffer
i8 * input_buffer
Definition:
socket_api.h:55
vl_socket_args_for_process_t::data
u8 * data
Definition:
socket_api.h:31
u32
unsigned int u32
Definition:
types.h:88
socket_main_t::socket_name
u8 * socket_name
Definition:
socket_api.h:37
socket_main_t::bind_address
u32 bind_address
Definition:
socket_api.h:40
vl_socket_write_ready
clib_error_t * vl_socket_write_ready(struct clib_file *uf)
Definition:
socket_api.c:311
vl_socket_add_pending_output
void vl_socket_add_pending_output(struct clib_file *uf, struct vl_api_registration_ *rp, u8 *buffer, uword buffer_bytes)
Definition:
socket_api.c:270
i8
signed char i8
Definition:
types.h:45
ssvm.h
api_main_t
API main structure, used by both vpp and binary API clients.
Definition:
api_common.h:201
vl_socket_args_for_process_t
Definition:
socket_api.h:27
vl_api_registration_
An API client registration, only in vpp/vlib.
Definition:
api_common.h:44
vm
vlib_main_t * vm
Definition:
buffer.c:294
socket_main_t::socksvr_listen_socket
clib_socket_t socksvr_listen_socket
Definition:
socket_api.h:61
vl_sock_api_send_fd_msg
clib_error_t * vl_sock_api_send_fd_msg(int socket_fd, int fd_to_share)
Definition:
socket_api.c:452
socket_main_t
Definition:
socket_api.h:34
vl_socket_add_pending_output_no_flush
void vl_socket_add_pending_output_no_flush(struct clib_file *uf, struct vl_api_registration_ *rp, u8 *buffer, uword buffer_bytes)
Definition:
socket_api.c:287
clib_socket_t
struct _socket_t clib_socket_t
socket_main_t::current_rp
vl_api_registration_t * current_rp
Definition:
socket_api.h:52
socket_main
socket_main_t socket_main
Definition:
socket_api.c:48
clib_error_t
Definition:
clib_error.h:21
vlib_main_t
Definition:
main.h:59
uword
u64 uword
Definition:
types.h:112
api_common.h
clib_file
Definition:
file.h:51
vl_socket_api_send
void vl_socket_api_send(vl_api_registration_t *rp, u8 *elem)
Definition:
socket_api.c:78
vl_sock_api_init
clib_error_t * vl_sock_api_init(vlib_main_t *vm)
Definition:
socket_api.c:641
src
vlibmemory
socket_api.h
Generated on Fri May 24 2019 10:25:48 for FD.io VPP by
1.8.11