Cleanup of CMake.config system
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Wed, 14 Mar 2012 10:24:22 +0000 (11:24 +0100)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Wed, 14 Mar 2012 10:24:22 +0000 (11:24 +0100)
18 files changed:
CMake.config
CMake.flags
CMakeLists.txt
src-api/builddata/CMakeLists.txt
src-api/builddata/app_config.h.in [new file with mode: 0644]
src-api/core/CMakeLists.txt
src-api/packetbb/CMakeLists.txt
src-api/packetbb/pbb_context.h
src-api/packetbb/pbb_msg_generator.c
src-api/packetbb/pbb_pkt_generator.c
src-api/packetbb/pbb_reader.c
src-api/packetbb/pbb_tlv_writer.c
src-api/packetbb/pbb_writer.c
src/CMake.link_dynamic
src/CMake.link_static
src/olsr_main.c
tests/packetbb/CMakeLists.txt
tests/packetbb/test_packetbb_reader_dropcontext.c

index 9bd3eb6..76385c8 100644 (file)
@@ -1,10 +1,23 @@
-###################################
-#### Generic API configuration ####
-###################################
+###############################
+#### Generic configuration ####
+###############################
 
-# set CMAKE build type (Debug, Release, MinSizeRel)
+# set CMAKE build type for application, api and plugins
+# (Debug, Release, MinSizeRel)
 set (CMAKE_BUILD_TYPE Debug)
 
+# remove logging level from application, core-api and plugins
+set (OONF_REMOVE_DEBUG_LOGGING false)
+set (OONF_REMOVE_INFO_LOGGING  false)
+set (OONF_REMOVE_WARN_LOGGING  false)
+
+# remove help texts from application, core-api and plugins
+set (OONF_REMOVE_HELPTEXT false)
+
+###########################################
+#### Default Application configuration ####
+###########################################
+
 # set name of program the executable and library prefix
 set (OONF_APP Olsrd)
 set (OONF_EXE olsrd)
@@ -37,33 +50,32 @@ set (OONF_NEED_ROOT true)
 # set to true if the application needs to set ip routes for traffic forwarding
 set (OONF_NEED_ROUTING true)
 
-# allow removal of Logging levels from code
-set (OONF_REMOVE_DEBUG_LOGGING false)
-set (OONF_REMOVE_INFO_LOGGING  false)
-set (OONF_REMOVE_WARN_LOGGING  false)
+# set to true to link packetbb API to application
+set (OONF_NEED_PACKETBB true)
 
-# set to true to remove help texts from code
-set (OONF_REMOVE_HELPTEXT false)
+# set port for packetbb scheduler
+# (default should be 269 according to RFC 5498)
+set (OONF_PACKETBB_PORT 269)
 
 ####################################
 #### PacketBB API configuration ####
 ####################################
 
-# set to 1 to disallow the consumer to drop a tlv context
-set (PBB_DISALLOW_CONSUMER_CONTEXT_DROP 0)
+# disallow the consumer to drop a tlv context
+set (PBB_DISALLOW_CONSUMER_CONTEXT_DROP false)
 
-# set to 1 to activate assets() to check state of the pbb write
+# activate assets() to check state of the pbb write
 # and prevent calling functions at the wrong time
-set (PBB_WRITER_STATE_MACHINE 1)
+set (PBB_WRITER_STATE_MACHINE true)
 
-# set to 1 to activate several unnecessary cleanup operations
+# activate several unnecessary cleanup operations
 # that make debugging the API easier
-set (PBB_DEBUG_CLEANUP 1)
+set (PBB_DEBUG_CLEANUP true)
 
-# set to 1 to activate rfc5444 addressblock compression
-set (PBB_DO_ADDR_COMPRESSION 1)
+# activate rfc5444 address-block compression
+set (PBB_DO_ADDR_COMPRESSION true)
 
 # set to 1 to clear all bits in an address which are not included
 # in the subnet mask
-# set this to 0 to make interop tests!
-set (PBB_CLEAR_ADDRESS_POSTFIX 0)
+# set this to false to make interop tests!
+set (PBB_CLEAR_ADDRESS_POSTFIX false)
index 62b14fe..314cc0e 100644 (file)
@@ -9,7 +9,7 @@ function(add_compiler_flag flag)
     endif()
 endfunction(add_compiler_flag)
 
-# allow to remove parts of the logging/helptext for smaller executable
+# compiler flags that needs to be there both for API and application
 IF (OONF_REMOVE_DEBUG_LOGGING)
     ADD_DEFINITIONS(-DREMOVE_LOG_DEBUG)
 ENDIF (OONF_REMOVE_DEBUG_LOGGING)
@@ -24,16 +24,7 @@ IF (OONF_REMOVE_HELPTEXT)
     ADD_DEFINITIONS(-DREMOVE_HELPTEXT)
 ENDIF(OONF_REMOVE_HELPTEXT)
 
