]> git.proxmox.com Git - mirror_iproute2.git/blame_incremental - lib/ll_types.c
Tree wide: Drop sockaddr_nl arg
[mirror_iproute2.git] / lib / ll_types.c
... / ...
CommitLineData
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 <fcntl.h>
16#include <sys/ioctl.h>
17#include <sys/socket.h>
18#include <netinet/in.h>
19#include <arpa/inet.h>
20#include <string.h>
21
22#include <linux/netdevice.h>
23#include <linux/if_arp.h>
24#include <linux/sockios.h>
25
26#include "rt_names.h"
27
28const char * ll_type_n2a(int type, char *buf, int len)
29{
30#define __PF(f,n) { ARPHRD_##f, #n },
31static const struct {
32 int type;
33 const char *name;
34} arphrd_names[] = {
35{ 0, "generic" },
36__PF(ETHER,ether)
37__PF(EETHER,eether)
38__PF(AX25,ax25)
39__PF(PRONET,pronet)
40__PF(CHAOS,chaos)
41__PF(IEEE802,ieee802)
42__PF(ARCNET,arcnet)
43__PF(APPLETLK,atalk)
44__PF(DLCI,dlci)
45__PF(ATM,atm)
46__PF(METRICOM,metricom)
47__PF(IEEE1394,ieee1394)
48__PF(INFINIBAND,infiniband)
49__PF(SLIP,slip)
50__PF(CSLIP,cslip)
51__PF(SLIP6,slip6)
52__PF(CSLIP6,cslip6)
53__PF(RSRVD,rsrvd)
54__PF(ADAPT,adapt)
55__PF(ROSE,rose)
56__PF(X25,x25)
57__PF(HWX25,hwx25)
58__PF(CAN,can)
59__PF(PPP,ppp)
60__PF(HDLC,hdlc)
61__PF(LAPB,lapb)
62__PF(DDCMP,ddcmp)
63__PF(RAWHDLC,rawhdlc)
64__PF(TUNNEL,ipip)
65__PF(TUNNEL6,tunnel6)
66__PF(FRAD,frad)
67__PF(SKIP,skip)
68__PF(LOOPBACK,loopback)
69__PF(LOCALTLK,ltalk)
70__PF(FDDI,fddi)
71__PF(BIF,bif)
72__PF(SIT,sit)
73__PF(IPDDP,ip/ddp)
74__PF(IPGRE,gre)
75__PF(PIMREG,pimreg)
76__PF(HIPPI,hippi)
77__PF(ASH,ash)
78__PF(ECONET,econet)
79__PF(IRDA,irda)
80__PF(FCPP,fcpp)
81__PF(FCAL,fcal)
82__PF(FCPL,fcpl)
83__PF(FCFABRIC,fcfb0)
84__PF(FCFABRIC+1,fcfb1)
85__PF(FCFABRIC+2,fcfb2)
86__PF(FCFABRIC+3,fcfb3)
87__PF(FCFABRIC+4,fcfb4)
88__PF(FCFABRIC+5,fcfb5)
89__PF(FCFABRIC+6,fcfb6)
90__PF(FCFABRIC+7,fcfb7)
91__PF(FCFABRIC+8,fcfb8)
92__PF(FCFABRIC+9,fcfb9)
93__PF(FCFABRIC+10,fcfb10)
94__PF(FCFABRIC+11,fcfb11)
95__PF(FCFABRIC+12,fcfb12)
96__PF(IEEE802_TR,tr)
97__PF(IEEE80211,ieee802.11)
98__PF(IEEE80211_PRISM,ieee802.11/prism)
99__PF(IEEE80211_RADIOTAP,ieee802.11/radiotap)
100__PF(IEEE802154, ieee802.15.4)
101__PF(IEEE802154_MONITOR, ieee802.15.4/monitor)
102__PF(PHONET, phonet)
103__PF(PHONET_PIPE, phonet_pipe)
104__PF(CAIF, caif)
105__PF(IP6GRE, gre6)
106__PF(NETLINK, netlink)
107__PF(6LOWPAN, 6lowpan)
108
109__PF(NONE, none)
110__PF(VOID,void)
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}