/********************************************************************************************************************************/ /* Created: 28-MAY-2004 16:28:24 by OpenVMS SDL EV1-60 */ /* Source: 25-MAY-2004 22:29:54 DISK$SYSMAN:[LAISHEV.WORK.TFTP]TFTPDEF.SDL;10 */ /********************************************************************************************************************************/ /*** MODULE TFTPDEF IDENT TFTPDEF-1-X ***/ #ifndef __TFTPDEF_LOADED #define __TFTPDEF_LOADED 1 #pragma __nostandard /* This file uses non-ANSI-Standard features */ #pragma __member_alignment __save #pragma __nomember_alignment #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __save /* Save the previously-defined required ptr size */ #pragma __required_pointer_size __short /* And set ptr size default to 32-bit pointers */ #endif #ifdef __cplusplus extern "C" { #define __unknown_params ... #define __optional_params ... #else #define __unknown_params #define __optional_params ... #endif #ifndef __struct #if !defined(__VAXC) #define __struct struct #else #define __struct variant_struct #endif #endif #ifndef __union #if !defined(__VAXC) #define __union union #else #define __union variant_union #endif #endif /*++ */ /*Facility: */ /* TFTP Server Client */ /* */ /* Abstract: */ /* An interface module defined TFTP primitives, constants, this story is based on */ /* RFC1350 (THE TFTP PROTOCOL (REVISION 2)) */ /* ftp://ftp.rfc-editor.org/in-notes/rfc1350.txt */ /* */ /* Author: */ /* Ruslan R. Laishev */ /* */ /* Creation Date: 24-MAY-2004 */ /* */ /* Modification History: */ /*-- */ /* */ /**++ */ /** */ /** TFTP modes of transfer */ /** */ /**-- */ /* */ #define TFTP__$K_NETASCII 1 /* This is */ /* ascii as defined in "USA Standard Code for Information Interchange" */ /* [1] with the modifications specified in "Telnet Protocol */ /* Specification" [3].) Note that it is 8 bit ascii. */ #define TFTP__$K_OCTET 2 /* octet (This replaces the "binary" mode */ /* of previous versions of this document.) raw 8 bit bytes; */ #define TFTP__$K_PORT 69 /* */ /**++ */ /** */ /** TFTP primitives */ /** */ /* */ /* Type Op # Format without header */ /* */ /* 2 bytes string 1 byte string 1 byte */ /* ----------------------------------------------- */ /* RRQ/ | 01/02 | Filename | 0 | Mode | 0 | */ /* WRQ ----------------------------------------------- */ /* 2 bytes 2 bytes n bytes */ /* --------------------------------- */ /* DATA | 03 | Block # | Data | */ /* --------------------------------- */ /* 2 bytes 2 bytes */ /* ------------------- */ /* ACK | 04 | Block # | */ /* -------------------- */ /* 2 bytes 2 bytes string 1 byte */ /* ---------------------------------------- */ /* ERROR | 05 | ErrorCode | ErrMsg | 0 | */ /* ---------------------------------------- */ /**-- */ #define TFTP_OPC$K_RRQ 1 /* 1 Read request (RRQ) */ #define TFTP_OPC$K_WRQ 2 /* 2 Write request (WRQ) */ #define TFTP_OPC$K_DATA 3 /* 3 Data (DATA) */ #define TFTP_OPC$K_ACK 4 /* 4 Acknowledgment (ACK) */ #define TFTP_OPC$K_ERROR 5 /* 5 Error (ERROR) */ #ifdef __NEW_STARLET typedef struct _tftp_pdu { unsigned short int tftp_pdu$w_opcode; /* field which indicates */ /* the packet's type (e.g., DATA, ERROR, etc.) These opcodes and the */ /* formats of the various types of packets are discussed further in the */ /* section on TFTP packets. */ __union { __struct { unsigned char tftp_pdu$b_args [510]; } tftp_pdu$r_xrq; __struct { unsigned short int tftp_pdu$w_lbn; unsigned char tftp_pdu$b_data [512]; } tftp_pdu$r_data; __struct { unsigned short int tftp_pdu$w_lbn; } tftp_pdu$r_ack; __struct { unsigned short int tftp_pdu$w_code; unsigned char tftp_pdu$b_msg [510]; } tftp_pdu$r_error; } tftp_pdu$r_req; } TFTP_PDU; #if !defined(__VAXC) #define tftp_pdu$r_xrq tftp_pdu$r_req.tftp_pdu$r_xrq #define tftp_pdu$b_args tftp_pdu$r_xrq.tftp_pdu$b_args #define tftp_pdu$r_data tftp_pdu$r_req.tftp_pdu$r_data #define tftp_pdu$w_lbn tftp_pdu$r_data.tftp_pdu$w_lbn #define tftp_pdu$b_data tftp_pdu$r_data.tftp_pdu$b_data #define tftp_pdu$r_ack tftp_pdu$r_req.tftp_pdu$r_ack #define tftp_pdu$w_lbn tftp_pdu$r_ack.tftp_pdu$w_lbn #define tftp_pdu$r_error tftp_pdu$r_req.tftp_pdu$r_error #define tftp_pdu$w_code tftp_pdu$r_error.tftp_pdu$w_code #define tftp_pdu$b_msg tftp_pdu$r_error.tftp_pdu$b_msg #endif /* #if !defined(__VAXC) */ #else /* __OLD_STARLET */ struct tftp_pdu { unsigned short int tftp_pdu$w_opcode; /* field which indicates */ /* the packet's type (e.g., DATA, ERROR, etc.) These opcodes and the */ /* formats of the various types of packets are discussed further in the */ /* section on TFTP packets. */ __union { __struct { unsigned char tftp_pdu$b_args [510]; } tftp_pdu$r_xrq; __struct { unsigned short int tftp_pdu$w_lbn; unsigned char tftp_pdu$b_data [512]; } tftp_pdu$r_data; __struct { unsigned short int tftp_pdu$w_lbn; } tftp_pdu$r_ack; __struct { unsigned short int tftp_pdu$w_code; unsigned char tftp_pdu$b_msg [510]; } tftp_pdu$r_error; } tftp_pdu$r_req; } ; #if !defined(__VAXC) #define tftp_pdu$b_args tftp_pdu$r_req.tftp_pdu$r_xrq.tftp_pdu$b_args #define tftp_pdu$w_lbn tftp_pdu$r_req.tftp_pdu$r_data.tftp_pdu$w_lbn #define tftp_pdu$b_data tftp_pdu$r_req.tftp_pdu$r_data.tftp_pdu$b_data #define tftp_pdu$w_lbn tftp_pdu$r_req.tftp_pdu$r_ack.tftp_pdu$w_lbn #define tftp_pdu$w_code tftp_pdu$r_req.tftp_pdu$r_error.tftp_pdu$w_code #define tftp_pdu$b_msg tftp_pdu$r_req.tftp_pdu$r_error.tftp_pdu$b_msg #endif /* #if !defined(__VAXC) */ #endif /* #ifdef __NEW_STARLET */ #pragma __member_alignment __restore #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __restore /* Restore the previously-defined required ptr size */ #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __TFTPDEF_LOADED */