summaryrefslogtreecommitdiffstats
path: root/extras/libmemif/src/socket.h
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2021-01-04 11:10:42 +0100
committerDamjan Marion <dmarion@me.com>2021-09-27 14:35:45 +0000
commit134f1e02251b27ad73c3ff4591954c2e0919c984 (patch)
tree30e84c2bea30ad760a6629a7b1d5843bdd7f8a7c /extras/libmemif/src/socket.h
parent45cf1fc3f58ee465d2e7e4689158e79fd706658e (diff)
libmemif: refactor connection establishment
per_thread_ namespace fuctionality replaced by memif socket. Interfaces are grouped by memif socket which holds interface database. Each thread can create it's unique memif socket. The path name can be equal across threads so that the app only uses one UNIX socket. In case of listener socket, listener fd can be obtained and set using APIs. This change allows: - No lookup on file descriptor events - improves interrupt handling - Loopback support (connect two interfaces in one app) - usefull for debugging and testing - Improves code readability by providing control channel abstraction for each interface and listener sockets Type: refactor Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I1b8261042431c0376646ab4c4c831f6e59dd3eed
Diffstat (limited to 'extras/libmemif/src/socket.h')
-rw-r--r--extras/libmemif/src/socket.h56
1 files changed, 4 insertions, 52 deletions
diff --git a/extras/libmemif/src/socket.h b/extras/libmemif/src/socket.h
index ea6979d6bd5..0c1a848a677 100644
--- a/extras/libmemif/src/socket.h
+++ b/extras/libmemif/src/socket.h
@@ -31,59 +31,11 @@
/* socket.c */
-int memif_conn_fd_read_ready (memif_connection_t * c);
+int memif_listener_handler (memif_fd_event_type_t type, void *private_ctx);
-int memif_conn_fd_write_ready (memif_connection_t * c);
+int memif_control_channel_handler (memif_fd_event_type_t type,
+ void *private_ctx);
-int memif_conn_fd_error (memif_connection_t * c);
-
-int memif_conn_fd_accept_ready (memif_socket_t * ms);
-
-int memif_read_ready (libmemif_main_t *lm, int fd);
-
-int memif_msg_send_disconnect (int fd, uint8_t * err_string,
- uint32_t err_code);
-
-/* when compiling unit tests, compile functions without static keyword
- and declare functions in header file */
-#ifdef MEMIF_UNIT_TEST
-#define static_fn
-
-int memif_msg_send (int fd, memif_msg_t * msg, int afd);
-
-int memif_msg_enq_ack (memif_connection_t * c);
-
-int memif_msg_send_hello (libmemif_main_t *lm, int fd);
-
-int memif_msg_enq_init (memif_connection_t * c);
-
-int memif_msg_enq_add_region (memif_connection_t * c, uint8_t region);
-
-int memif_msg_enq_add_ring (memif_connection_t * c, uint8_t index,
- uint8_t dir);
-
-int memif_msg_receive_hello (memif_connection_t * c, memif_msg_t * msg);
-
-int memif_msg_receive_init (memif_socket_t * ms, int fd, memif_msg_t * msg);
-
-int memif_msg_receive_add_region (memif_connection_t * c, memif_msg_t * msg,
- int fd);
-
-int memif_msg_receive_add_ring (memif_connection_t * c, memif_msg_t * msg,
- int fd);
-
-int memif_msg_enq_connect (memif_connection_t * c);
-
-int memif_msg_enq_connected (memif_connection_t * c);
-
-int memif_msg_receive_connect (memif_connection_t * c, memif_msg_t * msg);
-
-int memif_msg_receive_connected (memif_connection_t * c, memif_msg_t * msg);
-
-int memif_msg_receive_disconnect (memif_connection_t * c, memif_msg_t * msg);
-
-#else
-#define static_fn static
-#endif /* MEMIF_UNIT_TEST */
+void memif_delete_control_channel (memif_control_channel_t *cc);
#endif /* _SOCKET_H_ */