Magellan Linux

Contents of /trunk/mkinitrd-magellan/busybox/networking/libiproute/ll_types.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 9 months ago) by niro
File MIME type: text/plain
File size: 2268 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 /* vi: set sw=4 ts=4: */
2 /*
3 * ll_types.c
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 *
10 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
11 */
12 #include <stdio.h>
13 #include <arpa/inet.h>
14
15 #include <linux/if_arp.h>
16
17 #include "rt_names.h"
18
19 const char * ll_type_n2a(int type, char *buf, int len)
20 {
21 #define __PF(f,n) { ARPHRD_##f, #n },
22 static struct {
23 int type;
24 char *name;
25 } arphrd_names[] = {
26 { 0, "generic" },
27 __PF(ETHER,ether)
28 __PF(EETHER,eether)
29 __PF(AX25,ax25)
30 __PF(PRONET,pronet)
31 __PF(CHAOS,chaos)
32 #ifdef ARPHRD_IEEE802_TR
33 __PF(IEEE802,ieee802)
34 #else
35 __PF(IEEE802,tr)
36 #endif
37 __PF(ARCNET,arcnet)
38 __PF(APPLETLK,atalk)
39 __PF(DLCI,dlci)
40 #ifdef ARPHRD_ATM
41 __PF(ATM,atm)
42 #endif
43 __PF(METRICOM,metricom)
44 #ifdef ARPHRD_IEEE1394
45 __PF(IEEE1394,ieee1394)
46 #endif
47
48 __PF(SLIP,slip)
49 __PF(CSLIP,cslip)
50 __PF(SLIP6,slip6)
51 __PF(CSLIP6,cslip6)
52 __PF(RSRVD,rsrvd)
53 __PF(ADAPT,adapt)
54 __PF(ROSE,rose)
55 __PF(X25,x25)
56 #ifdef ARPHRD_HWX25
57 __PF(HWX25,hwx25)
58 #endif
59 __PF(PPP,ppp)
60 __PF(HDLC,hdlc)
61 __PF(LAPB,lapb)
62 #ifdef ARPHRD_DDCMP
63 __PF(DDCMP,ddcmp)
64 __PF(RAWHDLC,rawhdlc)
65 #endif
66
67 __PF(TUNNEL,ipip)
68 __PF(TUNNEL6,tunnel6)
69 __PF(FRAD,frad)
70 __PF(SKIP,skip)
71 __PF(LOOPBACK,loopback)
72 __PF(LOCALTLK,ltalk)
73 __PF(FDDI,fddi)
74 __PF(BIF,bif)
75 __PF(SIT,sit)
76 __PF(IPDDP,ip/ddp)
77 __PF(IPGRE,gre)
78 __PF(PIMREG,pimreg)
79 __PF(HIPPI,hippi)
80 __PF(ASH,ash)
81 __PF(ECONET,econet)
82 __PF(IRDA,irda)
83 __PF(FCPP,fcpp)
84 __PF(FCAL,fcal)
85 __PF(FCPL,fcpl)
86 __PF(FCFABRIC,fcfb0)
87 __PF(FCFABRIC+1,fcfb1)
88 __PF(FCFABRIC+2,fcfb2)
89 __PF(FCFABRIC+3,fcfb3)
90 __PF(FCFABRIC+4,fcfb4)
91 __PF(FCFABRIC+5,fcfb5)
92 __PF(FCFABRIC+6,fcfb6)
93 __PF(FCFABRIC+7,fcfb7)
94 __PF(FCFABRIC+8,fcfb8)
95 __PF(FCFABRIC+9,fcfb9)
96 __PF(FCFABRIC+10,fcfb10)
97 __PF(FCFABRIC+11,fcfb11)
98 __PF(FCFABRIC+12,fcfb12)
99 #ifdef ARPHRD_IEEE802_TR
100 __PF(IEEE802_TR,tr)
101 #endif
102 #ifdef ARPHRD_IEEE80211
103 __PF(IEEE80211,ieee802.11)
104 #endif
105 #ifdef ARPHRD_VOID
106 __PF(VOID,void)
107 #endif
108 };
109 #undef __PF
110
111 int i;
112 for (i=0; i<sizeof(arphrd_names)/sizeof(arphrd_names[0]); i++) {
113 if (arphrd_names[i].type == type)
114 return arphrd_names[i].name;
115 }
116 snprintf(buf, len, "[%d]", type);
117 return buf;
118 }