I need to parse a text file stream after downloading and without saving the text file to harddisk or sdcard using tftp protocol. I've the data in payload. Please help.
struct pbuf {
struct pbuf *next;
void *payload;
u16_t tot_len;
u16_t len;
u8_t type;
u8_t flags;
u16_t ref;
};
The following code assigns the opcode and filename. But how to get the contents of the file?
/* Extract the opcode from a TFTP message in a buffer */
tftp_opcode tftp_decode_op(char *buf)
{
return (tftp_opcode)(buf[1]);
}
void tftp_extract_filename(char *fname, char *buf)
{
strcpy(fname, buf + 2);
}