#ifndef _c_libshm_queue_so_go_wrapper_h_ #define _c_libshm_queue_so_go_wrapper_h_ #ifdef __cplusplus extern "C"{ #endif #include "libcbhomebus_func.h" #include // shm manipulate static tfn_shm_init fn_shm_init = NULL; static tfn_shm_alloc_key fn_shm_alloc_key = NULL; static tfn_shm_start_resycle fn_shm_start_recycle = NULL; static tfn_shm_destroy fn_shm_destroy = NULL; static tfn_shm_remove_keys fn_shm_remove_keys = NULL; static tfn_shm_remove_keys_exclude fn_shm_remove_keys_exclude = NULL; // net mode socket static tfn_net_mod_socket_open fn_socket_open = NULL; static tfn_net_mod_socket_close fn_socket_close = NULL; static tfn_net_mod_socket_bind fn_socket_bind = NULL; static tfn_net_mod_socket_force_bind fn_socket_force_bind = NULL; static tfn_net_mod_socket_sendto fn_socket_sendto = NULL; static tfn_net_mod_socket_sendto_timeout fn_socket_sendto_timeout = NULL; static tfn_net_mod_socket_sendto_nowait fn_socket_sendto_nowait = NULL; static tfn_net_mod_socket_recvfrom fn_socket_recvfrom = NULL; static tfn_net_mod_socket_recvfrom_timeout fn_socket_recvfrom_timeout = NULL; static tfn_net_mod_socket_recvfrom_nowait fn_socket_recvfrom_nowait = NULL; static tfn_net_mod_socket_sendandrecv fn_socket_sendandrecv = NULL; static tfn_net_mod_socket_sendandrecv_timeout fn_socket_sendandrecv_timeout = NULL; static tfn_net_mod_socket_sendandrecv_nowait fn_socket_sendandrecv_nowait = NULL; // add recvandsend funcs static tfn_net_mod_socket_recvandsend fn_socket_recvandsend = NULL; static tfn_net_mod_socket_recvandsend_timeout fn_socket_recvandsend_timeout = NULL; static tfn_net_mod_socket_recvandsend_nowait fn_socket_recvandsend_nowait = NULL; //static tfn_net_mod_socket_start_bus fn_socket_start_bus = NULL; static tfn_net_mod_socket_pub fn_socket_pub = NULL; static tfn_net_mod_socket_pub_timeout fn_socket_pub_timeout = NULL; static tfn_net_mod_socket_pub_nowait fn_socket_pub_nowait = NULL; static tfn_net_mod_socket_sub fn_socket_sub = NULL; static tfn_net_mod_socket_sub_timeout fn_socket_sub_timeout = NULL; static tfn_net_mod_socket_sub_nowait fn_socket_sub_nowait = NULL; static tfn_net_mod_socket_desub fn_socket_desub = NULL; static tfn_net_mod_socket_desub_timeout fn_socket_desub_timeout = NULL; static tfn_net_mod_socket_desub_nowait fn_socket_desub_nowait = NULL; static tfn_net_mod_socket_get_key fn_socket_get_key = NULL; static tfn_net_mod_socket_free_recv_msg_arr fn_socket_free_recv_msg_arr = NULL; static tfn_net_mod_socket_free fn_socket_free = NULL; static tfn_net_mod_server_socket_open fn_server_socket_open = NULL; static tfn_net_mod_server_socket_close fn_server_socket_close = NULL; static tfn_net_mod_server_socket_start fn_server_socket_start = NULL; // bus static tfn_bus_server_socket_wrapper_open fn_bus_server_socket_open = NULL; static tfn_bus_server_socket_wrapper_close fn_bus_server_socket_close = NULL; static tfn_bus_server_socket_wrapper_start_bus fn_bus_server_socket_start = NULL; ////////////////////////////////////////////////////////////////////// // labels // shm const static char l_shm_init[] = "shm_mm_wrapper_init"; const static char l_shm_destroy[] = "shm_mm_wrapper_destroy"; const static char l_shm_start_recycle[] = "shm_mm_wrapper_start_resycle"; const static char l_shm_alloc_key[] = "shm_mm_wrapper_alloc_key"; const static char l_shm_remove_keys[] = "shm_mm_wrapper_remove_keys"; const static char l_shm_remove_keys_exclude[] = "shm_mm_wrapper_remove_keys_exclude"; // net mode socket const static char l_socket_open[] = "net_mod_socket_open"; const static char l_net_mod_socket_open[] = "net_mod_socket_open"; const static char l_net_mod_socket_close[] = "net_mod_socket_close"; const static char l_net_mod_socket_bind[] = "net_mod_socket_bind"; const static char l_net_mod_socket_force_bind[] = "net_mod_socket_force_bind"; const static char l_net_mod_socket_sendto[] = "net_mod_socket_sendto"; const static char l_net_mod_socket_sendto_timeout[] = "net_mod_socket_sendto_timeout"; const static char l_net_mod_socket_sendto_nowait[] = "net_mod_socket_sendto_nowait"; const static char l_net_mod_socket_recvfrom[] = "net_mod_socket_recvfrom"; const static char l_net_mod_socket_recvfrom_timeout[] = "net_mod_socket_recvfrom_timeout"; const static char l_net_mod_socket_recvfrom_nowait[] = "net_mod_socket_recvfrom_nowait"; const static char l_net_mod_socket_sendandrecv[] = "net_mod_socket_sendandrecv"; const static char l_net_mod_socket_sendandrecv_timeout[] = "net_mod_socket_sendandrecv_timeout"; const static char l_net_mod_socket_sendandrecv_nowait[] = "net_mod_socket_sendandrecv_nowait"; // add recvandsend funcs const static char l_net_mod_socket_recvandsend[] = "net_mod_socket_recvandsend"; const static char l_net_mod_socket_recvandsend_timeout[] = "net_mod_socket_recvandsend_timeout"; const static char l_net_mod_socket_recvandsend_nowait[] = "net_mod_socket_recvandsend_nowait"; //const static char l_net_mod_socket_start_bus[] = "net_mod_socket_start_bus"; const static char l_net_mod_socket_pub[] = "net_mod_socket_pub"; const static char l_net_mod_socket_pub_timeout[] = "net_mod_socket_pub_timeout"; const static char l_net_mod_socket_pub_nowait[] = "net_mod_socket_pub_nowait"; const static char l_net_mod_socket_sub[] = "net_mod_socket_sub"; const static char l_net_mod_socket_sub_timeout[] = "net_mod_socket_sub_timeout"; const static char l_net_mod_socket_sub_nowait[] = "net_mod_socket_sub_nowait"; const static char l_net_mod_socket_desub[] = "net_mod_socket_desub"; const static char l_net_mod_socket_desub_timeout[] = "net_mod_socket_desub_timeout"; const static char l_net_mod_socket_desub_nowait[] = "net_mod_socket_desub_nowait"; const static char l_net_mod_socket_get_key[] = "net_mod_socket_get_key"; const static char l_net_mod_socket_free_recv_msg_arr[] = "net_mod_socket_free_recv_msg_arr"; const static char l_net_mod_socket_free[] = "net_mod_socket_free"; const static char l_net_mod_server_socket_open[] = "net_mod_server_socket_open"; const static char l_net_mod_server_socket_close[] = "net_mod_server_socket_close"; const static char l_net_mod_server_socket_start[] = "net_mod_server_socket_start"; // bus const static char l_bus_server_socket_wrapper_open[] = "bus_server_socket_wrapper_open"; const static char l_bus_server_socket_wrapper_close[] = "bus_server_socket_wrapper_close"; const static char l_bus_server_socket_wrapper_start_bus[] = "bus_server_socket_wrapper_start_bus"; ////////////////////////////////////////////////////////////////////// // dlopen dynamic library typedef void* hbhomebus; hbhomebus c_bhomebus_handle(const char *so); void c_bhomebus_release(hbhomebus lib); // shm manipulate void wrap_fn_shm_init(hbhomebus lib, int size); int wrap_fn_shm_alloc_key(hbhomebus lib); int wrap_fn_shm_start_recycle(hbhomebus lib); void wrap_fn_shm_destroy(hbhomebus lib); int wrap_fn_shm_remove_keys(hbhomebus lib, void *keys, int length); int wrap_fn_shm_remove_keys_exclude(hbhomebus lib, void *keys, int length); ///////////////////////////////////////////////////////// // net mode socket void * wrap_fn_socket_open(hbhomebus lib); void wrap_fn_socket_close(hbhomebus lib, void *_sockt); int wrap_fn_socket_bind(hbhomebus lib, void * _socket, int key); int wrap_fn_socket_force_bind(hbhomebus lib, void * _socket, int key); int wrap_fn_socket_sendto(hbhomebus lib, void *_socket, const void *buf, const int size, const int key); int wrap_fn_socket_sendto_timeout(hbhomebus lib, void *_socket, const void *buf, const int size, const int key, int sec, int nsec); int wrap_fn_socket_sendto_nowait(hbhomebus lib, void *_socket, const void *buf, const int size, const int key); int wrap_fn_socket_recvfrom(hbhomebus lib, void *_socket, void **buf, int *size, int *key); int wrap_fn_socket_recvfrom_timeout(hbhomebus lib, void *_socket, void **buf, int *size, int *key, int sec, int nsec); int wrap_fn_socket_recvfrom_nowait(hbhomebus lib, void *_socket, void **buf, int *size, int *key); int wrap_fn_socket_sendandrecv(hbhomebus lib, void *_sockt, void *node_arr, int arrlen, void *send_buf, int send_size, void ** recv_arr, int *recv_arr_size) ; int wrap_fn_socket_sendandrecv_timeout(hbhomebus lib, void *_sockt, void *node_arr, int arrlen, void *send_buf, int send_size, void ** recv_arr, int *recv_arr_size, int timeout); int wrap_fn_socket_sendandrecv_nowait(hbhomebus lib, void *_sockt, void *node_arr, int arrlen, void *send_buf, int send_size, void ** recv_arr, int *recv_arr_size) ; // add recvandsend funcs typedef void(*recv_callback_fn)(void**, int*); int wrap_fn_socket_recvandsend(hbhomebus lib, void *_sockt, recvandsend_callback_fn fn, void *user_data); int wrap_fn_socket_recvandsend_timeout(hbhomebus lib, void *_sockt, recvandsend_callback_fn fn, int sec, int nsec, void *user_data); int wrap_fn_socket_recvandsend_nowait (hbhomebus lib, void *_sockt, recvandsend_callback_fn fn, void *user_data); //int wrap_fn_socket_start_bus(hbhomebus lib, void * _socket); int wrap_fn_socket_pub(hbhomebus lib, void *_sockt, void *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size); int wrap_fn_socket_pub_timeout(hbhomebus lib, void *_sockt, void *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size, int timeout); int wrap_fn_socket_pub_nowait(hbhomebus lib, void *_sockt, void *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size); int wrap_fn_socket_sub(hbhomebus lib, void * _socket, void *topic, int size); int wrap_fn_socket_sub_timeout(hbhomebus lib, void * _socket, void *topic, int size, int sec, int nsec); int wrap_fn_socket_sub_nowait(hbhomebus lib, void * _socket, void *topic, int size); int wrap_fn_socket_desub(hbhomebus lib, void * _socket, void *topic, int size); int wrap_fn_socket_desub_timeout(hbhomebus lib, void * _socket, void *topic, int size, int sec, int nsec); int wrap_fn_socket_desub_nowait(hbhomebus lib, void * _socket, void *topic, int size); int wrap_fn_socket_get_key(hbhomebus lib, void * _socket) ; void wrap_fn_socket_free_recv_msg_arr(hbhomebus lib, void * arr, int size); void wrap_fn_socket_free(hbhomebus lib, void *buf) ; void *wrap_fn_server_socket_open(hbhomebus lib, int port); void wrap_fn_server_socket_close(hbhomebus lib, void* _socket); int wrap_fn_server_socket_start(hbhomebus lib, void* _socket); //bus void *wrap_fn_bus_server_socket_open(hbhomebus lib); void wrap_fn_bus_server_socket_close(hbhomebus lib, void* _socket); int wrap_fn_bus_server_socket_start(hbhomebus lib, void* _socket); #ifdef __cplusplus } #endif #endif