coap_client_block.c File Reference

CoAP block-wise transfer. More...

#include <stdlib.h>
#include "core/net.h"
#include "coap/coap_client.h"
#include "coap/coap_client_block.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   COAP_TRACE_LEVEL
 

Functions

error_t coapClientSetTxBlockSize (CoapClientRequest *request, uint_t blockSize)
 Set preferred block for transmission path. More...
 
error_t coapClientSetRxBlockSize (CoapClientRequest *request, uint_t blockSize)
 Set preferred block for reception path. More...
 
error_t coapClientWriteBody (CoapClientRequest *request, const void *data, size_t length, size_t *written, bool_t last)
 Write resource body using block-wise mode. More...
 
error_t coapClientReadBody (CoapClientRequest *request, void *data, size_t size, size_t *received)
 Read resource body using block-wise mode. More...
 
CoapBlockSize coapClientGetMaxBlockSize (void)
 Get maximum block size. More...
 

Detailed Description

CoAP block-wise transfer.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 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
2.4.4

Definition in file coap_client_block.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   COAP_TRACE_LEVEL

Definition at line 32 of file coap_client_block.c.

Function Documentation

◆ coapClientGetMaxBlockSize()

CoapBlockSize coapClientGetMaxBlockSize ( void  )

Get maximum block size.

Returns
Block size

Definition at line 600 of file coap_client_block.c.

◆ coapClientReadBody()

error_t coapClientReadBody ( CoapClientRequest request,
void *  data,
size_t  size,
size_t *  received 
)

Read resource body using block-wise mode.

Parameters
[in]requestCoAP request handle
[out]dataBuffer into which received data will be placed
[in]sizeMaximum number of bytes that can be received
[out]receivedNumber of bytes that have been received
Returns
Error code

Definition at line 400 of file coap_client_block.c.

◆ coapClientSetRxBlockSize()

error_t coapClientSetRxBlockSize ( CoapClientRequest request,
uint_t  blockSize 
)

Set preferred block for reception path.

Parameters
[in]requestCoAP request handle
[in]blockSizePreferred block size, in bytes
Returns
Error code

Definition at line 112 of file coap_client_block.c.

◆ coapClientSetTxBlockSize()

error_t coapClientSetTxBlockSize ( CoapClientRequest request,
uint_t  blockSize 
)

Set preferred block for transmission path.

Parameters
[in]requestCoAP request handle
[in]blockSizePreferred block size, in bytes
Returns
Error code

Definition at line 52 of file coap_client_block.c.

◆ coapClientWriteBody()

error_t coapClientWriteBody ( CoapClientRequest request,
const void *  data,
size_t  length,
size_t *  written,
bool_t  last 
)

Write resource body using block-wise mode.

Parameters
[in]requestCoAP request handle
[in]dataPointer to a buffer containing the data to be transmitted
[in]lengthNumber of bytes to be transmitted
[out]writtenActual number of bytes written (optional parameter)
[in]lastFlag indicating whether this message fragment is the last
Returns
Error code

Definition at line 175 of file coap_client_block.c.