Loading...
Searching...
No Matches
tftp_context Struct Reference
Applications » TFTP client/server

`#include <tftp_common.h>`

## Data Fields

void *(* | open )(const char *fname, const char *mode, u8_t write)
void(* | close )(void *handle)
int(* | read )(void *handle, void *buf, int bytes)
int(* | write )(void *handle, struct pbuf *p)
void(* | error )(void *handle, int err, const char *msg, int size)

## Detailed Description

TFTP context containing callback functions for TFTP transfers

## Field Documentation

## close

void(* tftp_context::close) (void *handle)

Close file handle

Parameters

  handle | File handle returned by open()/tftp_put()/tftp_get()

## error

void(* tftp_context::error) (void *handle, int err, const char *msg, int size)

Error indication from client or response from server

Parameters

  handle | File handle set by open()/tftp_get()/tftp_put()
  err | error code from client or server
  msg | error message from client or server
  size | size of msg

## open

void *(* tftp_context::open) (const char *fname, const char *mode, u8_t write)

Open file for read/write (server mode only).

Parameters

  fname | Filename
  mode | Mode string from TFTP RFC 1350 (netascii, octet, mail)
  write | Flag indicating read (0) or write (!= 0) access

Returns
  File handle supplied to other functions

## read

int(* tftp_context::read) (void *handle, void *buf, int bytes)

Read from file

Parameters

  handle | File handle returned by open()/tftp_put()/tftp_get()
  buf | Target buffer to copy read data to
  bytes | Number of bytes to copy to buf

Returns
  >= 0: Success; < 0: Error

## write

int(* tftp_context::write) (void *handle, struct pbuf *p)

Write to file

Parameters

  handle | File handle returned by open()/tftp_put()/tftp_get()
  pbuf | PBUF adjusted such that payload pointer points to the beginning of write data. In other words, TFTP headers are stripped off.

Returns
  >= 0: Success; < 0: Error

The documentation for this struct was generated from the following file:

- src/include/lwip/apps/tftp_common.h