2020-11-05 03:37:45 +03:00
|
|
|
#ifndef TFTP_H
|
|
|
|
#define TFTP_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
2021-08-12 08:40:29 +03:00
|
|
|
#include <fs/file.h>
|
2020-11-05 03:37:45 +03:00
|
|
|
|
|
|
|
#define UNDI_GET_INFORMATION 0xC
|
|
|
|
|
|
|
|
#define TFTP_OPEN 0x0020
|
|
|
|
struct pxenv_open {
|
|
|
|
uint16_t status;
|
|
|
|
uint32_t sip;
|
|
|
|
uint32_t gip;
|
|
|
|
uint8_t name[128];
|
|
|
|
uint16_t port;
|
|
|
|
uint16_t packet_size;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
#define TFTP_READ 0x22
|
|
|
|
struct pxenv_read {
|
|
|
|
uint16_t status;
|
|
|
|
uint16_t pn;
|
|
|
|
uint16_t bsize;
|
|
|
|
uint16_t boff;
|
|
|
|
uint16_t bseg;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
#define TFTP_GET_FILE_SIZE 0x25
|
|
|
|
struct pxenv_get_file_size {
|
|
|
|
uint16_t status;
|
|
|
|
uint32_t sip;
|
|
|
|
uint32_t gip;
|
|
|
|
uint8_t name[128];
|
|
|
|
uint32_t file_size;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
#define TFTP_CLOSE 0x21
|
|
|
|
|
|
|
|
//server_ip and server_port can be 0 for default
|
2022-07-04 21:16:33 +03:00
|
|
|
struct file_handle *tftp_open(uint32_t server_ip, uint16_t server_port, const char *name);
|
2021-08-12 08:40:29 +03:00
|
|
|
|
2021-03-13 11:08:01 +03:00
|
|
|
uint32_t get_boot_server_info(void);
|
2020-11-05 03:37:45 +03:00
|
|
|
|
|
|
|
#endif
|