Commit | Line | Data |
---|---|---|
bb0cfa24 DF |
1 | /* |
2 | * Copyright (c) 1983 Regents of the University of California. | |
f4f66d2c | 3 | * All rights reserved. |
bb0cfa24 | 4 | * |
f4f66d2c KB |
5 | * Redistribution and use in source and binary forms are permitted |
6 | * provided that the above copyright notice and this paragraph are | |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
16 | * | |
17 | * @(#)tftp.h 5.2 (Berkeley) %G% | |
bb0cfa24 | 18 | */ |
1e82972c SL |
19 | |
20 | /* | |
21 | * Trivial File Transfer Protocol (IEN-133) | |
22 | */ | |
23 | #define SEGSIZE 512 /* data segment size */ | |
1e82972c SL |
24 | |
25 | /* | |
26 | * Packet types. | |
27 | */ | |
28 | #define RRQ 01 /* read request */ | |
29 | #define WRQ 02 /* write request */ | |
30 | #define DATA 03 /* data packet */ | |
31 | #define ACK 04 /* acknowledgement */ | |
32 | #define ERROR 05 /* error code */ | |
33 | ||
34 | struct tftphdr { | |
35 | short th_opcode; /* packet type */ | |
36 | union { | |
37 | short tu_block; /* block # */ | |
38 | short tu_code; /* error code */ | |
39 | char tu_stuff[1]; /* request packet stuff */ | |
40 | } th_u; | |
41 | char th_data[1]; /* data or error string */ | |
42 | }; | |
43 | ||
44 | #define th_block th_u.tu_block | |
45 | #define th_code th_u.tu_code | |
46 | #define th_stuff th_u.tu_stuff | |
47 | #define th_msg th_data | |
48 | ||
49 | /* | |
50 | * Error codes. | |
51 | */ | |
52 | #define EUNDEF 0 /* not defined */ | |
53 | #define ENOTFOUND 1 /* file not found */ | |
54 | #define EACCESS 2 /* access violation */ | |
55 | #define ENOSPACE 3 /* disk full or allocation exceeded */ | |
56 | #define EBADOP 4 /* illegal TFTP operation */ | |
57 | #define EBADID 5 /* unknown transfer ID */ | |
58 | #define EEXISTS 6 /* file already exists */ | |
59 | #define ENOUSER 7 /* no such user */ |