diff options
author | Jakub Grajciar <jgrajcia@cisco.com> | 2019-07-01 14:24:48 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-07-02 14:06:46 +0000 |
commit | 12df497bb6b7f60513f48c0dacca9ad99d717192 (patch) | |
tree | 71b219bc3a369a54fe119a65b1597c2d03337b86 /extras/libmemif/src/memif_private.h | |
parent | 312758f9af526d3d498219cf84e58887d6740687 (diff) |
libmemif: version 3.0
Add support for multi-thread connection establishment.
- control_fd_update() callback now passes private context
associated with updated file descriptor. File descriptor
can belong to memif socket, memif connection or timerfd.
In case of timerfd the context is NULL.
- memif_create_socket() new API. Creates memif socket
handle to be passed to memif_create() in memif_conn_args_t.
This API allows to pass private context whenever the file
descriptor is updated.
- memif_delete_socket() new API. Deletes memif socket.
Socket must not be in use by any interface.
Type: feature
Change-Id: I7ca4e4349595d4477195f1c32403d3e3a6eb5361
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras/libmemif/src/memif_private.h')
-rw-r--r-- | extras/libmemif/src/memif_private.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/extras/libmemif/src/memif_private.h b/extras/libmemif/src/memif_private.h index 64d5bb80c86..eceac677752 100644 --- a/extras/libmemif/src/memif_private.h +++ b/extras/libmemif/src/memif_private.h @@ -35,8 +35,7 @@ _Static_assert (strlen (MEMIF_DEFAULT_APP_NAME) <= MEMIF_NAME_LEN, "MEMIF_DEFAULT_APP_NAME max length is 32"); -#define MEMIF_DEFAULT_SOCKET_DIR "/run/vpp" -#define MEMIF_DEFAULT_SOCKET_FILENAME "memif.sock" +#define MEMIF_DEFAULT_SOCKET_PATH "/run/vpp/memif.sock" #define MEMIF_DEFAULT_RING_SIZE 1024 #define MEMIF_DEFAULT_LOG2_RING_SIZE 10 #define MEMIF_DEFAULT_RX_QUEUES 1 @@ -67,6 +66,13 @@ _Static_assert (strlen (MEMIF_DEFAULT_APP_NAME) <= MEMIF_NAME_LEN, #define DBG(...) #endif /* MEMIF_DBG */ +typedef enum +{ + MEMIF_SOCKET_TYPE_NONE = 0, /* unassigned, not used by any interface */ + MEMIF_SOCKET_TYPE_LISTENER, /* listener socket, master interface assigned */ + MEMIF_SOCKET_TYPE_CLIENT /* client socket, slave interface assigned */ +} memif_socket_type_t; + typedef struct { void *addr; @@ -121,7 +127,6 @@ typedef struct memif_connection memif_conn_run_args_t run_args; int fd; - int listener_fd; memif_fn *write_fn, *read_fn, *error_fn; @@ -158,8 +163,10 @@ typedef struct { int fd; uint16_t use_count; + memif_socket_type_t type; uint8_t *filename; uint16_t interface_list_len; + void *private_ctx; memif_list_elt_t *interface_list; /* memif master interfaces listening on this socket */ } memif_socket_t; @@ -171,6 +178,8 @@ typedef struct uint16_t disconn_slaves; uint8_t app_name[MEMIF_NAME_LEN]; + memif_socket_handle_t default_socket; + memif_add_external_region_t *add_external_region; memif_get_external_region_addr_t *get_external_region_addr; memif_del_external_region_t *del_external_region; @@ -182,11 +191,11 @@ typedef struct uint16_t control_list_len; uint16_t interrupt_list_len; - uint16_t listener_list_len; + uint16_t socket_list_len; uint16_t pending_list_len; memif_list_elt_t *control_list; memif_list_elt_t *interrupt_list; - memif_list_elt_t *listener_list; + memif_list_elt_t *socket_list; memif_list_elt_t *pending_list; } libmemif_main_t; |