net: Restructure network protocols
This commit restructures the network protocols. Changes applied are: - Move lib/iot/ to subsys/net/lib - Move network protocol headers to include/net - Move lib/iot/zoap/link-format.h to include/net/zoap_link_format.h and link-format.c to zoap_link_format.c - Move tests/iot/ to tests/net/lib/ - Adapt sample code - Adapt build system - Modify doxygen paths Change-Id: I37085fa4cc76a8a8e19a499ecb4e87b451120349 Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
parent
dc862ec104
commit
ac7300611c
67 changed files with 74 additions and 72 deletions
|
@ -106,7 +106,8 @@ INPUT = \
|
||||||
include/arch/nios2/ \
|
include/arch/nios2/ \
|
||||||
lib/libc/minimal/include/ \
|
lib/libc/minimal/include/ \
|
||||||
ext/lib/crypto/tinycrypt/include/ \
|
ext/lib/crypto/tinycrypt/include/ \
|
||||||
lib/iot/zoap/zoap.h \
|
include/net/zoap.h \
|
||||||
|
include/net/dns_client.h \
|
||||||
tests/ztest/include/
|
tests/ztest/include/
|
||||||
INPUT_ENCODING = UTF-8
|
INPUT_ENCODING = UTF-8
|
||||||
FILE_PATTERNS = "*.c" "*.h" "*.S"
|
FILE_PATTERNS = "*.c" "*.h" "*.S"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef _MQTT_H_
|
#ifndef _MQTT_H_
|
||||||
#define _MQTT_H_
|
#define _MQTT_H_
|
||||||
|
|
||||||
#include <iot/mqtt_types.h>
|
#include <net/mqtt_types.h>
|
||||||
#include <net/net_context.h>
|
#include <net/net_context.h>
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,2 +1 @@
|
||||||
obj-y += libc/
|
obj-y += libc/
|
||||||
obj-y += iot/
|
|
|
@ -19,6 +19,4 @@ menu "Cryptography"
|
||||||
source "lib/crypto/tinycrypt/Kconfig"
|
source "lib/crypto/tinycrypt/Kconfig"
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
source "lib/iot/Kconfig"
|
|
||||||
|
|
||||||
source "lib/libc/Kconfig"
|
source "lib/libc/Kconfig"
|
||||||
|
|
|
@ -13,5 +13,3 @@ endif
|
||||||
else
|
else
|
||||||
ZEPHYRINCLUDE += -I$(srctree)/lib/libc/minimal/include
|
ZEPHYRINCLUDE += -I$(srctree)/lib/libc/minimal/include
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(srctree)/lib/iot/Makefile
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
ifdef CONFIG_ZOAP
|
|
||||||
include $(srctree)/lib/iot/zoap/Makefile
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef CONFIG_DNS_RESOLVER
|
|
||||||
include $(srctree)/lib/iot/dns/Makefile
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef CONFIG_MQTT_LIB
|
|
||||||
include $(srctree)/lib/iot/mqtt/Makefile
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef CONFIG_HTTP_PARSER
|
|
||||||
include $(srctree)/lib/iot/http/Makefile
|
|
||||||
endif
|
|
|
@ -1,5 +0,0 @@
|
||||||
ccflags-y += -I$(srctree)/lib/iot/dns
|
|
||||||
|
|
||||||
obj-y := dns_pack.o
|
|
||||||
obj-y += dns_client.o
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
obj-y := mqtt_pkt.o
|
|
||||||
obj-y += mqtt.o
|
|
|
@ -1,4 +0,0 @@
|
||||||
subdir-ccflags-y +=-I$(srctree)/lib/iot/zoap
|
|
||||||
ccflags-y += -I${srctree}/net/ip
|
|
||||||
|
|
||||||
obj-y := zoap.o link-format.o
|
|
|
@ -1 +0,0 @@
|
||||||
ZEPHYRINCLUDE += -I$(srctree)/lib/iot/zoap
|
|
|
@ -63,8 +63,8 @@ The number of additional queries is controlled by the
|
||||||
DNS_RESOLVER_ADDITIONAL_QUERIES Kconfig variable.
|
DNS_RESOLVER_ADDITIONAL_QUERIES Kconfig variable.
|
||||||
|
|
||||||
For more information about DNS configuration variables, see:
|
For more information about DNS configuration variables, see:
|
||||||
lib/iot/dns/Kconfig. The DNS resolver API can be found at
|
subsys/net/lib/dns/Kconfig. The DNS resolver API can be found at
|
||||||
include/iot/dns_client.h.
|
include/net/dns_client.h.
|
||||||
|
|
||||||
Building instructions and sample output can be found at the
|
Building instructions and sample output can be found at the
|
||||||
samples/net/dns_client/README_xxx files.
|
samples/net/dns_client/README_xxx files.
|
||||||
|
|
|
@ -10,7 +10,7 @@ The DNS API allows to recover IPv4 and IPv6 addresses.
|
||||||
API Return Codes
|
API Return Codes
|
||||||
================
|
================
|
||||||
|
|
||||||
API return codes are documented in the API (see include/iot/dns_client.h).
|
API return codes are documented in the API (see include/net/dns_client.h).
|
||||||
|
|
||||||
Macro | Value | Description
|
Macro | Value | Description
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <zephyr.h>
|
#include <zephyr.h>
|
||||||
#include <iot/dns_client.h>
|
#include <net/dns_client.h>
|
||||||
#include <net/net_core.h>
|
#include <net/net_core.h>
|
||||||
#include <net/net_if.h>
|
#include <net/net_if.h>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ ccflags-y +=-I${ZEPHYR_BASE}/samples/net/common/
|
||||||
ccflags-y +=-DNET_TESTING_SERVER=1
|
ccflags-y +=-DNET_TESTING_SERVER=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ccflags-y += -I${ZEPHYR_BASE}/lib/iot/zoap
|
|
||||||
ccflags-$(CONFIG_NET_L2_BLUETOOTH) += -I${ZEPHYR_BASE}/samples/bluetooth/
|
ccflags-$(CONFIG_NET_L2_BLUETOOTH) += -I${ZEPHYR_BASE}/samples/bluetooth/
|
||||||
|
|
||||||
obj-y = leds-demo.o
|
obj-y = leds-demo.o
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
#include <gatt/ipss.h>
|
#include <gatt/ipss.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <zoap.h>
|
#include <net/zoap.h>
|
||||||
#include <link-format.h>
|
#include <net/zoap_link_format.h>
|
||||||
|
|
||||||
#define MY_COAP_PORT 5683
|
#define MY_COAP_PORT 5683
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[test]
|
[test]
|
||||||
tags = net
|
tags = net zoap
|
||||||
build_only = true
|
build_only = true
|
||||||
arch_whitelist = x86
|
arch_whitelist = x86
|
||||||
platform_exclude = quark_d2000_crb # not enough RAM
|
platform_exclude = quark_d2000_crb # not enough RAM
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <net/buf.h>
|
#include <net/buf.h>
|
||||||
#include <net/nbuf.h>
|
#include <net/nbuf.h>
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
||||||
#include <zoap.h>
|
#include <net/zoap.h>
|
||||||
|
|
||||||
#define MY_COAP_PORT 5683
|
#define MY_COAP_PORT 5683
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
ccflags-y += -I${ZEPHYR_BASE}/net/yaip
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_NET_TESTING), y)
|
ifeq ($(CONFIG_NET_TESTING), y)
|
||||||
ccflags-y +=-I${ZEPHYR_BASE}/samples/net/common/
|
ccflags-y +=-I${ZEPHYR_BASE}/samples/net/common/
|
||||||
ccflags-y +=-DNET_TESTING_SERVER=1
|
ccflags-y +=-DNET_TESTING_SERVER=1
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <net/nbuf.h>
|
#include <net/nbuf.h>
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
||||||
|
|
||||||
#include <zoap.h>
|
#include <net/zoap.h>
|
||||||
|
|
||||||
#define MY_COAP_PORT 5683
|
#define MY_COAP_PORT 5683
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ if NETWORKING
|
||||||
|
|
||||||
source "subsys/net/ip/Kconfig"
|
source "subsys/net/ip/Kconfig"
|
||||||
|
|
||||||
|
source "subsys/net/lib/Kconfig"
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
|
@ -6,4 +6,8 @@ obj-y += ip/nbuf.o
|
||||||
else
|
else
|
||||||
obj-y += ip/
|
obj-y += ip/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
include lib/Makefile
|
||||||
|
obj-y += lib/
|
||||||
|
|
|
@ -14,14 +14,14 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
menu "IoT Protocols"
|
menu "Network Protocols"
|
||||||
|
|
||||||
source "lib/iot/zoap/Kconfig"
|
source "subsys/net/lib/zoap/Kconfig"
|
||||||
|
|
||||||
source "lib/iot/dns/Kconfig"
|
source "subsys/net/lib/dns/Kconfig"
|
||||||
|
|
||||||
source "lib/iot/mqtt/Kconfig"
|
source "subsys/net/lib/mqtt/Kconfig"
|
||||||
|
|
||||||
source "lib/iot/http/Kconfig"
|
source "subsys/net/lib/http/Kconfig"
|
||||||
|
|
||||||
endmenu
|
endmenu
|
15
subsys/net/lib/Makefile
Normal file
15
subsys/net/lib/Makefile
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
ifdef CONFIG_ZOAP
|
||||||
|
include $(srctree)/subsys/net/lib/zoap/Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_DNS_RESOLVER
|
||||||
|
include $(srctree)/subsys/net/lib/dns/Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_MQTT_LIB
|
||||||
|
include $(srctree)/subsys/net/lib/mqtt/Makefile
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CONFIG_HTTP_PARSER
|
||||||
|
include $(srctree)/subsys/net/lib/http/Makefile
|
||||||
|
endif
|
7
subsys/net/lib/dns/Makefile
Normal file
7
subsys/net/lib/dns/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
ZEPHYRINCLUDE += -I$(srctree)/subsys/net/lib/dns
|
||||||
|
|
||||||
|
ccflags-y += -I$(srctree)/subsys/net/lib/dns
|
||||||
|
|
||||||
|
obj-y := dns_pack.o
|
||||||
|
obj-y += dns_client.o
|
||||||
|
|
|
@ -15,8 +15,4 @@ Usage:
|
||||||
Before calling the resolver, it must be initialized via the 'dns_init'
|
Before calling the resolver, it must be initialized via the 'dns_init'
|
||||||
routine.
|
routine.
|
||||||
|
|
||||||
'dnsX_resolve_quick' routines just return the first IP address.
|
|
||||||
However, domain names may be served by more IP addresses, so
|
|
||||||
'dnsX_resolve' routines may be more useful.
|
|
||||||
|
|
||||||
See samples/net/dns_client/src/main.c.
|
See samples/net/dns_client/src/main.c.
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iot/dns_client.h>
|
#include <net/dns_client.h>
|
||||||
#include "dns_pack.h"
|
#include "dns_pack.h"
|
||||||
|
|
||||||
#include <drivers/rand32.h>
|
#include <drivers/rand32.h>
|
|
@ -21,7 +21,7 @@
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#include <iot/http_parser.h>
|
#include <net/http_parser.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
4
subsys/net/lib/mqtt/Makefile
Normal file
4
subsys/net/lib/mqtt/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
ZEPHYRINCLUDE += -I$(srctree)/subsys/net/lib/mqtt
|
||||||
|
|
||||||
|
obj-y := mqtt_pkt.o
|
||||||
|
obj-y += mqtt.o
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iot/mqtt.h>
|
#include <net/mqtt.h>
|
||||||
#include "mqtt_pkt.h"
|
#include "mqtt_pkt.h"
|
||||||
|
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
|
@ -30,7 +30,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include <iot/mqtt_types.h>
|
#include <net/mqtt_types.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mqtt_pack_connack Packs the MQTT CONNACK message
|
* @brief mqtt_pack_connack Packs the MQTT CONNACK message
|
4
subsys/net/lib/zoap/Kbuild
Normal file
4
subsys/net/lib/zoap/Kbuild
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
subdir-ccflags-y +=-I$(srctree)/subsys/net/lib/zoap
|
||||||
|
ccflags-y += -I${srctree}/net/ip
|
||||||
|
|
||||||
|
obj-y := zoap.o zoap_link_format.o
|
1
subsys/net/lib/zoap/Makefile
Normal file
1
subsys/net/lib/zoap/Makefile
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ZEPHYRINCLUDE += -I$(srctree)/subsys/net/lib/zoap
|
|
@ -26,7 +26,7 @@
|
||||||
#include <net/nbuf.h>
|
#include <net/nbuf.h>
|
||||||
#include <net/net_ip.h>
|
#include <net/net_ip.h>
|
||||||
|
|
||||||
#include "zoap.h"
|
#include <net/zoap.h>
|
||||||
|
|
||||||
struct option_context {
|
struct option_context {
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include <misc/printk.h>
|
#include <misc/printk.h>
|
||||||
|
|
||||||
#include "zoap.h"
|
#include <net/zoap.h>
|
||||||
#include "link-format.h"
|
#include <net/zoap_link_format.h>
|
||||||
|
|
||||||
static int format_uri(const char * const *path, struct net_buf *buf)
|
static int format_uri(const char * const *path, struct net_buf *buf)
|
||||||
{
|
{
|
|
@ -1,4 +0,0 @@
|
||||||
ccflags-y += -I$(ZEPHYR_BASE)/lib/iot/mqtt
|
|
||||||
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
|
|
||||||
|
|
||||||
obj-y = test_mqtt_packet.o
|
|
|
@ -1,4 +1,7 @@
|
||||||
# Comment the following line if you want to try another libc
|
CONFIG_NETWORKING=y
|
||||||
|
CONFIG_RANDOM_GENERATOR=y
|
||||||
|
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||||
|
|
||||||
CONFIG_HTTP_PARSER=y
|
CONFIG_HTTP_PARSER=y
|
||||||
# Enable strict parser by uncommenting the following line
|
# Enable strict parser by uncommenting the following line
|
||||||
# CONFIG_HTTP_PARSER_STRICT=y
|
# CONFIG_HTTP_PARSER_STRICT=y
|
|
@ -16,4 +16,4 @@
|
||||||
|
|
||||||
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
|
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
|
||||||
|
|
||||||
obj-y += test_http_header.o
|
obj-y += http_header_fields.o
|
|
@ -19,7 +19,7 @@
|
||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iot/http_parser.h>
|
#include <net/http_parser.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[test]
|
[test]
|
||||||
tags = http iot
|
tags = http
|
||||||
build_only = false
|
build_only = false
|
4
tests/net/lib/mqtt_packet/src/Makefile
Normal file
4
tests/net/lib/mqtt_packet/src/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
ccflags-y += -I$(ZEPHYR_BASE)/subsys/net/lib/mqtt
|
||||||
|
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
|
||||||
|
|
||||||
|
obj-y = mqtt_packet.o
|
|
@ -1,4 +1,4 @@
|
||||||
[test]
|
[test]
|
||||||
tags = mqtt iot
|
tags = mqtt
|
||||||
build_only = false
|
build_only = false
|
||||||
platform_whitelist = qemu_x86 arduino_101 quark_se_c1000_devboard frdm_k64f
|
platform_whitelist = qemu_x86 arduino_101 quark_se_c1000_devboard frdm_k64f
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <tc_util.h>
|
#include <tc_util.h>
|
||||||
|
|
||||||
#include <zoap.h>
|
#include <net/zoap.h>
|
||||||
|
|
||||||
#define ZOAP_BUF_SIZE 128
|
#define ZOAP_BUF_SIZE 128
|
||||||
#define ZOAP_LIMITED_BUF_SIZE 13
|
#define ZOAP_LIMITED_BUF_SIZE 13
|
Loading…
Add table
Add a link
Reference in a new issue