-# set preprocessor variables for level of root access the app needs
-IF (OONF_NEED_ROOT)
-    ADD_DEFINITIONS(-DNEED_ROOT)
-ENDIF (OONF_NEED_ROOT)
-
-IF (OONF_NEED_ROUTING)
-    ADD_DEFINITIONS(-DNEED_ROUTING)
-ENDIF(OONF_NEED_ROUTING)
-
-# OS-specific settings
+# OS-specific compiler settings
 IF(ANDROID OR WIN32)
     # Android and windows don't compile well with c99
     ADD_DEFINITIONS(-std=gnu99)
index 6c41702..467421a 100644 (file)
@@ -34,6 +34,7 @@ endif(DOXYGEN_FOUND)
 include_directories(src)
 include_directories(src-api)
 include_directories(src-api/core)
+include_directories(${CMAKE_BINARY_DIR})
 
 ENABLE_TESTING()
 
index 8c12619..a92b61b 100644 (file)
@@ -2,6 +2,8 @@
 SET(GEN_DATA_C           ${PROJECT_BINARY_DIR}/data.c)
 SET(GEN_PLUGIN_STATIC_C  ${PROJECT_BINARY_DIR}/plugin_static.c)
 
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/app_config.h.in ${CMAKE_BINARY_DIR}/builddata/app_config.h)
+
 ADD_CUSTOM_TARGET(AppCleanData ALL
     COMMAND ${CMAKE_COMMAND} -E remove ${GEN_BUILDDATA_H} ${GEN_PLUGIN_STATIC_C}
     COMMENT "Remove old builddata"
diff --git a/src-api/builddata/app_config.h.in b/src-api/builddata/app_config.h.in
new file mode 100644 (file)
index 0000000..a169fe3
--- /dev/null
@@ -0,0 +1,49 @@
+
+/*
+ * The olsr.org Optimized Link-State Routing daemon(olsrd)
+ * Copyright (c) 2004-2012, the olsr.org team - see HISTORY file
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * 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.
+ * * Neither the name of olsr.org, olsrd nor the names of its
+ *   contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * 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 OWNER 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.
+ *
+ * Visit http://www.olsr.org for more information.
+ *
+ * If you find this software useful feel free to make a donation
+ * to the project. For more information see the website or contact
+ * the copyright holders.
+ *
+ */
+
+#ifndef OLSR_APP_CONFIG_H_
+#define OLSR_APP_CONFIG_H_
+
+#define OONF_NEED_ROOT ${OONF_NEED_ROOT}
+#define OONF_NEED_ROUTING ${OONF_NEED_ROUTING}
+#define OONF_NEED_PACKETBB ${OONF_NEED_PACKETBB}
+
+#endif /* OLSR_APP_CONFIG_H_ */
index 14518e6..ae30a13 100644 (file)
@@ -15,7 +15,7 @@ SET(OONF_CORE_SRCS olsr_cfg.c
                    olsr.c
                    os_net_generic.c
                    os_system_generic.c)
-                   
+
 # add os_specific source files
 # TODO: add BSD and WIN32
 IF(LINUX)
index 3db09c7..4966619 100644 (file)
@@ -1,6 +1,5 @@
 # prepare packetbb API configuration
-configure_file (pbb_api_config.h.in ${CMAKE_BINARY_DIR}/pbb_api_config.h)
-include_directories(${CMAKE_BINARY_DIR})
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/pbb_api_config.h.in ${CMAKE_BINARY_DIR}/packetbb/pbb_api_config.h)
 
 SET(OLSRD_PACKETBB_SRCS pbb_msg_generator.c
                         pbb_pkt_generator.c
index 39f1da0..5a276a0 100644 (file)
@@ -85,7 +85,7 @@
  *   bad format of forwarded message, size field wrong
  */
 enum pbb_result {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
   PBB_DROP_PACKET          =  5,
   PBB_DROP_MESSAGE         =  4,
   PBB_DROP_MSG_BUT_FORWARD =  3,
index 9d10880..a3bc06a 100644 (file)
@@ -43,7 +43,7 @@
 
 #include "common/common_types.h"
 #include "packetbb/pbb_writer.h"
-#include "pbb_api_config.h"
+#include "packetbb/pbb_api_config.h"
 
 /* data necessary for automatic address compression */
 struct _pbb_internal_addr_compress_session {
@@ -94,7 +94,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
   bool first;
   bool not_fragmented;
   size_t max_msg_size;
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -169,7 +169,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
   /* initialize message tlvdata */
   _pbb_tlv_writer_init(&writer->msg, max_msg_size, writer->msg_mtu);
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_ADD_HEADER;
 #endif
   /* let the message creator write the message header */
@@ -178,7 +178,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
     msg->addMessageHeader(writer, msg);
   }
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_ADD_MSGTLV;
 #endif
 
@@ -189,7 +189,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
     }
   }
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_ADD_ADDRESSES;
 #endif
   /* call content providers for addresses */
