]>
Commit | Line | Data |
---|---|---|
91447636 A |
1 | /* |
2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. | |
3 | * | |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
91447636 | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
91447636 A |
27 | */ |
28 | ||
29 | /* HISTORY | |
30 | * 8 Aug. 2003 - Created (Derek Kumar) | |
31 | */ | |
32 | ||
55e303ae | 33 | /* Various protocol definitions |
91447636 | 34 | * for the core transfer protocol, which is a variant of TFTP |
55e303ae A |
35 | */ |
36 | ||
37 | /* | |
38 | * Packet types. | |
39 | */ | |
40 | #define KDP_RRQ 1 /* read request */ | |
41 | #define KDP_WRQ 2 /* write request */ | |
42 | #define KDP_DATA 3 /* data packet */ | |
43 | #define KDP_ACK 4 /* acknowledgement */ | |
44 | #define KDP_ERROR 5 /* error code */ | |
45 | #define KDP_SEEK 6 /* Seek to specified offset */ | |
46 | #define KDP_EOF 7 /* signal end of file */ | |
b0d623f7 | 47 | #define KDP_FEATURE_MASK_STRING "features" |
6d2010ae A |
48 | |
49 | enum {KDP_FEATURE_LARGE_CRASHDUMPS = 1, KDP_FEATURE_LARGE_PKT_SIZE = 2}; | |
50 | extern uint32_t kdp_feature_large_crashdumps, kdp_feature_large_pkt_size; | |
51 | ||
55e303ae A |
52 | struct corehdr { |
53 | short th_opcode; /* packet type */ | |
54 | union { | |
55 | unsigned int tu_block; /* block # */ | |
56 | unsigned int tu_code; /* error code */ | |
57 | char tu_rpl[1]; /* request packet payload */ | |
58 | } th_u; | |
6d2010ae | 59 | char th_data[0]; /* data or error string */ |
55e303ae A |
60 | }__attribute__((packed)); |
61 | ||
62 | #define th_block th_u.tu_block | |
63 | #define th_code th_u.tu_code | |
64 | #define th_stuff th_u.tu_rpl | |
65 | #define th_msg th_data | |
66 | ||
67 | /* | |
68 | * Error codes. | |
69 | */ | |
70 | #define EUNDEF 0 /* not defined */ | |
71 | #define ENOTFOUND 1 /* file not found */ | |
72 | #define EACCESS 2 /* access violation */ | |
73 | #define ENOSPACE 3 /* disk full or allocation exceeded */ | |
74 | #define EBADOP 4 /* illegal TFTP operation */ | |
75 | #define EBADID 5 /* unknown transfer ID */ | |
76 | #define EEXISTS 6 /* file already exists */ | |
77 | #define ENOUSER 7 /* no such user */ | |
78 | ||
79 | #define CORE_REMOTE_PORT 1069 /* hardwired, we can't really query the services file */ | |
80 | ||
81 | void kdp_panic_dump (void); | |
55e303ae | 82 | void abort_panic_transfer (void); |
7e4a7d39 A |
83 | void kdp_set_dump_info(const uint32_t flags, const char *file, const char *destip, |
84 | const char *routerip, const uint32_t port); | |
85 | void kdp_get_dump_info(uint32_t *flags, char *file, char *destip, char *routerip, | |
86 | uint32_t *port); | |
87 | ||
55e303ae A |
88 | |
89 | struct corehdr *create_panic_header(unsigned int request, const char *corename, unsigned length, unsigned block); | |
90 | ||
0c530ab8 | 91 | int kdp_send_crashdump_pkt(unsigned int request, char *corename, |
b0d623f7 | 92 | uint64_t length, void *panic_data); |
0c530ab8 A |
93 | |
94 | int kdp_send_crashdump_data(unsigned int request, char *corename, | |
6d2010ae A |
95 | int64_t length, caddr_t txstart); |
96 | ||
97 | #define KDP_CRASHDUMP_POLL_COUNT (2500) |