#include "vine-utils.h"
typedef struct {
- vine_data_path_type_e type;
vine_address_family_e addr_family;
char *addr;
int port;
};
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)
{
}
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);
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");
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");
}
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};
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;