tftp_client_misc.c File Reference

Helper functions for TFTP client. More...

#include "tftp/tftp_client.h"
#include "tftp/tftp_client_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   TFTP_TRACE_LEVEL
 

Functions

error_t tftpClientOpenConnection (TftpClientContext *context)
 Open connection with the TFTP server. More...
 
void tftpClientCloseConnection (TftpClientContext *context)
 Close connection with the TFTP server. More...
 
error_t tftpClientProcessEvents (TftpClientContext *context)
 Process TFTP client events. More...
 
void tftpClientProcessPacket (TftpClientContext *context, const IpAddr *srcIpAddr, uint16_t srcPort)
 Process incoming packet. More...
 
void tftpClientProcessDataPacket (TftpClientContext *context, uint16_t srcPort, const TftpDataPacket *dataPacket, size_t length)
 Process incoming DATA packet. More...
 
void tftpClientProcessAckPacket (TftpClientContext *context, uint16_t srcPort, const TftpAckPacket *ackPacket, size_t length)
 Process incoming ACK packet. More...
 
void tftpClientProcessErrorPacket (TftpClientContext *context, uint16_t srcPort, const TftpErrorPacket *errorPacket, size_t length)
 Process incoming ERROR packet. More...
 
error_t tftpClientSendRrqPacket (TftpClientContext *context, const char_t *filename, const char_t *mode)
 Send RRQ packet. More...
 
error_t tftpClientSendWrqPacket (TftpClientContext *context, const char_t *filename, const char_t *mode)
 Send WRQ packet. More...
 
error_t tftpClientSendDataPacket (TftpClientContext *context)
 Send DATA packet. More...
 
error_t tftpClientSendAckPacket (TftpClientContext *context)
 Send ACK packet. More...
 
error_t tftpClientSendErrorPacket (TftpClientContext *context, uint16_t errorCode, const char_t *errorMsg)
 Send ERROR packet. More...
 
error_t tftpClientRetransmitPacket (TftpClientContext *context)
 Retransmit the last packet. More...
 

Detailed Description

Helper functions for TFTP client.

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 tftp_client_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   TFTP_TRACE_LEVEL

Definition at line 32 of file tftp_client_misc.c.

Function Documentation

◆ tftpClientCloseConnection()

void tftpClientCloseConnection ( TftpClientContext context)

Close connection with the TFTP server.

Parameters
[in]contextPointer to the TFTP client context

Definition at line 95 of file tftp_client_misc.c.

◆ tftpClientOpenConnection()

error_t tftpClientOpenConnection ( TftpClientContext context)

Open connection with the TFTP server.

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

Definition at line 49 of file tftp_client_misc.c.

◆ tftpClientProcessAckPacket()

void tftpClientProcessAckPacket ( TftpClientContext context,
uint16_t  srcPort,
const TftpAckPacket ackPacket,
size_t  length 
)

Process incoming ACK packet.

Parameters
[in]contextPointer to the TFTP client context
[in]srcPortSource port number
[in]ackPacketPointer to the ACK packet
[in]lengthLength of the packet, in bytes

Definition at line 309 of file tftp_client_misc.c.

◆ tftpClientProcessDataPacket()

void tftpClientProcessDataPacket ( TftpClientContext context,
uint16_t  srcPort,
const TftpDataPacket dataPacket,
size_t  length 
)

Process incoming DATA packet.

Parameters
[in]contextPointer to the TFTP client context
[in]srcPortSource port number
[in]dataPacketPointer to the DATA packet
[in]lengthLength of the packet, in bytes

Definition at line 240 of file tftp_client_misc.c.

◆ tftpClientProcessErrorPacket()

void tftpClientProcessErrorPacket ( TftpClientContext context,
uint16_t  srcPort,
const TftpErrorPacket errorPacket,
size_t  length 
)

Process incoming ERROR packet.

Parameters
[in]contextPointer to the TFTP client context
[in]srcPortSource port number
[in]errorPacketPointer to the ERROR packet
[in]lengthLength of the packet, in bytes

Definition at line 395 of file tftp_client_misc.c.

◆ tftpClientProcessEvents()

error_t tftpClientProcessEvents ( TftpClientContext context)

Process TFTP client events.

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

Definition at line 113 of file tftp_client_misc.c.

◆ tftpClientProcessPacket()

void tftpClientProcessPacket ( TftpClientContext context,
const IpAddr srcIpAddr,
uint16_t  srcPort 
)

Process incoming packet.

Parameters
[in]contextPointer to the TFTP client context
[in]srcIpAddrSource IP address
[in]srcPortSource port number

Definition at line 187 of file tftp_client_misc.c.

◆ tftpClientRetransmitPacket()

error_t tftpClientRetransmitPacket ( TftpClientContext context)

Retransmit the last packet.

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

Definition at line 674 of file tftp_client_misc.c.

◆ tftpClientSendAckPacket()

error_t tftpClientSendAckPacket ( TftpClientContext context)

Send ACK packet.

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

Definition at line 583 of file tftp_client_misc.c.

◆ tftpClientSendDataPacket()

error_t tftpClientSendDataPacket ( TftpClientContext context)

Send DATA packet.

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

Definition at line 543 of file tftp_client_misc.c.

◆ tftpClientSendErrorPacket()

error_t tftpClientSendErrorPacket ( TftpClientContext context,
uint16_t  errorCode,
const char_t errorMsg 
)

Send ERROR packet.

Parameters
[in]contextPointer to the TFTP client context
[in]errorCodeInteger indicating the nature of the error
[in]errorMsgError message intended for human consumption
Returns
Error code

Definition at line 625 of file tftp_client_misc.c.

◆ tftpClientSendRrqPacket()

error_t tftpClientSendRrqPacket ( TftpClientContext context,
const char_t filename,
const char_t mode 
)

Send RRQ packet.

Parameters
[in]contextPointer to the TFTP client context
[in]filenameNULL-terminated string specifying the filename
[in]modeNULL-terminated string specifying the transfer mode
Returns
Error code

Definition at line 433 of file tftp_client_misc.c.

◆ tftpClientSendWrqPacket()

error_t tftpClientSendWrqPacket ( TftpClientContext context,
const char_t filename,
const char_t mode 
)

Send WRQ packet.

Parameters
[in]contextPointer to the TFTP client context
[in]filenameNULL-terminated string specifying the filename
[in]modeNULL-terminated string specifying the transfer mode
Returns
Error code

Definition at line 489 of file tftp_client_misc.c.