96 lines
3.6 KiB
C
96 lines
3.6 KiB
C
/* in_var.h - in_var header file */
|
|
|
|
/* Copyright 2001-2003 Wind River Systems, Inc. */
|
|
|
|
/*
|
|
* Copyright (c) 1985, 1986, 1993
|
|
* The Regents of the University of California. All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
* must display the following acknowledgement:
|
|
* This product includes software developed by the University of
|
|
* California, Berkeley and its contributors.
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* @(#)in_var.h 8.2 (Berkeley) 1/9/95
|
|
* $FreeBSD: src/sys/netinet/in_var.h,v 1.33.2.3 2001/12/14 20:09:34 jlemon Exp $
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
01e,13may05,xli remove the struct already defined in invar.h
|
|
01d,22mar05,xli remove some macro redefinition which already defined in netinet/in_var.h
|
|
01c,05oct04,tlu temporary fixing for compile errors when using both INCLUDE_IPFW_HOOKS
|
|
and VIRTUAL_STACK flags
|
|
01b,18aug04,jwl changed to work with VIRTUAL_STACK flag
|
|
01a,23mar04,zrh created from in_var.h for the ospf_30
|
|
*/
|
|
|
|
|
|
#ifndef _OSPF_IN_VAR_H_
|
|
#define _OSPF_IN_VAR_H_
|
|
|
|
#include <sys/queue.h>
|
|
|
|
#include <sys/fnv_hash.h>
|
|
#include <net/if.h>
|
|
|
|
extern __inline Fnv32_t fnv_32_buf(const void *buf, size_t len, Fnv32_t hval);
|
|
extern u_long in_ifaddrhmask;
|
|
|
|
/*
|
|
* Interface address, Internet version. One of these structures
|
|
* is allocated for each Internet address on an interface.
|
|
* The ifaddr structure contains the protocol-independent part
|
|
* of the structure and is assumed to be first.
|
|
*/
|
|
|
|
/*
|
|
* Given a pointer to an in_ifaddr (ifaddr),
|
|
* return a pointer to the addr as a sockaddr_in.
|
|
*/
|
|
#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
|
|
#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr))
|
|
|
|
#define IN_LNAOF(in, ifa) \
|
|
((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
|
|
|
|
|
|
#ifndef VIRTUAL_STACK
|
|
extern struct ifqueue ipintrq; /* ip packet input queue */
|
|
#endif /* !VIRTUAL_STACK */
|
|
|
|
/*
|
|
* Hash table for IP addresses.
|
|
*/
|
|
|
|
#define INADDR_HASHVAL(x) fnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT)
|
|
#define INADDR_HASH(x) \
|
|
(&in_ifaddrhashtbl[INADDR_HASHVAL(x) & in_ifaddrhmask])
|
|
|
|
|
|
#endif /* _NETINET_IN_VAR_H_ */
|