]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kdp/kdp_core.h
xnu-792.6.61.tar.gz
[apple/xnu.git] / osfmk / kdp / kdp_core.h
CommitLineData
91447636
A
1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
37839358
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
91447636 11 *
37839358
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
91447636
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
91447636
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23/* HISTORY
24 * 8 Aug. 2003 - Created (Derek Kumar)
25 */
26
55e303ae 27/* Various protocol definitions
91447636 28 * for the core transfer protocol, which is a variant of TFTP
55e303ae
A
29 */
30
31/*
32 * Packet types.
33 */
34#define KDP_RRQ 1 /* read request */
35#define KDP_WRQ 2 /* write request */
36#define KDP_DATA 3 /* data packet */
37#define KDP_ACK 4 /* acknowledgement */
38#define KDP_ERROR 5 /* error code */
39#define KDP_SEEK 6 /* Seek to specified offset */
40#define KDP_EOF 7 /* signal end of file */
41struct corehdr {
42 short th_opcode; /* packet type */
43 union {
44 unsigned int tu_block; /* block # */
45 unsigned int tu_code; /* error code */
46 char tu_rpl[1]; /* request packet payload */
47 } th_u;
48 char th_data[1]; /* data or error string */
49}__attribute__((packed));
50
51#define th_block th_u.tu_block
52#define th_code th_u.tu_code
53#define th_stuff th_u.tu_rpl
54#define th_msg th_data
55
56/*
57 * Error codes.
58 */
59#define EUNDEF 0 /* not defined */
60#define ENOTFOUND 1 /* file not found */
61#define EACCESS 2 /* access violation */
62#define ENOSPACE 3 /* disk full or allocation exceeded */
63#define EBADOP 4 /* illegal TFTP operation */
64#define EBADID 5 /* unknown transfer ID */
65#define EEXISTS 6 /* file already exists */
66#define ENOUSER 7 /* no such user */
67
68#define CORE_REMOTE_PORT 1069 /* hardwired, we can't really query the services file */
69
70void kdp_panic_dump (void);
71
72void abort_panic_transfer (void);
73
74struct corehdr *create_panic_header(unsigned int request, const char *corename, unsigned length, unsigned block);
75
76int kdp_send_panic_pkt (unsigned int request, char *corename, unsigned int length, void *panic_data);