@@ -203,7 +203,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
   /* no addresses ? */
   if (list_is_empty(&msg->addr_head)) {
     _finalize_message_fragment(writer, msg, NULL, NULL, true, useIf, param);
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
     writer->int_state = PBB_WRITER_NONE;
 #endif
     _pbb_writer_free_addresses(writer, msg);
@@ -242,7 +242,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
     /* look for best current compression */
     best_head = -1;
     best_size = writer->msg.max + 1;
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
     for (i = 0; i < msg->addr_len; i++) {
 #else
     i=0;
@@ -262,7 +262,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
     if (best_head == -1) {
       if (first_addr == addr) {
         /* even a single address does not fit into the block */
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
         writer->int_state = PBB_WRITER_NONE;
 #endif
         _pbb_writer_free_addresses(writer, msg);
@@ -286,7 +286,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
       continue;
     } else {
       /* add cost for this address to total costs */
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
       for (i = 0; i < msg->addr_len; i++) {
 #else
       i=0;
@@ -294,7 +294,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
 #endif
         acs[i].total += acs[i].current;
 
-#if DEBUG_CLEANUP == 1
+#if DEBUG_CLEANUP == true
         acs[i].current = 0;
 #endif
       }
@@ -315,7 +315,7 @@ pbb_writer_create_message(struct pbb_writer *writer, uint8_t msgid,
   /* free storage of addresses and address-tlvs */
   _pbb_writer_free_addresses(writer, msg);
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_NONE;
 #endif
   return PBB_OKAY;
@@ -375,7 +375,7 @@ pbb_writer_forward_msg(struct pbb_writer *writer, uint8_t *msg, size_t len,
   struct pbb_writer_interface *interf;
   size_t max_msg_size;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -475,7 +475,7 @@ pbb_writer_forward_msg(struct pbb_writer *writer, uint8_t *msg, size_t len,
 enum pbb_result
 pbb_writer_add_messagetlv(struct pbb_writer *writer,
     uint8_t type, uint8_t exttype, void *value, size_t length) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_MSGTLV);
 #endif
   return _pbb_tlv_writer_add(&writer->msg, type, exttype, value, length);
@@ -493,7 +493,7 @@ pbb_writer_add_messagetlv(struct pbb_writer *writer,
 enum pbb_result
 pbb_writer_allocate_messagetlv(struct pbb_writer *writer,
     bool has_exttype, size_t length) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_MSGTLV);
 #endif
   return _pbb_tlv_writer_allocate(&writer->msg, has_exttype, length);
@@ -513,7 +513,7 @@ pbb_writer_allocate_messagetlv(struct pbb_writer *writer,
 enum pbb_result
 pbb_writer_set_messagetlv(struct pbb_writer *writer,
     uint8_t type, uint8_t exttype, void *value, size_t length) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_FINISH_MSGTLV);
 #endif
   return _pbb_tlv_writer_set(&writer->msg, type, exttype, value, length);
@@ -529,7 +529,7 @@ pbb_writer_set_messagetlv(struct pbb_writer *writer,
 void
 pbb_writer_set_msg_addrlen(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_message *msg, uint8_t addrlen) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_HEADER);
 #endif
 
@@ -561,7 +561,7 @@ void
 pbb_writer_set_msg_header(struct pbb_writer *writer, struct pbb_writer_message *msg,
     bool has_originator, bool has_hopcount, bool has_hoplimit, bool has_seqno) {
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_HEADER);
 #endif
 
@@ -599,7 +599,7 @@ pbb_writer_set_msg_header(struct pbb_writer *writer, struct pbb_writer_message *
 void
 pbb_writer_set_msg_originator(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_message *msg, uint8_t *originator) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_HEADER || writer->int_state == PBB_WRITER_FINISH_HEADER);
 #endif
 
@@ -618,7 +618,7 @@ pbb_writer_set_msg_originator(struct pbb_writer *writer __attribute__ ((unused))
 void
 pbb_writer_set_msg_hopcount(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_message *msg, uint8_t hopcount) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_HEADER || writer->int_state == PBB_WRITER_FINISH_HEADER);
 #endif
   msg->hopcount = hopcount;
@@ -636,7 +636,7 @@ pbb_writer_set_msg_hopcount(struct pbb_writer *writer __attribute__ ((unused)),
 void
 pbb_writer_set_msg_hoplimit(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_message *msg, uint8_t hoplimit) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_HEADER || writer->int_state == PBB_WRITER_FINISH_HEADER);
 #endif
   msg->hoplimit = hoplimit;
@@ -654,7 +654,7 @@ pbb_writer_set_msg_hoplimit(struct pbb_writer *writer __attribute__ ((unused)),
 void
 pbb_writer_set_msg_seqno(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_message *msg, uint16_t seqno) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_HEADER || writer->int_state == PBB_WRITER_FINISH_HEADER);
 #endif
   msg->seqno = seqno;
@@ -675,7 +675,7 @@ _close_addrblock(struct _pbb_internal_addr_compress_session *acs,
     struct pbb_writer_message *msg __attribute__ ((unused)),
     struct pbb_writer_address *last_addr, int common_head) {
   int best;
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
   int i, size;
   if (common_head > msg->addr_len) {
     /* nothing to do */
@@ -686,7 +686,7 @@ _close_addrblock(struct _pbb_internal_addr_compress_session *acs,
 #endif
   /* check for best compression at closed blocks */
   best = common_head;
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
   size = acs[common_head].total;
   for (i = common_head + 1; i < msg->addr_len; i++) {
     if (acs[i].total < size) {
@@ -700,7 +700,7 @@ _close_addrblock(struct _pbb_internal_addr_compress_session *acs,
   acs[best].ptr->block_multiple_prefixlen = acs[best].multiplen;
   acs[best].ptr->block_headlen = best;
 
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
   for (i = common_head + 1; i < msg->addr_len; i++) {
     /* remember best block compression */
     acs[i].total = size;
@@ -790,7 +790,7 @@ _compress_address(struct _pbb_internal_addr_compress_session *acs,
     }
 
     /* add bytes to continue encodings with same prefix */
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
     for (common_head = 0; common_head < addrlen; common_head++) {
       if (last_addr->addr[common_head] != addr->addr[common_head]) {
         break;
@@ -801,7 +801,7 @@ _compress_address(struct _pbb_internal_addr_compress_session *acs,
   }
 
   /* calculate new costs for next address including tlvs */
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
   for (i = 0; i < addrlen; i++) {
 #else
   i = 0;
@@ -810,7 +810,7 @@ _compress_address(struct _pbb_internal_addr_compress_session *acs,
     int new_cost = 0, continue_cost = 0;
     bool closed = false;
 
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
     closed = first || (i > common_head);
 #else
     closed = true;
@@ -921,12 +921,12 @@ _write_addresses(struct pbb_writer *writer, struct pbb_writer_message *msg,
   /* loop through address blocks */
   do {
     uint8_t head_len = 0, tail_len = 0, mid_len = 0;
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
     bool zero_tail = false;
 #endif
 
     addr_end = addr_start->block_end;
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
     if (addr_start != addr_end) {
       /* only use head/tail for address blocks with multiple addresses */
       int tail;
@@ -965,7 +965,7 @@ _write_addresses(struct pbb_writer *writer, struct pbb_writer_message *msg,
     flag = ptr;
     *ptr++ = 0;
 
-#if DO_ADDR_COMPRESSION == 1
+#if DO_ADDR_COMPRESSION == true
     /* write head */
     if (head_len) {
       *flag |= PBB_ADDR_FLAG_HEAD;
@@ -1171,7 +1171,7 @@ _finalize_message_fragment(struct pbb_writer *writer, struct pbb_writer_message
   /* reset optional tlv length */
   writer->msg.set = 0;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_FINISH_MSGTLV;
 #endif
 
@@ -1186,7 +1186,7 @@ _finalize_message_fragment(struct pbb_writer *writer, struct pbb_writer_message
     _write_addresses(writer, msg, first, last);
   }
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_FINISH_HEADER;
 #endif
 
@@ -1198,7 +1198,7 @@ _finalize_message_fragment(struct pbb_writer *writer, struct pbb_writer_message
   /* write header */
   _write_msgheader(writer, msg);
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_NONE;
 #endif
 
@@ -1246,7 +1246,7 @@ _finalize_message_fragment(struct pbb_writer *writer, struct pbb_writer_message
   writer->msg.set = 0;
 
   /* clear message buffer */
-#if DEBUG_CLEANUP == 1
+#if DEBUG_CLEANUP == true
   memset(&writer->msg.buffer[len], 0, writer->msg.max - len);
 #endif
 }
index 731f100..00ace2d 100644 (file)
@@ -43,7 +43,7 @@
 #include "common/common_types.h"
 #include "common/list.h"
 #include "packetbb/pbb_writer.h"
-#include "pbb_api_config.h"
+#include "packetbb/pbb_api_config.h"
 
 static void _write_pktheader(struct pbb_writer_interface *interf);
 
@@ -60,7 +60,7 @@ _pbb_writer_begin_packet(struct pbb_writer *writer, struct pbb_writer_interface
   /* cleanup packet buffer data */
   _pbb_tlv_writer_init(&interface->pkt, interface->mtu, interface->mtu);
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_ADD_PKTHEADER;
 #endif
   /* add packet header */
@@ -71,7 +71,7 @@ _pbb_writer_begin_packet(struct pbb_writer *writer, struct pbb_writer_interface
     pbb_writer_set_pkt_header(writer, interface, false);
   }
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_ADD_PKTTLV;
 #endif
   /* add packet tlvs */
@@ -80,7 +80,7 @@ _pbb_writer_begin_packet(struct pbb_writer *writer, struct pbb_writer_interface
   }
 
   interface->is_flushed = false;
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_NONE;
 #endif
 }
@@ -96,7 +96,7 @@ pbb_writer_flush(struct pbb_writer *writer, struct pbb_writer_interface *interfa
   struct pbb_writer_pkthandler *handler;
   size_t len;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -111,7 +111,7 @@ pbb_writer_flush(struct pbb_writer *writer, struct pbb_writer_interface *interfa
     _pbb_writer_begin_packet(writer, interface);
   }
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_FINISH_PKTTLV;
 #endif
 
@@ -120,7 +120,7 @@ pbb_writer_flush(struct pbb_writer *writer, struct pbb_writer_interface *interfa
     handler->finishPacketTLVs(writer, interface);
   }
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_FINISH_PKTHEADER;
 #endif
   /* finalize packet header */
@@ -158,11 +158,11 @@ pbb_writer_flush(struct pbb_writer *writer, struct pbb_writer_interface *interfa
   /* mark buffer as flushed */
   interface->is_flushed = true;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_NONE;
 #endif
 
-#if DEBUG_CLEANUP == 1
+#if DEBUG_CLEANUP == true
   memset(&interface->pkt.buffer[len + interface->pkt.added], 0,
       interface->pkt.max - len - interface->pkt.added);
 #endif
@@ -184,7 +184,7 @@ enum pbb_result
 pbb_writer_add_packettlv(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_interface *interf,
     uint8_t type, uint8_t exttype, void *value, size_t length) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_PKTTLV);
 #endif
   return _pbb_tlv_writer_add(&interf->pkt, type, exttype, value, length);
@@ -203,7 +203,7 @@ pbb_writer_add_packettlv(struct pbb_writer *writer __attribute__ ((unused)),
 enum pbb_result
 pbb_writer_allocate_packettlv(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_interface *interf, bool has_exttype, size_t length) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_PKTTLV);
 #endif
   return _pbb_tlv_writer_allocate(&interf->pkt, has_exttype, length);
@@ -224,7 +224,7 @@ enum pbb_result
 pbb_writer_set_packettlv(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_interface *interf,
     uint8_t type, uint8_t exttype, void *value, size_t length) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_FINISH_PKTTLV);
 #endif
   return _pbb_tlv_writer_set(&interf->pkt, type, exttype, value, length);
@@ -239,7 +239,7 @@ pbb_writer_set_packettlv(struct pbb_writer *writer __attribute__ ((unused)),
  */
 void pbb_writer_set_pkt_header(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_interface *interf, bool has_seqno) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_PKTHEADER);
 #endif
 
@@ -264,7 +264,7 @@ void pbb_writer_set_pkt_header(struct pbb_writer *writer __attribute__ ((unused)
 void
 pbb_writer_set_pkt_seqno(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_interface *interf, uint16_t seqno) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_PKTHEADER
       || writer->int_state == PBB_WRITER_FINISH_PKTHEADER);
 #endif
index 3d221a1..ea54ee3 100644 (file)
@@ -45,9 +45,9 @@
 #include "common/avl_comp.h"
 #include "common/common_types.h"
 #include "packetbb/pbb_reader.h"
-#include "pbb_api_config.h"
+#include "packetbb/pbb_api_config.h"
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 1
+#if DISALLOW_CONSUMER_CONTEXT_DROP == true
 #define PBB_CONSUMER_DROP_ONLY(value, def) (def)
 #else
 #define PBB_CONSUMER_DROP_ONLY(value, def) (value)
@@ -78,7 +78,7 @@ static struct pbb_reader_tlvblock_entry *_malloc_tlvblock_entry(void);
 
 static uint8_t pbb_get_pktversion(uint8_t v);
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
 static void _set_addr_bitarray(struct pbb_reader_bitarray256 *b, int idx);
 static bool _test_addrbitarray(struct pbb_reader_bitarray256 *b, int idx);
 #endif
@@ -190,11 +190,11 @@ pbb_reader_handle_packet(struct pbb_reader *parser, uint8_t *buffer, size_t leng
     last_started = consumer;
     /* this one can drop a packet */
     if (consumer->start_callback != NULL) {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       result =
 #endif
           consumer->start_callback(consumer, &context);
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       if (result != PBB_OKAY) {
         goto cleanup_parse_packet;
       }
@@ -203,11 +203,11 @@ pbb_reader_handle_packet(struct pbb_reader *parser, uint8_t *buffer, size_t leng
     /* handle packet tlv consumers */
     if (has_tlv && (consumer->tlv_callback != NULL || consumer->block_callback != NULL)) {
       /* can drop packet */
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       result =
 #endif
           _schedule_tlvblock(consumer, &context, &entries, 0);
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       if (result != PBB_OKAY) {
         goto cleanup_parse_packet;
       }
@@ -221,7 +221,7 @@ pbb_reader_handle_packet(struct pbb_reader *parser, uint8_t *buffer, size_t leng
     result = _handle_message(parser, &context, &ptr, eob);
   }
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
 cleanup_parse_packet:
 #endif
   /* call end-of-context callback */
@@ -235,7 +235,7 @@ cleanup_parse_packet:
   _free_tlvblock(parser, &entries);
 
   /* do not tell caller about packet drop */
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
   if (result == PBB_DROP_PACKET) {
     return PBB_OKAY;
   }
@@ -701,11 +701,11 @@ _schedule_tlvblock(struct pbb_reader_tlvblock_consumer *consumer, struct pbb_rea
     /* handle tlv_callback first */
     if (index_match && consumer->tlv_callback != NULL) {
       /* call consumer for TLV, can skip tlv, address, message and packet */
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       result =
 #endif
           consumer->tlv_callback(consumer, tlv, context);
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       if (result == PBB_DROP_TLV) {
         /* mark dropped tlv */
         _set_addr_bitarray(&tlv->int_drop_tlv, idx);
@@ -772,12 +772,12 @@ _schedule_tlvblock(struct pbb_reader_tlvblock_consumer *consumer, struct pbb_rea
 
   /* call consumer for tlvblock */
   if (consumer->block_callback != NULL) {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
     result =
 #endif
         consumer->block_callback(consumer, context, mandatory_missing);
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
     if (result == PBB_DROP_TLV) {
       avl_for_each_element(&consumer->consumer_entries, cons_entry, node) {
         if (cons_entry->tlv != NULL && cons_entry->drop) {
@@ -791,10 +791,10 @@ _schedule_tlvblock(struct pbb_reader_tlvblock_consumer *consumer, struct pbb_rea
     }
 #endif
   }
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
 cleanup_handle_tlvblock:
 #endif
-#if  DEBUG_CLEANUP == 1
+#if  DEBUG_CLEANUP == true
   avl_for_each_element(&consumer->consumer_entries, cons_entry, node) {
     cons_entry->tlv = NULL;
     cons_entry->drop = false;
@@ -918,7 +918,7 @@ schedule_msgtlv_consumer(struct pbb_reader_tlvblock_consumer *consumer,
   /* call start-of-context callback */
   if (consumer->start_callback) {
     /* could drop tlv, message or packet */
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
     result =
 #endif
         consumer->start_callback(consumer, tlv_context);
@@ -957,7 +957,7 @@ schedule_msgaddr_consumer(struct pbb_reader_tlvblock_consumer *consumer,
     tlv_context->prefixlen = addr->prefixlen;
     for (i=0; i<addr->num_addr; i++) {
       /* test if we should skip this address */
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       if (_test_addrbitarray(&addr->dropAddr, i)) {
         continue;
       }
@@ -975,7 +975,7 @@ schedule_msgaddr_consumer(struct pbb_reader_tlvblock_consumer *consumer,
       /* call start-of-context callback */
       if (consumer->start_callback) {
         /* can drop address, addressblock, message and packet */
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
         result =
 #endif
             consumer->start_callback(consumer, tlv_context);
@@ -995,7 +995,7 @@ schedule_msgaddr_consumer(struct pbb_reader_tlvblock_consumer *consumer,
         }
       }
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       /* handle result from tlvblock callbacks */
       if (result == PBB_DROP_ADDRESS) {
         _set_addr_bitarray(&addr->dropAddr, i);
@@ -1163,12 +1163,12 @@ _handle_message(struct pbb_reader *parser,
 
     /* remember range of consumers with same order to call end_message() callbacks */
     if (same_order[0] != NULL && consumer->order > same_order[1]->order) {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       result =
 #endif
       schedule_end_message_cbs(tlv_context,
           same_order[0], same_order[1], result);
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       if (result != PBB_OKAY) {
         goto cleanup_parse_message;
       }
@@ -1177,13 +1177,13 @@ _handle_message(struct pbb_reader *parser,
     }
 
     if (consumer->addrblock_consumer) {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       result =
 #endif
       schedule_msgaddr_consumer(consumer, tlv_context, &addr_head);
     }
     else {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       result =
 #endif
       schedule_msgtlv_consumer(consumer, tlv_context, &tlv_entries);
@@ -1193,7 +1193,7 @@ _handle_message(struct pbb_reader *parser,
       same_order[1] = consumer;
     }
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
     if (result != PBB_OKAY) {
       break;
     }
@@ -1202,12 +1202,12 @@ _handle_message(struct pbb_reader *parser,
 
   /* handle last end_message() callback range */
   if (same_order[0] != NULL) {
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
     result =
 #endif
     schedule_end_message_cbs(tlv_context,
         same_order[0], same_order[1], result);
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
     if (result != PBB_OKAY) {
       goto cleanup_parse_message;
     }
@@ -1217,7 +1217,7 @@ _handle_message(struct pbb_reader *parser,
 cleanup_parse_message:
   /* handle message forwarding */
   if (
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
       (result == PBB_OKAY || result == PBB_DROP_MSG_BUT_FORWARD) &&
 #endif
       parser->forward_message != NULL && tlv_context->has_hopcount) {
@@ -1240,7 +1240,7 @@ cleanup_parse_message:
   /* free message tlvblock */
   _free_tlvblock(parser, &tlv_entries);
   *ptr = end;
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
   if (result == PBB_DROP_MESSAGE) {
     /* do not propagate message drop */
     return PBB_OKAY;
@@ -1322,7 +1322,7 @@ pbb_get_pktversion(uint8_t v) {
   return v >> 4;
 }
 
-#if DISALLOW_CONSUMER_CONTEXT_DROP == 0
+#if DISALLOW_CONSUMER_CONTEXT_DROP == false
 /**
  * Set a bit in the bitarray256 struct
  * @param b pointer to bitarray
index 0a51b33..8959cc8 100644 (file)
@@ -42,7 +42,7 @@
 #include "common/common_types.h"
 #include "packetbb/pbb_tlv_writer.h"
 #include "packetbb/pbb_context.h"
-#include "pbb_api_config.h"
+#include "packetbb/pbb_api_config.h"
 
 static size_t _calc_tlv_size(bool exttype, size_t length);
 static void _write_tlv(uint8_t *ptr, uint8_t type, uint8_t exttype,
@@ -66,7 +66,7 @@ _pbb_tlv_writer_init(struct pbb_tlv_writer_data *data, size_t max,
   data->set = 0;
   data->max = max;
 
-#if DEBUG_CLEANUP == 1
+#if DEBUG_CLEANUP == true
   memset(data->buffer, 0, mtu);
 #endif
 }
index 6fdf82d..e61cdc3 100644 (file)
@@ -47,7 +47,7 @@
 #include "common/list.h"
 #include "packetbb/pbb_context.h"
 #include "packetbb/pbb_writer.h"
-#include "pbb_api_config.h"
+#include "packetbb/pbb_api_config.h"
 
 static int _msgaddr_avl_comp(const void *k1, const void *k2, void *ptr);
 static void *_copy_addrtlv_value(struct pbb_writer *writer, void *value, size_t length);
@@ -88,7 +88,7 @@ pbb_writer_init(struct pbb_writer *writer, size_t msg_mtu, size_t addrtlv_data)
   _pbb_tlv_writer_init(&writer->msg, 0, msg_mtu);
 
   writer->addrtlv_size = addrtlv_data;
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   writer->int_state = PBB_WRITER_NONE;
 #endif
 
@@ -112,7 +112,7 @@ pbb_writer_cleanup(struct pbb_writer *writer) {
   struct pbb_writer_interface *interf, *safe_interf;
 
   assert(writer);
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -170,7 +170,7 @@ pbb_writer_add_addrtlv(struct pbb_writer *writer, struct pbb_writer_address *add
     struct pbb_writer_tlvtype *tlvtype, void *value, size_t length, bool allow_dup) {
   struct pbb_writer_addrtlv *addrtlv;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_ADDRESSES);
 #endif
 
@@ -220,16 +220,16 @@ struct pbb_writer_address *
 pbb_writer_add_address(struct pbb_writer *writer __attribute__ ((unused)),
     struct pbb_writer_message *msg, uint8_t *addr, uint8_t prefix) {
   struct pbb_writer_address *address;
-#if CLEAR_ADDRESS_POSTFIX == 1
+#if CLEAR_ADDRESS_POSTFIX == true
   int i, p;
   uint8_t cleaned_addr[PBB_MAX_ADDRLEN];
 #endif
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_ADD_ADDRESSES);
 #endif
 
-#if CLEAR_ADDRESS_POSTFIX == 1
+#if CLEAR_ADDRESS_POSTFIX == true
   /* only copy prefix part of address */
   for (p = prefix, i=0; i < msg->addr_len; i++, p -= 8) {
     if (p > 7) {
@@ -255,7 +255,7 @@ pbb_writer_add_address(struct pbb_writer *writer __attribute__ ((unused)),
       return NULL;
     }
 
-#if CLEAR_ADDRESS_POSTFIX == 1
+#if CLEAR_ADDRESS_POSTFIX == true
     memcpy(address->addr, cleaned_addr, msg->addr_len);
 #else
     memcpy(address->addr, addr, msg->addr_len);
@@ -287,7 +287,7 @@ pbb_writer_register_addrtlvtype(struct pbb_writer *writer, uint8_t msgtype, uint
   struct pbb_writer_tlvtype *tlvtype;
   struct pbb_writer_message *msg;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
   if ((msg = _get_message(writer, msgtype)) == NULL) {
@@ -332,7 +332,7 @@ pbb_writer_register_addrtlvtype(struct pbb_writer *writer, uint8_t msgtype, uint
  */
 void
 pbb_writer_unregister_addrtlvtype(struct pbb_writer *writer, struct pbb_writer_tlvtype *tlvtype) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
   if (--tlvtype->usage_counter) {
@@ -360,7 +360,7 @@ pbb_writer_register_msgcontentprovider(struct pbb_writer *writer,
     struct pbb_writer_content_provider *cpr, uint8_t msgid, int priority) {
   struct pbb_writer_message *msg;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -384,7 +384,7 @@ pbb_writer_register_msgcontentprovider(struct pbb_writer *writer,
  */
 void
 pbb_writer_unregister_content_provider(struct pbb_writer *writer, struct pbb_writer_content_provider *cpr) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -408,7 +408,7 @@ pbb_writer_register_message(struct pbb_writer *writer, uint8_t msgid,
     bool if_specific, uint8_t addr_len) {
   struct pbb_writer_message *msg;
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -441,7 +441,7 @@ pbb_writer_register_message(struct pbb_writer *writer, uint8_t msgid,
  */
 void
 pbb_writer_unregister_message(struct pbb_writer *writer, struct pbb_writer_message *msg) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -464,7 +464,7 @@ void
 pbb_writer_register_pkthandler(struct pbb_writer *writer,
     struct pbb_writer_pkthandler *pkt) {
 
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -481,7 +481,7 @@ pbb_writer_register_pkthandler(struct pbb_writer *writer,
 void
 pbb_writer_unregister_pkthandler(struct pbb_writer *writer  __attribute__ ((unused)),
     struct pbb_writer_pkthandler *pkt) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -498,7 +498,7 @@ pbb_writer_unregister_pkthandler(struct pbb_writer *writer  __attribute__ ((unus
 int
 pbb_writer_register_interface(struct pbb_writer *writer,
     struct pbb_writer_interface *interf, size_t mtu) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
@@ -524,7 +524,7 @@ void
 pbb_writer_unregister_interface(
     struct pbb_writer *writer  __attribute__ ((unused)),
     struct pbb_writer_interface *interf) {
-#if WRITER_STATE_MACHINE == 1
+#if WRITER_STATE_MACHINE == true
   assert(writer->int_state == PBB_WRITER_NONE);
 #endif
 
index 6ce166d..31fe00e 100644 (file)
@@ -9,6 +9,11 @@ ENDFOREACH(plugin)
 # link core
 TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_core)
 
+# link packetbb if necessary
+IF(OONF_NEED_PACKETBB)
+    TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_packetbb)
+ENDIF(OONF_NEED_PACKETBB)
+
 # link config and common API
 TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_config)
 TARGET_LINK_LIBRARIES(${OONF_EXE} ${OONF_LIBPREFIX}_common)
index fea0abb..3e66543 100644 (file)
@@ -13,6 +13,11 @@ ENDFOREACH(plugin)
 # link core
 TARGET_LINK_LIBRARIES(${OONF_EXE} static_core)
 
+# link packetbb if necessary
+IF(OONF_NEED_PACKETBB)
+    TARGET_LINK_LIBRARIES(${OONF_EXE} static_packetbb)
+ENDIF(OONF_NEED_PACKETBB)
+
 # link config and common API
 TARGET_LINK_LIBRARIES(${OONF_EXE} static_config)
 TARGET_LINK_LIBRARIES(${OONF_EXE} static_common)
index eca87df..b0992ed 100644 (file)
 #include "config/cfg_schema.h"
 #include "builddata/plugin_static.h"
 #include "builddata/data.h"
+#include "builddata/app_config.h"
 #include "os_clock.h"
 #include "os_net.h"
 #include "os_system.h"
-#include "os_routing.h"
 #include "olsr_cfg.h"
 #include "olsr_clock.h"
 #include "olsr_http.h"
 #include "olsr_setup.h"
 #include "olsr.h"
 
+#if OONF_NEED_ROUTING == true
+#include "os_routing.h"
+#endif
+
 static bool _end_olsr_signal, _display_schema;
 static char *_schema_name;
 
@@ -206,7 +210,7 @@ main(int argc, char **argv) {
   }
 
   /* check if we are root, otherwise stop */
-#ifdef NEED_ROOT
+#if OONF_NEED_ROOT == true
   if (geteuid() != 0) {
     OLSR_WARN(LOG_MAIN, "You must be root(uid = 0) to run %s!\n",
         olsr_builddata_get()->app_name);
@@ -248,7 +252,7 @@ main(int argc, char **argv) {
     goto olsrd_cleanup;
   }
 
-#ifdef NEED_ROUTING
+#if OONF_NEED_ROUTING == true
   if (os_routing_init()) {
     goto olsrd_cleanup;
   }
@@ -313,7 +317,7 @@ olsrd_cleanup:
   olsr_telnet_cleanup();
   olsr_interface_cleanup();
   os_net_cleanup();
-#ifdef NEED_ROUTING
+#if OONF_NEED_ROUTING
   os_routing_cleanup();
 #endif
   os_system_cleanup();
index 05bd106..203ba14 100644 (file)
@@ -22,8 +22,6 @@ set(TESTS test_packetbb_reader_blockcb
           test_packetbb_writer_fragmentation
           test_packetbb_writer_ifspecific)
 
-include_directories(${CMAKE_BINARY_DIR})
-
 foreach(TEST ${TESTS})
     compile_packetbb_test(${TEST} ${TEST}.c)
     ADD_TEST(NAME ${TEST} COMMAND ${TEST})
index cbf55bb..63b68a3 100644 (file)
@@ -42,7 +42,7 @@
 #include <stdio.h>
 
 #include "packetbb/pbb_reader.h"
-#include "pbb_api_config.h"
+#include "packetbb/pbb_api_config.h"
 
 #define PRINT_CB 1