Commit Graph
626 Commits
Author SHA1 Message Date
Olaf Bergmann ecda1426ac resource.c: Increase use of coap_malloc_type() and coap_free_type()
coap_malloc_type() and coap_free_type() provide an abstract API for
dynamic memory management on different platforms. resource.c still
is in transition and needs more cleanup.
2015-03-11 14:59:40 +01:00
Olaf Bergmann d55bd85e14 examples/contiki/server.c: Define clock_offset locally
The global variable clock_offset has been removed from libcoap, so
we have to define our own.
2015-03-11 14:37:18 +01:00
Olaf Bergmann f1b36046f2 Contiki: Make sure that COAP_RESOURCES_NOHASH is defined 2015-03-11 14:34:06 +01:00
Olaf Bergmann 65620fde3e resource.[hc]: Replaced custom list structures by utlist macros.
The CoAP resource management is based on uthash and utlist for
platform POSIX but used a custom list implementation for Contiki.
This modification replaces the list handling by utlist macros
entirely. A set of convenience macros has been defined to access
the resources stored in a CoAP context with respect to the
preprocessor symbol COAP_RESOURCES_NOHASH.
2015-03-11 14:28:24 +01:00
Olaf Bergmann b9adebec93 client.c: Fixed signed/unsigned in comparisons 2015-03-10 13:47:38 +01:00
Olaf Bergmann 005d00bf5b client.c: Declare unused parameters to make -Wunused quiet 2015-03-10 13:42:40 +01:00
Olaf Bergmann 445849d5ba client.c: Made private functions static to quiet compiler warnings 2015-03-10 13:41:02 +01:00
Olaf Bergmann c38a6d9ca4 Made private functions static to quiet compiler warnings 2015-03-10 13:25:08 +01:00
Olaf Bergmann 9b1ab5eef3 server.c: Declare unused parameters to make -Wunused quiet 2015-03-10 13:06:03 +01:00
Olaf Bergmann eb2251f06f Update boilerplate text in testdriver
The errors in the URI parser test suite have been fixed,
making the description in testdriver.c obsolete.
2015-03-09 18:30:20 +01:00
Olaf Bergmann 55c6efeca8 coap_split_uri: Check if port number is in valid range
This change is made to resolve the failed URI parser test
t_parse_uri5()
2015-03-09 18:01:34 +01:00
Olaf Bergmann 3e99d6634e Fixed documentation of coap_split_path_impl() 2015-03-09 17:56:08 +01:00
Olaf Bergmann 0c53e63a3d Fixed URI parser bug and removed broken parser iterator
The parser iterator did not break up URIs correctly. As this
cannot be fixed easily, the parser iterator has been removed.
coap_split_path_impl() now operates directly on the message
buffer instead of the iterator abstraction.

This bug also caused t_parse_uri12() in the URI test suite
to fail.
2015-03-09 17:49:21 +01:00
Olaf Bergmann 04e1d8e7de Make test data unsigned to shut up compiler warnings. 2015-03-09 14:59:22 +01:00
Olaf Bergmann 8894f2ffec Fixed a couple of warnings from doxygen. 2015-03-09 14:53:01 +01:00
Olaf Bergmann 284f4afb84 Added missing macro ax_check_link_flag.m4 2015-03-08 21:40:14 +01:00
Olaf Bergmann 4ca91190d6 Revised time-related functions to get rid of clock_offset for POSIX platform.
* Removed tne preprocessor defines for coap_tick() and coap_clock_init() --
  this made the code less readable and seemed to be of little use.

* Introduced the new type coap_time_t to represent wall clock time. On POSIX,
  this is the number of seconds since the epoch, while on embedded systems
  without a real time clock, this could be the number of seconds since the
  last reboot. The new function coap_ticks_to_rt() is used to convert
  coap_tick_t to coap_time.h. Currently, this is a division by COAP_TICKS_PER_SECOND
  on all platforms.

* POSIX: coap_tick_t is now defined as unsigned long to avoid overflows in
  coap_ticks().
