Network Component
Version 7.19.0
MDK Middleware for IPv4 and IPv6 Networking
|
TFTP client functions that work with a File System. More...
Functions | |
void * | netTFTPc_fopen (const char *fname, const char *mode) |
Open local file for reading or writing in the TFTP client. [interface]. More... | |
void | netTFTPc_fclose (void *file) |
Close local file previously open in the TFTP client. [interface]. More... | |
uint32_t | netTFTPc_fread (void *file, uint8_t *buf, uint32_t len) |
Read block of data from local file in the TFTP client. [interface]. More... | |
uint32_t | netTFTPc_fwrite (void *file, const uint8_t *buf, uint32_t len) |
Write block of data to local file in the TFTP client. [interface]. More... | |
TFTP client functions that work with a File System.
All File System Interface functions are located in TFTP_Client_FS.c, which will be automatically added to your project's Network folder. The file is preconfigured for the File System Component, so no modifications are required. If you wish to use another type of file system or to use a different storage media such as a hard disk, you need to add a similar file to your project.
The following functions are implemented in this module:
void netTFTPc_fclose | ( | void * | file | ) |
Close local file previously open in the TFTP client. [interface].
[in] | file | pointer to the file to close. |
The function netTFTPc_fclose closes the file identified by the file stream pointer in the function argument.
The function interfaces to the File System Component and will be called by the Network Component automatically. If another file system will be used, refer to the reference implementation in the TFTP_Client_FS.c module.
void * netTFTPc_fopen | ( | const char * | fname, |
const char * | mode | ||
) |
Open local file for reading or writing in the TFTP client. [interface].
[in] | fname | name of the file to open. |
[in] | mode | type of access:
|
The function netTFTPc_fopen opens a local file for reading or writing.
The argument mode defines the type of access permitted for the file fname. mode can have one of the following values:
Mode | Description |
---|---|
"rb" | Opens the file for reading. If the file does not exist, the function fails. |
"wb" | Opens an empty file for writing. If the file exists already, then the content is cleared. |
The function interfaces to the File System Component and will be called by the Network Component automatically. If another file system will be used, refer to the reference implementation in the TFTP_Client_FS.c module.
uint32_t netTFTPc_fread | ( | void * | file, |
uint8_t * | buf, | ||
uint32_t | len | ||
) |
Read block of data from local file in the TFTP client. [interface].
[in] | file | pointer to the file to read from. |
[out] | buf | block of memory to write data to. |
[in] | len | length of data to read in bytes. |
The function netTFTPc_fread reads len bytes from the file identified by the file stream pointer in the function argument.
The argument buf is a pointer to the buffer where the function stores the read data.
The function interfaces to the File System Component and will be called by the Network Component automatically. If another file system will be used, refer to the reference implementation in the TFTP_Client_FS.c module.
uint32_t netTFTPc_fwrite | ( | void * | file, |
const uint8_t * | buf, | ||
uint32_t | len | ||
) |
Write block of data to local file in the TFTP client. [interface].
[in] | file | pointer to the file to write to. |
[in] | buf | block of memory to be written. |
[in] | len | length of data to write in bytes. |
The function netTFTPc_fwrite writes a block of data to the file identified by the file stream pointer.
The argument buf points to the buffer containing the data to write to the file.
The argument len specifies the number of bytes to write to the file.
The function interfaces to the File System Component and will be called by the Network Component automatically. If another file system will be used, refer to the reference implementation in the TFTP_Client_FS.c module.