diff --git a/Makefile b/Makefile index eb0b3264a4ec80f3353f645109a22ccaa5ed6ea4..27b42b29c9c3e0d0fd6f6e1c232b140011ebd855 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,7 @@ ifndef PLATFORM PLATFORM := linux - FLAVOUR := x86_generic +FLAVOUR := iopsys #FLAVOUR := arm_wrt1900acx #FLAVOUR := x86_windows_mingw @@ -134,13 +134,6 @@ ifeq ($(PLATFORM),linux) endif CCFLAGS += -g -O0 -Wall -Werror #-Wextra - CCFLAGS += -DMAX_NETWORK_SEGMENT_SIZE=1500 - CCFLAGS += -DINT8U="unsigned char" - CCFLAGS += -DINT16U="unsigned short int" - CCFLAGS += -DINT32U="unsigned int" - CCFLAGS += -DINT8S="signed char" - CCFLAGS += -DINT16S="signed short int" - CCFLAGS += -DINT32S="signed int" CCFLAGS += -D_GNU_SOURCE else $(error "'PLATFORM' variable was not set to a valid value") diff --git a/include/meshcomms.h b/include/meshcomms.h index 263b927325ba12fd9fa7e7e0b242a055e7e442d9..fe5a8919109d9bbec35931b269edd7fdeadfaa2a 100644 --- a/include/meshcomms.h +++ b/include/meshcomms.h @@ -2,27 +2,18 @@ #define _MESHCOMMS_H_ // Include common header files -#include <meshcomms/common/packet_tools.h> -#include <meshcomms/common/platform.h> -#include <meshcomms/common/utils.h> +#include "platform_datatypes.h" +#include "packet_tools.h" +#include "platform.h" +#include "utils.h" // Include factory header files -#include <meshcomms/factory/1905_alme.h> -#include <meshcomms/factory/1905_cmdus.h> -#include <meshcomms/factory/1905_l2.h> -#include <meshcomms/factory/1905_tlvs.h> -#include <meshcomms/factory/lldp_payload.h> -#include <meshcomms/factory/lldp_tlvs.h> -#include <meshcomms/factory/media_specific_blobs.h> - -// Include al header files -#include <meshcomms/al/al.h> -#include <meshcomms/al/platform_alme_server.h> -#include <meshcomms/al/platform_crypto.h> -#include <meshcomms/al/platform_interfaces.h> -#include <meshcomms/al/platform_os.h> - -// Include bbf header files -#include <meshcomms/bbf/bbf_tlvs.h> +#include "1905_alme.h" +#include "1905_cmdus.h" +#include "1905_l2.h" +#include "1905_tlvs.h" +#include "lldp_payload.h" +#include "lldp_tlvs.h" +#include "media_specific_blobs.h" #endif //_MESHCOMMS_H_ diff --git a/src/al/Makefile b/src/al/Makefile index 561aefc4885f5cdc7ce5302d85250e1ca5ed79ac..9a10acbb006f0e7476af8ce428735178eb2f25c8 100644 --- a/src/al/Makefile +++ b/src/al/Makefile @@ -90,6 +90,8 @@ SRC_PLATFORM := $(wildcard src_$(PLATFORM)/*.c) OBJ_INDEPENDENT := $(patsubst %.c,$(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o,$(SRC_INDEPENDENT)) OBJ_PLATFORM := $(patsubst %.c,$(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o,$(SRC_PLATFORM)) +LIB_OBJ := $(shell find $(OUTPUT_FOLDER)/tmp/ -name '*.o') + INTERNAL_INC_INDEPENDENT := src_independent internal_interfaces INTERNAL_INC_INDEPENDENT += $(sort $(dir $(wildcard interfaces/extensions/*/))) $(sort $(dir $(wildcard src_independent/extensions/*/))) INTERNAL_INC_PLATFORM := src_$(PLATFORM) internal_interfaces @@ -103,41 +105,22 @@ HDR_PLATFORM := $(shell find $(INTERNAL_INC_PLATFORM) $(EXTERNA ################################################################################ # Targets ################################################################################ -ifeq ($(FLAVOUR), iopsys) -OBJ_WMAIN := $(filter-out %/al_entity_main.o,$(OBJ_PLATFORM)) -OBJ_MAIN := $(filter %/al_entity_main.o,$(OBJ_PLATFORM)) -endif .PHONY: all -all: $(EXE) +all: $(EXE) $(MLIB) -ifeq ($(FLAVOUR), iopsys) -$(EXE): $(OBJ_MAIN) $(MLIB) - $(CC) $^ $(LDFLAGS) -o $@ +$(MLIB): + $(CC) -shared -Wl,-soname,libmeshcomms.so $(LIB_OBJ) -o $@ -$(MLIB): $(OBJ_INDEPENDENT) $(OBJ_WMAIN) - $(CC) -L $(OUTPUT_FOLDER) -shared -Wl,-soname,libmeshcomms.so -o $@ $^ -lc -lcommon -lfactory -else $(EXE): $(OBJ_INDEPENDENT) $(OBJ_PLATFORM) $(FACTORY_LIB) $(COMMON_LIB) $(CC) $^ $(LDFLAGS) -o $@ -endif - $(OBJ_INDEPENDENT) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_INDEPENDENT) $(foreach directory, $(sort $(dir $(wildcard $(SRC_INDEPENDENT)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);) $(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_INDEPENDENT) $(EXTERNAL_INC)) $< -o $@ -ifeq ($(FLAVOUR), iopsys) -$(OBJ_WMAIN) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM) - $(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);) - $(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@ -$(OBJ_MAIN) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM) - $(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);) - $(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@ -else $(OBJ_PLATFORM) : $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/%.o : %.c $(HDR_PLATFORM) $(foreach directory, $(sort $(dir $(wildcard $(SRC_PLATFORM)))), $(MKDIR) $(OUTPUT_FOLDER)/tmp/$(AL_DIRECTORY)/$(directory);) $(CC) $(CCFLAGS) -c $(addprefix -I,$(INTERNAL_INC_PLATFORM) $(EXTERNAL_INC)) $< -o $@ -endif .PHONY: clean clean: rm -rf $(EXE) diff --git a/src/al/src_linux/platform_interfaces_wrt1900acx_priv.h b/src/al/src_linux/platform_interfaces_wrt1900acx_priv.h index 764ca5dbaaa0fb16ec8eff4b159d5ab132b77fb6..4a3de4c4555239ee9866b1b4501f8f60e86dbaa2 100644 --- a/src/al/src_linux/platform_interfaces_wrt1900acx_priv.h +++ b/src/al/src_linux/platform_interfaces_wrt1900acx_priv.h @@ -57,7 +57,7 @@ #ifndef _PLATFORM_INTERFACES_WRT1900ACX_PRIV_H_ #define _PLATFORM_INTERFACES_WRT1900ACX_PRIV_H_ - +#include "platform_datatypes.h" // Fill the "interfaceInfo" structure (associated to the provided // "interface_name") by obtaining information from the OpenWRT UCI subsystem. diff --git a/src/common/interfaces/platform.h b/src/common/interfaces/platform.h index e66085bb3ca338052ade3cf8e1077a803938dd9b..8cfb3624d775c856862be2fab198ad7669751762 100644 --- a/src/common/interfaces/platform.h +++ b/src/common/interfaces/platform.h @@ -67,48 +67,7 @@ //////////////////////////////////////////////////////////////////////////////// // Hardware stuff //////////////////////////////////////////////////////////////////////////////// - -// The following preprocessor macros must be defined to a platform-dependent -// value: -// -// MAX_NETWORK_SEGMENT_SIZE --------> This is the maximum packet size that -// is allowed in your platform. It is -// used to 'fragment' CMDUs. Note that -// even if your platform supports packets -// bigger than 1500 bytes, this macro -// must never be bigger than that. This -// macro is only present in this file for -// those special cases where, for some -// platform related reason, packets must -// be smaller than 1500. -// -// INT8U | These types must be adjusted to that -// INT16U |---------------------------> they represent 1, 2 and 4 bytes -// INT32U | unsigned integers respectively. -// -// INT8S | These types must be adjusted to that -// INT16S |---------------------------> they represent 1, 2 and 4 bytes signed -// INT32S | integers respectively. -// -// -// In the next few lines we are just going to check that these are defined, -// nothing else. -// In order to actually define them use the "root" Makefile where these MACROS -// are sent to the compiler using the "-D flag" (open the "root" Makefile and -// search for "CCFLAGS" to understand how to do this) - -#ifndef MAX_NETWORK_SEGMENT_SIZE -# error "You must define 'MAX_NETWORK_SEGMENT_SIZE' to some value (for example, '1500')" -#endif - -#if !defined(INT8U) || !defined(INT16U) || !defined(INT32U) -# error "You must define 'INT8U', 'INT16U' and 'INT32U' to represent 8, 16 and 32 bit unsigned integers respectively" -#endif - -#if !defined(INT8S) || !defined(INT16S) || !defined(INT32S) -# error "You must define 'INT8S', 'INT16S' and 'INT32S' to represent 8, 16 and 32 bit signed integers respectively" -#endif - +#include "platform_datatypes.h" //////////////////////////////////////////////////////////////////////////////// // Typical libc stuff diff --git a/src/common/interfaces/platform_datatypes.h b/src/common/interfaces/platform_datatypes.h new file mode 100644 index 0000000000000000000000000000000000000000..b97819443b3fd1cd3384c4964f0149a7f37c1af7 --- /dev/null +++ b/src/common/interfaces/platform_datatypes.h @@ -0,0 +1,68 @@ +/* + * Broadband Forum IEEE 1905.1/1a stack + * + * Copyright (c) 2017, Broadband Forum + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Subject to the terms and conditions of this license, each copyright + * holder and contributor hereby grants to those receiving rights under + * this license a perpetual, worldwide, non-exclusive, no-charge, + * royalty-free, irrevocable (except for failure to satisfy the + * conditions of this license) patent license to make, have made, use, + * offer to sell, sell, import, and otherwise transfer this software, + * where such license applies only to those patent claims, already + * acquired or hereafter acquired, licensable by such copyright holder or + * contributor that are necessarily infringed by: + * + * (a) their Contribution(s) (the licensed copyrights of copyright holders + * and non-copyrightable additions of contributors, in source or binary + * form) alone; or + * + * (b) combination of their Contribution(s) with the work of authorship to + * which such Contribution(s) was added by such copyright holder or + * contributor, if, at the time the Contribution is added, such addition + * causes such combination to be necessarily infringed. The patent + * license shall not apply to any other combinations which include the + * Contribution. + * + * Except as expressly stated above, no rights or licenses from any + * copyright holder or contributor is granted under this license, whether + * expressly, by implication, estoppel or otherwise. + * + * DISCLAIMER + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + */ + +#ifndef _PLATFORM_DATATYPES_H_ +#define _PLATFORM_DATATYPES_H_ + +typedef unsigned char INT8U; +typedef unsigned short int INT16U; +typedef unsigned int INT32U; +typedef signed char INT8S; +typedef signed short int INT16S; +typedef signed int INT32S; +#define MAX_NETWORK_SEGMENT_SIZE 1500 +#endif diff --git a/src/common/interfaces/utils.h b/src/common/interfaces/utils.h index ca6d56e99cce90a7b4fc8cd900ee6d293b9077a9..809e5b22f61e9261405b5c8a9f108a2d4396be95 100644 --- a/src/common/interfaces/utils.h +++ b/src/common/interfaces/utils.h @@ -57,7 +57,7 @@ #ifndef _UTILS_H_ #define _UTILS_H_ - +#include "platform_datatypes.h" // This is an auxiliary function which is used when calling the "visit_*()" // family of functions so that the contents of the memory structures can be // printed on screen for debugging/logging purposes. diff --git a/src/factory/interfaces/media_specific_blobs.h b/src/factory/interfaces/media_specific_blobs.h index 4539eb703697dd65e0be875ccddf63261bf381e1..8ab81297b27e7a9ec84532edef77d87b191d2b61 100644 --- a/src/factory/interfaces/media_specific_blobs.h +++ b/src/factory/interfaces/media_specific_blobs.h @@ -57,7 +57,7 @@ #ifndef _MEDIA_SPECIFIC_BLOBS_H_ #define _MEDIA_SPECIFIC_BLOBS_H_ - +#include "platform_datatypes.h" //////////////////////////////////////////////////////////////////////////////// // Structure type used for generic interfaces