summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2022-05-15 14:52:00 -0400
committerguo <[email protected]>2022-05-16 10:02:22 +0800
commitb793b6427a9093663a89cbca786c52d17c077266 (patch)
treedb745068a760add9916a0f3a9552cbecc96fdf43 /components
parent19abf927d210338ea830908af7de37bb23d12682 (diff)
[sal] add draft for docking winsock
Diffstat (limited to 'components')
-rw-r--r--components/libc/compilers/common/sys/time.h4
-rw-r--r--components/net/sal/Kconfig35
-rw-r--r--components/net/sal/SConscript11
-rw-r--r--components/net/sal/docking/af_inet.h (renamed from components/net/sal/impl/af_inet.h)0
-rw-r--r--components/net/sal/docking/af_inet_at.c (renamed from components/net/sal/impl/af_inet_at.c)0
-rw-r--r--components/net/sal/docking/af_inet_lwip.c (renamed from components/net/sal/impl/af_inet_lwip.c)0
-rw-r--r--components/net/sal/docking/af_inet_winsock.c12
-rw-r--r--components/net/sal/docking/proto_mbedtls.c (renamed from components/net/sal/impl/proto_mbedtls.c)0
8 files changed, 39 insertions, 23 deletions
diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h
index b7b193d25a..8a4dbb68f3 100644
--- a/components/libc/compilers/common/sys/time.h
+++ b/components/libc/compilers/common/sys/time.h
@@ -43,14 +43,14 @@ struct timezone
int tz_dsttime; /* type of dst correction */
};
-#if !defined(_TIMEVAL_DEFINED)
+#ifndef _TIMEVAL_DEFINED
#define _TIMEVAL_DEFINED
struct timeval
{
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
-#endif /* !defined(_TIMEVAL_DEFINED) && !defined(_WIN32) */
+#endif /* _TIMEVAL_DEFINED */
#if defined(__ARMCC_VERSION) || defined(_WIN32) || (defined(__ICCARM__) && (__VER__ < 8010001))
struct timespec
diff --git a/components/net/sal/Kconfig b/components/net/sal/Kconfig
index 8542f02a2e..27a98d48d7 100644
--- a/components/net/sal/Kconfig
+++ b/components/net/sal/Kconfig
@@ -12,27 +12,28 @@ if RT_USING_SAL
help
The ability that check internet status is provided by RT-Thread.
- if RT_USING_LWIP || AT_USING_SOCKET
+ menu "Docking with protocol stacks"
- menu "protocol stack implement"
+ config SAL_USING_LWIP
+ bool "Docking with lwIP stack"
+ default y
+ depends on RT_USING_LWIP
- config SAL_USING_LWIP
- bool "Support lwIP stack"
- default y
- depends on RT_USING_LWIP
+ config SAL_USING_AT
+ bool "Docking with AT commands stack"
+ default y
+ depends on AT_USING_SOCKET
- config SAL_USING_AT
- bool "Support AT Commands stack"
- default y
- depends on AT_USING_SOCKET
+ config SAL_USING_WINSOCK
+ bool "Docking with Windows socket (winsock)"
+ default y
+ depends on BSP_USING_SAL_WINSOCK
- config SAL_USING_TLS
- bool "Support MbedTLS protocol"
- default y
- depends on PKG_USING_MBEDTLS
- endmenu
-
- endif
+ config SAL_USING_TLS
+ bool "Docking with MbedTLS protocol"
+ default y
+ depends on PKG_USING_MBEDTLS
+ endmenu
config SAL_USING_POSIX
bool
diff --git a/components/net/sal/SConscript b/components/net/sal/SConscript
index 3903dce89a..25788e0bed 100644
--- a/components/net/sal/SConscript
+++ b/components/net/sal/SConscript
@@ -11,16 +11,19 @@ CPPPATH = [cwd + '/include']
CPPPATH += [cwd + '/include/socket']
if GetDepend('SAL_USING_LWIP'):
- src += Glob('impl/af_inet_lwip.c')
+ src += Glob('docking/af_inet_lwip.c')
if GetDepend('SAL_USING_AT'):
- src += Glob('impl/af_inet_at.c')
+ src += Glob('docking/af_inet_at.c')
if GetDepend('SAL_USING_LWIP') or GetDepend('SAL_USING_AT'):
- CPPPATH += [cwd + '/impl']
+ CPPPATH += [cwd + '/docking']
+
+if GetDepend('SAL_USING_WINSOCK'):
+ src += Glob('docking/af_inet_winsock.c')
if GetDepend('SAL_USING_TLS'):
- src += Glob('impl/proto_mbedtls.c')
+ src += Glob('docking/proto_mbedtls.c')
if GetDepend('SAL_USING_POSIX'):
CPPPATH += [cwd + '/include/dfs_net']
diff --git a/components/net/sal/impl/af_inet.h b/components/net/sal/docking/af_inet.h
index 421d15bfae..421d15bfae 100644
--- a/components/net/sal/impl/af_inet.h
+++ b/components/net/sal/docking/af_inet.h
diff --git a/components/net/sal/impl/af_inet_at.c b/components/net/sal/docking/af_inet_at.c
index 07dff0018c..07dff0018c 100644
--- a/components/net/sal/impl/af_inet_at.c
+++ b/components/net/sal/docking/af_inet_at.c
diff --git a/components/net/sal/impl/af_inet_lwip.c b/components/net/sal/docking/af_inet_lwip.c
index 2cf0958ee4..2cf0958ee4 100644
--- a/components/net/sal/impl/af_inet_lwip.c
+++ b/components/net/sal/docking/af_inet_lwip.c
diff --git a/components/net/sal/docking/af_inet_winsock.c b/components/net/sal/docking/af_inet_winsock.c
new file mode 100644
index 0000000000..f3f103d0ca
--- /dev/null
+++ b/components/net/sal/docking/af_inet_winsock.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2006-2022, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ */
+
+#include <winsock.h>
+
+/* Do NOT include sys/time.h in this file */
diff --git a/components/net/sal/impl/proto_mbedtls.c b/components/net/sal/docking/proto_mbedtls.c
index 338792c948..338792c948 100644
--- a/components/net/sal/impl/proto_mbedtls.c
+++ b/components/net/sal/docking/proto_mbedtls.c