1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SOFTBUS_ADAPTER_DEFINE_H
17 #define SOFTBUS_ADAPTER_DEFINE_H
18 
19 #include <arpa/inet.h>
20 #include <netinet/in.h>
21 #include <netinet/tcp.h>
22 #include <stdint.h>
23 #include <sys/ioctl.h>
24 #include <sys/select.h>
25 #include <sys/socket.h>
26 #include <sys/types.h>
27 
28 #ifdef __cplusplus
29 #if __cplusplus
30 extern "C" {
31 #endif
32 #endif
33 
34 /* sys/socket.h */
35 #define SOFTBUS_PF_UNSPEC_ PF_UNSPEC
36 #define SOFTBUS_AF_UNSPEC_ AF_UNSPEC
37 #define SOFTBUS_PF_INET_ PF_INET
38 #define SOFTBUS_AF_INET_ AF_INET
39 
40 #define SOFTBUS_PF_INET6_ PF_INET6
41 #define SOFTBUS_AF_INET6_ AF_INET6
42 
43 #define SOFTBUS_PF_NETLINK_ PF_NETLINK
44 #define SOFTBUS_AF_NETLINK_ AF_NETLINK
45 
46 #define SOFTBUS_SOCK_STREAM_ SOCK_STREAM
47 #define SOFTBUS_SOCK_DGRAM_ SOCK_DGRAM
48 #define SOFTBUS_SOCK_RAW_ SOCK_RAW
49 
50 #define SOFTBUS_SOCK_CLOEXEC_ SOCK_CLOEXEC
51 #define SOFTBUS_SOCK_NONBLOCK_ SOCK_NONBLOCK
52 
53 #define SOFTBUS_SOL_SOCKET_ SOL_SOCKET
54 
55 #define SOFTBUS_SO_REUSEADDR_ SO_REUSEADDR
56 #define SOFTBUS_SO_RCVBUF_ SO_RCVBUF
57 #define SOFTBUS_SO_SNDBUF_ SO_SNDBUF
58 #define SOFTBUS_SO_KEEPALIVE_ SO_KEEPALIVE
59 #define SOFTBUS_SO_REUSEPORT_ SO_REUSEPORT
60 #define SOFTBUS_SO_RCVBUFFORCE_ SO_RCVBUFFORCE
61 #define SOFTBUS_SO_BINDTODEVICE_ SO_BINDTODEVICE
62 
63 #define SOFTBUS_TCP_KEEPIDLE_ TCP_KEEPIDLE
64 #define SOFTBUS_TCP_KEEPINTVL_ TCP_KEEPINTVL
65 #define SOFTBUS_TCP_KEEPCNT_ TCP_KEEPCNT
66 #define SOFTBUS_TCP_USER_TIMEOUT_ TCP_USER_TIMEOUT
67 
68 #define SOFTBUS_SHUT_RD_ SHUT_RD
69 #define SOFTBUS_SHUT_WR_ SHUT_WR
70 #define SOFTBUS_SHUT_RDWR_ SHUT_RDWR
71 
72 /* netinet/in.h */
73 #define SOFTBUS_IPPROTO_IP_ IPPROTO_IP
74 #define SOFTBUS_IPPROTO_TCP_ IPPROTO_TCP
75 
76 #define SOFTBUS_IP_TOS_ IP_TOS
77 
78 /* netinet/tcp.h */
79 #define SOFTBUS_TCP_NODELAY_ TCP_NODELAY
80 
81 /* fcntl.h */
82 #define SOFTBUS_F_GETFL_ F_GETFL
83 #define SOFTBUS_F_SETFL_ F_SETFL
84 
85 #define SOFTBUS_O_NONBLOCK_ O_NONBLOCK
86 
87 /* select.h */
88 /* linux support 1024, liteos support 640 */
89 #define SOFTBUS_FD_SETSIZE_ FD_SETSIZE
90 
91 
92 #ifdef __cplusplus
93 #if __cplusplus
94 }
95 #endif /* __cplusplus */
96 #endif /* __cplusplus */
97 
98 #endif
99 
100