summaryrefslogtreecommitdiff
path: root/components/net/sal_socket/impl
diff options
context:
space:
mode:
authorchenyong <[email protected]>2018-08-24 20:39:10 +0800
committerchenyong <[email protected]>2018-08-25 16:01:31 +0800
commit192b17751868b4aa9a95ad34bb90dcd54071e5df (patch)
tree405f3c6ebd8c33a57eac4a0f80ef3abd3e8a18ec /components/net/sal_socket/impl
parent0d737de882bbdaaa726552f9dae19aa402eb7ce6 (diff)
[at][sal] Add query and unregistered protocol family functions
Diffstat (limited to 'components/net/sal_socket/impl')
-rw-r--r--components/net/sal_socket/impl/af_inet.h40
-rw-r--r--components/net/sal_socket/impl/af_inet_at.c2
-rw-r--r--components/net/sal_socket/impl/af_inet_lwip.c2
3 files changed, 44 insertions, 0 deletions
diff --git a/components/net/sal_socket/impl/af_inet.h b/components/net/sal_socket/impl/af_inet.h
new file mode 100644
index 0000000000..10a77d5871
--- /dev/null
+++ b/components/net/sal_socket/impl/af_inet.h
@@ -0,0 +1,40 @@
+/*
+ * File : af_inet.h
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2018-08-25 ChenYong First version
+ */
+
+#ifndef __AF_INET_H__
+#define __AF_INET_H__
+
+#include <rtthread.h>
+
+#ifdef SAL_USING_LWIP
+/* lwIP protocol family register */
+int lwip_inet_init(void);
+#endif
+
+#ifdef SAL_USING_AT
+/* AT protocol family register */
+int at_inet_init(void);
+#endif
+
+#endif /* __AF_INET_H__ */
diff --git a/components/net/sal_socket/impl/af_inet_at.c b/components/net/sal_socket/impl/af_inet_at.c
index 8ddb236e84..3337af4194 100644
--- a/components/net/sal_socket/impl/af_inet_at.c
+++ b/components/net/sal_socket/impl/af_inet_at.c
@@ -26,6 +26,7 @@
#include <sal.h>
#include <at_socket.h>
+#include <af_inet.h>
#ifdef SAL_USING_POSIX
#include <dfs_poll.h>
@@ -107,6 +108,7 @@ static int at_create(struct sal_socket *socket, int type, int protocol)
}
static const struct proto_family at_inet_family_ops = {
+ "at",
AF_AT,
AF_INET,
at_create,
diff --git a/components/net/sal_socket/impl/af_inet_lwip.c b/components/net/sal_socket/impl/af_inet_lwip.c
index deb9239bf4..c45e39e39e 100644
--- a/components/net/sal_socket/impl/af_inet_lwip.c
+++ b/components/net/sal_socket/impl/af_inet_lwip.c
@@ -34,6 +34,7 @@
#endif
#include <sal.h>
+#include <af_inet.h>
#if LWIP_VERSION < 0x2000000
#define SELWAIT_T int
@@ -284,6 +285,7 @@ static int inet_create(struct sal_socket *socket, int type, int protocol)
}
static const struct proto_family lwip_inet_family_ops = {
+ "lwip",
AF_INET,
AF_INET,
inet_create,