| 1 | #ifndef TFTP_H |
| 2 | #define TFTP_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stddef.h> |
| 6 | #include <fs/file.h> |
| 7 | |
| 8 | #if defined (BIOS) |
| 9 | |
| 10 | #define UNDI_GET_INFORMATION 0xC |
| 11 | |
| 12 | #define TFTP_OPEN 0x0020 |
| 13 | struct pxenv_open { |
| 14 | uint16_t status; |
| 15 | uint32_t sip; |
| 16 | uint32_t gip; |
| 17 | uint8_t name[128]; |
| 18 | uint16_t port; |
| 19 | uint16_t packet_size; |
| 20 | } __attribute__((packed)); |
| 21 | |
| 22 | #define TFTP_READ 0x22 |
| 23 | struct pxenv_read { |
| 24 | uint16_t status; |
| 25 | uint16_t pn; |
| 26 | uint16_t bsize; |
| 27 | uint16_t boff; |
| 28 | uint16_t bseg; |
| 29 | } __attribute__((packed)); |
| 30 | |
| 31 | #define TFTP_GET_FILE_SIZE 0x25 |
| 32 | struct pxenv_get_file_size { |
| 33 | uint16_t status; |
| 34 | uint32_t sip; |
| 35 | uint32_t gip; |
| 36 | uint8_t name[128]; |
| 37 | uint32_t file_size; |
| 38 | } __attribute__((packed)); |
| 39 | |
| 40 | #define TFTP_CLOSE 0x21 |
| 41 | |
| 42 | #endif |
| 43 | |
| 44 | struct file_handle *tftp_open(struct volume *part, const char *server_addr, const char *name); |
| 45 | |
| 46 | #endif |