tftp_server_misc.h File Reference

Helper functions for TFTP server. More...

#include "core/net.h"
#include "tftp/tftp_server.h"

Go to the source code of this file.

Functions

void tftpServerTick (TftpServerContext *context)
 Handle periodic operations. More...
 
TftpClientConnectiontftpServerOpenConnection (TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort)
 Create client connection. More...
 
void tftpServerCloseConnection (TftpClientConnection *connection)
 Close client connection. More...
 
void tftpServerAcceptRequest (TftpServerContext *context)
 Accept connection request. More...
 
void tftpServerProcessPacket (TftpServerContext *context, TftpClientConnection *connection)
 Process incoming packet. More...
 
void tftpServerProcessRrqPacket (TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort, const TftpRrqPacket *rrqPacket, size_t length)
 Process incoming RRQ packet. More...
 
void tftpServerProcessWrqPacket (TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort, const TftpWrqPacket *wrqPacket, size_t length)
 Process incoming WRQ packet. More...
 
void tftpServerProcessDataPacket (TftpClientConnection *connection, const TftpDataPacket *dataPacket, size_t length)
 Process incoming DATA packet. More...
 
void tftpServerProcessAckPacket (TftpClientConnection *connection, const TftpAckPacket *ackPacket, size_t length)
 Process incoming ACK packet. More...
 
void tftpServerProcessErrorPacket (TftpClientConnection *connection, const TftpErrorPacket *errorPacket, size_t length)
 Process incoming ERROR packet. More...
 
error_t tftpServerSendDataPacket (TftpClientConnection *connection)
 Send DATA packet. More...
 
error_t tftpServerSendAckPacket (TftpClientConnection *connection)
 Send ACK packet. More...
 
error_t tftpServerSendErrorPacket (TftpClientConnection *connection, uint16_t errorCode, const char_t *errorMsg)
 Send ERROR packet. More...
 
error_t tftpServerRetransmitPacket (TftpClientConnection *connection)
 Retransmit the last packet. More...
 

Detailed Description

Helper functions for TFTP server.

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.0

Definition in file tftp_server_misc.h.

Function Documentation

◆ tftpServerAcceptRequest()

void tftpServerAcceptRequest ( TftpServerContext context)

Accept connection request.

Parameters
[in]contextPointer to the TFTP server context

Definition at line 260 of file tftp_server_misc.c.

◆ tftpServerCloseConnection()

void tftpServerCloseConnection ( TftpClientConnection connection)

Close client connection.

Parameters
[in]connectionPointer to the client connection

Definition at line 219 of file tftp_server_misc.c.

◆ tftpServerOpenConnection()

TftpClientConnection* tftpServerOpenConnection ( TftpServerContext context,
const IpAddr clientIpAddr,
uint16_t  clientPort 
)

Create client connection.

Parameters
[in]contextPointer to the TFTP server context
[in]clientIpAddrIP address of the client
[in]clientPortPort number used by the client
Returns
Pointer to the structure describing the connection

Definition at line 111 of file tftp_server_misc.c.

◆ tftpServerProcessAckPacket()

void tftpServerProcessAckPacket ( TftpClientConnection connection,
const TftpAckPacket ackPacket,
size_t  length 
)

Process incoming ACK packet.

Parameters
[in]connectionPointer to the client connection
[in]ackPacketPointer to the ACK packet
[in]lengthLength of the packet, in bytes

Definition at line 666 of file tftp_server_misc.c.

◆ tftpServerProcessDataPacket()

void tftpServerProcessDataPacket ( TftpClientConnection connection,
const TftpDataPacket dataPacket,
size_t  length 
)

Process incoming DATA packet.

Parameters
[in]connectionPointer to the client connection
[in]dataPacketPointer to the DATA packet
[in]lengthLength of the packet, in bytes

Definition at line 561 of file tftp_server_misc.c.

◆ tftpServerProcessErrorPacket()

void tftpServerProcessErrorPacket ( TftpClientConnection connection,
const TftpErrorPacket errorPacket,
size_t  length 
)

Process incoming ERROR packet.

Parameters
[in]connectionPointer to the client connection
[in]errorPacketPointer to the ERROR packet
[in]lengthLength of the packet, in bytes

Definition at line 720 of file tftp_server_misc.c.

◆ tftpServerProcessPacket()

void tftpServerProcessPacket ( TftpServerContext context,
TftpClientConnection connection 
)

Process incoming packet.

Parameters
[in]contextPointer to the TFTP server context
[in]connectionPointer to the client connection

Definition at line 315 of file tftp_server_misc.c.

◆ tftpServerProcessRrqPacket()

void tftpServerProcessRrqPacket ( TftpServerContext context,
const IpAddr clientIpAddr,
uint16_t  clientPort,
const TftpRrqPacket rrqPacket,
size_t  length 
)

Process incoming RRQ packet.

Parameters
[in]contextPointer to the TFTP server context
[in]clientIpAddrIP address of the client
[in]clientPortPort number used by the client
[in]rrqPacketPointer to the RRQ packet
[in]lengthLength of the packet, in bytes

Definition at line 377 of file tftp_server_misc.c.

◆ tftpServerProcessWrqPacket()

void tftpServerProcessWrqPacket ( TftpServerContext context,
const IpAddr clientIpAddr,
uint16_t  clientPort,
const TftpWrqPacket wrqPacket,
size_t  length 
)

Process incoming WRQ packet.

Parameters
[in]contextPointer to the TFTP server context
[in]clientIpAddrIP address of the client
[in]clientPortPort number used by the client
[in]wrqPacketPointer to the WRQ packet
[in]lengthLength of the packet, in bytes

Definition at line 468 of file tftp_server_misc.c.

◆ tftpServerRetransmitPacket()

error_t tftpServerRetransmitPacket ( TftpClientConnection connection)

Retransmit the last packet.

Parameters
[in]connectionPointer to the client connection
Returns
Error code

Definition at line 944 of file tftp_server_misc.c.

◆ tftpServerSendAckPacket()

error_t tftpServerSendAckPacket ( TftpClientConnection connection)

Send ACK packet.

Parameters
[in]connectionPointer to the client connection
Returns
Error code

Definition at line 853 of file tftp_server_misc.c.

◆ tftpServerSendDataPacket()

error_t tftpServerSendDataPacket ( TftpClientConnection connection)

Send DATA packet.

Parameters
[in]connectionPointer to the client connection
Returns
Error code

Definition at line 756 of file tftp_server_misc.c.

◆ tftpServerSendErrorPacket()

error_t tftpServerSendErrorPacket ( TftpClientConnection connection,
uint16_t  errorCode,
const char_t errorMsg 
)

Send ERROR packet.

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

Definition at line 895 of file tftp_server_misc.c.

◆ tftpServerTick()

void tftpServerTick ( TftpServerContext context)

Handle periodic operations.

Parameters
[in]contextPointer to the TFTP server context

Definition at line 48 of file tftp_server_misc.c.