tftp_server.h File Reference

TFTP server. More...

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

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

Macros

#define TFTP_SERVER_SUPPORT   ENABLED
 
#define TFTP_SERVER_STACK_SIZE   650
 
#define TFTP_SERVER_PRIORITY   OS_TASK_PRIORITY_NORMAL
 
#define TFTP_SERVER_MAX_CONNECTIONS   2
 
#define TFTP_SERVER_TICK_INTERVAL   500
 
#define TFTP_SERVER_MAX_RETRIES   5
 
#define TFTP_SERVER_TIMEOUT   5000
 
#define TFTP_SERVER_FINAL_DELAY   10000
 
#define TFTP_SERVER_BLOCK_SIZE   512
 
#define TFTP_SERVER_PRIVATE_CONTEXT
 
#define TFTP_SERVER_MAX_PACKET_SIZE   (sizeof(TftpDataPacket) + TFTP_SERVER_BLOCK_SIZE)
 
#define TftpClientConnection   struct _TftpClientConnection
 
#define TftpServerContext   struct _TftpServerContext
 

Typedefs

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

Enumerations

enum  TftpConnectionState {
  TFTP_STATE_CLOSED = 0 , TFTP_STATE_OPEN = 1 , TFTP_STATE_READING = 2 , TFTP_STATE_WRITING = 3 ,
  TFTP_STATE_READ_COMPLETE = 4 , TFTP_STATE_WRITE_COMPLETE = 5
}
 TFTP connection state. More...
 

Functions

void tftpServerGetDefaultSettings (TftpServerSettings *settings)
 Initialize settings with default values. More...
 
error_t tftpServerInit (TftpServerContext *context, const TftpServerSettings *settings)
 TFTP server initialization. More...
 
error_t tftpServerStart (TftpServerContext *context)
 Start TFTP server. More...
 
error_t tftpServerStop (TftpServerContext *context)
 Stop TFTP server. More...
 
void tftpServerTask (TftpServerContext *context)
 TFTP server task. More...
 
void tftpServerDeinit (TftpServerContext *context)
 Release TFTP server context. More...
 

Detailed Description

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

Macro Definition Documentation

◆ TFTP_SERVER_BLOCK_SIZE

#define TFTP_SERVER_BLOCK_SIZE   512

Definition at line 94 of file tftp_server.h.

◆ TFTP_SERVER_FINAL_DELAY

#define TFTP_SERVER_FINAL_DELAY   10000

Definition at line 87 of file tftp_server.h.

◆ TFTP_SERVER_MAX_CONNECTIONS

#define TFTP_SERVER_MAX_CONNECTIONS   2

Definition at line 59 of file tftp_server.h.

◆ TFTP_SERVER_MAX_PACKET_SIZE

#define TFTP_SERVER_MAX_PACKET_SIZE   (sizeof(TftpDataPacket) + TFTP_SERVER_BLOCK_SIZE)

Definition at line 105 of file tftp_server.h.

◆ TFTP_SERVER_MAX_RETRIES

#define TFTP_SERVER_MAX_RETRIES   5

Definition at line 73 of file tftp_server.h.

◆ TFTP_SERVER_PRIORITY

#define TFTP_SERVER_PRIORITY   OS_TASK_PRIORITY_NORMAL

Definition at line 54 of file tftp_server.h.

◆ TFTP_SERVER_PRIVATE_CONTEXT

#define TFTP_SERVER_PRIVATE_CONTEXT

Definition at line 101 of file tftp_server.h.

◆ TFTP_SERVER_STACK_SIZE

#define TFTP_SERVER_STACK_SIZE   650

Definition at line 47 of file tftp_server.h.

◆ TFTP_SERVER_SUPPORT

#define TFTP_SERVER_SUPPORT   ENABLED

Definition at line 40 of file tftp_server.h.

◆ TFTP_SERVER_TICK_INTERVAL

#define TFTP_SERVER_TICK_INTERVAL   500

Definition at line 66 of file tftp_server.h.

◆ TFTP_SERVER_TIMEOUT

#define TFTP_SERVER_TIMEOUT   5000

Definition at line 80 of file tftp_server.h.

◆ TftpClientConnection

#define TftpClientConnection   struct _TftpClientConnection

Definition at line 109 of file tftp_server.h.

◆ TftpServerContext

#define TftpServerContext   struct _TftpServerContext

Definition at line 113 of file tftp_server.h.

Typedef Documentation

◆ TftpServerCloseFileCallback

typedef void(* TftpServerCloseFileCallback) (void *file)

Close file callback function.

Definition at line 164 of file tftp_server.h.

◆ TftpServerOpenFileCallback

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

Open file callback function.

Definition at line 140 of file tftp_server.h.

◆ TftpServerReadFileCallback

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 156 of file tftp_server.h.

◆ TftpServerWriteFileCallback

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

Write file callback function.

Definition at line 148 of file tftp_server.h.

Enumeration Type Documentation

◆ TftpConnectionState

TFTP connection state.

Enumerator
TFTP_STATE_CLOSED 
TFTP_STATE_OPEN 
TFTP_STATE_READING 
TFTP_STATE_WRITING 
TFTP_STATE_READ_COMPLETE 
TFTP_STATE_WRITE_COMPLETE 

Definition at line 125 of file tftp_server.h.

Function Documentation

◆ tftpServerDeinit()

void tftpServerDeinit ( TftpServerContext context)

Release TFTP server context.

Parameters
[in]contextPointer to the TFTP server context

Definition at line 363 of file tftp_server.c.

◆ tftpServerGetDefaultSettings()

void tftpServerGetDefaultSettings ( TftpServerSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains TFTP server settings

Definition at line 58 of file tftp_server.c.

◆ tftpServerInit()

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

◆ tftpServerStart()

error_t tftpServerStart ( TftpServerContext context)

Start TFTP server.

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

Definition at line 139 of file tftp_server.c.

◆ tftpServerStop()

error_t tftpServerStop ( TftpServerContext context)

Stop TFTP server.

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

Definition at line 221 of file tftp_server.c.

◆ tftpServerTask()

void tftpServerTask ( TftpServerContext context)

TFTP server task.

Parameters
[in]contextPointer to the TFTP server context

Definition at line 268 of file tftp_server.c.