Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

tftp_server.h File Reference

tftp_server.h File Reference

TFTP server. More...

Go to the source code of this file.

Data Structures

struct  TftpServerSettings
 TFTP server settings. More...
struct  _TftpClientConnection
 TFTP client connection. More...
struct  _TftpServerContext
 TFTP server context. More...

Typedefs

typedef void *(* TftpServerOpenFileCallback )(const char_t *filename, const char_t *mode, bool_t writeAccess)
 Open file callback function.
typedef error_t(* TftpServerWriteFileCallback )(void *file, size_t offset, const uint8_t *data, size_t length)
 Write file callback function.
typedef error_t(* TftpServerReadFileCallback )(void *file, size_t offset, uint8_t *data, size_t size, size_t *length)
 Read file callback function.
typedef void(* TftpServerCloseFileCallback )(void *file)
 Close file callback function.

Enumerations

enum  TftpConnectionState
 

TFTP connection state.

More...

Functions

void tftpServerGetDefaultSettings (TftpServerSettings *settings)
 Initialize settings with default values.
error_t tftpServerInit (TftpServerContext *context, const TftpServerSettings *settings)
 TFTP server initialization.
error_t tftpServerStart (TftpServerContext *context)
 Start TFTP server.
void tftpServerTask (TftpServerContext *context)
 TFTP server task.
void tftpServerTick (TftpServerContext *context)
 Handle periodic operations.
void tftpServerAcceptRequest (TftpServerContext *context)
 Accept connection request.
void tftpServerProcessPacket (TftpServerContext *context, TftpClientConnection *connection)
 Process incoming packet.
void tftpServerProcessRrqPacket (TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort, const TftpRrqPacket *rrqPacket, size_t length)
 Process incoming RRQ packet.
void tftpServerProcessWrqPacket (TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort, const TftpWrqPacket *wrqPacket, size_t length)
 Process incoming WRQ packet.
void tftpServerProcessDataPacket (TftpClientConnection *connection, const TftpDataPacket *dataPacket, size_t length)
 Process incoming DATA packet.
void tftpServerProcessAckPacket (TftpClientConnection *connection, const TftpAckPacket *ackPacket, size_t length)
 Process incoming ACK packet.
void tftpServerProcessErrorPacket (TftpClientConnection *connection, const TftpErrorPacket *errorPacket, size_t length)
 Process incoming ERROR packet.
error_t tftpServerSendDataPacket (TftpClientConnection *connection)
 Send DATA packet.
error_t tftpServerSendAckPacket (TftpClientConnection *connection)
 Send ACK packet.
error_t tftpServerSendErrorPacket (TftpClientConnection *connection, uint16_t errorCode, const char_t *errorMsg)
 Send ERROR packet.
error_t tftpServerRetransmitPacket (TftpClientConnection *connection)
 Retransmit the last packet.
TftpClientConnection * tftpServerOpenConnection (TftpServerContext *context, const IpAddr *clientIpAddr, uint16_t clientPort)
 Create client connection.
void tftpServerCloseConnection (TftpClientConnection *connection)
 Close client connection.

Detailed Description

TFTP server.

License

Copyright (C) 2010-2017 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.7.6

Definition in file tftp_server.h.


Typedef Documentation

typedef void(* TftpServerCloseFileCallback)(void *file)

Close file callback function.

Definition at line 152 of file tftp_server.h.

typedef void*(* TftpServerOpenFileCallback)(const char_t *filename, const char_t *mode, bool_t writeAccess)

Open file callback function.

Definition at line 128 of file tftp_server.h.

typedef error_t(* TftpServerReadFileCallback)(void *file, size_t offset, uint8_t *data, size_t size, size_t *length)

Read file callback function.

Definition at line 144 of file tftp_server.h.

typedef error_t(* TftpServerWriteFileCallback)(void *file, size_t offset, const uint8_t *data, size_t length)

Write file callback function.

Definition at line 136 of file tftp_server.h.


Enumeration Type Documentation

TFTP connection state.

Definition at line 113 of file tftp_server.h.


Function Documentation

void tftpServerAcceptRequest ( TftpServerContext *  context )

Accept connection request.

Parameters:
[in]contextPointer to the TFTP server context

Definition at line 324 of file tftp_server.c.

void tftpServerCloseConnection ( TftpClientConnection *  connection )

Close client connection.

Parameters:
[in]connectionPointer to the client connection

Definition at line 1135 of file tftp_server.c.

void tftpServerGetDefaultSettings ( TftpServerSettings settings )

Initialize settings with default values.

Parameters:
[out]settingsStructure that contains TFTP server settings

Definition at line 55 of file tftp_server.c.

error_t tftpServerInit ( TftpServerContext *  context,
const TftpServerSettings settings 
)

TFTP server initialization.

Parameters:
[in]contextPointer to the TFTP server context
[in]settingsTFTP server specific settings
Returns:
Error code

Definition at line 81 of file tftp_server.c.

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 1028 of file tftp_server.c.

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 730 of file tftp_server.c.

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 625 of file tftp_server.c.

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 779 of file tftp_server.c.

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 379 of file tftp_server.c.

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 441 of file tftp_server.c.

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 532 of file tftp_server.c.

error_t tftpServerRetransmitPacket ( TftpClientConnection *  connection )

Retransmit the last packet.

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

Definition at line 1003 of file tftp_server.c.

error_t tftpServerSendAckPacket ( TftpClientConnection *  connection )

Send ACK packet.

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

Definition at line 912 of file tftp_server.c.

error_t tftpServerSendDataPacket ( TftpClientConnection *  connection )

Send DATA packet.

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

Definition at line 815 of file tftp_server.c.

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 954 of file tftp_server.c.

error_t tftpServerStart ( TftpServerContext *  context )

Start TFTP server.

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

Definition at line 155 of file tftp_server.c.

void tftpServerTask ( TftpServerContext *  context )

TFTP server task.

Parameters:
[in]contextPointer to the TFTP server context

Definition at line 184 of file tftp_server.c.

void tftpServerTick ( TftpServerContext *  context )

Handle periodic operations.

Parameters:
[in]contextPointer to the TFTP server context

Definition at line 264 of file tftp_server.c.