From 33d423413e853b3a52a475cf356ccbd96bbf2aa7 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Wed, 12 May 2021 11:33:54 +0900 Subject: [PATCH] Remove ununsed enum(vine_data_path_type_e) Change-Id: I2601a01927c826650a94fcd4ed407342e39db6e1 --- src/include/vine-data-path.h | 6 ------ src/vine-data-path.cpp | 31 +++++++++++++------------------ 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/include/vine-data-path.h b/src/include/vine-data-path.h index a38687a..0cd2c97 100755 --- a/src/include/vine-data-path.h +++ b/src/include/vine-data-path.h @@ -23,12 +23,6 @@ typedef void *vine_data_path_h; -typedef enum { - VINE_DATA_PATH_TYPE_SERVER = 0, - VINE_DATA_PATH_TYPE_CLIENT, - VINE_DATA_PATH_TYPE_UNKNOWN -} vine_data_path_type_e; - typedef void (*vine_data_path_received_cb)(vine_data_path_h datapath, size_t received_len, void *user_data); typedef void (*vine_data_path_opened_cb)(vine_data_path_h datapath, diff --git a/src/vine-data-path.cpp b/src/vine-data-path.cpp index 64d6284..e95de52 100755 --- a/src/vine-data-path.cpp +++ b/src/vine-data-path.cpp @@ -26,7 +26,6 @@ #include "vine-utils.h" typedef struct { - vine_data_path_type_e type; vine_address_family_e addr_family; char *addr; int port; @@ -93,10 +92,9 @@ static vine_dp_plugin_callbacks g_dp_plugin_cbs = { }; static void (*__init_plugin)(vine_dp_plugin_fn *fn); -static vine_data_path_s *_vine_data_path_create(vine_data_path_type_e type, - vine_security_h security, - vine_address_family_e addr_family, const char *addr, - int port, void *plugin_data, vine_event_queue_h event_fd); +static vine_data_path_s *_vine_data_path_create(vine_address_family_e addr_family, + const char *addr, int port, vine_security_h security, + void *plugin_data, vine_event_queue_h event_fd); static vine_error_e __convert_data_path_error_to_vine_error(vine_data_path_error error) { @@ -266,14 +264,15 @@ static vine_address_family_e __convert_addr_family(vine_dp_addr_family_e addr_fa } return VINE_ADDRESS_FAMILY_DEFAULT; } + static void __accepted_cb(vine_dp_addr_family_e addr_family, char *addr, int port, void *plugin_data, void *user_data) { RET_IF(user_data == NULL, "listen_dp is NULL"); vine_data_path_s *listen_dp = (vine_data_path_s *)user_data; - vine_data_path_s *connected_dp = _vine_data_path_create(VINE_DATA_PATH_TYPE_SERVER, - listen_dp->security, __convert_addr_family(addr_family), addr, port, plugin_data, listen_dp->event_fd); + vine_data_path_s *connected_dp = _vine_data_path_create(__convert_addr_family(addr_family), + addr, port, listen_dp->security, plugin_data, listen_dp->event_fd); RET_IF(connected_dp == NULL, "Out of memory"); VINE_LOGD("Accepted dp[%p] addr[%s] port[%d] listen_dp[%p]", connected_dp, addr, port, user_data); @@ -468,11 +467,9 @@ int vine_data_path_close(vine_data_path_h datapath) return VINE_ERROR_NONE; } -// This function will be called when publish session is started -// or request to connect to a service. -static vine_data_path_s *_vine_data_path_create(vine_data_path_type_e type, - vine_security_h security, vine_address_family_e addr_family, - const char *addr, int port, void *plugin_data, vine_event_queue_h event_fd) +static vine_data_path_s *_vine_data_path_create(vine_address_family_e addr_family, + const char *addr, int port, vine_security_h security, + void *plugin_data, vine_event_queue_h event_fd) { RET_VAL_IF(addr == NULL, NULL, "addr is NULL"); @@ -482,9 +479,7 @@ static vine_data_path_s *_vine_data_path_create(vine_data_path_type_e type, dp = (vine_data_path_s *)calloc(1, sizeof(vine_data_path_s)); RET_VAL_IF(dp == NULL, NULL, "Out of memory"); - dp->type = type; dp->addr_family = addr_family; - dp->addr = STRDUP(addr); if (dp->addr == NULL) { VINE_LOGE("Out of memory"); @@ -681,8 +676,7 @@ int vine_data_path_open(vine_address_family_e addr_family, int port, const char } vine_data_path_s *dp = - _vine_data_path_create(VINE_DATA_PATH_TYPE_SERVER, security, - addr_family, "", port, NULL, event_fd); + _vine_data_path_create(addr_family, "", port, security, NULL, event_fd); RET_VAL_IF(dp == NULL, VINE_ERROR_OUT_OF_MEMORY, "Out of memory"); vine_dp_ssl ssl = {false, VINE_DP_TLS_VERSION_DEFAULT, 0, NULL, NULL, NULL}; @@ -717,9 +711,10 @@ int vine_data_path_connect(vine_address_family_e addr_family, vine_data_path_h *connected_datapath, vine_event_queue_h event_fd) { vine_data_path_s *dp = - _vine_data_path_create(VINE_DATA_PATH_TYPE_CLIENT, security, addr_family, ip, port, NULL, event_fd); + _vine_data_path_create(addr_family, ip, port, security, NULL, event_fd); RET_VAL_IF(dp == NULL, VINE_ERROR_OUT_OF_MEMORY, "Out of memory"); - RET_VAL_IF(connected_datapath == NULL, VINE_ERROR_INVALID_PARAMETER, "connected_datapath is NULL"); + RET_VAL_IF(connected_datapath == NULL, + VINE_ERROR_INVALID_PARAMETER, "connected_datapath is NULL"); dp->connected_cb = callback; dp->connected_cb_data = user_data; -- 2.7.4