Commit | Line | Data |
---|---|---|
bb0cfa24 DF |
1 | /* |
2 | * Copyright (c) 1983 Regents of the University of California. | |
f4f66d2c | 3 | * All rights reserved. |
bb0cfa24 | 4 | * |
269a7923 | 5 | * %sccs.include.redist.c% |
f4f66d2c | 6 | * |
269a7923 | 7 | * @(#)tftp.h 5.3 (Berkeley) %G% |
bb0cfa24 | 8 | */ |
1e82972c SL |
9 | |
10 | /* | |
11 | * Trivial File Transfer Protocol (IEN-133) | |
12 | */ | |
13 | #define SEGSIZE 512 /* data segment size */ | |
1e82972c SL |
14 | |
15 | /* | |
16 | * Packet types. | |
17 | */ | |
18 | #define RRQ 01 /* read request */ | |
19 | #define WRQ 02 /* write request */ | |
20 | #define DATA 03 /* data packet */ | |
21 | #define ACK 04 /* acknowledgement */ | |
22 | #define ERROR 05 /* error code */ | |
23 | ||
24 | struct tftphdr { | |
25 | short th_opcode; /* packet type */ | |
26 | union { | |
27 | short tu_block; /* block # */ | |
28 | short tu_code; /* error code */ | |
29 | char tu_stuff[1]; /* request packet stuff */ | |
30 | } th_u; | |
31 | char th_data[1]; /* data or error string */ | |
32 | }; | |
33 | ||
34 | #define th_block th_u.tu_block | |
35 | #define th_code th_u.tu_code | |
36 | #define th_stuff th_u.tu_stuff | |
37 | #define th_msg th_data | |
38 | ||
39 | /* | |
40 | * Error codes. | |
41 | */ | |
42 | #define EUNDEF 0 /* not defined */ | |
43 | #define ENOTFOUND 1 /* file not found */ | |
44 | #define EACCESS 2 /* access violation */ | |
45 | #define ENOSPACE 3 /* disk full or allocation exceeded */ | |
46 | #define EBADOP 4 /* illegal TFTP operation */ | |
47 | #define EBADID 5 /* unknown transfer ID */ | |
48 | #define EEXISTS 6 /* file already exists */ | |
49 | #define ENOUSER 7 /* no such user */ |