5.11. tftp_server — TFTP server

TFTP is a simple file transfer protocol.

Only binary mode is supported.


Source code: src/inet/tftp_server.h, src/inet/tftp_server.c

Test code: tst/inet/tftp_server/main.c

Test coverage: src/inet/tftp_server.c

Example code: examples/tftp_server/main.c


Functions

int tftp_server_init(struct tftp_server_t *self_p, struct inet_addr_t *addr_p, int timeout_ms, const char *name_p, const char *root_p, void *stack_p, size_t stack_size)

Initialize given TFTP server.

Return
zero(0) or negative error code.
Parameters
  • self_p: TFTP server to initialize.
  • addr_p: Ip address and port of the server.
  • timeout_ms: Packet reception timeout.
  • name_p: Name of the server thread.
  • root_p: File system root path.
  • stack_p: Server thread stack.
  • stack_size: Server thread stack size.

int tftp_server_start(struct tftp_server_t *self_p)

Start given TFTP server.

Return
zero(0) or negative error code.
Parameters
  • self_p: TFTP server to start.

struct tftp_server_t
#include <tftp_server.h>

Public Members

struct inet_addr_t addr
struct socket_t listener
int timeout_ms
const char *name_p
const char *root_p
void *stack_p
size_t stack_size
struct thrd_t *thrd_p