CNDP  22.08.0
csock_private.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2020-2022 Intel Corporation
3  */
4 
5 #include <stdint.h>
6 #include <sys/types.h>
7 #include <sys/socket.h>
8 #include <netinet/in.h>
9 
19 #ifndef _CSOCK_PRIVATE_H_
20 #define _CSOCK_PRIVATE_H_
21 
22 #include "csock.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
29 #define CSOCK_USE_STDIO "{stdio}"
30 
31 typedef struct c_sock {
32  int fd;
33  int running;
34  uint32_t flags;
35  char host_name[CSOCK_MAX_HOST_NAME_LENGTH];
36  char sock_addr[CSOCK_MAX_SOCK_INFO_LENGTH];
37  union {
38  struct sockaddr sa;
39  struct sockaddr_un un;
40  } addr;
41  struct sockaddr peer;
42  size_t addr_len;
43  int port;
44  csock_client_fn_t *client_fn;
45  csock_read_t *read_fn;
46  csock_write_t *write_fn;
47  csock_close_t *close_fn;
48 } c_sock_t;
49 
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #endif /* _CSOCK_PRIVATE_H_ */
int() csock_close_t(csock_t *c)
Definition: csock.h:73
@ CSOCK_MAX_SOCK_INFO_LENGTH
Definition: csock.h:36
@ CSOCK_MAX_HOST_NAME_LENGTH
Definition: csock.h:35
ssize_t() csock_write_t(csock_t *c, char *data, size_t len)
Definition: csock.h:63
void *() csock_client_fn_t(csock_t *c)
Definition: csock.h:58
ssize_t() csock_read_t(csock_t *c, char *data, size_t len)
Definition: csock.h:68