1 /* vi: set sw=4 ts=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.
10 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
18 #if defined(__GLIBC__) && __GLIBC__ >=2 && __GLIBC_MINOR__ >= 1
19 #include <net/ethernet.h>
21 #include <linux/if_ether.h>
24 #define __PF(f,n) { ETH_P_##f, #n },
41 #ifdef ETH_P_IEEEPUPAT
42 __PF(IEEEPUPAT,ieeepupat)
58 __PF(PPP_DISC,ppp_disc)
78 __PF(LOCALTALK,localtalk)
80 __PF(TR_802_2,tr_802_2)
94 const char * ll_proto_n2a(unsigned short id, char *buf, int len)
100 for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) {
101 if (llproto_names[i].id == id)
102 return llproto_names[i].name;
104 snprintf(buf, len, "[%d]", id);
108 int ll_proto_a2n(unsigned short *id, char *buf)
111 for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) {
112 if (strcasecmp(llproto_names[i].name, buf) == 0) {
113 *id = htons(llproto_names[i].id);
117 if (get_u16(id, buf, 0))