1 /* 2 * This file is part of the openHiTLS project. 3 * 4 * openHiTLS is licensed under the Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * See the Mulan PSL v2 for more details. 14 */ 15 16 #ifndef SAL_NET_H 17 #define SAL_NET_H 18 19 #include "hitls_build.h" 20 #ifdef HITLS_BSL_SAL_NET 21 22 #include <stdint.h> 23 24 #ifdef HITLS_BSL_SAL_LINUX 25 #include <arpa/inet.h> 26 #include <netinet/tcp.h> 27 #endif 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 int32_t SAL_Write(int32_t fd, const void *buf, uint32_t len, int32_t *err); 34 35 int32_t SAL_Read(int32_t fd, void *buf, uint32_t len, int32_t *err); 36 37 int32_t SAL_Sendto(int32_t sock, const void *buf, size_t len, int32_t flags, BSL_SAL_SockAddr address, int32_t addrLen, 38 int32_t *err); 39 40 int32_t SAL_RecvFrom(int32_t sock, void *buf, size_t len, int32_t flags, BSL_SAL_SockAddr address, int32_t *addrLen, 41 int32_t *err); 42 43 int32_t SAL_SockAddrNew(BSL_SAL_SockAddr *sockAddr); 44 void SAL_SockAddrFree(BSL_SAL_SockAddr sockAddr); 45 uint32_t SAL_SockAddrSize(const BSL_SAL_SockAddr sockAddr); 46 void SAL_SockAddrCopy(BSL_SAL_SockAddr dst, BSL_SAL_SockAddr src); 47 48 49 #ifdef __cplusplus 50 } 51 #endif /* __cplusplus */ 52 53 #endif /* HITLS_BSL_SAL_NET */ 54 55 #endif // SAL_NET_H 56