Do not send back a RST is there is receipt of an empty message and using
TCP.
Otherwise, rate limit RST packets to 4 a second when receiving empty
messages
Add in the new functions
coap_session_set_max_retransmit()
coap_session_set_ack_timeout()
coap_session_set_ack_random_factor()
coap_session_get_max_transmit()
coap_session_get_ack_timeout()
coap_session_get_ack_random_factor()
Remove 'cc Rate Control' which is now in coap_session.h.
Update Q, ACK_TIMEOUT and ACK_RANDOM_FACTOR #defines to include session's
recovery parameters, now in coap_fixed_point_t.
Update calc_timeout() to include session (now called coap_calc_timeout()).
Update coap_retransmit() to use session's max_retransmit.
Add in the new functions
coap_session_set_max_retransmit()
coap_session_set_ack_timeout()
coap_session_set_ack_random_factor()
coap_session_get_max_transmit()
coap_session_get_ack_timeout()
coap_session_get_ack_random_factor()
Add in the default values in coap_make_session()
Update coap_calc_timeout() in coap_session_delay_pdu()
Include session as one of the parameters to coap_calc_timeout() as it is now
per session, which is renamed from calc_timeout() as it is now a public
function.
Support is required (RFC7252: 4.8.1. Changing the Parameters) to support
changing max_retransmit, ack_timeout and ack_random_factor values per
session instead of just using the default values.
Define struct coap_fixed_point_t to handle fixed point parameters
Added functions
coap_session_set_max_retransmit()
coap_session_set_ack_timeout()
coap_session_set_ack_random_factor()
coap_session_get_max_transmit()
coap_session_get_ack_timeout()
coap_session_get_ack_random_factor()
'cc Rate Control' moved from net.c into coap_session.h and updated to use
coap_fixed_point_t values where appropriate.
If the non-blocking connect() does not immediately complete, when the main i/o
processing loop runs and coap_read is called, coap_read_session() will assert if
COAP_SOCKET_CONNECTED is not set as there will be some TLS level packets to
process.
If WSAEWOULDBLOCK/EINPROGRESS is returned from the connect() set
COAP_SOCKET_CONNECTED in the socket flags.
This bugfix allows clients to send datagrams to IP multicast groups.
After introducing the concept of client sessions, datagram sockets
have been connected to their remote peer in coap_socket_connect_udp().
As this operation fails for multicast addresses, sending to multicast
groups was not possible anymore.
coap_socket_connect_udp() now checks whether the given server address
is a multicast address. If this is the case, connect() is not called
and the flag COAP_SOCKET_MULTICAST is set in the coap_socket_t
structure while COAP_SOCKET_CONNECTED is cleared.
The flag COAP_SOCKET_CONNECTED is now set by coap_socket_connect_udp()
and coap_socket_connect_tcp1().
coap_read_session() now allows reading from sockets that have either
the flag COAP_SOCKET_CONNECTED or COAP_SOCKET_MULTICAST set.
coap_session_t uses reference counting hence client sessions must be
released by coap_session_release() instead of directly calling
coap_session_free().
Valgrind reports Syscall param sendmsg(msg.msg_control) points to
uninitialised byte(s) due alignment padding in the CMSG macros
leaving uninitialized gaps in struct sent to the sendmsg system call.
This issue was reported including this patch on the libcoap-developers
mailing list [1].
[1] https://sourceforge.net/p/libcoap/mailman/message/36141279/
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
If a TCP connection connection fails, or a an ICMP Unreachable is received
for a UDP packet, then the file descriptor is not closed off. Eventually
all fails when no more file descriptors are allowed.
Update functions appropriately.
Move coap_new_client_session_pki() back into coap_session.h (its correct place)
Add in enum coap_asn1_privatekey_type_t
A simple structure for (D)TLS-specific unit tests has been added.
Currently, only general support and the version number as reported
by coap_get_tls_library_version() are checked.
As unit tests with IPv6 addresses keep failing on docker-based
travis CI, this changes reverts to IPv4 usage in following files:
test_wellknown.c
test_sendqueue.c
When determing whether to do a re-transmit timeout based on
coap_dtls_get_timeout, if s->tls is not set (unable to set up TLS session,
TLS error etc.), then coap_write() assert's when calling
coap_dtls_get_timeout(). This fix just sets the timeout to 0 if s->tls is not
set.