This change introduces a new subtree in the library's directory structure.
Platform-specific code now should be placed into the corresponding directory
in src/platform/. To illustrate this, prng.h has been split into three
distinct files, one for each platform (contiki, lwip, posix) and moved into
the respective subdirectory.
When a client sends a GET request with Observe: 1, it must be removed from
the list of observers before the resource handler is called. Otherwise, it
will add an Observe option to its response.
The API version was missed to the 'Libs' entry in commit
45760a922d
We need the the correct API version in the *.pc file as pkgconfig can't
find the required libray without.
This example now uses LwIP release 1.4.1 as the devel branch seems
to have disappeared from the git repository. Moreover, we just do
a shallow clone so maybe the server does not kick us that often.
The new structure of libcoap allows to clone Contiki in a
subdirectory. The example build now uses Makefile to first clone
Contiki and then invoke Makefile.contiki for the actual build.
The TARGET is set to minimal-net by default but can be changed to
any other (tested) target.
Some configuration flags have been changed since Contiki version 3.
The Makefile.contiki for building a server example that uses libcoap
as a Contiki app has been fixed. The following builds now succeed:
make -f Makefile.contiki TARGET=minimal-net
make -f Makefile.contiki TARGET=econotag
make -f Makefile.contiki TARGET=mbxxx
When TESTS=yes is given, the scripts invokes the test driver from
the top build directory. Platform-specific actions hence must ensure
that they stay in that directory and keep the last exit code.
The build script invokes configure and make with different
parameters depending on the environment variables PLATFORM
and TESTS. PLATFORM currently must be one of 'posix', 'contiki', or
'lwip'. If TESTS is set to 'yes' or 'true', the option --enable-tests
will be passed to configure and tests/testdriver will be invoked
after configuration and make.
According to the Core Resource directory draft [1]. The discovery of the registration should be done using the /.well-known/core and including a Resource Type (rt) with the value "core.rd". Like that:
GET /.well-known/core?rt=core.rd
There is a typo in the libcoap which accept the "core-rd" instead of the "core.rd" parameter. Fixing that in this version.
[1] - https://tools.ietf.org/html/draft-ietf-core-resource-directory-05#section-5.1
uip_ds6_prefix_add is using 6 arguments, better use explicit argument
list than let the compiler decide. Some compiler will complain if some
optionally arguments are missed.
COAP_MAX_BLOCK_SZX is defined to "2" already before a define rule for
CONTIKI_TARGET_CC2538DK, just add a simply undefine line before the
redefine of COAP_MAX_BLOCK_SZX to make the compiler happy.
After splitting of the platform header part within libcoap some source
files that use functions of the network stack need to include coap.h
(which is including the libcoap.h) to get the platform specific header file
for the network stack.
Sort list of included headers in alphabetical order.
To get a proper public header setup for libcoap we need to split out the
static and platform related header files.
This commit is about creating the platform specific header file which
have to contain platform relevant header and or declarations and is
included by the coap.h header file.
Currently there is only Contiki as non Linux/BSD based platform we have
to take care. Potentially there is more to come.
Resume the cleaning of the public header files, no functional changes.
Reformatting the infos in the head of the header files, restructure header
inclusion check to be more generic. Reorder some include directives in a
alphabetical order. Remove including instructions for C++ stuff, it's
already done in the coap.h header, and the user only has to include this
header file.
Dropping the prefixing of the include guarding of uthash.h because it would
cause trouble with the macro handling in TinyDLS.
Thanks Olaf for reminding this!
The various variable checks within the public header files are not
useful as such checks doesn't have to be done in these files.
The public header files have only to provide the function declarations
and some macro definitions, any check for the availability of needed
other system header files has to be done by the user on his own.
TODO: The check for syslog.h in debug.h has to be moved out of the
public part into the source of the library later.
This fixes a bug reported by Daniel Petrie:
"When the coap-client is used and a local address to bind to is
specified, but the local port is not specified, I get errors for the
response coming in from an unexpected interface and the response is
dropped/ignored."
The solution here is to call getsockname() after successful bind()
in coap_new_endpoint() to set ep->addr to the actual transport
address being used.
The limitation of COAP_OPT_FILTER_SHORT to six entries made the
critical option check fail e.g. for Block2. This change hard-codes
the built-in critical options in coap_option_check_critical() so
that up to COAP_OPT_FILTER_SHORT short options and COAP_OPT_FILTER_LONG
long options can be registered dynamically.
Please note that registering critical options that are already known
(i.e. listed in pdu.h and checked in coap_option_check_critical())
is a waste of storage space.
The options --disable-documentation and --disable-examples did
not have the desired effect in some configurations. Now, if any
of documentation or examples is disabled, the manual pages in
the examples folder are not created.
Two new flags COAP_RESOURCE_FLAGS_NOTIFY_NON and
COAP_RESOURCE_FLAGS_NOTIFY_CON have been added to control the
message type for notifications to send. The default type is
COAP_RESOURCE_FLAGS_NOTIFY_NON which can be changed with the
function coap_resource_set_mode().
The observer-specific flag has been removed.
Baptiste Clenet <bapclenet@gmail.com> has pointed out that passing
an empty string causes address resolution to fail in certain cases.
This modification replaces the service parameter in the getaddrinfo
call with NULL as suggested.
The testdriver was linked against the statically generated library of
libcoap. By this the testdriver will *always* find any symbols, no
matter if it is a private or public symbol.
Due this the testing behavior isn't the same as a user would use the
shared library and can get a potentially pitfall even if the testdriver
was successful.
Due previous changes to the public header the testdriver source needs
now the local header coap_config.h to find all needed functions so there
are small changes needed to the source files.