• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// -*- mode:doc; -*-
2// vim: set syntax=asciidoc,tw=0:
3
4coap_context(3)
5===============
6:doctype: manpage
7:man source:   coap_context
8:man version:  @PACKAGE_VERSION@
9:man manual:   libcoap Manual
10
11NAME
12----
13coap_context,
14coap_new_context,
15coap_free_context,
16coap_context_set_max_idle_sessions,
17coap_context_get_max_idle_sessions,
18coap_context_set_max_handshake_sessions,
19coap_context_get_max_handshake_sessions,
20coap_context_set_session_timeout,
21coap_context_get_session_timeout,
22coap_context_set_csm_timeout,
23coap_context_get_csm_timeout
24- Work with CoAP contexts
25
26SYNOPSIS
27--------
28*#include <coap@LIBCOAP_API_VERSION@/coap.h>*
29
30*coap_context_t *coap_new_context(const coap_address_t *_listen_addr_);*
31
32*void coap_free_context(coap_context_t *_context_);*
33
34*void coap_context_set_max_idle_sessions(coap_context_t *_context_,
35unsigned int _max_idle_sessions_);*
36
37*unsigned int coap_context_get_max_idle_sessions(
38const coap_context_t *_context_);*
39
40*void coap_context_set_max_handshake_sessions(coap_context_t *_context_,
41unsigned int _max_handshake_sessions_);*
42
43*unsigned int coap_context_get_max_handshake_sessions(
44const coap_context_t *_context_);*
45
46*void coap_context_set_session_timeout(coap_context_t *_context_,
47unsigned int _session_timeout_);*
48
49*unsigned int coap_context_get_session_timeout(
50const coap_context_t *_context_);*
51
52*void coap_context_set_csm_timeout(coap_context_t *_context_,
53unsigned int _csm_timeout_);*
54
55*unsigned int coap_context_get_csm_timeout(const coap_context_t *_context_);*
56
57For specific (D)TLS library support, link with
58*-lcoap-@LIBCOAP_API_VERSION@-notls*, *-lcoap-@LIBCOAP_API_VERSION@-gnutls*,
59*-lcoap-@LIBCOAP_API_VERSION@-openssl*, *-lcoap-@LIBCOAP_API_VERSION@-mbedtls*
60or *-lcoap-@LIBCOAP_API_VERSION@-tinydtls*.   Otherwise, link with
61*-lcoap-@LIBCOAP_API_VERSION@* to get the default (D)TLS library support.
62
63DESCRIPTION
64-----------
65This man page focuses on the CoAP Context and how to update or get information
66from the opaque coap_context_t structure.
67
68The CoAP stack's global state is stored in a coap_context_t Context object.
69Resources, Endpoints and Sessions are associated with this context object.
70There can be more than one coap_context_t object per application, it is up to
71the application to manage each one accordingly.
72
73The *coap_new_context*() function creates a new Context that is then used
74to keep all the CoAP Resources, Endpoints and Sessions information.
75The optional _listen_addr_ parameter, if set for a CoAP server, creates an
76Endpoint that is added to the _context_ that is listening for un-encrypted
77traffic on the IP address and port number defined by _listen_addr_.
78
79The *coap_free_context*() function must be used to release the CoAP stack
80_context_.  It clears all entries from the receive queue and send queue and
81deletes the Resources that have been registered with _context_, and frees the
82attached Sessions and Endpoints.
83
84The *coap_context_set_max_idle_sessions*() function sets the maximum number of
85idle server sessions to _max_idle_sessions_ for _context_.  If this number is
86exceeded, the least recently used server session is completely removed. 0 (the
87initial default) means that the number of idle sessions is not monitored.
88
89The *coap_context_get_max_idle_sessions*() function returns the maximum number
90of idle server sessions for _context_.
91
92The *coap_context_set_max_handshake_sessions*() function sets the maximum
93number of outstanding server sessions in (D)TLS handshake to
94_max_handshake_sessions_ for _context_.  If this number is exceeded, the least
95recently used server session in handshake is completely removed. 0 (the default)
96means that the number of handshakes is not monitored.
97
98The *coap_context_get_max_handshake_sessions*() function returns the maximum
99number of outstanding server sessions in (D)TLS handshake for _context_.
100
101The *coap_context_set_session_timeout*() function sets the number of seconds of
102inactivity to _session_timeout_ for _context_ before an idle server session is
103removed. 0 (the default) means wait for the default of 300 seconds.
104
105The *coap_context_get_session_timeout*() function returns the seconds to wait
106before timing out an idle server session for _context_.
107
108The *coap_context_set_csm_timeout*() function sets the number of seconds to
109wait for a (TCP) CSM negotiation response from the peer to _csm_timeout_ for
110_context_.  0 (the default) means wait forever.
111
112The *coap_context_get_csm_timeout*() function returns the seconds to wait for
113a (TCP) CSM negotiation response from the peer for _context_,
114
115RETURN VALUES
116-------------
117*coap_new_context*() function returns a newly created context or
118NULL if there is a creation failure.
119
120*coap_context_get_max_idle_sessions*() returns the maximum number of idle
121server sessions.
122
123*coap_context_get_max_handshake_sessions*() returns the maximum number of
124outstanding server sessions in (D)TLS handshake.
125
126*coap_context_get_session_timeout*() returns the seconds to wait before timing
127out an idle server session.
128
129*coap_context_get_csm_timeout*() returns the seconds to wait for a (TCP) CSM
130negotiation response from the peer.
131
132SEE ALSO
133--------
134*coap_session*(3)
135
136FURTHER INFORMATION
137-------------------
138See "RFC7252: The Constrained Application Protocol (CoAP)" for further
139information.
140
141BUGS
142----
143Please report bugs on the mailing list for libcoap:
144libcoap-developers@lists.sourceforge.net or raise an issue on GitHub at
145https://github.com/obgm/libcoap/issues
146
147AUTHORS
148-------
149The libcoap project <libcoap-developers@lists.sourceforge.net>
150