Correct Disable TCP for TLS and Windows

Makefile.am:

include coap_tcp_internal.h in EXTRA_DIST

libcoap-2.map
libcoap-2.sym:

Don't expose previously static coap_socket_format_errno().

src/coap_gnutls.c:
src/coap_openssl.c:
src/coap_tinydtls.c:

Correct ENABLE_TCP (never defined) to !COAP_DISABLE_TCP.
Conditionally compile in TLS code as appropriate.

src/coap_io.c:

Correct #endif description.

src/coap_session.c:

Conditionally compile in TLS code as appropriate.

src/coap_tcp.c

Merge in appropriate parts of https://github.com/obgm/libcoap/pull/396 and
https://github.com/obgm/libcoap/pull/345 fixes.

include/coap2/coap_tcp.h:
include/coap2/coap_tcp_internal.h:

Rename include/coap2/coap_tcp.h to include/coap2/coap_tcp_internal.h and
remove reference to coap_tcp_is_supported().

include/coap2/coap.h.in:

Remove reference to coap_tcp.h.

coap_config.h.windows:

Include #define COAP_DISABLE_TCP 0.

include/coap2/coap.h.windows:

Reorder #includes

include/coap2/coap_internal.h:

Add #include coap_tcp_internal.h

include/coap2/coap_io.h:

Add in definition of coap_tcp_is_supported().

win32/libcoap.vcxproj:
win32/libcoap.vcxproj.filters:

Include src/coap_tcp.c and include/coap2/coap_tcp_internal.h.
This commit is contained in:
Jon Shallow committed 2020-01-16 15:17:10 +00:00
1 parent b43907ef2b
commit c237b15b16
17 files changed
+93 -33

No files matched your search

-1
View File
@@ -40,7 +40,6 @@ extern "C" {
#include "coap_dtls.h"
#include "coap_event.h"
#include "coap_io.h"
#include "coap_tcp.h"
#include "coap_time.h"
#include "coap_debug.h"
#include "encode.h"
+1 -1
View File
@@ -37,11 +37,11 @@ extern "C" {
#include "async.h"
#include "bits.h"
#include "block.h"
#include "coap_debug.h"
#include "coap_dtls.h"
#include "coap_event.h"
#include "coap_io.h"
#include "coap_time.h"
#include "coap_debug.h"
#include "encode.h"
#include "mem.h"
#include "net.h"
+1
View File
@@ -48,5 +48,6 @@
/* Specifically defined internal .h files */
#include "coap_session_internal.h"
#include "coap_subscribe_internal.h"
#include "coap_tcp_internal.h"
#endif /* COAP_INTERNAL_H_ */
+7
View File
@@ -128,6 +128,13 @@ const char *coap_socket_strerror( void );
const char *coap_socket_format_errno(int error);
/**
* Check whether TCP is available.
*
* @return @c 1 if support for TCP is enabled, or @c 0 otherwise.
*/
int coap_tcp_is_supported(void);
/**
* Function interface for data transmission. This function returns the number of
* bytes that have been transmitted, or a value less than zero on error.
@@ -1,30 +1,28 @@
/*
* coap_tcp.h -- TCP functions for libcoap
* coap_tcp_internal.h -- TCP functions for libcoap
*
* Copyright (C) 2019 Olaf Bergmann <bergmann@tzi.org> and others
* Copyright (C) 2019--2020 Olaf Bergmann <bergmann@tzi.org> and others
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_TCP_H_
#define COAP_TCP_H_
/**
* @file coap_tcp_internal.h
* @brief COAP tcp internal information
*/
#ifndef COAP_TCP_INTERNAL_H_
#define COAP_TCP_INTERNAL_H_
#include "coap_io.h"
/**
* @defgroup tcp TCP Support
* API functions for interfacing with the system TCP stack.
* Internal API functions for interfacing with the system TCP stack.
* @{
*/
/**
* Check whether TCP is available.
*
* @return @c 1 if support for TCP is enabled, or @c 0 otherwise.
*/
int coap_tcp_is_supported(void);
int
coap_socket_connect_tcp1(coap_socket_t *sock,
const coap_address_t *local_if,
@@ -51,4 +49,4 @@ coap_socket_accept_tcp(coap_socket_t *server,
/** @} */
#endif /* COAP_TCP_H_ */
#endif /* COAP_TCP_INTERNAL_H_ */