123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- #ifndef _GPXE_TFTP_H
- #define _GPXE_TFTP_H
-
-
-
- #include <stdint.h>
- #include <gpxe/udp.h>
- #include <gpxe/async.h>
- #include <gpxe/retry.h>
- #include <gpxe/buffer.h>
-
- #define TFTP_PORT 69
- #define TFTP_DEFAULT_BLKSIZE 512
- #define TFTP_MAX_BLKSIZE 1432
-
- #define TFTP_RRQ 1
- #define TFTP_WRQ 2
- #define TFTP_DATA 3
- #define TFTP_ACK 4
- #define TFTP_ERROR 5
- #define TFTP_OACK 6
-
- #define TFTP_ERR_FILE_NOT_FOUND 1
- #define TFTP_ERR_ACCESS_DENIED 2
- #define TFTP_ERR_DISK_FULL 3
- #define TFTP_ERR_ILLEGAL_OP 4
- #define TFTP_ERR_UNKNOWN_TID 5
- #define TFTP_ERR_FILE_EXISTS 6
- #define TFTP_ERR_UNKNOWN_USER 7
- #define TFTP_ERR_BAD_OPTS 8
-
-
- struct tftp_rrq {
- uint16_t opcode;
- char data[0];
- } __attribute__ (( packed ));
-
-
- struct tftp_data {
- uint16_t opcode;
- uint16_t block;
- uint8_t data[0];
- } __attribute__ (( packed ));
-
-
- struct tftp_ack {
- uint16_t opcode;
- uint16_t block;
- } __attribute__ (( packed ));
-
-
- struct tftp_error {
- uint16_t opcode;
- uint16_t errcode;
- char errmsg[0];
- } __attribute__ (( packed ));
-
-
- struct tftp_oack {
- uint16_t opcode;
- char data[0];
- } __attribute__ (( packed ));
-
-
- struct tftp_common {
- uint16_t opcode;
- } __attribute__ (( packed ));
-
-
- union tftp_any {
- struct tftp_common common;
- struct tftp_rrq rrq;
- struct tftp_data data;
- struct tftp_ack ack;
- struct tftp_error error;
- struct tftp_oack oack;
- };
-
-
- struct tftp_session {
-
- struct uri *uri;
-
- struct buffer *buffer;
-
- struct async async;
-
-
-
- unsigned int request_blksize;
-
-
-
- unsigned int blksize;
-
-
- unsigned long tsize;
-
-
-
- uint16_t tid;
-
-
- int state;
-
- struct udp_connection udp;
-
- struct retry_timer timer;
- };
-
-
-
- extern int tftp_get ( struct uri *uri, struct buffer *buffer,
- struct async *parent );
-
- #endif
|