FD.io VPP  v16.06
Vector Packet Processing
api.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * api.h
4  *
5  * Copyright (c) 2009 Cisco and/or its affiliates.
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  */
19 
20 #ifndef included_vlibsocket_api_h
21 #define included_vlibsocket_api_h
22 
23 #include <vlibapi/api.h>
24 
25 typedef struct {
26  /* Server port number */
27  int portno;
28 
29  /* By default, localhost... */
31 
32  /*
33  * (listen, server, client) registrations. Shared memory
34  * registrations are in shared memory
35  */
37  /*
38  * Chain-drag variables, so message API handlers
39  * (generally) don't know whether they're talking to a socket
40  * or to a shared-memory connection.
41  */
44  /* One input buffer, shared across all sockets */
47 
49 
50 void socksvr_add_pending_output (struct unix_file * uf,
51  struct vl_api_registration_ * cf,
52  u8 * buffer, uword buffer_bytes);
53 
54 #define SOCKSVR_DEFAULT_PORT 32741 /* whatever */
55 
56 void vl_free_socket_registration_index (u32 pool_index);
57 void vl_socket_process_msg (struct unix_file *uf,
58  struct vl_api_registration_ *rp, i8 *input_v);
60 void vl_socket_add_pending_output (struct unix_file * uf,
61  struct vl_api_registration_ * rp,
62  u8 * buffer,
63  uword buffer_bytes);
67  u8 *elem, u8 *data_vector);
69  u8 *elem, u32 msg_length);
71  u8 *elem, u32 msg_length);
72 u32 sockclnt_open_index (char *client_name, char *hostname, int port);
73 void sockclnt_close_index (u32 index);
76 void socksvr_set_port (u16 port);
77 void socksvr_set_bind_address (u32 bind_address);
78 
79 #endif /* included_vlibsocket_api_h */
void vl_socket_process_msg(struct unix_file *uf, struct vl_api_registration_ *rp, i8 *input_v)
void vl_socket_api_send(vl_api_registration_t *rp, u8 *elem)
Definition: memory_vlib.c:82
void socksvr_set_port(u16 port)
Definition: socksvr_vlib.c:629
vl_api_registration_t * registration_pool
Definition: api.h:36
vl_api_registration_t * current_rp
Definition: api.h:42
clib_error_t * vl_socket_read_ready(struct unix_file *uf)
Definition: socksvr_vlib.c:234
socket_main_t socket_main
Definition: api.h:48
void vl_socket_api_send_with_length(vl_api_registration_t *rp, u8 *elem, u32 msg_length)
Definition: socksvr_vlib.c:194
char i8
Definition: types.h:45
void vl_socket_api_send_with_data(vl_api_registration_t *rp, u8 *elem, u8 *data_vector)
Definition: socksvr_vlib.c:112
void socksvr_add_pending_output(struct unix_file *uf, struct vl_api_registration_ *cf, u8 *buffer, uword buffer_bytes)
void sockclnt_close_index(u32 index)
u32 bind_address
Definition: api.h:30
unix_file_t * current_uf
Definition: api.h:43
int portno
Definition: api.h:27
unsigned int u32
Definition: types.h:88
u32 sockclnt_open_index(char *client_name, char *hostname, int port)
Definition: sockclnt_vlib.c:71
void vl_free_socket_registration_index(u32 pool_index)
Definition: socksvr_vlib.c:206
clib_error_t * vl_socket_write_ready(struct unix_file *uf)
Definition: socksvr_vlib.c:363
u64 uword
Definition: types.h:112
unsigned short u16
Definition: types.h:57
void vl_socket_add_pending_output(struct unix_file *uf, struct vl_api_registration_ *rp, u8 *buffer, uword buffer_bytes)
Definition: socksvr_vlib.c:329
unsigned char u8
Definition: types.h:56
Definition: unix.h:49
i8 * input_buffer
Definition: api.h:45
vl_api_registration_t * sockclnt_get_registration(u32 index)
void vl_client_msg_api_send(vl_api_registration_t *cm, u8 *elem)
void socksvr_set_bind_address(u32 bind_address)
Definition: socksvr_vlib.c:635
void vl_socket_api_send_with_length_no_free(vl_api_registration_t *rp, u8 *elem, u32 msg_length)
Definition: socksvr_vlib.c:200