'\" t
.\" Title: coap_init
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 10/28/2023
.\" Manual: libcoap Manual
.\" Source: coap_init 4.3.4
.\" Language: English
.\"
.TH "COAP_INIT" "3" "10/28/2023" "coap_init 4\&.3\&.4" "libcoap Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
coap_init, coap_startup, coap_cleanup \- Work with CoAP initialization
.SH "SYNOPSIS"
.sp
\fB#include \fR
.sp
\fBvoid coap_startup(void);\fR
.sp
\fBvoid coap_cleanup(void);\fR
.sp
For specific (D)TLS library support, link with \fB\-lcoap\-3\-notls\fR, \fB\-lcoap\-3\-gnutls\fR, \fB\-lcoap\-3\-openssl\fR, \fB\-lcoap\-3\-mbedtls\fR or \fB\-lcoap\-3\-tinydtls\fR\&. Otherwise, link with \fB\-lcoap\-3\fR to get the default (D)TLS library support\&.
.SH "DESCRIPTION"
.sp
The CoAP libcoap logic needs to be initialized before there is any use of the libcoap public API\&. This is done by calling \fBcoap_startup\fR()\&.
.SH "FUNCTIONS"
.sp
\fBFunction: coap_startup()\fR
.sp
The \fBcoap_startup\fR() function must be called before any other \fBcoap_\fR*() functions are called\&. It is used to initialize things like mutexes, random number gererators, clocks, TLS libraries etc\&.
.sp
\fBNOTE:\fR This should be called after any other lower layer is initialized\&. For example, for LwIP, lwip_init() must be called before \fBcoap_startup\fR()\&.
.sp
\fBNOTE:\fR After the inital call to \fBcoap_startup\fR(), subsequent calls are ignored until \fBcoap_cleanup\fR() is called\&.
.sp
\fBFunction: coap_cleanup()\fR
.sp
The \fBcoap_cleanup\fR() function is used to cleanup / free any information set up by the \fBcoap_startup\fR() function and should be the last \fBcoap_\fR*() function called\&. It is possible to call \fBcoap_startup\fR() after \fBcoap_cleanup\fR() to re\-initialize the libcoap logic\&.
.sp
\fBNOTE:\fR All other libcoap cleanups should called prior to \fBcoap_cleanup\fR(), e\&.g\&. \fBcoap_free_context\fR(3)\&.
.SH "FURTHER INFORMATION"
.sp
See
.sp
"RFC7252: The Constrained Application Protocol (CoAP)"
.sp
for further information\&.
.SH "BUGS"
.sp
Please report bugs on the mailing list for libcoap: libcoap\-developers@lists\&.sourceforge\&.net or raise an issue on GitHub at https://github\&.com/obgm/libcoap/issues
.SH "AUTHORS"
.sp
The libcoap project