| | |
| | | |
| | | #-I$(ROOT)/include/usgcommon |
| | | |
| | | INCLUDES += -I./queue -I./socket -I./common/include -I$(ROOT)/include/usgcommon |
| | | INCLUDES += -I./queue -I./socket -I$(ROOT)/include/usgcommon |
| | | |
| | | SOURCES := $(wildcard *.c ./**/*.c) |
| | | OBJS = $(patsubst %.c, $(DEST)/%.o, $(SOURCES)) |
| | |
| | | sprintf(portstr, "%d", port); |
| | | listenfd = open_listenfd(portstr); |
| | | if(listenfd < 0) { |
| | | LoggerFactory::getLogger()->error(errno, "NetModServerSocket::start"); |
| | | LoggerFactory::getLogger()->error(errno, "NetModServerSocket::start . errno=%d", errno); |
| | | return -1; |
| | | } |
| | | init_pool(listenfd); |
| | |
| | | #define PUT(p, val) (*(uint32_t *)(p) = (val)) |
| | | |
| | | |
| | | |
| | | #define ERROR_NET_MOD_SOCKET_ADDR_IN_USE 1 |
| | | |
| | | |
| | | class NetModServerSocket; |
| | |
| | | net_mod_socket_t *sockt = (net_mod_socket_t *)_socket; |
| | | return sockt->sockt->pub(node_arr, node_arr_len, topic, topic_size, content, content_size); |
| | | } |
| | | int net_mod_socket_pub_timeout(void *_sockt, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size, int timeout){ |
| | | return 0; |
| | | } |
| | | int net_mod_socket_pub_nowait(void *_sockt, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size){ |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * @return 成功发布的节点的个数 |
| | | */ |
| | | int net_mod_socket_pub(void *_sockt, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size); |
| | | |
| | | |
| | | int net_mod_socket_pub_timeout(void *_sockt, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size, int timeout); |
| | | int net_mod_socket_pub_nowait(void *_sockt, net_node_t *node_arr, int node_arr_len, char *topic, int topic_size, void *content, int content_size); |
| | | |
| | | /** |
| | | * 订阅指定主题 |
| | |
| | | PLATFORM=$(shell $(ROOT)/systype.sh) |
| | | include $(ROOT)/Make.defines.$(PLATFORM) |
| | | |
| | | #RPATH += -Wl,-rpath=${ROOT}/lib |
| | | RPATH += -Wl,-rpath=$(ROOT)/lib:$(DEST)/lib |
| | | # 开源工具包路径 |
| | | LDDIR += -L${DEST}/lib |
| | | LDDIR += -L$(DEST)/lib |
| | | |
| | | #-lusgcommon |
| | | # 开源工具包 |
| | |
| | | printf("Start net proxy\n"); |
| | | void *serverSocket = net_mod_server_socket_open(port); |
| | | if(net_mod_server_socket_start(serverSocket) != 0) { |
| | | err_exit(errno, "net_mod_server_socket_start"); |
| | | err_msg(errno, "net_mod_server_socket_start"); |
| | | } |
| | | } |
| | | |