[insert project logo here (125x200px max)] Navigator Mailinglists Please report any errors or ommissions you find to our `Help' mailinglist, or post a message in the Forums. Copyright and Licensing Information Snap is (c) Jonathan T. Moore, 1999-2002 and licensed under the GNU General Public License (GPL). All other parts of Splash are (c) Willem de Bruijn, 2002-2003 and licensed under the BSD Open Source License. All sourcecode is made publicly available. Acknowledgement Splash and the Splash website are hosted by SourceForge.net |
Splash - DocumentationSNMP Plus a Lightweight API for SNAP Handlingsnap-1.1-wjdb/lib/hw.cGo to the documentation of this file.00001 /* 00002 * lib/hw.c This file contains the top-level part of the hardware 00003 * support functions module for the NET-2 base distribution. 00004 * 00005 * Version: lib/hw.c 1.21 (1998-07-01) 00006 * 00007 * Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de> 00008 * 00009 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 00010 * Copyright 1993 MicroWalt Corporation 00011 * 00012 *980701 {1.21} Arnaldo C. Melo GNU gettext instead of catgets 00013 * 00014 * This program is free software; you can redistribute it 00015 * and/or modify it under the terms of the GNU General 00016 * Public License as published by the Free Software 00017 * Foundation; either version 2 of the License, or (at 00018 * your option) any later version. 00019 */ 00020 #include <sys/types.h> 00021 #include <sys/socket.h> 00022 #include <stdlib.h> 00023 #include <stdio.h> 00024 #include <errno.h> 00025 #include <ctype.h> 00026 #include <string.h> 00027 #include <unistd.h> 00028 #include "config.h" 00029 #include "net-support.h" 00030 #include "pathnames.h" 00031 #include "intl.h" 00032 00033 extern struct hwtype unspec_hwtype; 00034 extern struct hwtype loop_hwtype; 00035 00036 extern struct hwtype slip_hwtype; 00037 extern struct hwtype cslip_hwtype; 00038 extern struct hwtype slip6_hwtype; 00039 extern struct hwtype cslip6_hwtype; 00040 extern struct hwtype adaptive_hwtype; 00041 00042 extern struct hwtype ether_hwtype; 00043 extern struct hwtype fddi_hwtype; 00044 extern struct hwtype hippi_hwtype; 00045 extern struct hwtype tr_hwtype; 00046 00047 extern struct hwtype ax25_hwtype; 00048 extern struct hwtype rose_hwtype; 00049 extern struct hwtype netrom_hwtype; 00050 extern struct hwtype tunnel_hwtype; 00051 00052 extern struct hwtype ash_hwtype; 00053 00054 extern struct hwtype ppp_hwtype; 00055 00056 extern struct hwtype arcnet_hwtype; 00057 00058 extern struct hwtype dlci_hwtype; 00059 extern struct hwtype frad_hwtype; 00060 00061 extern struct hwtype hdlc_hwtype; 00062 extern struct hwtype lapb_hwtype; 00063 00064 extern struct hwtype sit_hwtype; 00065 00066 static struct hwtype *hwtypes[] = { 00067 00068 &loop_hwtype, 00069 00070 #if HAVE_HWSLIP 00071 &slip_hwtype, 00072 &cslip_hwtype, 00073 &slip6_hwtype, 00074 &cslip6_hwtype, 00075 &adaptive_hwtype, 00076 #endif 00077 #if HAVE_HWASH 00078 &ash_hwtype, 00079 #endif 00080 #if HAVE_HWETHER 00081 ðer_hwtype, 00082 #endif 00083 #if HAVE_HWTR 00084 &tr_hwtype, 00085 #endif 00086 #if HAVE_HWAX25 00087 &ax25_hwtype, 00088 #endif 00089 #if HAVE_HWNETROM 00090 &netrom_hwtype, 00091 #endif 00092 #if HAVE_HWTUNNEL 00093 &tunnel_hwtype, 00094 #endif 00095 #if HAVE_HWPPP 00096 &ppp_hwtype, 00097 #endif 00098 #if HAVE_HWHDLCLAPB 00099 &hdlc_hwtype, 00100 &lapb_hwtype, 00101 #endif 00102 #if HAVE_HWARC 00103 &arcnet_hwtype, 00104 #endif 00105 #if HAVE_HWFR 00106 &dlci_hwtype, 00107 &frad_hwtype, 00108 #endif 00109 #if HAVE_HWSIT 00110 &sit_hwtype, 00111 #endif 00112 #if HAVE_HWROSE 00113 &rose_hwtype, 00114 #endif 00115 #if HAVE_HWFDDI 00116 &fddi_hwtype, 00117 #endif 00118 #if HAVE_HWHIPPI 00119 &hippi_hwtype, 00120 #endif 00121 &unspec_hwtype, 00122 NULL 00123 }; 00124 00125 static short sVhwinit = 0; 00126 00127 void hwinit () 00128 { 00129 loop_hwtype.title = _("Local Loopback"); 00130 unspec_hwtype.title = _("UNSPEC"); 00131 #if HAVE_HWSLIP 00132 slip_hwtype.title = _("Serial Line IP"); 00133 cslip_hwtype.title = _("VJ Serial Line IP"); 00134 slip6_hwtype.title = _("6-bit Serial Line IP"); 00135 cslip6_hwtype.title = _("VJ 6-bit Serial Line IP"); 00136 adaptive_hwtype.title = _("Adaptive Serial Line IP"); 00137 #endif 00138 #if HAVE_HWETHER 00139 ether_hwtype.title = _("Ethernet"); 00140 #endif 00141 #if HAVE_HWASH 00142 ash_hwtype.title = _("Ash"); 00143 #endif 00144 #if HAVE_HWFDDI 00145 fddi_hwtype.title = _("Fiber Distributed Data Interface"); 00146 #endif 00147 #if HAVE_HWHIPPI 00148 hippi_hwtype.title = _("HIPPI"); 00149 #endif 00150 #if HAVE_HWAX25 00151 ax25_hwtype.title = _("AMPR AX.25"); 00152 #endif 00153 #if HAVE_HWROSE 00154 rose_hwtype.title = _("AMPR ROSE"); 00155 #endif 00156 #if HAVE_HWNETROM 00157 netrom_hwtype.title = _("AMPR NET/ROM"); 00158 #endif 00159 #if HAVE_HWTUNNEL 00160 tunnel_hwtype.title = _("IPIP Tunnel"); 00161 #endif 00162 #if HAVE_HWPPP 00163 ppp_hwtype.title = _("Point-to-Point Protocol"); 00164 #endif 00165 #if HAVE_HWHDLCLAPB 00166 hdlc_hwtype.title = _("(Cisco)-HDLC"); 00167 lapb_hwtype.title = _("LAPB"); 00168 #endif 00169 #if HAVE_HWARC 00170 arcnet_hwtype.title = _("1.5Mbps ARCnet"); 00171 #endif 00172 #if HAVE_HWFR 00173 dlci_hwtype.title = _("Frame Relay DLCI"); 00174 frad_hwtype.title = _("Frame Relay Access Device"); 00175 #endif 00176 #if HAVE_HWSIT 00177 sit_hwtype.title = _("IPv6-in-IPv4"); 00178 #endif 00179 sVhwinit = 1; 00180 } 00181 00182 /* Check our hardware type table for this type. */ 00183 struct hwtype * 00184 get_hwtype(const char *name) 00185 { 00186 struct hwtype **hwp; 00187 00188 if (!sVhwinit) 00189 hwinit(); 00190 00191 hwp = hwtypes; 00192 while (*hwp != NULL) { 00193 if (!strcmp((*hwp)->name, name)) return(*hwp); 00194 hwp++; 00195 } 00196 return(NULL); 00197 } 00198 00199 00200 /* Check our hardware type table for this type. */ 00201 struct hwtype * 00202 get_hwntype(int type) 00203 { 00204 struct hwtype **hwp; 00205 00206 if (!sVhwinit) 00207 hwinit(); 00208 00209 hwp = hwtypes; 00210 while (*hwp != NULL) { 00211 if ((*hwp)->type == type) return(*hwp); 00212 hwp++; 00213 } 00214 return(NULL); 00215 } |