xorp

ether_compat.h

00001 /* -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- */
00002 /* vim:set sts=4 ts=8: */
00003 
00004 /*
00005  * Copyright (c) 2001-2009 XORP, Inc.
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License, Version
00009  * 2.1, June 1999 as published by the Free Software Foundation.
00010  * Redistribution and/or modification of this program under the terms of
00011  * any other version of the GNU Lesser General Public License is not
00012  * permitted.
00013  * 
00014  * This program is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00017  * see the GNU Lesser General Public License, Version 2.1, a copy of
00018  * which can be found in the XORP LICENSE.lgpl file.
00019  * 
00020  * XORP, Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00021  * http://xorp.net
00022  */
00023 
00024 /*
00025  * $XORP: xorp/libxorp/ether_compat.h,v 1.20 2008/10/28 14:08:18 bms Exp $
00026  */
00027 
00028 /* Ethernet manipulation compatibility functions */
00029 
00030 #ifndef __LIBXORP_ETHER_COMPAT_H__
00031 #define __LIBXORP_ETHER_COMPAT_H__
00032 
00033 #include "libxorp/xorp.h"
00034 
00035 #ifdef HAVE_SYS_TYPES_H
00036 #include <sys/types.h>
00037 #endif
00038 #ifdef HAVE_SYS_SOCKET_H
00039 #include <sys/socket.h>
00040 #endif
00041 #ifdef HAVE_SYS_ETHERNET_H
00042 #include <sys/ethernet.h>
00043 #endif
00044 #ifdef HAVE_NET_ETHERNET_H
00045 #include <net/ethernet.h>
00046 #endif
00047 #ifdef HAVE_NET_IF_H
00048 #include <net/if.h>
00049 #endif
00050 #ifdef HAVE_NET_IF_ETHER_H
00051 #include <net/if_ether.h>
00052 #endif
00053 #ifdef HAVE_NETINET_IN_H
00054 #include <netinet/in.h>
00055 #endif
00056 #ifdef HAVE_NETINET_IF_ETHER_H
00057 #include <netinet/if_ether.h>
00058 #endif
00059 #ifdef HAVE_NETINET_ETHER_H
00060 #include <netinet/ether.h>
00061 #endif
00062 
00063 
00064 #ifdef __cplusplus
00065 extern "C" {
00066 #endif /* __cplusplus */
00067 
00068 #ifndef HAVE_STRUCT_ETHER_ADDR
00069 #ifndef ETHER_ADDR_LEN
00070 #define ETHER_ADDR_LEN 6
00071 #endif
00072 struct ether_addr {
00073     char    octet[ETHER_ADDR_LEN];
00074 };
00075 #endif /* HAVE_STRUCT_ETHER_ADDR */
00076 
00077 #ifndef HAVE_ETHER_ATON
00078 struct ether_addr* ether_aton(const char *a);
00079 #endif
00080 
00081 #ifndef HAVE_ETHER_NTOA
00082 char* ether_ntoa(const struct ether_addr* ea);
00083 #endif
00084 
00085 #ifndef ETHERTYPE_IP
00086 #define ETHERTYPE_IP    0x0800
00087 #endif
00088 
00089 #ifndef ETHERTYPE_ARP
00090 #define ETHERTYPE_ARP   0x0806
00091 #endif
00092 
00093 #ifdef __cplusplus
00094 }
00095 #endif /* __cplusplus */
00096 
00097 #endif /* __LIBXORP_ETHER_COMPAT_H__ */
 All Classes Namespaces Functions Variables Typedefs Enumerations