source: MondoRescue/branches/stable/mindi-busybox/networking/libiproute/ll_types.c@ 821

Last change on this file since 821 was 821, checked in by Bruno Cornec, 18 years ago

Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)

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