From f85c9b875b060681b51f57b15074ba1c7c9f5636 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期一, 20 七月 2020 11:10:02 +0800 Subject: [PATCH] update --- queue/include/mod_socket.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 51 insertions(+), 2 deletions(-) diff --git a/queue/include/mod_socket.h b/queue/include/mod_socket.h index 27d076f..21498ee 100644 --- a/queue/include/mod_socket.h +++ b/queue/include/mod_socket.h @@ -1,12 +1,12 @@ #ifndef __MOD_SOCKET_H__ #define __MOD_SOCKET_H__ -#include "shm_socket.h" + #ifdef __cplusplus extern "C" { #endif -enum shm_mod_t +enum socket_mod_t { PULL_PUSH = 1, REQ_REP = 2, @@ -17,8 +17,57 @@ }; +/** + * 鍒涘缓socket + * @return socket鍦板潃 +*/ +void *mod_open_socket(int mod); + +/** + * 鍏抽棴socket +*/ +int mod_close_socket(void * _socket); + +/** + * 缁戝畾绔彛鍒皊ocket, 濡傛灉涓嶇粦瀹氬垯绯荤粺鑷姩鍒嗛厤涓�涓� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +int mod_socket_bind(void * _socket, int port); + + +/** + * 鏈嶅姟绔紑鍚繛鎺ョ洃鍚� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 + */ +int mod_listen(void * _socket); + +/** + * 瀹㈡埛绔彂璧疯繛鎺ヨ姹� + */ +int mod_connect(void * _socket, int port); + +/** + * 鍙戦�佷俊鎭� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 + */ +int mod_send(void * _socket, const void *buf, const int size); + +/** + * 鎺ユ敹淇℃伅 + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +int mod_recv(void * _socket, void **buf, int *size) ; + +/** + * 閲婃斁鎺ユ敹淇℃伅鐨刡uf + */ +void mod_free(void *buf); +/** + * 鑾峰彇soket绔彛鍙� + */ +int mod_get_socket_port(void * _socket); #ifdef __cplusplus } -- Gitblit v1.8.0