2015-03-08 15:14:43 +01:00
Olaf Bergmann a31981b95b Implement decode_segment() and check_segment(), LWS cleanup
The helper functions decode_segment() and check_segment() are private
functions in uri.c and thus should not be accessible from outside. For
simplicity, these functions have been copied to client.c.
2015-03-08 15:09:22 +01:00
Olaf Bergmann fa3f09cdb7 Fix warnings in unit tests 2015-03-04 15:10:09 +01:00
Olaf Bergmann 853049fe47 Make private functions static 2015-03-04 14:57:26 +01:00
Olaf Bergmann 71de08ac5f Fix warnings in resource.c
Internal functions are now static. print_wellknown() is exported
as coap_print_wellknown() to make it accessible from net.c and
for unit tests.
2015-03-04 14:55:26 +01:00
Olaf Bergmann e297a0ca76 Fix warnings in net.[hc]
Internal functions are now static. wellknown_response() is exported
as coap_wellknown_response() to make it accessible for unit tests.
2015-03-04 14:43:42 +01:00
Olaf Bergmann 8ba8d2a288 Exclude m4/ax_* from .gitignore 2015-03-04 13:48:11 +01:00
Olaf Bergmann f1b8a48bfc Fix source path and include flag for Contiki build
As the libcoap sources have been moved to the sub-directory src it
must be added to the vpath. The header files now reside in include/coap,
so we need an additional -I compiler flag for this.

The root path for libcoap is derived from the variable APPDS which is
set by $(CONTIKI)/Makefile.include. This is a bit fragile but the best
we have...
2015-03-04 13:22:05 +01:00
Olaf Bergmann 4b249f3739 coap_list.c was moved to examples 2015-03-04 13:19:56 +01:00
Olaf Bergmann 78b96e606d Fix lwip example 2015-03-03 22:03:37 +01:00
Olaf Bergmann 124d871cc8 Fixed path to source and header path
Made vpath %.c point to ../../src and repaired include path.

The common part of the Makefile has been moved to Makefile.common
to leverage Makefile creation for other platforms such as econotag.
2015-03-03 21:53:26 +01:00
Olaf Bergmann 5a7300f5c2 Add Darwin to known platforms 2015-03-03 20:10:09 +01:00
Olaf Bergmann 9c7d45a924 Invoke AX_CHECK_COMPILE_FLAG with -Werror
Some compilers (clang, e.g.) just emit a warning that the tested
flags are not supported. As the macro does not recognize this,
we must pass -Werror as EXTRA_FLAG to exclude the unknown flags.
2015-03-03 20:03:50 +01:00
Olaf Bergmann 53f35526db Define SOL_IP to IPPROTO_IP for platforms that do not have it 2015-03-03 19:21:44 +01:00
Olaf Bergmann 0af74b7cd6 Add Solaris to known platforms
For Solaris, XPG4v2 must be enabled for ancillary data while the compiler flag
-std=c99 restricts the code to C99 and nothing else. To make this work anyway,
we have to use the following compiler flags:
-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=600 -D__EXTENSIONS__=1
2015-03-03 19:21:44 +01:00
Olaf Bergmann 489df85c88 Check if linker supports scripts for versioning
Use ld's option --version-script where available and fall back
to plain symbol file otherwise. This check uses the m4 macro
AX_CHECK_LINK_FLAG <http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html>
2015-03-03 19:21:44 +01:00
Olaf Bergmann e3f555f396 Check if compiler supports -fdiagnostics-color
Newer compilers such as clang or gcc 4.9 can emit colorized
diagnostics. For gcc, this flag must be present to switch
coloring on.
2015-03-03 19:21:44 +01:00
Olaf Bergmann 81bc3dd9f5 Check if compiler supports -Wlogical-op
clang has dropped support for this warning and therefore emits
warnings when it is used as a compiler flag.

configure now uses AX_CHECK_COMPILE_FLAG[0] to check for compiler support.
[0] http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html

Because local m4 macros are located in the sub-directory m4, autogen.sh
must not remove that directory but only clean the libtool-generated files.
2015-03-03 19:21:43 +01:00
Olaf Bergmann 101efbfe69 Create symbol file libcoap-$(LIBCOAP_API_VERSION).sym
As not all versions of ld support linker scripts, we need plain
symbol files as fallback. This commit extends the Makefile target
'update-map-file' to create a .sym file in addition to the .map
file.
2015-03-03 19:21:43 +01:00
Olaf Bergmann fe1b34e78e Check if ctags supports option --c-kinds
This option is used to extract function names from C header files
but is not supported by all versions of ctags. In particular, the
version included with GNU Emacs does not recognize it. This simple
test checks if '--c-kinds=f' is recognized and emits a warning
otherwise.
2015-03-03 19:21:43 +01:00
Carsten Schoenert 96d875ab7a CFLAGS: reorder the various CFLAGS inside the files
Doing up some housekeeping around the used CFLAGS.
To be more generic put the default declaration for additional warning
CFLAGS into configure.ac and clean up the Makefile.am's.

There are the default CFLAGS variable that is a global variable if not
re adjusted inside the different targets.

The second variable for CFLAGS is the AM_CFLAGS definition that is used
inside a Makefile as a global variable.

