Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (113 sloc) 2.48 KB
* ll_types.c
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* Authors: Alexey Kuznetsov, <>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/sockios.h>
#include "rt_names.h"
const char * ll_type_n2a(int type, char *buf, int len)
#define __PF(f,n) { ARPHRD_##f, #n },
static const struct {
int type;
const char *name;
} arphrd_names[] = {
{ 0, "generic" },
__PF(IEEE802154, ieee802.15.4)
__PF(PHONET, phonet)
__PF(PHONET_PIPE, phonet_pipe)
__PF(CAIF, caif)
__PF(NONE, none)
#undef __PF
int i;
for (i=0; i<sizeof(arphrd_names)/sizeof(arphrd_names[0]); i++) {
if (arphrd_names[i].type == type)
return arphrd_names[i].name;
snprintf(buf, len, "[%d]", type);
return buf;
Jump to Line
Something went wrong with that request. Please try again.