#ifndef _c_libshm_queue_so_go_wrapper_h_ #define _c_libshm_queue_so_go_wrapper_h_ #include "libcsoftbus_func.h" #include #ifdef __cplusplus extern "C"{ #endif // shm manipulate static tfn_shm_init fn_shm_init = NULL; static tfn_shm_alloc_key fn_shm_alloc_key = NULL; static tfn_shm_destroy fn_shm_destroy = NULL; static tfn_shm_rm_dead_queue fn_shm_rm_dead_queue = NULL; // shm queue create drop static tfn_queue_create fn_queue_create = NULL; static tfn_queue_attach fn_queue_attach = NULL; static tfn_queue_drop fn_queue_drop = NULL; // shm queue size static tfn_queue_size fn_queue_size = NULL; static tfn_queue_full fn_queue_full = NULL; static tfn_queue_empty fn_queue_empty = NULL; // shm queue push static tfn_queue_push fn_queue_push = NULL; static tfn_queue_push_nowait fn_queue_push_nowait = NULL; static tfn_queue_push_timeout fn_queue_push_timeout = NULL; // shm queue pop static tfn_queue_pop fn_queue_pop = NULL; static tfn_queue_pop_nowait fn_queue_pop_nowait = NULL; static tfn_queue_pop_timeout fn_queue_pop_timeout = NULL; static tfn_queue_free_poped fn_queue_free_poped = NULL; // socket mode static tfn_socket_open fn_socket_open = NULL; static tfn_socket_close fn_socket_close = NULL; static tfn_socket_bind fn_socket_bind = NULL; static tfn_socket_listen fn_socket_listen = NULL; static tfn_socket_connect fn_socket_connect = NULL; static tfn_socket_send fn_socket_send = NULL; static tfn_socket_recv fn_socket_recv = NULL; static tfn_socket_buf_free fn_socket_buf_free = NULL; static tfn_socket_port fn_socket_port = NULL; // dgram mode socket static tfn_dgram_socket_open fn_dgram_socket_open = NULL; static tfn_dgram_socket_close fn_dgram_socket_close = NULL; static tfn_dgram_socket_bind fn_dgram_socket_bind = NULL; static tfn_dgram_socket_force_bind fn_dgram_socket_force_bind = NULL; static tfn_dgram_socket_sendto fn_dgram_socket_sendto = NULL; static tfn_dgram_socket_sendto_timeout fn_dgram_socket_sendto_timeout = NULL; static tfn_dgram_socket_sendto_nowait fn_dgram_socket_sendto_nowait = NULL; static tfn_dgram_socket_recvfrom fn_dgram_socket_recvfrom = NULL; static tfn_dgram_socket_recvfrom_timeout fn_dgram_socket_recvfrom_timeout = NULL; static tfn_dgram_socket_recvfrom_nowait fn_dgram_socket_recvfrom_nowait = NULL; static tfn_dgram_socket_sendandrecv fn_dgram_socket_sendandrecv = NULL; static tfn_dgram_socket_sendandrecv_timeout fn_dgram_socket_sendandrecv_timeout = NULL; static tfn_dgram_socket_sendandrecv_nowait fn_dgram_socket_sendandrecv_nowait = NULL; static tfn_dgram_socket_start_bus fn_dgram_socket_start_bus = NULL; static tfn_dgram_socket_sub fn_dgram_socket_sub = NULL; static tfn_dgram_socket_sub_timeout fn_dgram_socket_sub_timeout = NULL; static tfn_dgram_socket_sub_nowait fn_dgram_socket_sub_nowait = NULL; static tfn_dgram_socket_desub fn_dgram_socket_desub = NULL; static tfn_dgram_socket_desub_timeout fn_dgram_socket_desub_timeout = NULL; static tfn_dgram_socket_desub_nowait fn_dgram_socket_desub_nowait = NULL; static tfn_dgram_socket_pub fn_dgram_socket_pub = NULL; static tfn_dgram_socket_pub_timeout fn_dgram_socket_pub_timeout = NULL; static tfn_dgram_socket_pub_nowait fn_dgram_socket_pub_nowait = NULL; static tfn_dgram_socket_port fn_dgram_socket_port = NULL; static tfn_dgram_socket_free fn_dgram_socket_free = NULL; static tfn_dgram_remove_key fn_dgram_remove_key = NULL; static tfn_dgram_remove_keys fn_dgram_remove_keys = NULL; ////////////////////////////////////////////////////////////////////// // labels // shm const static char l_shm_init[] = "shm_init"; const static char l_shm_alloc_key[] = "shm_alloc_key"; const static char l_shm_destroy[] = "shm_destroy"; const static char l_shm_rm_dead_queue[] = "shm_remove_queues_exclude"; // queue const static char l_queue_create[] = "shmqueue_create"; const static char l_queue_attach[] = "shmqueue_attach"; const static char l_queue_drop[] = "shmqueue_drop"; // queue size const static char l_queue_size[] = "shmqueue_size"; const static char l_queue_full[] = "shmqueue_full"; const static char l_queue_empty[] = "shmqueue_empty"; // queue push const static char l_queue_push[] = "shmqueue_push"; const static char l_queue_push_nowait[] = "shmqueue_push_nowait"; const static char l_queue_push_timeout[] = "shmqueue_push_timeout"; // queue pop const static char l_queue_pop[] = "shmqueue_pop"; const static char l_queue_pop_nowait[] = "shmqueue_pop_nowait"; const static char l_queue_pop_timeout[] = "shmqueue_pop_timeout"; const static char l_queue_free_poped[] = "shmqueue_free"; // mode socket const static char l_socket_open[] = "mod_open_socket"; const static char l_socket_close[] = "mod_close_socket"; const static char l_socket_bind[] = "mod_socket_bind"; const static char l_socket_listen[] = "mod_listen"; const static char l_socket_connect[] = "mod_connect"; const static char l_socket_send[] = "mod_send"; const static char l_socket_recv[] = "mod_recv"; const static char l_socket_free[] = "mod_free"; const static char l_socket_port[] = "mod_get_socket_port"; // dgram mode socket const static char l_dgram_socket_open[] = "dgram_mod_open_socket"; const static char l_dgram_socket_close[] = "dgram_mod_close_socket"; const static char l_dgram_socket_bind[] = "dgram_mod_bind"; const static char l_dgram_socket_force_bind[] = "dgram_mod_force_bind"; const static char l_dgram_socket_sendto[] = "dgram_mod_sendto"; const static char l_dgram_socket_sendto_timeout[] = "dgram_mod_sendto_timeout"; const static char l_dgram_socket_sendto_nowait[] = "dgram_mod_sendto_nowait"; const static char l_dgram_socket_recvfrom[] = "dgram_mod_recvfrom"; const static char l_dgram_socket_recvfrom_timeout[] = "dgram_mod_recvfrom_timeout"; const static char l_dgram_socket_recvfrom_nowait[] = "dgram_mod_recvfrom_nowait"; const static char l_dgram_socket_sendandrecv[] = "dgram_mod_sendandrecv"; const static char l_dgram_socket_sendandrecv_timeout[] = "dgram_mod_sendandrecv_timeout"; const static char l_dgram_socket_sendandrecv_nowait[] = "dgram_mod_sendandrecv_nowait"; const static char l_dgram_socket_start_bus[] = "dgram_mod_start_bus"; const static char l_dgram_socket_sub[] = "dgram_mod_sub"; const static char l_dgram_socket_sub_timeout[] = "dgram_mod_sub_timeout"; const static char l_dgram_socket_sub_nowait[] = "dgram_mod_sub_nowait"; const static char l_dgram_socket_desub[] = "dgram_mod_desub"; const static char l_dgram_socket_desub_timeout[] = "dgram_mod_desub_timeout"; const static char l_dgram_socket_desub_nowait[] = "dgram_mod_desub_nowait"; const static char l_dgram_socket_pub[] = "dgram_mod_pub"; const static char l_dgram_socket_pub_timeout[] = "dgram_mod_pub_timeout"; const static char l_dgram_socket_pub_nowait[] = "dgram_mod_pub_nowait"; const static char l_dgram_socket_port[] = "dgram_mod_get_port"; const static char l_dgram_socket_free[] = "dgram_mod_free"; const static char l_dgram_remove_key[] = "dgram_mod_remove_key"; const static char l_dgram_remove_keys[] = "dgram_mod_remove_keys"; ////////////////////////////////////////////////////////////////////// // dlopen dynamic library typedef void* hcsoftbus; hcsoftbus c_softbus_handle(const char *so); void c_softbus_release(hcsoftbus lib); // shm manipulate void wrap_fn_shm_init(hcsoftbus lib, int size); int wrap_fn_shm_alloc_key(hcsoftbus lib); void wrap_fn_shm_destroy(hcsoftbus lib); void wrap_fn_shm_rm_dead_queue(hcsoftbus lib, void *array, int len); // queue create/drop void* wrap_fn_queue_create(hcsoftbus lib, int *key, int queue_size); void* wrap_fn_queue_attach(hcsoftbus lib, int key); void wrap_fn_queue_drop(hcsoftbus lib, void* shmq); // queue size int wrap_fn_queue_size(hcsoftbus lib, void *shmq); int wrap_fn_queue_full(hcsoftbus lib, void *shmq); int wrap_fn_queue_empty(hcsoftbus lib, void *shmq); // queue push int wrap_fn_queue_push(hcsoftbus lib, void *shmq, void *ele, int ele_size); int wrap_fn_queue_push_nowait(hcsoftbus lib, void *shmq, void *ele, int ele_size); int wrap_fn_queue_push_timeout(hcsoftbus lib, void *shmq, void *ele, int ele_size, int sec, int nsec); // queue pop int wrap_fn_queue_pop(hcsoftbus lib, void *shmq, void **ele, int *ele_size); int wrap_fn_queue_pop_nowait(hcsoftbus lib, void *shmq, void **ele, int *ele_size); int wrap_fn_queue_pop_timeout(hcsoftbus lib, void *shmq, void **ele, int *ele_size, int sec, int nsec); void wrap_fn_queue_free_poped(hcsoftbus lib, void *ptr); ///////////////////////////////////////////////////////// // socket mode void *wrap_fn_socket_open(hcsoftbus lib, int mod); int wrap_fn_socket_close(hcsoftbus lib, void* s); int wrap_fn_socket_bind(hcsoftbus lib, void *s, int port); int wrap_fn_socket_listen(hcsoftbus lib, void *s); int wrap_fn_socket_connect(hcsoftbus lib, void *s, int port); int wrap_fn_socket_send(hcsoftbus lib, void *s, const void *buf, const int size); int wrap_fn_socket_recv(hcsoftbus lib, void *s, void **buf, int *size); void wrap_fn_socket_buf_free(hcsoftbus lib, void *buf); int wrap_fn_socket_port(hcsoftbus lib, void *s); ///////////////////////////////////////////////////////// // dgram socket mode void *wrap_fn_dgram_socket_open(hcsoftbus lib); int wrap_fn_dgram_socket_close(hcsoftbus lib, void *s); int wrap_fn_dgram_socket_bind(hcsoftbus lib, void *s, int port); int wrap_fn_dgram_socket_force_bind(hcsoftbus lib, void *s, int port); int wrap_fn_dgram_socket_sendto(hcsoftbus lib, void *s, const void *buf, const int size, const int port); int wrap_fn_dgram_socket_sendto_timeout(hcsoftbus lib, void *s, const void *buf, const int size, const int port, int sec, int usec); int wrap_fn_dgram_socket_sendto_nowait(hcsoftbus lib, void *s, const void *buf, const int size, const int port); int wrap_fn_dgram_socket_recvfrom(hcsoftbus lib, void *s, void **buf, int *size, int *port); int wrap_fn_dgram_socket_recvfrom_timeout(hcsoftbus lib, void *s, void **buf, int *size, int *port, int sec, int usec); int wrap_fn_dgram_socket_recvfrom_nowait(hcsoftbus lib, void *s, void **buf, int *size, int *port); int wrap_fn_dgram_socket_sendandrecv(hcsoftbus lib, void *s, const void *sbuf, const int ssize, const int port, void **rbuf, int *rsize); int wrap_fn_dgram_socket_sendandrecv_timeout(hcsoftbus lib, void *s, const void *sbuf, const int ssize, const int port, void **rbuf, int *rsize, int sec, int usec); int wrap_fn_dgram_socket_sendandrecv_nowait(hcsoftbus lib, void *s, const void *sbuf, const int ssize, const int port, void **rbuf, int *rsize); int wrap_fn_dgram_socket_start_bus(hcsoftbus lib, void *s); int wrap_fn_dgram_socket_sub(hcsoftbus lib, void *s, void *topic, int size, int port); int wrap_fn_dgram_socket_sub_timeout(hcsoftbus lib, void *s, void *topic, int size, int port, int sec, int usec); int wrap_fn_dgram_socket_sub_nowait(hcsoftbus lib, void *s, void *topic, int size, int port); int wrap_fn_dgram_socket_desub(hcsoftbus lib, void *s, void *topic, int size, int port); int wrap_fn_dgram_socket_desub_timeout(hcsoftbus lib, void *s, void *topic, int size, int port, int sec, int usec); int wrap_fn_dgram_socket_desub_nowait(hcsoftbus lib, void *s, void *topic, int size, int port); int wrap_fn_dgram_socket_pub(hcsoftbus lib, void *s, void *topic, int tsize, void *content, int csize, int port); int wrap_fn_dgram_socket_pub_timeout(hcsoftbus lib, void *s, void *topic, int tsize, void *content, int csize, int port, int sec, int usec); int wrap_fn_dgram_socket_pub_nowait(hcsoftbus lib, void *s, void *topic, int tsize, void *content, int csize, int port); int wrap_fn_dgram_socket_port(hcsoftbus lib, void *s); void wrap_fn_dgram_socket_free(hcsoftbus lib, void *buf); int wrap_fn_dgram_remove_key(hcsoftbus lib, int key); int wrap_fn_dgram_remove_keys(hcsoftbus lib, void *keys, int length); #ifdef __cplusplus } #endif #endif