libcoap  4.2.1
coap_notls.c
Go to the documentation of this file.
1 /*
2 * coap_notls.c -- Stub Datagram Transport Layer Support for libcoap
3 *
4 * Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
5 *
6 * This file is part of the CoAP library libcoap. Please see README for terms
7 * of use.
8 */
9 
10 #include "coap_internal.h"
11 
12 #if !defined(HAVE_LIBTINYDTLS) && !defined(HAVE_OPENSSL) && !defined(HAVE_LIBGNUTLS)
13 
14 #ifdef __GNUC__
15 #define UNUSED __attribute__((unused))
16 #else /* __GNUC__ */
17 #define UNUSED
18 #endif /* __GNUC__ */
19 
20 int
22  return 0;
23 }
24 
25 int
27  return 0;
28 }
29 
32  static coap_tls_version_t version;
33  version.version = 0;
34  version.type = COAP_TLS_LIBRARY_NOTLS;
35  return &version;
36 }
37 
38 int
40  coap_dtls_pki_t* setup_data UNUSED,
41  coap_dtls_role_t role UNUSED
42 ) {
43  return 0;
44 }
45 
46 int
48  const char *ca_file UNUSED,
49  const char *ca_path UNUSED
50 ) {
51  return 0;
52 }
53 
54 int
56  const char *hint UNUSED,
57  coap_dtls_role_t role UNUSED
58 ) {
59  return 0;
60 }
61 
62 int
64 {
65  return 0;
66 }
67 
68 static int dtls_log_level = 0;
69 
70 void coap_dtls_startup(void) {
71 }
72 
73 void
75  dtls_log_level = level;
76 }
77 
78 int
80  return dtls_log_level;
81 }
82 
83 void *
85  return NULL;
86 }
87 
88 void
90 }
91 
93  return NULL;
94 }
95 
97  return NULL;
98 }
99 
101 }
102 
104 }
105 
106 int
108  const uint8_t *data UNUSED,
109  size_t data_len UNUSED
110 ) {
111  return -1;
112 }
113 
115  return 1;
116 }
117 
119  return 0;
120 }
121 
124  return 0;
125 }
126 
128 }
129 
130 int
132  const uint8_t *data UNUSED,
133  size_t data_len UNUSED
134 ) {
135  return -1;
136 }
137 
138 int
140  const uint8_t *data UNUSED,
141  size_t data_len UNUSED
142 ) {
143  return 0;
144 }
145 
147  return 0;
148 }
149 
150 void *coap_tls_new_client_session(coap_session_t *session UNUSED, int *connected UNUSED) {
151  return NULL;
152 }
153 
154 void *coap_tls_new_server_session(coap_session_t *session UNUSED, int *connected UNUSED) {
155  return NULL;
156 }
157 
159 }
160 
162  const uint8_t *data UNUSED,
163  size_t data_len UNUSED
164 ) {
165  return -1;
166 }
167 
169  uint8_t *data UNUSED,
170  size_t data_len UNUSED
171 ) {
172  return -1;
173 }
174 
175 #undef UNUSED
176 
177 #else /* !HAVE_LIBTINYDTLS && !HAVE_OPENSSL && !HAVE_LIBGNUTLS */
178 
179 #ifdef __clang__
180 /* Make compilers happy that do not like empty modules. As this function is
181  * never used, we ignore -Wunused-function at the end of compiling this file
182  */
183 #pragma GCC diagnostic ignored "-Wunused-function"
184 #endif
185 static inline void dummy(void) {
186 }
187 
188 #endif /* !HAVE_LIBTINYDTLS && !HAVE_OPENSSL && !HAVE_LIBGNUTLS */
void coap_dtls_set_log_level(int level)
Sets the (D)TLS logging level to the specified level.
Definition: coap_notls.c:74
int coap_dtls_hello(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:139
void coap_tls_free_session(coap_session_t *coap_session UNUSED)
Definition: coap_notls.c:158
int coap_dtls_receive(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:131
int coap_dtls_context_check_keys_enabled(coap_context_t *ctx UNUSED)
Definition: coap_notls.c:63
ssize_t coap_tls_read(coap_session_t *session UNUSED, uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:168
int coap_dtls_get_log_level(void)
Get the current (D)TLS logging.
Definition: coap_notls.c:79
void * coap_dtls_new_client_session(coap_session_t *session UNUSED)
Definition: coap_notls.c:96
int coap_dtls_is_supported(void)
Check whether DTLS is available.
Definition: coap_notls.c:21
void coap_dtls_free_context(void *handle UNUSED)
Definition: coap_notls.c:89
int coap_dtls_context_set_pki(coap_context_t *ctx UNUSED, coap_dtls_pki_t *setup_data UNUSED, coap_dtls_role_t role UNUSED)
Definition: coap_notls.c:39
void * coap_tls_new_server_session(coap_session_t *session UNUSED, int *connected UNUSED)
Definition: coap_notls.c:154
ssize_t coap_tls_write(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:161
uint64_t version
(D)TLS runtime Library Version
Definition: coap_dtls.h:52
void * coap_tls_new_client_session(coap_session_t *session UNUSED, int *connected UNUSED)
Definition: coap_notls.c:150
No DTLS library.
Definition: coap_dtls.h:41
int coap_tls_is_supported(void)
Check whether TLS is available.
Definition: coap_notls.c:26
coap_tls_library_t type
Library type.
Definition: coap_dtls.h:53
coap_tls_version_t * coap_get_tls_library_version(void)
Determine the type and version of the underlying (D)TLS library.
Definition: coap_notls.c:31
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
Definition: coap_time.h:93
COAP_STATIC_INLINE void dummy(void)
Definition: coap_time.c:129
unsigned int coap_dtls_get_overhead(coap_session_t *session UNUSED)
Definition: coap_notls.c:146
static int dtls_log_level
Definition: coap_notls.c:68
The structure used for returning the underlying (D)TLS library information.
Definition: coap_dtls.h:51
int coap_dtls_context_set_psk(coap_context_t *ctx UNUSED, const char *hint UNUSED, coap_dtls_role_t role UNUSED)
Definition: coap_notls.c:55
coap_dtls_role_t
Definition: coap_dtls.h:266
void coap_dtls_free_session(coap_session_t *coap_session UNUSED)
Definition: coap_notls.c:100
void * coap_dtls_new_server_session(coap_session_t *session UNUSED)
Definition: coap_notls.c:92
The structure used for defining the PKI setup data to be used.
Definition: coap_dtls.h:193
int coap_dtls_context_set_pki_root_cas(struct coap_context_t *ctx UNUSED, const char *ca_file UNUSED, const char *ca_path UNUSED)
Definition: coap_notls.c:47
int coap_dtls_send(coap_session_t *session UNUSED, const uint8_t *data UNUSED, size_t data_len UNUSED)
Definition: coap_notls.c:107
void coap_dtls_handle_timeout(coap_session_t *session UNUSED)
Definition: coap_notls.c:127
void coap_dtls_startup(void)
Initialize the underlying (D)TLS Library layer.
Definition: coap_notls.c:70
coap_tick_t coap_dtls_get_timeout(coap_session_t *session UNUSED, coap_tick_t now UNUSED)
Definition: coap_notls.c:123
unsigned char uint8_t
Definition: uthash.h:79
#define UNUSED
Definition: coap_notls.c:17
coap_tick_t coap_dtls_get_context_timeout(void *dtls_context UNUSED)
Definition: coap_notls.c:118
void coap_dtls_session_update_mtu(coap_session_t *session UNUSED)
Definition: coap_notls.c:103
void * coap_dtls_new_context(struct coap_context_t *coap_context UNUSED)
Definition: coap_notls.c:84
The CoAP stack&#39;s global state is stored in a coap_context_t object.
Definition: net.h:147
int coap_dtls_is_context_timeout(void)
Check if timeout is handled per CoAP session or per CoAP context.
Definition: coap_notls.c:114
Pulls together all the internal only header files.