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:
Flavio Santes 2016-12-23 15:09:15 -06:00 committed by Tomasz Bursztyka
parent dc862ec104
commit ac7300611c
67 changed files with 74 additions and 72 deletions

View file

@ -106,7 +106,8 @@ INPUT = \
include/arch/nios2/ \
lib/libc/minimal/include/ \
ext/lib/crypto/tinycrypt/include/ \
lib/iot/zoap/zoap.h \
include/net/zoap.h \
include/net/dns_client.h \
tests/ztest/include/
INPUT_ENCODING = UTF-8
FILE_PATTERNS = "*.c" "*.h" "*.S"

View file

@ -17,7 +17,7 @@
#ifndef _MQTT_H_
#define _MQTT_H_
#include <iot/mqtt_types.h>
#include <net/mqtt_types.h>
#include <net/net_context.h>
/**

View file

@ -1,2 +1 @@
obj-y += libc/
obj-y += iot/

View file

@ -19,6 +19,4 @@ menu "Cryptography"
source "lib/crypto/tinycrypt/Kconfig"
endmenu
source "lib/iot/Kconfig"
source "lib/libc/Kconfig"

View file

@ -13,5 +13,3 @@ endif
else
ZEPHYRINCLUDE += -I$(srctree)/lib/libc/minimal/include
endif
include $(srctree)/lib/iot/Makefile

View file

@ -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

View file

@ -1,5 +0,0 @@
ccflags-y += -I$(srctree)/lib/iot/dns
obj-y := dns_pack.o
obj-y += dns_client.o

View file

@ -1,2 +0,0 @@
obj-y := mqtt_pkt.o
obj-y += mqtt.o

View file

@ -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

View file

@ -1 +0,0 @@
ZEPHYRINCLUDE += -I$(srctree)/lib/iot/zoap

View file

@ -63,8 +63,8 @@ The number of additional queries is controlled by the
DNS_RESOLVER_ADDITIONAL_QUERIES Kconfig variable.
For more information about DNS configuration variables, see:
lib/iot/dns/Kconfig. The DNS resolver API can be found at
include/iot/dns_client.h.
subsys/net/lib/dns/Kconfig. The DNS resolver API can be found at
include/net/dns_client.h.
Building instructions and sample output can be found at the
samples/net/dns_client/README_xxx files.

View file

@ -10,7 +10,7 @@ The DNS API allows to recover IPv4 and IPv6 addresses.
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
------------------------------------------------------------------------

View file

@ -15,7 +15,7 @@
*/
#include <zephyr.h>
#include <iot/dns_client.h>
#include <net/dns_client.h>
#include <net/net_core.h>
#include <net/net_if.h>

View file

@ -5,7 +5,6 @@ ccflags-y +=-I${ZEPHYR_BASE}/samples/net/common/
ccflags-y +=-DNET_TESTING_SERVER=1
endif
ccflags-y += -I${ZEPHYR_BASE}/lib/iot/zoap
ccflags-$(CONFIG_NET_L2_BLUETOOTH) += -I${ZEPHYR_BASE}/samples/bluetooth/
obj-y = leds-demo.o

View file

@ -41,8 +41,8 @@
#include <gatt/ipss.h>
#endif
#include <zoap.h>
#include <link-format.h>
#include <net/zoap.h>
#include <net/zoap_link_format.h>
#define MY_COAP_PORT 5683

View file

@ -1,5 +1,5 @@
[test]
tags = net
tags = net zoap
build_only = true
arch_whitelist = x86
platform_exclude = quark_d2000_crb # not enough RAM

View file

@ -23,7 +23,7 @@
#include <net/buf.h>
#include <net/nbuf.h>
#include <net/net_ip.h>
#include <zoap.h>
#include <net/zoap.h>
#define MY_COAP_PORT 5683

View file

@ -1,5 +1,3 @@
ccflags-y += -I${ZEPHYR_BASE}/net/yaip
ifeq ($(CONFIG_NET_TESTING), y)
ccflags-y +=-I${ZEPHYR_BASE}/samples/net/common/
ccflags-y +=-DNET_TESTING_SERVER=1

View file

@ -25,7 +25,7 @@
#include <net/nbuf.h>
#include <net/net_ip.h>
#include <zoap.h>
#include <net/zoap.h>
#define MY_COAP_PORT 5683

View file

@ -72,6 +72,8 @@ if NETWORKING
source "subsys/net/ip/Kconfig"
source "subsys/net/lib/Kconfig"
endif
endmenu

View file

@ -6,4 +6,8 @@ obj-y += ip/nbuf.o
else
obj-y += ip/
endif
endif
include lib/Makefile
obj-y += lib/

View file

@ -14,14 +14,14 @@
# 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

15
subsys/net/lib/Makefile Normal file
View 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

View 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

View file

@ -15,8 +15,4 @@ Usage:
Before calling the resolver, it must be initialized via the 'dns_init'
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.

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <iot/dns_client.h>
#include <net/dns_client.h>
#include "dns_pack.h"
#include <drivers/rand32.h>

View file

@ -21,7 +21,7 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <iot/http_parser.h>
#include <net/http_parser.h>
#include <assert.h>
#include <stddef.h>
#include <ctype.h>

View file

@ -0,0 +1,4 @@
ZEPHYRINCLUDE += -I$(srctree)/subsys/net/lib/mqtt
obj-y := mqtt_pkt.o
obj-y += mqtt.o

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <iot/mqtt.h>
#include <net/mqtt.h>
#include "mqtt_pkt.h"
#include <net/net_ip.h>

View file

@ -30,7 +30,7 @@
#include <stdint.h>
#include <stddef.h>
#include <iot/mqtt_types.h>
#include <net/mqtt_types.h>
/**
* @brief mqtt_pack_connack Packs the MQTT CONNACK message

View 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

View file

@ -0,0 +1 @@
ZEPHYRINCLUDE += -I$(srctree)/subsys/net/lib/zoap

View file

@ -26,7 +26,7 @@
#include <net/nbuf.h>
#include <net/net_ip.h>
#include "zoap.h"
#include <net/zoap.h>
struct option_context {
uint8_t *buf;

View file

@ -27,8 +27,8 @@
#include <misc/printk.h>
#include "zoap.h"
#include "link-format.h"
#include <net/zoap.h>
#include <net/zoap_link_format.h>
static int format_uri(const char * const *path, struct net_buf *buf)
{

View file

@ -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

View file

@ -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
# Enable strict parser by uncommenting the following line
# CONFIG_HTTP_PARSER_STRICT=y

View file

@ -16,4 +16,4 @@
ccflags-y += -I$(ZEPHYR_BASE)/tests/include
obj-y += test_http_header.o
obj-y += http_header_fields.o

View file

@ -19,7 +19,7 @@
* IN THE SOFTWARE.
*/
#include <iot/http_parser.h>
#include <net/http_parser.h>
#include <string.h>
#include <errno.h>

View file

@ -1,3 +1,3 @@
[test]
tags = http iot
tags = http
build_only = false

View 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

View file

@ -1,4 +1,4 @@
[test]
tags = mqtt iot
tags = mqtt
build_only = false
platform_whitelist = qemu_x86 arduino_101 quark_se_c1000_devboard frdm_k64f

View file

@ -30,7 +30,7 @@
#include <tc_util.h>
#include <zoap.h>
#include <net/zoap.h>
#define ZOAP_BUF_SIZE 128
#define ZOAP_LIMITED_BUF_SIZE 13