diff --git a/tunnels/adapters/connector/udp/udp_connector.c b/tunnels/adapters/connector/udp/udp_connector.c index 773776e..d180f58 100644 --- a/tunnels/adapters/connector/udp/udp_connector.c +++ b/tunnels/adapters/connector/udp/udp_connector.c @@ -203,6 +203,8 @@ tunnel_t *newUdpConnector(node_instance_context_t *instance_info) } if (state->dest_addr_selected.status == kDvsConstant) { + state->constant_dest_addr.address_type = getHostAddrType(state->dest_addr_selected.value_ptr); + if (state->constant_dest_addr.address_type == kSatDomainName) { socketContextDomainSetConstMem(&(state->constant_dest_addr), state->dest_addr_selected.value_ptr, diff --git a/ww/library_loader.c b/ww/library_loader.c index bffb79b..284c29e 100644 --- a/ww/library_loader.c +++ b/ww/library_loader.c @@ -4,6 +4,7 @@ #include "loggers/core_logger.h" //NOLINT #include "stc/common.h" #include "utils/hashutils.h" +#include "hplatform.h" #include #include @@ -17,6 +18,49 @@ static struct vec_static_libs slibs; } *state; + +// #ifdef OS_WIN +// #include // for Windows LoadLibrary/GetProcAddress +// #else +// #include // for POSIX dlopen/dlsym +// #endif + +// void *getSymbol(void *libHandle, const char *name) { +// #ifdef OS_WIN +// return GetProcAddress((HMODULE)libHandle, name); +// #else +// return dlsym(libHandle, name); +// #endif +// } + +// static tunnel_lib_t dynLoadTunnelLib(hash_t hname) { +// char libName[256]; +// snprintf(libName, sizeof(libName), "libname-%u.so", hname); // Example library name generation + +// void *handle = NULL; +// #ifdef OS_WIN +// handle = LoadLibrary(libName); +// #else +// handle = dlopen(libName, RTLD_LAZY); +// #endif + +// if (!handle) { +// LOGF("Failed to load library: %s", libName); +// return (tunnel_lib_t){0}; +// } + +// tunnel_lib_t lib = {0}; +// lib.createHandle = (struct tunnel_s *(*)(node_instance_context_t *))getSymbol(handle, "createHandle"); +// lib.destroyHandle = (struct tunnel_s *(*)(struct tunnel_s *))getSymbol(handle, "destroyHandle"); +// lib.apiHandle = (api_result_t (*)(struct tunnel_s *, const char *))getSymbol(handle, "apiHandle"); +// lib.getMetadataHandle = (tunnel_metadata_t (*)(void))getSymbol(handle, "getMetadataHandle"); +// lib.hash_name = hname; + +// return lib; +// } + + + static tunnel_lib_t dynLoadTunnelLib(hash_t hname) { (void) hname; @@ -39,13 +83,13 @@ tunnel_lib_t loadTunnelLibByHash(hash_t hname) } return dynLoadTunnelLib(hname); } + tunnel_lib_t loadTunnelLib(const char *name) { hash_t hname = CALC_HASH_BYTES(name, strlen(name)); return loadTunnelLibByHash(hname); } -// CHECKFOR(TcpListener); void registerStaticLib(tunnel_lib_t lib) { diff --git a/ww/managers/memory_manager.c b/ww/managers/memory_manager.c index 4a71ba3..91ca99c 100644 --- a/ww/managers/memory_manager.c +++ b/ww/managers/memory_manager.c @@ -22,19 +22,21 @@ enum #ifdef ALLOCATOR_BYPASS -dedicated_memory_t *initMemoryManager(void) -{ - return NULL; -} -dedicated_memory_t *getMemoryManager(void) +void initMemoryManager(void) { - return NULL; + // assert(state == NULL); + // state = createWWDedicatedMemory(); + // return state; } + void setMemoryManager(dedicated_memory_t *new_state) { (void) new_state; + + // assert(state == NULL); + // state = new_state; } dedicated_memory_t *createWWDedicatedMemory(void) diff --git a/ww/ww.c b/ww/ww.c index 1159c71..6fb92b8 100644 --- a/ww/ww.c +++ b/ww/ww.c @@ -135,12 +135,12 @@ static void initializeShortCuts(void) void **space = globalMalloc(sizeof(void *) * kShourtcutsCount * total_workers); - GSTATE.shortcut_loops = (hloop_t **) (space + (0 * sizeof(void *) * total_workers)); - GSTATE.shortcut_buffer_pools = (buffer_pool_t **) (space + (1 * sizeof(void *) * total_workers)); - GSTATE.shortcut_shift_buffer_pools = (generic_pool_t **) (space + (2 * sizeof(void *) * total_workers)); - GSTATE.shortcut_context_pools = (generic_pool_t **) (space + (3 * sizeof(void *) * total_workers)); - GSTATE.shortcut_line_pools = (generic_pool_t **) (space + (4 * sizeof(void *) * total_workers)); - GSTATE.shortcut_pipeline_msg_pools = (generic_pool_t **) (space + (5 * sizeof(void *) * total_workers)); + GSTATE.shortcut_loops = (hloop_t **) (space + (0 *total_workers)); + GSTATE.shortcut_buffer_pools = (buffer_pool_t **) (space + (1 * total_workers)); + GSTATE.shortcut_shift_buffer_pools = (generic_pool_t **) (space + (2 * total_workers)); + GSTATE.shortcut_context_pools = (generic_pool_t **) (space + (3 * total_workers)); + GSTATE.shortcut_line_pools = (generic_pool_t **) (space + (4 * total_workers)); + GSTATE.shortcut_pipeline_msg_pools = (generic_pool_t **) (space + (5 * total_workers)); } void createWW(const ww_construction_data_t init_data)