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_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...
 
void tftpServerTask (TftpServerContext *context)
 TFTP server task. More...
 

Detailed Description

TFTP server.

License

Copyright (C) 2010-2018 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.9.0

Definition in file tftp_server.h.

Macro Definition Documentation

◆ TFTP_SERVER_BLOCK_SIZE

#define TFTP_SERVER_BLOCK_SIZE   512

Definition at line 92 of file tftp_server.h.

◆ TFTP_SERVER_FINAL_DELAY

#define TFTP_SERVER_FINAL_DELAY   10000

Definition at line 85 of file tftp_server.h.

◆ TFTP_SERVER_MAX_CONNECTIONS

#define TFTP_SERVER_MAX_CONNECTIONS   2

Definition at line 57 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 98 of file tftp_server.h.

◆ TFTP_SERVER_MAX_RETRIES

#define TFTP_SERVER_MAX_RETRIES   5

Definition at line 71 of file tftp_server.h.

◆ TFTP_SERVER_PRIORITY

#define TFTP_SERVER_PRIORITY   OS_TASK_PRIORITY_NORMAL

Definition at line 52 of file tftp_server.h.

◆ TFTP_SERVER_STACK_SIZE

#define TFTP_SERVER_STACK_SIZE   650

Definition at line 45 of file tftp_server.h.

◆ TFTP_SERVER_SUPPORT

#define TFTP_SERVER_SUPPORT   ENABLED

Definition at line 38 of file tftp_server.h.

◆ TFTP_SERVER_TICK_INTERVAL

#define TFTP_SERVER_TICK_INTERVAL   500

Definition at line 64 of file tftp_server.h.

◆ TFTP_SERVER_TIMEOUT

#define TFTP_SERVER_TIMEOUT   5000

Definition at line 78 of file tftp_server.h.

◆ TftpClientConnection

#define TftpClientConnection   struct _TftpClientConnection

Definition at line 102 of file tftp_server.h.

◆ TftpServerContext

#define TftpServerContext   struct _TftpServerContext

Definition at line 106 of file tftp_server.h.

Typedef Documentation

◆ TftpServerCloseFileCallback

typedef void(* TftpServerCloseFileCallback) (void *file)

Close file callback function.

Definition at line 157 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 133 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 149 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 141 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 118 of file tftp_server.h.

Function Documentation

◆ tftpServerGetDefaultSettings()

void tftpServerGetDefaultSettings ( TftpServerSettings settings)

Initialize settings with default values.

Parameters
[out]settingsStructure that contains TFTP server settings

Definition at line 56 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 82 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 156 of file tftp_server.c.

◆ tftpServerTask()

void tftpServerTask ( TftpServerContext context)

TFTP server task.

Parameters
[in]contextPointer to the TFTP server context

Definition at line 185 of file tftp_server.c.