| [444] | 1 | /* NLM (NetWare Loadable Module) support for BFD. | 
|---|
|  | 2 | Copyright 1993, 1994, 2005, 2010 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 3 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., 51 Franklin Street - Fifth Floor, Boston, | 
|---|
|  | 21 | MA 02110-1301, USA.  */ | 
|---|
|  | 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 | /* NLM Header.  */ | 
|---|
|  | 46 |  | 
|---|
|  | 47 | /* The version header is one of the optional auxiliary headers and | 
|---|
|  | 48 | follows the fixed length and variable length NLM headers.  */ | 
|---|
|  | 49 |  | 
|---|
|  | 50 | typedef struct nlmNAME(external_version_header) | 
|---|
|  | 51 | { | 
|---|
|  | 52 |  | 
|---|
|  | 53 | /* The header is recognized by "VeRsIoN#" in the stamp field. */ | 
|---|
|  | 54 | char stamp[8]; | 
|---|
|  | 55 |  | 
|---|
|  | 56 | unsigned char majorVersion[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 57 |  | 
|---|
|  | 58 | unsigned char minorVersion[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 59 |  | 
|---|
|  | 60 | unsigned char revision[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 61 |  | 
|---|
|  | 62 | unsigned char year[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 63 |  | 
|---|
|  | 64 | unsigned char month[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 65 |  | 
|---|
|  | 66 | unsigned char day[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 67 |  | 
|---|
|  | 68 | } NlmNAME(External_Version_Header); | 
|---|
|  | 69 |  | 
|---|
|  | 70 |  | 
|---|
|  | 71 | typedef struct nlmNAME(external_copyright_header) | 
|---|
|  | 72 | { | 
|---|
|  | 73 |  | 
|---|
|  | 74 | /* The header is recognized by "CoPyRiGhT=" in the stamp field. */ | 
|---|
|  | 75 |  | 
|---|
|  | 76 | char stamp[10]; | 
|---|
|  | 77 |  | 
|---|
|  | 78 | unsigned char copyrightMessageLength[1]; | 
|---|
|  | 79 |  | 
|---|
|  | 80 | /* There is a variable length field here called 'copyrightMessage' | 
|---|
|  | 81 | that is the length specified by copyrightMessageLength. */ | 
|---|
|  | 82 |  | 
|---|
|  | 83 | } NlmNAME(External_Copyright_Header); | 
|---|
|  | 84 |  | 
|---|
|  | 85 |  | 
|---|
|  | 86 | typedef struct nlmNAME(external_extended_header) | 
|---|
|  | 87 | { | 
|---|
|  | 88 |  | 
|---|
|  | 89 | /* The header is recognized by "MeSsAgEs" in the stamp field. */ | 
|---|
|  | 90 |  | 
|---|
|  | 91 | char stamp[8]; | 
|---|
|  | 92 |  | 
|---|
|  | 93 | unsigned char languageID[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 94 |  | 
|---|
|  | 95 | unsigned char messageFileOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 96 |  | 
|---|
|  | 97 | unsigned char messageFileLength[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 98 |  | 
|---|
|  | 99 | unsigned char messageCount[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 100 |  | 
|---|
|  | 101 | unsigned char helpFileOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 102 |  | 
|---|
|  | 103 | unsigned char helpFileLength[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 104 |  | 
|---|
|  | 105 | unsigned char RPCDataOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 106 |  | 
|---|
|  | 107 | unsigned char RPCDataLength[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 108 |  | 
|---|
|  | 109 | unsigned char sharedCodeOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 110 |  | 
|---|
|  | 111 | unsigned char sharedCodeLength[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 112 |  | 
|---|
|  | 113 | unsigned char sharedDataOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 114 |  | 
|---|
|  | 115 | unsigned char sharedDataLength[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 116 |  | 
|---|
|  | 117 | unsigned char sharedRelocationFixupOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 118 |  | 
|---|
|  | 119 | unsigned char sharedRelocationFixupCount[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 120 |  | 
|---|
|  | 121 | unsigned char sharedExternalReferenceOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 122 |  | 
|---|
|  | 123 | unsigned char sharedExternalReferenceCount[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 124 |  | 
|---|
|  | 125 | unsigned char sharedPublicsOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 126 |  | 
|---|
|  | 127 | unsigned char sharedPublicsCount[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 128 |  | 
|---|
|  | 129 | unsigned char sharedDebugRecordOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 130 |  | 
|---|
|  | 131 | unsigned char sharedDebugRecordCount[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 132 |  | 
|---|
|  | 133 | unsigned char sharedInitializationOffset[NLM_TARGET_ADDRESS_SIZE]; | 
|---|
|  | 134 |  | 
|---|
|  | 135 | unsigned char SharedExitProcedureOffset[NLM_TARGET_ADDRESS_SIZE]; | 
|---|
|  | 136 |  | 
|---|
|  | 137 | unsigned char productID[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 138 |  | 
|---|
|  | 139 | unsigned char reserved0[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 140 |  | 
|---|
|  | 141 | unsigned char reserved1[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 142 |  | 
|---|
|  | 143 | unsigned char reserved2[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 144 |  | 
|---|
|  | 145 | unsigned char reserved3[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 146 |  | 
|---|
|  | 147 | unsigned char reserved4[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 148 |  | 
|---|
|  | 149 | unsigned char reserved5[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 150 |  | 
|---|
|  | 151 | } NlmNAME(External_Extended_Header); | 
|---|
|  | 152 |  | 
|---|
|  | 153 |  | 
|---|
|  | 154 | typedef struct nlmNAME(external_custom_header) | 
|---|
|  | 155 | { | 
|---|
|  | 156 |  | 
|---|
|  | 157 | /* The header is recognized by "CuStHeAd" in the stamp field. */ | 
|---|
|  | 158 | char stamp[8]; | 
|---|
|  | 159 |  | 
|---|
|  | 160 | /* Length of this header.  */ | 
|---|
|  | 161 | unsigned char length[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 162 |  | 
|---|
|  | 163 | /* Offset to data.  */ | 
|---|
|  | 164 | unsigned char dataOffset[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 165 |  | 
|---|
|  | 166 | /* Length of data.  */ | 
|---|
|  | 167 | unsigned char dataLength[NLM_TARGET_LONG_SIZE]; | 
|---|
|  | 168 |  | 
|---|
|  | 169 | /* Stamp for this customer header--we recognize "CyGnUsEx".  */ | 
|---|
|  | 170 | char dataStamp[8]; | 
|---|
|  | 171 |  | 
|---|
|  | 172 | } NlmNAME(External_Custom_Header); | 
|---|