]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kdp/kdp_core.h
xnu-517.7.7.tar.gz
[apple/xnu.git] / osfmk / kdp / kdp_core.h
CommitLineData
55e303ae
A
1/* Various protocol definitions
2 * for the core transfer protocol, which is a variant of TFTP
3 */
4
5/*
6 * Packet types.
7 */
8#define KDP_RRQ 1 /* read request */
9#define KDP_WRQ 2 /* write request */
10#define KDP_DATA 3 /* data packet */
11#define KDP_ACK 4 /* acknowledgement */
12#define KDP_ERROR 5 /* error code */
13#define KDP_SEEK 6 /* Seek to specified offset */
14#define KDP_EOF 7 /* signal end of file */
15struct corehdr {
16 short th_opcode; /* packet type */
17 union {
18 unsigned int tu_block; /* block # */
19 unsigned int tu_code; /* error code */
20 char tu_rpl[1]; /* request packet payload */
21 } th_u;
22 char th_data[1]; /* data or error string */
23}__attribute__((packed));
24
25#define th_block th_u.tu_block
26#define th_code th_u.tu_code
27#define th_stuff th_u.tu_rpl
28#define th_msg th_data
29
30/*
31 * Error codes.
32 */
33#define EUNDEF 0 /* not defined */
34#define ENOTFOUND 1 /* file not found */
35#define EACCESS 2 /* access violation */
36#define ENOSPACE 3 /* disk full or allocation exceeded */
37#define EBADOP 4 /* illegal TFTP operation */
38#define EBADID 5 /* unknown transfer ID */
39#define EEXISTS 6 /* file already exists */
40#define ENOUSER 7 /* no such user */
41
42#define CORE_REMOTE_PORT 1069 /* hardwired, we can't really query the services file */
43
44void kdp_panic_dump (void);
45
46void abort_panic_transfer (void);
47
48struct corehdr *create_panic_header(unsigned int request, const char *corename, unsigned length, unsigned block);
49
50int kdp_send_panic_pkt (unsigned int request, char *corename, unsigned int length, void *panic_data);