File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / freevrrpd / vrrp_network.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 14 12:01:54 2017 UTC (7 years ago) by misho
Branches: freevrrpd, MAIN
CVS tags: v1_1, HEAD
freevrrpd 1.1

    1: /*
    2:  * Copyright (c) 2001,2002 Sebastien Petit <spe@bsdfr.org>
    3:  *
    4:  * Redistribution and use in source forms, with and without modification,
    5:  * are permitted provided that the following conditions are met:
    6:  * 1. Redistributions of source code must retain the above copyright notice,
    7:  *    this list of conditions and the following disclaimer.
    8:  * 2. Redistributions in binary form must reproduce the above copyright notice,
    9:  *    this list of conditions and the following disclaimer in the documentation
   10:  *    and/or other materials provided with the distribution. Obviously, it
   11:  *    would be nice if you gave credit where credit is due but requiring it
   12:  *    would be too onerous.
   13:  * 3. All advertising materials mentioning features or use of this software
   14:  *    must display the following acknowledgement:
   15:  *      This product includes software developed by Sebastien Petit.
   16:  * 4. Neither the name of its contributors may be used to endorse or promote
   17:  *    products derived from this software without specific prior written
   18:  *    permission.
   19:  *
   20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30:  * SUCH DAMAGE.
   31:  *
   32:  * $Id: vrrp_network.h,v 1.1.1.1 2017/06/14 12:01:54 misho Exp $
   33:  */
   34: 
   35: #include <sys/ioctl.h>
   36: #include <sys/time.h>
   37: #include <sys/types.h>
   38: #include <sys/socket.h>
   39: #include <sys/uio.h>
   40: #include <net/bpf.h>
   41: #include <net/if.h>
   42: #ifdef __FreeBSD__
   43: #include <net/ethernet.h>
   44: #endif
   45: #ifdef __NetBSD__
   46: #include <net/if_ether.h>
   47: #endif
   48: #include <net/route.h>
   49: #include <netinet/in_systm.h>
   50: #include <netinet/in.h>
   51: #include <netinet/ip.h>
   52: #include <arpa/inet.h>
   53: #include <errno.h>
   54: #include <fcntl.h>
   55: #include <stdio.h>
   56: #include <stdlib.h>
   57: #include <string.h>
   58: #include <syslog.h>
   59: #include <unistd.h>
   60: #include <stdarg.h>
   61: #include "vrrp_define.h"
   62: #include "vrrp_proto.h"
   63: #include "vrrp_functions.h"
   64: 
   65: #if defined (__NetBSD__) || defined (__OpenBSD__)
   66: #define octet ether_addr_octet
   67: #endif
   68: 
   69: struct arp_header {
   70: 	u_short         ar_hrd;	/* format of hardware address */
   71: #define ARPHRD_ETHER    1	/* ethernet hardware format */
   72: #define ARPHRD_IEEE802  6	/* token-ring hardware format */
   73: #define ARPHRD_FRELAY   15	/* frame relay hardware format */
   74: 	u_short         ar_pro;	/* format of protocol address */
   75: 	u_char          ar_hln;	/* length of hardware address */
   76: 	u_char          ar_pln;	/* length of protocol address */
   77: 	u_short         ar_op;	/* one of: */
   78: #define ARPOP_REQUEST   1	/* request to resolve address */
   79: #define ARPOP_REPLY     2	/* response to previous request */
   80: #define ARPOP_REVREQUEST 3	/* request protocol address given hardware */
   81: #define ARPOP_REVREPLY  4	/* response giving protocol address */
   82: #define ARPOP_INVREQUEST 8	/* request to identify peer */
   83: #define ARPOP_INVREPLY  9	/* response identifying peer */
   84: 	u_char          ar_sha[6];	/* sender hardware address */
   85: 	u_char          ar_spa[4];	/* sender protocol address */
   86: 	u_char          ar_tha[6];	/* target hardware address */
   87: 	u_char          ar_tpa[4];	/* target protocol address */
   88: };
   89: 
   90: struct routemsg {
   91: 	struct rt_msghdr rthdr;
   92: 	struct sockaddr_in addr;
   93: };

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>