1 | /* NLM (NetWare Loadable Module) support for BFD.
|
---|
2 | Copyright 1993, 1994 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | Written by Fred Fish @ Cygnus Support
|
---|
5 |
|
---|
6 | This file is part of BFD, the Binary File Descriptor library.
|
---|
7 |
|
---|
8 | This program is free software; you can redistribute it and/or modify
|
---|
9 | it under the terms of the GNU General Public License as published by
|
---|
10 | the Free Software Foundation; either version 2 of the License, or
|
---|
11 | (at your option) any later version.
|
---|
12 |
|
---|
13 | This program is distributed in the hope that it will be useful,
|
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | GNU General Public License for more details.
|
---|
17 |
|
---|
18 | You should have received a copy of the GNU General Public License
|
---|
19 | along with this program; if not, write to the Free Software
|
---|
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
---|
21 |
|
---|
22 |
|
---|
23 | /* This file is part of NLM support for BFD, and contains the portions
|
---|
24 | that describe how NLM is represented externally by the BFD library.
|
---|
25 | I.E. it describes the in-file representation of NLM. It requires
|
---|
26 | the nlm/common.h file which contains the portions that are common to
|
---|
27 | both the internal and external representations.
|
---|
28 |
|
---|
29 | Note that an NLM header consists of three parts:
|
---|
30 |
|
---|
31 | (1) A fixed length header that has specific fields of known length,
|
---|
32 | at specific offsets in the file.
|
---|
33 |
|
---|
34 | (2) A variable length header that has specific fields in a specific
|
---|
35 | order, but some fields may be variable length.
|
---|
36 |
|
---|
37 | (3) A auxiliary header that has various optional fields in no specific
|
---|
38 | order. There is no way to identify the end of the auxiliary headers
|
---|
39 | except by finding a header without a recognized 'stamp'.
|
---|
40 |
|
---|
41 | The exact format of the fixed length header unfortunately varies
|
---|
42 | from one NLM target to another, due to padding. Each target
|
---|
43 | defines the correct external format in a separate header file.
|
---|
44 |
|
---|
45 | */
|
---|
46 |
|
---|
47 | /* NLM Header */
|
---|
48 |
|
---|
49 | /* The version header is one of the optional auxiliary headers and
|
---|
50 | follows the fixed length and variable length NLM headers. */
|
---|
51 |
|
---|
52 | typedef struct nlmNAME(external_version_header)
|
---|
53 | {
|
---|
54 |
|
---|
55 | /* The header is recognized by "VeRsIoN#" in the stamp field. */
|
---|
56 | char stamp[8];
|
---|
57 |
|
---|
58 | unsigned char majorVersion[NLM_TARGET_LONG_SIZE];
|
---|
59 |
|
---|
60 | unsigned char minorVersion[NLM_TARGET_LONG_SIZE];
|
---|
61 |
|
---|
62 | unsigned char revision[NLM_TARGET_LONG_SIZE];
|
---|
63 |
|
---|
64 | unsigned char year[NLM_TARGET_LONG_SIZE];
|
---|
65 |
|
---|
66 | unsigned char month[NLM_TARGET_LONG_SIZE];
|
---|
67 |
|
---|
68 | unsigned char day[NLM_TARGET_LONG_SIZE];
|
---|
69 |
|
---|
70 | } NlmNAME(External_Version_Header);
|
---|
71 |
|
---|
72 |
|
---|
73 | typedef struct nlmNAME(external_copyright_header)
|
---|
74 | {
|
---|
75 |
|
---|
76 | /* The header is recognized by "CoPyRiGhT=" in the stamp field. */
|
---|
77 |
|
---|
78 | char stamp[10];
|
---|
79 |
|
---|
80 | unsigned char copyrightMessageLength[1];
|
---|
81 |
|
---|
82 | /* There is a variable length field here called 'copyrightMessage'
|
---|
83 | that is the length specified by copyrightMessageLength. */
|
---|
84 |
|
---|
85 | } NlmNAME(External_Copyright_Header);
|
---|
86 |
|
---|
87 |
|
---|
88 | typedef struct nlmNAME(external_extended_header)
|
---|
89 | {
|
---|
90 |
|
---|
91 | /* The header is recognized by "MeSsAgEs" in the stamp field. */
|
---|
92 |
|
---|
93 | char stamp[8];
|
---|
94 |
|
---|
95 | unsigned char languageID[NLM_TARGET_LONG_SIZE];
|
---|
96 |
|
---|
97 | unsigned char messageFileOffset[NLM_TARGET_LONG_SIZE];
|
---|
98 |
|
---|
99 | unsigned char messageFileLength[NLM_TARGET_LONG_SIZE];
|
---|
100 |
|
---|
101 | unsigned char messageCount[NLM_TARGET_LONG_SIZE];
|
---|
102 |
|
---|
103 | unsigned char helpFileOffset[NLM_TARGET_LONG_SIZE];
|
---|
104 |
|
---|
105 | unsigned char helpFileLength[NLM_TARGET_LONG_SIZE];
|
---|
106 |
|
---|
107 | unsigned char RPCDataOffset[NLM_TARGET_LONG_SIZE];
|
---|
108 |
|
---|
109 | unsigned char RPCDataLength[NLM_TARGET_LONG_SIZE];
|
---|
110 |
|
---|
111 | unsigned char sharedCodeOffset[NLM_TARGET_LONG_SIZE];
|
---|
112 |
|
---|
113 | unsigned char sharedCodeLength[NLM_TARGET_LONG_SIZE];
|
---|
114 |
|
---|
115 | unsigned char sharedDataOffset[NLM_TARGET_LONG_SIZE];
|
---|
116 |
|
---|
117 | unsigned char sharedDataLength[NLM_TARGET_LONG_SIZE];
|
---|
118 |
|
---|
119 | unsigned char sharedRelocationFixupOffset[NLM_TARGET_LONG_SIZE];
|
---|
120 |
|
---|
121 | unsigned char sharedRelocationFixupCount[NLM_TARGET_LONG_SIZE];
|
---|
122 |
|
---|
123 | unsigned char sharedExternalReferenceOffset[NLM_TARGET_LONG_SIZE];
|
---|
124 |
|
---|
125 | unsigned char sharedExternalReferenceCount[NLM_TARGET_LONG_SIZE];
|
---|
126 |
|
---|
127 | unsigned char sharedPublicsOffset[NLM_TARGET_LONG_SIZE];
|
---|
128 |
|
---|
129 | unsigned char sharedPublicsCount[NLM_TARGET_LONG_SIZE];
|
---|
130 |
|
---|
131 | unsigned char sharedDebugRecordOffset[NLM_TARGET_LONG_SIZE];
|
---|
132 |
|
---|
133 | unsigned char sharedDebugRecordCount[NLM_TARGET_LONG_SIZE];
|
---|
134 |
|
---|
135 | unsigned char sharedInitializationOffset[NLM_TARGET_ADDRESS_SIZE];
|
---|
136 |
|
---|
137 | unsigned char SharedExitProcedureOffset[NLM_TARGET_ADDRESS_SIZE];
|
---|
138 |
|
---|
139 | unsigned char productID[NLM_TARGET_LONG_SIZE];
|
---|
140 |
|
---|
141 | unsigned char reserved0[NLM_TARGET_LONG_SIZE];
|
---|
142 |
|
---|
143 | unsigned char reserved1[NLM_TARGET_LONG_SIZE];
|
---|
144 |
|
---|
145 | unsigned char reserved2[NLM_TARGET_LONG_SIZE];
|
---|
146 |
|
---|
147 | unsigned char reserved3[NLM_TARGET_LONG_SIZE];
|
---|
148 |
|
---|
149 | unsigned char reserved4[NLM_TARGET_LONG_SIZE];
|
---|
150 |
|
---|
151 | unsigned char reserved5[NLM_TARGET_LONG_SIZE];
|
---|
152 |
|
---|
153 | } NlmNAME(External_Extended_Header);
|
---|
154 |
|
---|
155 |
|
---|
156 | typedef struct nlmNAME(external_custom_header)
|
---|
157 | {
|
---|
158 |
|
---|
159 | /* The header is recognized by "CuStHeAd" in the stamp field. */
|
---|
160 | char stamp[8];
|
---|
161 |
|
---|
162 | /* Length of this header. */
|
---|
163 | unsigned char length[NLM_TARGET_LONG_SIZE];
|
---|
164 |
|
---|
165 | /* Offset to data. */
|
---|
166 | unsigned char dataOffset[NLM_TARGET_LONG_SIZE];
|
---|
167 |
|
---|
168 | /* Length of data. */
|
---|
169 | unsigned char dataLength[NLM_TARGET_LONG_SIZE];
|
---|
170 |
|
---|
171 | /* Stamp for this customer header--we recognize "CyGnUsEx". */
|
---|
172 | char dataStamp[8];
|
---|
173 |
|
---|
174 | } NlmNAME(External_Custom_Header);
|
---|