The TFTP client and server are described in tftp_support.h; the client API is simple and can be easily understood by reading tftp_client_test.c.
The server is more complex. It requires a filesystem implementation to be supplied by the user, and attached to the tftp server by means of a vector of function pointers:
struct tftpd_fileops { int (*open)(const char *, int); int (*close)(int); int (*write)(int, const void *, int); int (*read)(int, void *, int); }; |
These functions have the obvious semantics. The structure describing the filesystem is an argument to the tftpd_start(int, struct tftpd_fileops *); call. The first argument is the port to use for the server.
As discussed in the description of the tftp_server_test above, an example filesystem is provided in net/common/VERSION/src/tftp_dummy_file.c for use by the tftp server test. The dummy filesystem is not a supported part of the network stack, it exists purely for demonstration purposes.