Commit fadd273a authored by Carsten Schoenert's avatar Carsten Schoenert

New upstream version 4.2.0~rc3

parent da8f1e5e
libcoap authors
Olaf Bergmann
Carsten Schnert
Jon Shallow
Jean-Claude Michelou
Christian Amsss
Olaf Bergmann, Universitt Bremen <bergmann@tzi.org>
For additional contributors, see
https://github.com/obgm/libcoap/graphs/contributors
\ No newline at end of file
......@@ -70,6 +70,7 @@ libcoap_@LIBCOAP_NAME_SUFFIX@_la_SOURCES = \
src/block.c \
src/coap_event.c \
src/coap_hashkey.c \
src/coap_gnutls.c \
src/coap_io.c \
src/coap_notls.c \
src/coap_openssl.c \
......@@ -156,8 +157,10 @@ coap_dtls_send \
coap_dtls_session_update_mtu \
coap_dtls_startup \
coap_endpoint_new_dtls_session \
coap_mfree_endpoint \
coap_packet_extract_pbuf \
coap_pdu_from_pbuf \
coap_session_mfree \
coap_socket_accept_tcp \
coap_socket_bind_tcp \
coap_socket_bind_udp \
......
......@@ -157,6 +157,7 @@ am_libcoap_@LIBCOAP_NAME_SUFFIX@_la_OBJECTS = \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-block.lo \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_event.lo \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.lo \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.lo \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_notls.lo \
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_openssl.lo \
......@@ -204,6 +205,7 @@ am__depfiles_remade = \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-async.Plo \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-block.Plo \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_event.Plo \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Plo \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.Plo \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Plo \
src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_notls.Plo \
......@@ -369,6 +371,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
GnuTLS_CFLAGS = @GnuTLS_CFLAGS@
GnuTLS_LIBS = @GnuTLS_LIBS@
HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
......@@ -525,6 +529,7 @@ libcoap_@LIBCOAP_NAME_SUFFIX@_la_SOURCES = \
src/block.c \
src/coap_event.c \
src/coap_hashkey.c \
src/coap_gnutls.c \
src/coap_io.c \
src/coap_notls.c \
src/coap_openssl.c \
......@@ -602,8 +607,10 @@ coap_dtls_send \
coap_dtls_session_update_mtu \
coap_dtls_startup \
coap_endpoint_new_dtls_session \
coap_mfree_endpoint \
coap_packet_extract_pbuf \
coap_pdu_from_pbuf \
coap_session_mfree \
coap_socket_accept_tcp \
coap_socket_bind_tcp \
coap_socket_bind_udp \
......@@ -733,6 +740,8 @@ src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_event.lo: \
src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.lo: \
src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo: \
src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.lo: src/$(am__dirstamp) \
src/$(DEPDIR)/$(am__dirstamp)
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_notls.lo: \
......@@ -781,6 +790,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-async.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-block.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_event.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_notls.Plo@am__quote@ # am--include-marker
......@@ -864,6 +874,13 @@ src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.lo: src/coap_hashkey.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcoap_@LIBCOAP_NAME_SUFFIX@_la_CFLAGS) $(CFLAGS) -c -o src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.lo `test -f 'src/coap_hashkey.c' || echo '$(srcdir)/'`src/coap_hashkey.c
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo: src/coap_gnutls.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcoap_@LIBCOAP_NAME_SUFFIX@_la_CFLAGS) $(CFLAGS) -MT src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo -MD -MP -MF src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Tpo -c -o src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo `test -f 'src/coap_gnutls.c' || echo '$(srcdir)/'`src/coap_gnutls.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Tpo src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/coap_gnutls.c' object='src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcoap_@LIBCOAP_NAME_SUFFIX@_la_CFLAGS) $(CFLAGS) -c -o src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.lo `test -f 'src/coap_gnutls.c' || echo '$(srcdir)/'`src/coap_gnutls.c
src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.lo: src/coap_io.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcoap_@LIBCOAP_NAME_SUFFIX@_la_CFLAGS) $(CFLAGS) -MT src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.lo -MD -MP -MF src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Tpo -c -o src/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.lo `test -f 'src/coap_io.c' || echo '$(srcdir)/'`src/coap_io.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Tpo src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Plo
......@@ -1376,6 +1393,7 @@ distclean: distclean-recursive
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-async.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-block.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_event.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_notls.Plo
......@@ -1444,6 +1462,7 @@ maintainer-clean: maintainer-clean-recursive
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-async.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-block.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_event.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_gnutls.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_hashkey.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_io.Plo
-rm -f src/$(DEPDIR)/libcoap_@LIBCOAP_NAME_SUFFIX@_la-coap_notls.Plo
......
......@@ -10,7 +10,7 @@ ABOUT LIBCOAP
libcoap is a C implementation of a lightweight application-protocol
for devices that are constrained their resources such as computing
power, RF range, memory, bandwith, or network packet sizes. This
power, RF range, memory, bandwidth, or network packet sizes. This
protocol, CoAP, is standardized by the IETF as RFC 7252. For further
information related to CoAP, see <http://coap.technology>.
......
This diff is collapsed.
......@@ -13,7 +13,7 @@ m4_define([libcoap_micro_version], [0])
# define an appending release state if needed, for example for pre-releases
# like 'alpha' or 'rc1', for a full release keep the value empty!
m4_define([libcoap_release_state], [rc2])
m4_define([libcoap_release_state], [rc3])
# concatenate the full libcoap version string
m4_define([libcoap_version], [m4_format([%s.%s.%s%s], libcoap_major_version, libcoap_minor_version, libcoap_micro_version, libcoap_release_state)])
......@@ -301,7 +301,7 @@ AM_CONDITIONAL(BUILD_MANPAGES, [test "x$build_manpages" = "xyes"])
# If the user isn't using a selection we first search for GnuTLS and fallback
# to OpenSSL if the GnuTLS library couldn't be found.
gnutls_version_required=3.2.0
gnutls_version_required=3.3.0
openssl_version_required=1.1.0
AC_ARG_ENABLE([dtls],
......@@ -310,11 +310,11 @@ AC_ARG_ENABLE([dtls],
[build_dtls="$enableval"],
[build_dtls="yes"])
#AC_ARG_WITH([gnutls],
# [AS_HELP_STRING([--with-gnutls],
# [Use GnuTLS for DTLS functions])],
# [with_gnutls="$withval"],
# [with_gnutls="no"])
AC_ARG_WITH([gnutls],
[AS_HELP_STRING([--with-gnutls],
[Use GnuTLS for DTLS functions])],
[with_gnutls="$withval"],
[with_gnutls="no"])
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl],
......@@ -346,11 +346,10 @@ if test "x$build_dtls" = "xyes"; then
# Check for all possible usable and supported SSL crypto libraries
# GnuTLS
# PKG_CHECK_MODULES([GnuTLS],
# [gnutls],
# [have_gnutls="yes"],
# [have_gnutls="no"])
have_gnutls="no"
PKG_CHECK_MODULES([GnuTLS],
[gnutls],
[have_gnutls="yes"],
[have_gnutls="no"])
# OpenSSL
PKG_CHECK_MODULES([OpenSSL],
......@@ -362,20 +361,20 @@ if test "x$build_dtls" = "xyes"; then
# TBD ?
# The user wants to use explicit GnuTLS if '--with-gnutls' was set.
# if test "x$with_gnutls" = "xyes"; then
if test "x$with_gnutls" = "xyes"; then
# Some more sanity checking.
# if test "x$have_gnutls" != "xyes"; then
# AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the GnuTLS library but pkg-config file 'gnutls.pc' could not be found!
# Install the package(s) that contains the development files for GnuTLS,
# or use '--with-openssl' or disable the DTLS support using '--disable-dtls'.])
# fi
# AC_MSG_NOTICE([The use of GnuTLS was explicit requested due configure option '--with-gnutls'!])
if test "x$have_gnutls" != "xyes"; then
AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the GnuTLS library but pkg-config file 'gnutls.pc' could not be found!
Install the package(s) that contains the development files for GnuTLS,
or use '--with-openssl' or disable the DTLS support using '--disable-dtls'.])
fi
AC_MSG_NOTICE([The use of GnuTLS was explicit requested due configure option '--with-gnutls'!])
# check for valid GnuTLS version
# gnutls_version=`pkg-config --modversion gnutls`
# AX_CHECK_GNUTLS_VERSION
# have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script
# fi
gnutls_version=`pkg-config --modversion gnutls`
AX_CHECK_GNUTLS_VERSION
have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script
fi
# The user wants to use explicit OpenSSL if '--with-openssl was set'.
if test "x$with_openssl" = "xyes"; then
......@@ -409,17 +408,16 @@ if test "x$build_dtls" = "xyes"; then
# The user hasn't requested the use of a specific cryptography library
# we try first GnuTLS for usability ...
# if test "x$have_gnutls" = "xyes" -a "x$with_gnutls" = "xno" -a "x$with_tinydtls" = "xno"; then
# gnutls_version=`pkg-config --modversion gnutls`
# AX_CHECK_GNUTLS_VERSION
# AC_MSG_NOTICE([Using auto selected library GnuTLS for DTLS support!])
# with_gnutls_auto="yes"
# have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script
# fi
if test "x$have_gnutls" = "xyes" -a "x$with_gnutls" = "xno" -a "x$with_tinydtls" = "xno"; then
gnutls_version=`pkg-config --modversion gnutls`
AX_CHECK_GNUTLS_VERSION
AC_MSG_NOTICE([Using auto selected library GnuTLS for DTLS support!])
with_gnutls_auto="yes"
have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script
fi
# ... and if not found check OpenSSL is suitable.
# if test "x$have_openssl" = "xyes" -a "x$with_openssl" = "xno" -a "x$with_gnutls_auto" = "x" -a "x$with_tinydtls" = "xno"; then
if test "x$have_openssl" = "xyes" -a "x$with_openssl" = "xno" -a "x$with_tinydtls" = "xno"; then
if test "x$have_openssl" = "xyes" -a "x$with_openssl" = "xno" -a "x$with_gnutls_auto" = "x" -a "x$with_tinydtls" = "xno"; then
openssl_version=`pkg-config --modversion openssl`
AX_CHECK_OPENSSL_VERSION
AC_MSG_NOTICE([Using auto selected library OpenSSL for DTLS support!])
......@@ -430,12 +428,9 @@ if test "x$build_dtls" = "xyes"; then
# Note that tinyDTLS is used only when explicitly requested.
# Giving out an error message if we haven't found at least one crypto library.
# if test "x$have_gnutls" = "xno" -a "x$have_openssl" = "xno" -a "x$have_tinydtls" != "xno"; then
# AC_MSG_ERROR([==> Option '--enable-dtls' is set but one of the needed cryptography library GnuTLS nor OpenSSL nor tinyDTLS could be found!
# Install at least one of the package(s) that contains the development files for GnuTLS (>= $gnutls_version_required) or OpenSSL(>= $openssl_version_required)
if test "x$have_openssl" = "xno" -a "x$have_tinydtls" != "xno"; then
AC_MSG_ERROR([==> Option '--enable-dtls' is set but none of the needed cryptography libraries OpenSSL nor tinyDTLS could be found!
Install at least one of the package(s) that contains the development files for OpenSSL(>= $openssl_version_required)
if test "x$have_gnutls" = "xno" -a "x$have_openssl" = "xno" -a "x$have_tinydtls" != "xno"; then
AC_MSG_ERROR([==> Option '--enable-dtls' is set but one of the needed cryptography library GnuTLS nor OpenSSL nor tinyDTLS could be found!
Install at least one of the package(s) that contains the development files for GnuTLS (>= $gnutls_version_required) or OpenSSL(>= $openssl_version_required)
or disable the DTLS support using '--disable-dtls'.])
fi
......
......@@ -170,6 +170,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
GnuTLS_CFLAGS = @GnuTLS_CFLAGS@
GnuTLS_LIBS = @GnuTLS_LIBS@
HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
......@@ -400,8 +402,8 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
@HAVE_DOXYGEN_FALSE@clean-local:
@HAVE_DOXYGEN_FALSE@distclean-local:
@HAVE_DOXYGEN_FALSE@clean-local:
clean: clean-am
clean-am: clean-generic clean-libtool clean-local mostlyclean-am
......
......@@ -11,7 +11,7 @@ About libcoap
libcoap is a C implementation of a lightweight application-protocol
for devices that are constrained their resources such as computing
power, RF range, memory, bandwith, or network packet sizes. This
power, RF range, memory, bandwidth, or network packet sizes. This
protocol, CoAP, is standardized by the IETF as RFC 7252. For further
information related to CoAP, see <http://coap.technology>.
......
......@@ -13,8 +13,9 @@ AM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/include/coap$(LIBCOAP_API_VERSION) \
$(WARNING_CFLAGS) $(DTLS_CFLAGS) -std=c99
# etsi_iot_01 and tiny are missing
#
bin_PROGRAMS = coap-client coap-server coap-rd
check_PROGRAMS = coap-etsi_iot_01 coap-tiny
coap_client_SOURCES = client.c
coap_client_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
......@@ -25,4 +26,10 @@ coap_server_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SU
coap_rd_SOURCES = coap-rd.c
coap_rd_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
coap_etsi_iot_01_SOURCES = etsi_iot_01.c
coap_etsi_iot_01_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
coap_tiny_SOURCES = tiny.c
coap_tiny_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
endif # BUILD_EXAMPLES
......@@ -97,6 +97,8 @@ build_triplet = @build@
host_triplet = @host@
@BUILD_EXAMPLES_TRUE@bin_PROGRAMS = coap-client$(EXEEXT) \
@BUILD_EXAMPLES_TRUE@ coap-server$(EXEEXT) coap-rd$(EXEEXT)
@BUILD_EXAMPLES_TRUE@check_PROGRAMS = coap-etsi_iot_01$(EXEEXT) \
@BUILD_EXAMPLES_TRUE@ coap-tiny$(EXEEXT)
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_cryptolibs.m4 \
......@@ -125,6 +127,13 @@ AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
am__coap_etsi_iot_01_SOURCES_DIST = etsi_iot_01.c
@BUILD_EXAMPLES_TRUE@am_coap_etsi_iot_01_OBJECTS = \
@BUILD_EXAMPLES_TRUE@ etsi_iot_01.$(OBJEXT)
coap_etsi_iot_01_OBJECTS = $(am_coap_etsi_iot_01_OBJECTS)
@BUILD_EXAMPLES_TRUE@coap_etsi_iot_01_DEPENDENCIES = \
@BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \
@BUILD_EXAMPLES_TRUE@ $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
am__coap_rd_SOURCES_DIST = coap-rd.c
@BUILD_EXAMPLES_TRUE@am_coap_rd_OBJECTS = coap-rd.$(OBJEXT)
coap_rd_OBJECTS = $(am_coap_rd_OBJECTS)
......@@ -135,6 +144,11 @@ am__coap_server_SOURCES_DIST = coap-server.c
coap_server_OBJECTS = $(am_coap_server_OBJECTS)
@BUILD_EXAMPLES_TRUE@coap_server_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@BUILD_EXAMPLES_TRUE@ $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
am__coap_tiny_SOURCES_DIST = tiny.c
@BUILD_EXAMPLES_TRUE@am_coap_tiny_OBJECTS = tiny.$(OBJEXT)
coap_tiny_OBJECTS = $(am_coap_tiny_OBJECTS)
@BUILD_EXAMPLES_TRUE@coap_tiny_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@BUILD_EXAMPLES_TRUE@ $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
......@@ -151,7 +165,8 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/client.Po ./$(DEPDIR)/coap-rd.Po \
./$(DEPDIR)/coap-server.Po
./$(DEPDIR)/coap-server.Po ./$(DEPDIR)/etsi_iot_01.Po \
./$(DEPDIR)/tiny.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
......@@ -171,10 +186,12 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(coap_client_SOURCES) $(coap_rd_SOURCES) \
$(coap_server_SOURCES)
SOURCES = $(coap_client_SOURCES) $(coap_etsi_iot_01_SOURCES) \
$(coap_rd_SOURCES) $(coap_server_SOURCES) $(coap_tiny_SOURCES)
DIST_SOURCES = $(am__coap_client_SOURCES_DIST) \
$(am__coap_rd_SOURCES_DIST) $(am__coap_server_SOURCES_DIST)
$(am__coap_etsi_iot_01_SOURCES_DIST) \
$(am__coap_rd_SOURCES_DIST) $(am__coap_server_SOURCES_DIST) \
$(am__coap_tiny_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
......@@ -236,6 +253,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
GnuTLS_CFLAGS = @GnuTLS_CFLAGS@
GnuTLS_LIBS = @GnuTLS_LIBS@
HAVE_DOT = @HAVE_DOT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
......@@ -359,6 +378,10 @@ top_srcdir = @top_srcdir@
@BUILD_EXAMPLES_TRUE@coap_server_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
@BUILD_EXAMPLES_TRUE@coap_rd_SOURCES = coap-rd.c
@BUILD_EXAMPLES_TRUE@coap_rd_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
@BUILD_EXAMPLES_TRUE@coap_etsi_iot_01_SOURCES = etsi_iot_01.c
@BUILD_EXAMPLES_TRUE@coap_etsi_iot_01_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
@BUILD_EXAMPLES_TRUE@coap_tiny_SOURCES = tiny.c
@BUILD_EXAMPLES_TRUE@coap_tiny_LDADD = $(DTLS_LIBS) $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la
all: all-am
.SUFFIXES:
......@@ -442,10 +465,23 @@ clean-binPROGRAMS:
echo " rm -f" $$list; \
rm -f $$list
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
coap-client$(EXEEXT): $(coap_client_OBJECTS) $(coap_client_DEPENDENCIES) $(EXTRA_coap_client_DEPENDENCIES)
@rm -f coap-client$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(coap_client_OBJECTS) $(coap_client_LDADD) $(LIBS)
coap-etsi_iot_01$(EXEEXT): $(coap_etsi_iot_01_OBJECTS) $(coap_etsi_iot_01_DEPENDENCIES) $(EXTRA_coap_etsi_iot_01_DEPENDENCIES)
@rm -f coap-etsi_iot_01$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(coap_etsi_iot_01_OBJECTS) $(coap_etsi_iot_01_LDADD) $(LIBS)
coap-rd$(EXEEXT): $(coap_rd_OBJECTS) $(coap_rd_DEPENDENCIES) $(EXTRA_coap_rd_DEPENDENCIES)
@rm -f coap-rd$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(coap_rd_OBJECTS) $(coap_rd_LDADD) $(LIBS)
......@@ -454,6 +490,10 @@ coap-server$(EXEEXT): $(coap_server_OBJECTS) $(coap_server_DEPENDENCIES) $(EXTRA
@rm -f coap-server$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(coap_server_OBJECTS) $(coap_server_LDADD) $(LIBS)
coap-tiny$(EXEEXT): $(coap_tiny_OBJECTS) $(coap_tiny_DEPENDENCIES) $(EXTRA_coap_tiny_DEPENDENCIES)
@rm -f coap-tiny$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(coap_tiny_OBJECTS) $(coap_tiny_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
......@@ -463,6 +503,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coap-rd.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/coap-server.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etsi_iot_01.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tiny.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
......@@ -583,6 +625,7 @@ distdir-am: $(DISTFILES)
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
......@@ -621,12 +664,15 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/client.Po
-rm -f ./$(DEPDIR)/coap-rd.Po
-rm -f ./$(DEPDIR)/coap-server.Po
-rm -f ./$(DEPDIR)/etsi_iot_01.Po
-rm -f ./$(DEPDIR)/tiny.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
......@@ -675,6 +721,8 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/client.Po
-rm -f ./$(DEPDIR)/coap-rd.Po
-rm -f ./$(DEPDIR)/coap-server.Po
-rm -f ./$(DEPDIR)/etsi_iot_01.Po
-rm -f ./$(DEPDIR)/tiny.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
......@@ -693,18 +741,19 @@ ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
clean-libtool cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
......
This diff is collapsed.
......@@ -552,6 +552,7 @@ init_resources(coap_context_t *ctx) {
static void
usage( const char *program, const char *version) {
const char *p;
char buffer[64];
p = strrchr( program, '/' );
if ( p )
......@@ -559,11 +560,13 @@ usage( const char *program, const char *version) {
fprintf( stderr, "%s v%s -- CoRE Resource Directory implementation\n"
"(c) 2011-2012 Olaf Bergmann <bergmann@tzi.org>\n\n"
"%s\n\n"
"usage: %s [-A address] [-p port]\n\n"
"\t-A address\tinterface address to bind to\n"
"\t-p port\t\tlisten on specified port\n"
"\t-v num\t\tverbosity level (default: 3)\n",
program, version, program );
program, version, coap_string_tls_version(buffer, sizeof(buffer)),
program);
}
static coap_context_t *
......
......@@ -3,7 +3,7 @@
/* coap -- simple implementation of the Constrained Application Protocol (CoAP)
* as defined in RFC 7252
*
* Copyright (C) 2010--2018 Olaf Bergmann <bergmann@tzi.org>
* Copyright (C) 2010--2018 Olaf Bergmann <bergmann@tzi.org> and others
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
......@@ -479,12 +479,18 @@ hnd_put(coap_context_t *ctx UNUSED_PARAM,
value = NULL;
}
}
else if (offset !=
else if (offset >
(resource_entry->value ? resource_entry->value->length : 0)) {
/* Upload is not sequential */
/* Upload is not sequential - block missing */
response->code = COAP_RESPONSE_CODE(408);
return;
}
else if (offset <
(resource_entry->value ? resource_entry->value->length : 0)) {
/* Upload is not sequential - block duplicated */
goto just_respond;
}
/* Add in new block to end of current data */
resource_entry->value = coap_new_string(offset + size);
memcpy (&resource_entry->value->s[offset], data, size);
resource_entry->value->length = offset + size;
......@@ -493,6 +499,7 @@ hnd_put(coap_context_t *ctx UNUSED_PARAM,
coap_delete_string(value);
}
}
just_respond:
if (block1.m) {
response->code = COAP_RESPONSE_CODE(231);
}
......@@ -709,19 +716,44 @@ fill_keystore(coap_context_t *ctx) {
static void
usage( const char *program, const char *version) {
const char *p;
char buffer[64];
p = strrchr( program, '/' );
if ( p )
program = ++p;
fprintf( stderr, "%s v%s -- a small CoAP implementation\n"
"(c) 2010,2011,2015-2018 Olaf Bergmann <bergmann@tzi.org>\n\n"
"Usage: %s [-A address] [-g group] [-p port] [-l loss] [-c certfile]\n"
"\t\t[-C cafile] [-R root_cafile] [-k key] [-h hint] [-N]\n"
"\t\t[-v num] [-d max]\n\n"
"\t-A address\tInterface address to bind to\n"
"(c) 2010,2011,2015-2018 Olaf Bergmann <bergmann@tzi.org> and others\n\n"
"%s\n\n"
"Usage: %s [-d max] [-g group] [-l loss] [-p port] [-v num]\n"
"\t\t[-A address] [-N]\n"
"\t\t[[-k key] [-h hint]]\n"
"\t\t[[-c certfile][-C cafile] [-R root_cafile]]\n"
"General Options\n"
"\t-d max \t\tAllow dynamic creation of up to a total of max\n"
"\t \t\tresources. If max is reached, a 4.06 code is returned\n"
"\t \t\tuntil one of the dynamic resources has been deleted\n"
"\t-g group\tJoin the given multicast group\n"
"\t-l list\t\tFail to send some datagrams specified by a comma\n"
"\t \t\tseparated list of numbers or number ranges\n"
"\t \t\t(for debugging only)\n"
"\t-l loss%%\tRandomly fail to send datagrams with the specified\n"
"\t \t\tprobability - 100%% all datagrams, 0%% no datagrams\n"
"\t \t\t(for debugging only)\n"
"\t-p port\t\tListen on specified port\n"
"\t-v num \t\tVerbosity level (default 3, maximum is 9). Above 7,\n"
"\t \t\tthere is increased verbosity in GnuTLS logging\n"
"\t-A address\tInterface address to bind to\n"
"\t-N \t\tMake \"observe\" responses NON-confirmable. Even if set\n"
"\t \t\tevery fifth response will still be sent as a confirmable\n"
"\t \t\tresponse (RFC 7641 requirement)\n"
"PSK Options (if supported by underlying (D)TLS library)\n"
"\t-h hint\t\tPSK Hint. Default is CoAP\n"
"\t-k key \t\tPre-shared key. This argument requires (D)TLS with PSK\n"
"\t \t\tto be available. This cannot be empty if defined.\n"
"\t \t\tNote that both -c and -k need to be defined\n"
"\t \t\tfor both PSK and PKI to be concurrently supported\n"
"PKI Options (if supported by underlying (D)TLS library)\n"
"\t-c certfile\tPEM file containing both CERTIFICATE and PRIVATE KEY\n"
"\t \t\tThis argument requires (D)TLS with PKI to be available\n"
"\t-C cafile\tPEM file containing the CA Certificate that was used to\n"
......@@ -737,26 +769,10 @@ usage( const char *program, const char *version) {
"\t \t\tare to be used to validate the client certificate.\n"
"\t \t\tThe '-C cafile' does not have to be in this list and is\n"
"\t \t\t'trusted' for the verification.\n"
"\t \t\tAlternatively, this can point to a directory containing a\n"
"\t \t\tset of CA PEM files\n"
"\t-h hint\t\tPSK Hint. Default is CoAP\n"
"\t-k key \t\tPre-shared key. This argument requires (D)TLS with PSK\n"
"\t \t\tto be available. This cannot be empty if defined.\n"
"\t \t\tNote that both -c and -k need to be defined\n"
"\t \t\tfor both PSK and PKI to be concurrently supported\n"
"\t-N \t\tMake \"observe\" responses NON-confirmable. Even if set\n"
"\t \t\tevery fifth response will still be sent as a confirmable\n"
"\t \t\tresponse (RFC 7641 requirement)\n"
"\t-l list\t\tFail to send some datagrams specified by a comma separated\n"
"\t \t\tlist of numbers or number ranges (for debugging only)\n"
"\t-l loss%%\tRandomly fail to send datagrams with the specified\n"
"\t \t\tprobability - 100%% all datagrams, 0%% no datagrams\n"
"\t \t\t(for debugging only)\n"
"\t-v num \t\tVerbosity level (default: 3)\n"
"\t-d max \t\tAllow dynamic creation of up to a total of max resources.\n"
"\t \t\tIf max is reached, a 4.06 code is returned until one of the\n"
"\t \t\tdynamic resources has been deleted\n",
program, version, program );
"\t \t\tAlternatively, this can point to a directory containing\n"
"\t \t\ta set of CA PEM files\n"
, program, version, coap_string_tls_version(buffer, sizeof(buffer)),
program);
}
static coap_context_t *
......@@ -923,6 +939,7 @@ main(int argc, char **argv) {
coap_log_t log_level = LOG_WARNING;
unsigned wait_ms;
time_t t_last = 0;
struct sigaction sa;
clock_offset = time(NULL);
......@@ -998,7 +1015,12 @@ main(int argc, char **argv) {
if (group)
join(ctx, group);
signal(SIGINT, handle_sigint);
memset (&sa, 0, sizeof(sa));
sigemptyset(&sa.sa_mask);
sa.sa_handler = handle_sigint;
sa.sa_flags = 0;
sigaction (SIGINT, &sa, NULL);
sigaction (SIGTERM, &sa, NULL);
wait_ms = COAP_RESOURCE_CHECK_TIME * 1000;
......
......@@ -21,7 +21,7 @@
* See 'man coap_pdu_setup' for further information.
*
* examples/coap_list.[ch] files will be removed in a future release
* They are left here to support building backward compatability of old versions
* They are left here to support building backward compatibility of old versions
* of coap-client
*/
......
This diff is collapsed.
/* tiny -- tiny sender
*
* Copyright (C) 2010,2011 Olaf Bergmann <bergmann@tzi.org>
*
* This file is part of the CoAP library libcoap. Please see
* README for terms of use.
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include <sys/select.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <signal.h>
#include "coap.h"
#ifdef __GNUC__
#define UNUSED_PARAM __attribute__ ((unused))
#else /* not a GCC */
#define UNUSED_PARAM
#endif /* GCC */
static coap_tid_t id;
static int quit = 0;
/* SIGINT handler: set quit to 1 for graceful termination */
static void
handle_sigint(int signum UNUSED_PARAM) {
quit = 1;
}
static coap_pdu_t *
make_pdu( unsigned int value ) {
coap_pdu_t *pdu;
unsigned char enc;
static unsigned char buf[20];
int len, ls;
if (!(pdu = coap_pdu_init(0, 0, 0, COAP_DEFAULT_MTU)))
return NULL;
pdu->type = COAP_MESSAGE_NON;
pdu->code = COAP_REQUEST_POST;
pdu->tid = id++;
enc = COAP_PSEUDOFP_ENCODE_8_4_DOWN(value,ls);
len = sprintf((char *)buf, "%c%u", enc, COAP_PSEUDOFP_DECODE_8_4(enc));
coap_add_data( pdu, len, buf );
return pdu;
}
static void
usage( const char *program ) {
const char *p;
p = strrchr( program, '/' );
if ( p )
program = ++p;
fprintf( stderr, "%s -- tiny fake sensor\n"
"(c) 2010 Olaf Bergmann <bergmann@tzi.org>\n\n"
"usage: %s [group address]\n"
"\n\nSends some fake sensor values to specified multicast group\n",
program, program );
}
static coap_session_t *
get_session(const char *group) {
coap_context_t *ctx = coap_new_context(NULL);
int s;
struct addrinfo hints;
struct addrinfo *result, *rp;
coap_session_t *session;
int hops = 16;