coap_client.c File Reference

CoAP client. More...

#include <stdlib.h>
#include "core/net.h"
#include "coap/coap_client.h"
#include "coap/coap_client_transport.h"
#include "coap/coap_client_misc.h"
#include "coap/coap_debug.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   COAP_TRACE_LEVEL
 

Functions

error_t coapClientInit (CoapClientContext *context)
 Initialize CoAP client context. More...
 
error_t coapClientSetTransportProtocol (CoapClientContext *context, CoapTransportProtocol transportProtocol)
 Set the transport protocol to be used. More...
 
error_t coapClientRegisterDtlsInitCallback (CoapClientContext *context, CoapClientDtlsInitCallback callback)
 Register DTLS initialization callback function. More...
 
error_t coapClientSetTimeout (CoapClientContext *context, systime_t timeout)
 Set default request timeout. More...
 
error_t coapClientSetTokenLength (CoapClientContext *context, size_t length)
 Set the length of the token. More...
 
error_t coapClientBindToInterface (CoapClientContext *context, NetInterface *interface)
 Bind the CoAP client to a particular network interface. More...
 
error_t coapClientConnect (CoapClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort)
 Establish connection with the CoAP server. More...
 
error_t coapClientTask (CoapClientContext *context, systime_t timeout)
 Process CoAP client events. More...
 
error_t coapClientDisconnect (CoapClientContext *context)
 Disconnect from the CoAP server. More...
 
void coapClientDeinit (CoapClientContext *context)
 Release CoAP client context. More...
 

Detailed Description

CoAP client.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file coap_client.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   COAP_TRACE_LEVEL

Definition at line 30 of file coap_client.c.

Function Documentation

◆ coapClientBindToInterface()

error_t coapClientBindToInterface ( CoapClientContext context,
NetInterface interface 
)

Bind the CoAP client to a particular network interface.

Parameters
[in]contextPointer to the CoAP client context
[in]interfaceNetwork interface to be used
Returns
Error code

Definition at line 238 of file coap_client.c.

◆ coapClientConnect()

error_t coapClientConnect ( CoapClientContext context,
const IpAddr serverIpAddr,
uint16_t  serverPort 
)

Establish connection with the CoAP server.

Parameters
[in]contextPointer to the CoAP client context
[in]serverIpAddrIP address of the CoAP server to connect to
[in]serverPortUDP port number that will be used
Returns
Error code

Definition at line 265 of file coap_client.c.

◆ coapClientDeinit()

void coapClientDeinit ( CoapClientContext context)

Release CoAP client context.

Parameters
[in]contextPointer to the CoAP client context

Definition at line 436 of file coap_client.c.

◆ coapClientDisconnect()

error_t coapClientDisconnect ( CoapClientContext context)

Disconnect from the CoAP server.

Parameters
[in]contextPointer to the CoAP client context
Returns
Error code

Definition at line 397 of file coap_client.c.

◆ coapClientInit()

error_t coapClientInit ( CoapClientContext context)

Initialize CoAP client context.

Parameters
[in]contextPointer to the CoAP client context
Returns
Error code

Definition at line 51 of file coap_client.c.

◆ coapClientRegisterDtlsInitCallback()

error_t coapClientRegisterDtlsInitCallback ( CoapClientContext context,
CoapClientDtlsInitCallback  callback 
)

Register DTLS initialization callback function.

Parameters
[in]contextPointer to the CoAP client context
[in]callbackDTLS initialization callback function
Returns
Error code

Definition at line 156 of file coap_client.c.

◆ coapClientSetTimeout()

error_t coapClientSetTimeout ( CoapClientContext context,
systime_t  timeout 
)

Set default request timeout.

Parameters
[in]contextPointer to the CoAP client context
[in]timeoutTimeout value, in milliseconds
Returns
Error code

Definition at line 184 of file coap_client.c.

◆ coapClientSetTokenLength()

error_t coapClientSetTokenLength ( CoapClientContext context,
size_t  length 
)

Set the length of the token.

Parameters
[in]contextPointer to the CoAP client context
[in]lengthToken length
Returns
Error code

Definition at line 209 of file coap_client.c.

◆ coapClientSetTransportProtocol()

error_t coapClientSetTransportProtocol ( CoapClientContext context,
CoapTransportProtocol  transportProtocol 
)

Set the transport protocol to be used.

Parameters
[in]contextPointer to the CoAP client context
[in]transportProtocolTransport protocol to be used (UDP or DTLS)
Returns
Error code

Definition at line 128 of file coap_client.c.

◆ coapClientTask()

error_t coapClientTask ( CoapClientContext context,
systime_t  timeout 
)

Process CoAP client events.

Parameters
[in]contextPointer to the CoAP client context
[in]timeoutMaximum time to wait before returning
Returns
Error code

Definition at line 371 of file coap_client.c.