]>
Commit | Line | Data |
---|---|---|
aba5acdf SH |
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 | ||
12 | #include <stdio.h> | |
13 | #include <stdlib.h> | |
14 | #include <unistd.h> | |
15 | #include <syslog.h> | |
16 | #include <fcntl.h> | |
17 | #include <sys/ioctl.h> | |
18 | #include <sys/socket.h> | |
19 | #include <sys/ioctl.h> | |
aba5acdf SH |
20 | #include <netinet/in.h> |
21 | #include <arpa/inet.h> | |
22 | #include <string.h> | |
23 | ||
a7452b20 SH |
24 | #include <linux/netdevice.h> |
25 | #include <linux/if_arp.h> | |
26 | #include <linux/sockios.h> | |
27 | ||
28 | #include "rt_names.h" | |
29 | ||
30 | const char * ll_type_n2a(int type, char *buf, int len) | |
aba5acdf SH |
31 | { |
32 | #define __PF(f,n) { ARPHRD_##f, #n }, | |
4dbda0f4 | 33 | static const struct { |
aba5acdf | 34 | int type; |
a7452b20 | 35 | const char *name; |
aba5acdf SH |
36 | } arphrd_names[] = { |
37 | { 0, "generic" }, | |
38 | __PF(ETHER,ether) | |
39 | __PF(EETHER,eether) | |
40 | __PF(AX25,ax25) | |
41 | __PF(PRONET,pronet) | |
42 | __PF(CHAOS,chaos) | |
aba5acdf | 43 | __PF(IEEE802,ieee802) |
aba5acdf SH |
44 | __PF(ARCNET,arcnet) |
45 | __PF(APPLETLK,atalk) | |
46 | __PF(DLCI,dlci) | |
aba5acdf | 47 | __PF(ATM,atm) |
aba5acdf | 48 | __PF(METRICOM,metricom) |
aba5acdf | 49 | __PF(IEEE1394,ieee1394) |
1362865a | 50 | __PF(INFINIBAND,infiniband) |
aba5acdf SH |
51 | __PF(SLIP,slip) |
52 | __PF(CSLIP,cslip) | |
53 | __PF(SLIP6,slip6) | |
54 | __PF(CSLIP6,cslip6) | |
55 | __PF(RSRVD,rsrvd) | |
56 | __PF(ADAPT,adapt) | |
57 | __PF(ROSE,rose) | |
58 | __PF(X25,x25) | |
aba5acdf | 59 | __PF(HWX25,hwx25) |
98f9a1d2 | 60 | __PF(CAN,can) |
aba5acdf SH |
61 | __PF(PPP,ppp) |
62 | __PF(HDLC,hdlc) | |
63 | __PF(LAPB,lapb) | |
aba5acdf | 64 | __PF(DDCMP,ddcmp) |
aba5acdf | 65 | __PF(RAWHDLC,rawhdlc) |
aba5acdf SH |
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) | |
aba5acdf | 98 | __PF(IEEE802_TR,tr) |
aba5acdf | 99 | __PF(IEEE80211,ieee802.11) |
fc537c25 | 100 | __PF(IEEE80211_PRISM,ieee802.11/prism) |
fc537c25 | 101 | __PF(IEEE80211_RADIOTAP,ieee802.11/radiotap) |
4dbda0f4 SH |
102 | __PF(IEEE802154, ieee802.15.4) |
103 | __PF(PHONET, phonet) | |
104 | __PF(PHONET_PIPE, phonet_pipe) | |
105 | __PF(CAIF, caif) | |
4e20cc55 | 106 | __PF(IP6GRE, gre6) |
19106180 | 107 | __PF(NETLINK, netlink) |
4dbda0f4 | 108 | |
800b4440 | 109 | __PF(NONE, none) |
aba5acdf | 110 | __PF(VOID,void) |
aba5acdf SH |
111 | }; |
112 | #undef __PF | |
113 | ||
114 | int i; | |
115 | for (i=0; i<sizeof(arphrd_names)/sizeof(arphrd_names[0]); i++) { | |
116 | if (arphrd_names[i].type == type) | |
117 | return arphrd_names[i].name; | |
118 | } | |
119 | snprintf(buf, len, "[%d]", type); | |
120 | return buf; | |
121 | } |