There is also the possibility to graduate the CFLAGS for a single
target. But currently there are nothing more than one target within each
Makefile so we can set for now the target specific CFLAGS to the
AM_CFLAGS.

A new variable called WARNING_CFLAGS is inside the configure.ac created,
this variable holds all the warnings flags inside. The Makefile.am's are
taking the values and is setting the variable AM_CFLAGS which is used in
the target specific CFLAGS. Also the options 'DWITH_POSIX' and
'D_GNU_SOURCE' are now appended to the CFLAGS if the configure script is
detecting a *-[uc]linux* system.
2015-03-03 19:21:43 +01:00
Carsten Schoenert c9c1a80271 adding the tests/ folder to the build environment
To let the previous added configure option '--enable-tests' really build
the testdriver binary adding the needed changes to the files in the main
folder.
Finally adding a new Makefile.am within the tests/ folder.
2015-03-03 19:21:43 +01:00
Carsten Schoenert 5e018950fc configure.ac: adding configure switch for test binary
Adding a configure option to enable the build of the unit test binary.
This commit is just the configure option, the implementation into the
folder tests/ will follow!
2015-03-03 19:21:43 +01:00
Carsten Schoenert d37e47e12c configure.ac: changing libtool behavior for library build
The unit test binary needs the static library to link against. So there
is a real need to not only build the dynamic version of libcoap library.
2015-03-03 19:21:43 +01:00
Carsten Schoenert 700753e1d2 configure.ac: adding check for dot binary
Doxygen supports the creation of DOT graphics, but this depends on the
existence of the 'dot' binary on the build host. Adding a check for dot
and disable the support within the Doxygen file for DOT graphics if dot
can't be found.
2015-03-03 19:21:43 +01:00
Carsten Schoenert e68e506f45 doc/Doxyfile.in: update to recent version compatibility
Update to doxygen 1.8.x, also enable creation of DOT graphics.
2015-03-03 19:21:43 +01:00
Carsten Schoenert e11842e033 .gitignore: adding some more file to ignore 2015-03-03 19:21:43 +01:00
Carsten Schoenert 80d74208ce adding the doc/ folder to the build environment
To install the doxygen output, which is generated within doc/html/,
adding the needed checks for the doxygen binary to configure.ac and also
adding the needed doc/Makefile.am file.

Finally tuning doc/Doxyfile.in to let the autotools write the needed
informations into this file while generating the finally created
doc/Doxyfile.
2015-03-03 19:21:43 +01:00
Carsten Schoenert 4da433ca06 configure.ac: adding check for hostsystem
Starting to add some checks while configure runs. We are starting with
support for the classical linux system, kFreeBSD would be fine to
supporting too!
2015-03-03 19:21:43 +01:00
Carsten Schoenert dc2ada4323 adding check for ctags
We need ctags to run the make target 'update-map-file' so we better give
a warning out if ctags wasn't found.
2015-03-03 19:21:43 +01:00
Carsten Schoenert 4dc6637525 libcoap-1.0.map: adding first symbol mapping file 2015-03-03 19:21:43 +01:00
Carsten Schoenert a42f35303c adding dynamic libtool versioning to libcoap
To not fight every time with the logic of libtool for needed versioning
info of libcoap adding some automatism into the autoconf files. So now
there are only three lines to change if a release is planned.
Please note and respect the instructions inside configure.ac to generate
a correct versioning for libtool. But libtool will tell you later if you
doing something wrong with the versions. :)

Some helpful informations can be found on the following websites as
well.

http://ftp.gnu.org/pub/old-gnu/Manuals/libtool-1.4.2/html_chapter/libtool_6.html
https://blog.flameeyes.eu/2010/10/linkers-and-names
https://blog.flameeyes.eu/2009/04/shared-object-version
https://phab.enlightenment.org/w/autotoolsintegration/
https://autotools.io/libtool/version.html
http://www.freesoftwaremagazine.com/articles/building_shared_libraries_once_using_autotools
https://www.sourceware.org/autobook/autobook/autobook_91.html
2015-03-03 19:21:43 +01:00
Carsten Schoenert d6bc9dba10 configure.ac: use m4 macros to define package version
To reduce the places to define the package versions setting up the
version string by m4_define macros.
The complete substitution through the config files will be done
automatically by autoconf.
2015-03-03 19:21:43 +01:00
Carsten Schoenert 45760a922d pkgconfig: adding related package files
To help the users of the libcoap and especially the linker on the users
machines adding a libcoap.pc file that will be installed while the call
of 'make install'.
2015-03-03 19:21:43 +01:00