From b70473ad3084fe968bbfaa50eb54cc248b79e02a Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期二, 28 七月 2020 16:10:50 +0800 Subject: [PATCH] 添加dgram socket接口 --- libcsoftbus_func.h | 66 +++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) diff --git a/libcsoftbus_func.h b/libcsoftbus_func.h index 7ac20f5..5bd60dc 100644 --- a/libcsoftbus_func.h +++ b/libcsoftbus_func.h @@ -146,6 +146,72 @@ */ typedef int(*tfn_socket_port) (void*); +////////////////////////////////////////////// +// dgram socket +/** + * 鍒涘缓socket + * @return socket鍦板潃 +*/ +typedef void*(*tfn_dgram_socket_open) (); +/** + * 鍏抽棴socket + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +typedef int(*tfn_dgram_socket_close) (void*); +/** + * 缁戝畾绔彛鍒皊ocket, 濡傛灉涓嶇粦瀹氬垯绯荤粺鑷姩鍒嗛厤涓�涓� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +typedef int(*tfn_dgram_socket_bind) (void*, int); +typedef tfn_dgram_socket_bind tfn_dgram_socket_force_bind; +/** + * 鍙戦�佷俊鎭� + * @port 鍙戦�佺粰璋� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 + */ +typedef int(*tfn_dgram_socket_sendto) (void*, const void*, const int, const int); +/** + * 鎺ユ敹淇℃伅 + * @port 浠庤皝鍝噷鏀跺埌鐨勪俊鎭� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +typedef int(*tfn_dgram_socket_recvfrom) (void*, void**, int*, int*); +/** + * 鍙戦�佽姹備俊鎭苟绛夊緟鎺ユ敹搴旂瓟 + * @port 鍙戦�佺粰璋� + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +typedef int(*tfn_dgram_socket_sendandrecv) (void*, const void*, const int, const int, void**, int*); +/** + * 鍚姩bus + * + * @return 0 鎴愬姛锛� 鍏朵粬鍊� 澶辫触鐨勯敊璇爜 +*/ +typedef int(*tfn_dgram_socket_start_bus) (void*); +/** + * 璁㈤槄鎸囧畾涓婚 + * @topic 涓婚 + * @size 涓婚闀垮害 + * @port 鎬荤嚎绔彛 + */ +typedef int(*tfn_dgram_socket_sub) (void*, void*, int, int); +/** + * 鍙戝竷涓婚 + * @topic 涓婚 + * @content 涓婚鍐呭 + * @port 鎬荤嚎绔彛 + */ +typedef int(*tfn_dgram_socket_pub) (void*, void*, int, void*, int, int); +/** + * 鑾峰彇soket绔彛鍙� + */ +typedef int(*tfn_dgram_socket_port) (void*); +/** + * 閲婃斁瀛樺偍鎺ユ敹淇℃伅鐨刡uf + */ +typedef void(*tfn_dgram_socket_free) (void*); + + #ifdef __cplusplus } #endif -- Gitblit v1.8.0