1COAP_CONTEXT(3)                 libcoap Manual                 COAP_CONTEXT(3)
2
3
4

NAME

6       coap_context, coap_new_context, coap_free_context,
7       coap_context_set_max_idle_sessions, coap_context_get_max_idle_sessions,
8       coap_context_set_max_handshake_sessions,
9       coap_context_get_max_handshake_sessions,
10       coap_context_set_session_timeout, coap_context_get_session_timeout,
11       coap_context_set_csm_timeout, coap_context_get_csm_timeout - Work with
12       CoAP contexts
13

SYNOPSIS

15       #include <coap3/coap.h>
16
17       coap_context_t *coap_new_context(const coap_address_t *listen_addr);
18
19       void coap_free_context(coap_context_t *context);
20
21       void coap_context_set_max_idle_sessions(coap_context_t *context,
22       unsigned int max_idle_sessions);
23
24       unsigned int coap_context_get_max_idle_sessions( const coap_context_t
25       *context);
26
27       void coap_context_set_max_handshake_sessions(coap_context_t *context,
28       unsigned int max_handshake_sessions);
29
30       unsigned int coap_context_get_max_handshake_sessions( const
31       coap_context_t *context);
32
33       void coap_context_set_session_timeout(coap_context_t *context, unsigned
34       int session_timeout);
35
36       unsigned int coap_context_get_session_timeout( const coap_context_t
37       *context);
38
39       void coap_context_set_csm_timeout(coap_context_t *context, unsigned int
40       csm_timeout);
41
42       unsigned int coap_context_get_csm_timeout(const coap_context_t
43       *context);
44
45       For specific (D)TLS library support, link with -lcoap-3-notls,
46       -lcoap-3-gnutls, -lcoap-3-openssl, -lcoap-3-mbedtls or
47       -lcoap-3-tinydtls. Otherwise, link with -lcoap-3 to get the default
48       (D)TLS library support.
49

DESCRIPTION

51       This man page focuses on the CoAP Context and how to update or get
52       information from the opaque coap_context_t structure.
53
54       The CoAP stack’s global state is stored in a coap_context_t Context
55       object. Resources, Endpoints and Sessions are associated with this
56       context object. There can be more than one coap_context_t object per
57       application, it is up to the application to manage each one
58       accordingly.
59
60       The coap_new_context() function creates a new Context that is then used
61       to keep all the CoAP Resources, Endpoints and Sessions information. The
62       optional listen_addr parameter, if set for a CoAP server, creates an
63       Endpoint that is added to the context that is listening for
64       un-encrypted traffic on the IP address and port number defined by
65       listen_addr.
66
67       The coap_free_context() function must be used to release the CoAP stack
68       context. It clears all entries from the receive queue and send queue
69       and deletes the Resources that have been registered with context, and
70       frees the attached Sessions and Endpoints.
71
72       The coap_context_set_max_idle_sessions() function sets the maximum
73       number of idle server sessions to max_idle_sessions for context. If
74       this number is exceeded, the least recently used server session is
75       completely removed. 0 (the initial default) means that the number of
76       idle sessions is not monitored.
77
78       The coap_context_get_max_idle_sessions() function returns the maximum
79       number of idle server sessions for context.
80
81       The coap_context_set_max_handshake_sessions() function sets the maximum
82       number of outstanding server sessions in (D)TLS handshake to
83       max_handshake_sessions for context. If this number is exceeded, the
84       least recently used server session in handshake is completely removed.
85       0 (the default) means that the number of handshakes is not monitored.
86
87       The coap_context_get_max_handshake_sessions() function returns the
88       maximum number of outstanding server sessions in (D)TLS handshake for
89       context.
90
91       The coap_context_set_session_timeout() function sets the number of
92       seconds of inactivity to session_timeout for context before an idle
93       server session is removed. 0 (the default) means wait for the default
94       of 300 seconds.
95
96       The coap_context_get_session_timeout() function returns the seconds to
97       wait before timing out an idle server session for context.
98
99       The coap_context_set_csm_timeout() function sets the number of seconds
100       to wait for a (TCP) CSM negotiation response from the peer to
101       csm_timeout for context. 0 (the default) means wait forever.
102
103       The coap_context_get_csm_timeout() function returns the seconds to wait
104       for a (TCP) CSM negotiation response from the peer for context,
105

RETURN VALUES

107       coap_new_context() function returns a newly created context or NULL if
108       there is a creation failure.
109
110       coap_context_get_max_idle_sessions() returns the maximum number of idle
111       server sessions.
112
113       coap_context_get_max_handshake_sessions() returns the maximum number of
114       outstanding server sessions in (D)TLS handshake.
115
116       coap_context_get_session_timeout() returns the seconds to wait before
117       timing out an idle server session.
118
119       coap_context_get_csm_timeout() returns the seconds to wait for a (TCP)
120       CSM negotiation response from the peer.
121

SEE ALSO

123       coap_session(3)
124

FURTHER INFORMATION

126       See "RFC7252: The Constrained Application Protocol (CoAP)" for further
127       information.
128

BUGS

130       Please report bugs on the mailing list for libcoap:
131       libcoap-developers@lists.sourceforge.net or raise an issue on GitHub at
132       https://github.com/obgm/libcoap/issues
133

AUTHORS

135       The libcoap project <libcoap-developers@lists.sourceforge.net>
136
137
138
139coap_context 4.3.1                11/24/2022                   COAP_CONTEXT(3)
Impressum