BeRTOS
Functions
tftp.c File Reference

TFTP protocol implementation. More...

#include "tftp.h"
#include "cfg/cfg_tftp.h"
#include <cfg/log.h>
#include <lwip/inet.h>
#include <lwip/sockets.h>
#include <string.h>

Go to the source code of this file.

Functions

KFiletftp_listen (TftpSession *ctx, char *filename, size_t len, TftpOpenMode *mode)
 Listen for incoming tftp sessions.
int tftp_init (TftpSession *ctx, unsigned short port, mtime_t timeout)
 Init a server session.

Detailed Description

TFTP protocol implementation.

Author:
Luca Ottaviano <lottaviano@develer.com>

Definition in file tftp.c.


Function Documentation

int tftp_init ( TftpSession *  ctx,
unsigned short  port,
mtime_t  timeout 
)

Init a server session.

Create a IPv4 session on all addresses and port port.

Parameters:
ctxContext to be initialized as server
portPort to listen incoming connections
timeoutTimeout to be used for tftp connections
Returns:
0 if successful, -1 otherwise

Definition at line 296 of file tftp.c.

KFile* tftp_listen ( TftpSession *  ctx,
char *  filename,
size_t  len,
TftpOpenMode *  mode 
)

Listen for incoming tftp sessions.

Note:
Only write requests are accepted.
Parameters:
ctxInitialized TftpChannel
filenameString to be filled with file name to be written
lenLength of the filename
modeOpen mode for the returned KFile
Returns:
KFile pointer to read from

Definition at line 247 of file tftp.c.