mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-16 13:04:55 +03:00
hashkey.[ch] files restored (now prefixed with coap_) LWIP and Contiki builds now include these files block.[ch]: New function coap_add_data_blocked_response() to simplify GET responses and handle adding in BLOCK2 options as appropriate. Needs coap_hash() to generate ETag option. net.c: Determine if Block2 is in use, and add to coap_add_observer(). resource.[ch]: Include Block2 request in coap_add_observer(). subscribe.h: Include Block2 definition in coap_subscriber_t for using during observe responses. pdu.h: Update comment. coap-client.c: No longer causes duplicate calls to coap_show_pdu() (one in library, one in coap-client for the same PDU). If a block'ed response received and observing, now observing continues. (Fixes #166). Send Observe Cancel with Block2 option if -b defined coap-server.c: Replaced all option setting, data addition etc. with new coap_add_data_blocked_response() function in the GET handlers. (Fixes #246 Issue 2). Support PUT with BLOCK1. (Fixes #246 Issue 1). Add in -N option to send observe responses as non-confirmable. Handle small wait_ms values correctly (after being decremented) for testing whether observe should be triggered or not. Refresh time every second by making COAP_RESOURCE_CHECK_TIME 1 Manuals: Add in new function coap_add_data_blocked_response() Update coap_observe with coap_delete_observer(s) functions Correct example typo and use new function in hnd_get_time(). Add in -N option to coap-server(5) Be more specific about COAP_RESOURCE_FLAGS_NOTIFY_NON and COAP_RESOURCE_FLAGS_NOTIFY_CON usage for observe. Files: Makefile.am Makefile.libcoap examples/client.c examples/coap-server.c examples/lwip/Makefile include/coap/block.h include/coap/coap_hashkey.h include/coap/pdu.h include/coap/resource.h include/coap/subscribe.h libcoap-2.map libcoap-2.sym man/Makefile.am man/coap-server.txt.in man/coap_handler.txt.in man/coap_observe.txt.in man/coap_pdu_setup.txt.in man/coap_resource.txt.in src/block.c src/coap_hashkey.c src/net.c src/resource.c
67 lines
2.2 KiB
Makefile
67 lines
2.2 KiB
Makefile
top_srcdir = ../..
|
|
|
|
WITH_LWIP_BRANCH=STABLE-2_0_3_RELEASE
|
|
WITH_LWIP_CONTRIB_BRANCH=STABLE-2_0_1_RELEASE
|
|
|
|
# Need to determine which library clock_gettime() resides in (as found by ./autogen.sh)
|
|
LDLIBS := $(shell if [ ../../config.log ] ; then grep ac_cv_search_clock_gettime=- ../../config.log|cut -d= -f2 ; fi)
|
|
|
|
all: server
|
|
|
|
lwip:
|
|
git clone --depth 1 git://git.savannah.nongnu.org/lwip.git -b $(WITH_LWIP_BRANCH)
|
|
(cd lwip ; git checkout $(WITH_LWIP_BRANCH))
|
|
$(MAKE)
|
|
|
|
lwip-contrib:
|
|
git clone --depth 1 git://git.savannah.nongnu.org/lwip/lwip-contrib.git -b $(WITH_LWIP_CONTRIB_BRANCH)
|
|
(cd lwip-contrib ; git checkout $(WITH_LWIP_CONTRIB_BRANCH))
|
|
$(MAKE)
|
|
|
|
# lwip and coap opts (include early to shadow the lwip-contrib/ports/unix/proj/minimal/ file and any ../../config.h)
|
|
CFLAGS += -DWITH_LWIP -iquote.
|
|
|
|
# lwip library
|
|
|
|
LWIPOBJS = def.o init.o tapif.o etharp.o netif.o timeouts.o stats.o mem.o memp.o udp.o tcp.o pbuf.o ip4_addr.o ip4.o inet_chksum.o tcp_in.o tcp_out.o icmp.o raw.o ip4_frag.o sys_arch.o ethernet.o ip.o
|
|
vpath %.c lwip/src/core/ lwip-contrib/ports/unix/proj/minimal/ lwip/src/netif/ lwip/src/core/ipv4/ lwip-contrib/ports/unix/port/ lwip-contrib/ports/unix/port/netif/
|
|
# CFLAGS += -DLWIP_UNIX_LINUX
|
|
|
|
# if ipv6 is used
|
|
vpath %.c lwip/src/core/ipv6/
|
|
LWIPOBJS += mld6.o ip6.o icmp6.o ethip6.o nd6.o ip6_addr.o ip6_frag.o
|
|
|
|
# coap library
|
|
|
|
CFLAGS += -std=gnu99
|
|
|
|
CFLAGS += -I$(top_srcdir)/include/coap
|
|
|
|
vpath %.c $(top_srcdir)/src
|
|
|
|
COAPOBJS = net.o debug.o option.o resource.o pdu.o encode.o subscribe.o coap_io_lwip.o block.o uri.o str.o coap_session.o coap_notls.o coap_hashkey.o
|
|
|
|
CFLAGS += -g3 -Wall -Wextra -pedantic -O0 -fpack-struct
|
|
# not sorted out yet
|
|
CFLAGS += -Wno-unused-parameter
|
|
|
|
CFLAGS += -Ilwip/src/include/ -Ilwip/src/include/ipv4/ -Ilwip-contrib/ports/unix/port/include/ -Ilwip-contrib/ports/unix/proj/minimal/
|
|
|
|
# making an executable out of all of it
|
|
|
|
OBJS = server.o server-coap.o ${LWIPOBJS} ${COAPOBJS}
|
|
|
|
../../include/coap/coap.h:
|
|
@echo "Error: coap.h not present. Run the autotools chain (\`./autogen.sh && ./configure\`) in the project root directory to build the required coap.h file."
|
|
@exit 1
|
|
|
|
${OBJS}: lwip lwip-contrib ../../include/coap/coap.h
|
|
|
|
server: ${OBJS}
|
|
# $(CC) ${OBJS} -o server -lrt
|
|
|
|
clean:
|
|
rm -f ${OBJS}
|
|
|
|
.PHONY: clean
|