xref: /openbsd/usr.sbin/mopd/common/nma.c (revision 17df1aa7)
1 /*	$OpenBSD: nma.c,v 1.7 2009/10/27 23:59:52 deraadt Exp $ */
2 
3 /*
4  * Copyright (c) 1995 Mats O Jansson.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26 
27 #include <stddef.h>
28 #include "common/nmadef.h"
29 
30 struct commDev {
31 	int		val;
32 	char		*sname;
33 	char		*name;
34 };
35 
36 struct commDev nmaCommDev[] = {
37 	{ NMA_C_SOFD_DP , "DP ", "DP11-DA" },
38 	{ NMA_C_SOFD_UNA, "UNA", "DEUNA" },
39 	{ NMA_C_SOFD_DU , "DU ", "DU11-DA" },
40 	{ NMA_C_SOFD_CNA, "CNA", "DECNA" },
41 	{ NMA_C_SOFD_DL , "DL ", "DL11-C, -E, or -WA" },
42 	{ NMA_C_SOFD_QNA, "QNA", "DEQNA" },
43 	{ NMA_C_SOFD_DQ , "DQ ", "DQ11-DA" },
44 	{ NMA_C_SOFD_CI , "CI ", "Computer Interconnect" },
45 	{ NMA_C_SOFD_DA , "DA ", "DA11-B or -AL" },
46 	{ NMA_C_SOFD_PCL, "PCL", "PCL11-B" },
47 	{ NMA_C_SOFD_DUP, "DUP", "DUP11-DA" },
48 	{ NMA_C_SOFD_LUA, "LUA", "DELUA" },
49 	{ NMA_C_SOFD_DMC, "DMC", "DMC11-DA/AR, -FA/AR, -MA/AL or -MD/AL" },
50 	{ NMA_C_SOFD_LNA, "LNA", "MicroServer Lance" },
51 	{ NMA_C_SOFD_DN , "DN ", "DN11-BA or -AA" },
52 	{ NMA_C_SOFD_DLV, "DLV", "DLV11-E, -F, -J, MXV11-A or -B" },
53 	{ NMA_C_SOFD_LCS, "LCS", "DECServer 100" },
54 	{ NMA_C_SOFD_DMP, "DMP", "DMP11" },
55 	{ NMA_C_SOFD_AMB, "AMB", "AMBER" },
56 	{ NMA_C_SOFD_DTE, "DTE", "DTE20" },
57 	{ NMA_C_SOFD_DBT, "DBT", "DEBET" },
58 	{ NMA_C_SOFD_DV , "DV ", "DV11-AA/BA" },
59 	{ NMA_C_SOFD_BNA, "BNA", "DEBNA" },
60 	{ NMA_C_SOFD_BNT, "BNT", "DEBNT" },
61 	{ NMA_C_SOFD_DZ , "DZ ", "DZ11-A, -B, -C, -D" },
62 	{ NMA_C_SOFD_LPC, "LPC", "PCXX" },
63 	{ NMA_C_SOFD_DSV, "DSV", "DSV11" },
64 	{ NMA_C_SOFD_CEC, "CEC", "3-COM/IBM-PC" },
65 	{ NMA_C_SOFD_KDP, "KDP", "KMC11/DUP11-DA" },
66 	{ NMA_C_SOFD_IEC, "IEC", "Interlan/IBM-PC" },
67 	{ NMA_C_SOFD_KDZ, "KDZ", "KMC11/DZ11-A, -B, -C, or -D" },
68 	{ NMA_C_SOFD_UEC, "UEC", "Univation/RAINBOW-100" },
69 	{ NMA_C_SOFD_KL8, "KL8", "KL8-J" },
70 	{ NMA_C_SOFD_DS2, "DS2", "DECServer 200" },
71 	{ NMA_C_SOFD_DMV, "DMV", "DMV11" },
72 	{ NMA_C_SOFD_DS5, "DS5", "DECServer 500" },
73 	{ NMA_C_SOFD_DPV, "DPV", "DPV11" },
74 	{ NMA_C_SOFD_LQA, "LQA", "DELQA" },
75 	{ NMA_C_SOFD_DMF, "DMF", "DMF32" },
76 	{ NMA_C_SOFD_SVA, "SVA", "DESVA" },
77 	{ NMA_C_SOFD_DMR, "DMR", "DMR11-AA, -AB, -AC, or -AE" },
78 	{ NMA_C_SOFD_MUX, "MUX", "MUXserver" },
79 	{ NMA_C_SOFD_KMY, "KMY", "KMS11-PX" },
80 	{ NMA_C_SOFD_DEP, "DEP", "DEPCA PCSG/IBM-PC" },
81 	{ NMA_C_SOFD_KMX, "KMX", "KMS11-BD/BE" },
82 	{ NMA_C_SOFD_LTM, "LTM", "LTM Ethernet monitor" },
83 	{ NMA_C_SOFD_DMB, "DMB", "DMB-32" },
84 	{ NMA_C_SOFD_DES, "DES", "DESNC" },
85 	{ NMA_C_SOFD_KCP, "KCP", "KCP" },
86 	{ NMA_C_SOFD_MX3, "MX3", "MUXServer 300" },
87 	{ NMA_C_SOFD_SYN, "SYN", "MicroServer" },
88 	{ NMA_C_SOFD_MEB, "MEB", "DEMEB" },
89 	{ NMA_C_SOFD_DSB, "DSB", "DSB32" },
90 	{ NMA_C_SOFD_BAM, "BAM", "DEBAM LANBridge-200" },
91 	{ NMA_C_SOFD_DST, "DST", "DST-32 TEAMmate" },
92 	{ NMA_C_SOFD_FAT, "FAT", "DEFAT" },
93 	{ NMA_C_SOFD_RSM, "RSM", "DERSM - Remote Segment Monitor" },
94 	{ NMA_C_SOFD_RES, "RES", "DERES - Remote Environmental Sensor" },
95 	{ NMA_C_SOFD_3C2, "3C2", "3COM Etherlink II (3C503)" },
96 	{ NMA_C_SOFD_3CM, "3CM", "3COM Etherlink/MC (3C523)" },
97 	{ NMA_C_SOFD_DS3, "DS3", "DECServer 300" },
98 	{ NMA_C_SOFD_MF2, "MF2", "Mayfair-2" },
99 	{ NMA_C_SOFD_MMR, "MMR", "DEMMR" },
100 	{ NMA_C_SOFD_VIT, "VIT", "Vitalink TransLAN III/IV (NP3A) Bridge " },
101 	{ NMA_C_SOFD_VT5, "VT5", "Vitalink TransLAN 350 (NPC25) Bridge " },
102 	{ NMA_C_SOFD_BNI, "BNI", "DEBNI" },
103 	{ NMA_C_SOFD_MNA, "MNA", "DEMNA" },
104 	{ NMA_C_SOFD_PMX, "PMX", "PMAX (KN01)" },
105 	{ NMA_C_SOFD_NI5, "NI5", "Interlan NI5210-8" },
106 	{ NMA_C_SOFD_NI9, "NI9", "Interlan NI9210" },
107 	{ NMA_C_SOFD_KMK, "KMK", "KMS11-K" },
108 	{ NMA_C_SOFD_3CP, "3CP", "3COM Etherlink Plus (3C505) " },
109 	{ NMA_C_SOFD_DP2, "DP2", "DPNserver-200" },
110 	{ NMA_C_SOFD_ISA, "ISA", "SGEC" },
111 	{ NMA_C_SOFD_DIV, "DIV", "DIV-32 DEC WAN controller-100" },
112 	{ NMA_C_SOFD_QTA, "QTA", "DEQTA" },
113 	{ NMA_C_SOFD_B15, "B15", "LANbridge-150" },
114 	{ NMA_C_SOFD_WD8, "WD8", "WD8003 Family" },
115 	{ NMA_C_SOFD_ILA, "ILA", "BICC ISOLAN 4110-2" },
116 	{ NMA_C_SOFD_ILM, "ILM", "BICC ISOLAN 4110-3" },
117 	{ NMA_C_SOFD_APR, "APR", "Apricot Xen-S and Qi" },
118 	{ NMA_C_SOFD_ASN, "ASN", "AST EtherNode" },
119 	{ NMA_C_SOFD_ASE, "ASE", "AST Ethernet" },
120 	{ NMA_C_SOFD_TRW, "TRW", "TRW HC-2001" },
121 	{ NMA_C_SOFD_EDX, "EDX", "Ethernet-XT/AT" },
122 	{ NMA_C_SOFD_EDA, "EDA", "Ethernet-AT" },
123 	{ NMA_C_SOFD_DR2, "DR2", "DECrouter-250" },
124 	{ NMA_C_SOFD_SCC, "SCC", "DECrouter-250 DUSCC" },
125 	{ NMA_C_SOFD_DCA, "DCA", "DCA Series 300" },
126 	{ NMA_C_SOFD_TIA, "TIA", "LANcard/E" },
127 	{ NMA_C_SOFD_FBN, "FBN", "DEFEB DECbridge-500" },
128 	{ NMA_C_SOFD_FEB, "FEB", "DEFEB DECbridge-500 FDDI" },
129 	{ NMA_C_SOFD_FCN, "FCN", "DEFCN DECconcentrator-500" },
130 	{ NMA_C_SOFD_MFA, "MFA", "DEMFA" },
131 	{ NMA_C_SOFD_MXE, "MXE", "MIPS workstation family" },
132 	{ NMA_C_SOFD_CED, "CED", "Cabletron Ethernet Desktop" },
133 	{ NMA_C_SOFD_C20, "C20", "3Com CS/200" },
134 	{ NMA_C_SOFD_CS1, "CS1", "3Com CS/1" },
135 	{ NMA_C_SOFD_C2M, "C2M", "3Com CS/210, CS/2000, CS/2100" },
136 	{ NMA_C_SOFD_ACA, "ACA", "ACA/32000 system" },
137 	{ NMA_C_SOFD_GSM, "GSM", "Gandalf StarMaster" },
138 	{ NMA_C_SOFD_DSF, "DSF", "DSF32" },
139 	{ NMA_C_SOFD_CS5, "CS5", "3Com CS/50" },
140 	{ NMA_C_SOFD_XIR, "XIR", "XIRCOM PE10B2" },
141 	{ NMA_C_SOFD_KFE, "KFE", "KFE52" },
142 	{ NMA_C_SOFD_RT3, "RT3", "rtVAX-300" },
143 	{ NMA_C_SOFD_SPI, "SPI", "Spiderport M250" },
144 	{ NMA_C_SOFD_FOR, "FOR", "LAT gateway" },
145 	{ NMA_C_SOFD_MER, "MER", "Meridian" },
146 	{ NMA_C_SOFD_PER, "PER", "Persoft" },
147 	{ NMA_C_SOFD_STR, "STR", "AT&T StarLan-10" },
148 	{ NMA_C_SOFD_MPS, "MPS", "MIPSfair" },
149 	{ NMA_C_SOFD_L20, "L20", "LPS20 print server" },
150 	{ NMA_C_SOFD_VT2, "VT2", "Vitalink TransLAN 320 Bridge" },
151 	{ NMA_C_SOFD_DWT, "DWT", "VT-1000" },
152 	{ NMA_C_SOFD_WGB, "WGB", "DEWGB" },
153 	{ NMA_C_SOFD_ZEN, "ZEN", "Zenith Z-LAN4000, Z-LAN" },
154 	{ NMA_C_SOFD_TSS, "TSS", "Thursby Software Systems" },
155 	{ NMA_C_SOFD_MNE, "MNE", "3MIN (KN02-BA)" },
156 	{ NMA_C_SOFD_FZA, "FZA", "DEFZA" },
157 	{ NMA_C_SOFD_90L, "90L", "DS90L" },
158 	{ NMA_C_SOFD_CIS, "CIS", "Cisco Systems" },
159 	{ NMA_C_SOFD_STC, "STC", "STRTC" },
160 	{ NMA_C_SOFD_UBE, "UBE", "Ungermann-Bass PC2030, PC3030" },
161 	{ NMA_C_SOFD_DW2, "DW2", "DECwindows terminal II" },
162 	{ NMA_C_SOFD_FUE, "FUE", "Fujitsu Etherstar MB86950" },
163 	{ NMA_C_SOFD_M38, "M38", "MUXServer 380" },
164 	{ NMA_C_SOFD_NTI, "NTI", "NTI Group PC Ethernet Card" },
165 	{ NMA_C_SOFD_RAD, "RAD", "RADLINX LAN Gateway" },
166 	{ NMA_C_SOFD_INF, "INF", "Infotron Commix" },
167 	{ NMA_C_SOFD_XMX, "XMX", "Xyplex MAXserver" },
168 	{ NMA_C_SOFD_NDI, "NDI", "NDIS data link driver for MS/DOS systems" },
169 	{ NMA_C_SOFD_ND2, "ND2", "NDIS data link driver for OS/2 systems" },
170 	{ NMA_C_SOFD_TRN, "TRN", "DEC LANcontroller 520" },
171 	{ NMA_C_SOFD_DEV, "DEV", "Develcon Electronics Ltd. LAT gateway" },
172 	{ NMA_C_SOFD_ACE, "ACE", "Acer 5220, 5270 adapter" },
173 	{ NMA_C_SOFD_PNT, "PNT", "ProNet-4/18 #1390" },
174 	{ NMA_C_SOFD_ISE, "ISE", "Network Integration Server 600" },
175 	{ NMA_C_SOFD_IST, "IST", "Network Integration Server 600 T1" },
176 	{ NMA_C_SOFD_ISH, "ISH", "Network Integration Server 64 kb HDLC" },
177 	{ NMA_C_SOFD_ISF, "ISF", "Network Integration Server 600 FDDI" },
178 	{ NMA_C_SOFD_DSW, "DSW", "DSW-21" },
179 	{ NMA_C_SOFD_DW4, "DW4", "DSW-41/42" },
180 	{ NMA_C_SOFD_TRA, "TRA", "DETRA-AA" },
181 	{ 0, 0, 0 },
182 };
183 
184 char *
185 nmaGetShort(int devno)
186 {
187 	struct commDev *current;
188 
189 	current = nmaCommDev;
190 
191 	while (current->sname != NULL) {
192 		if (current->val == devno)
193 			break;
194 		current++;
195 	}
196 
197 	return (current->sname);
198 }
199 
200 char *
201 nmaGetDevice(int devno)
202 {
203 	struct commDev *current;
204 
205 	current = nmaCommDev;
206 
207 	while (current->name != NULL) {
208 		if (current->val == devno)
209 			break;
210 		current++;
211 	}
212 
213 	return (current->name);
214 }
215