⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipv6_var.h

📁 嵌入式操作系统ECOS的网络开发包
💻 H
📖 第 1 页 / 共 2 页
字号:
//==========================================================================
//
//      include/netinet6_ipv6_var.h
//
//      
//
//==========================================================================
//####BSDCOPYRIGHTBEGIN####
//
// -------------------------------------------
//
// Portions of this software may have been derived from OpenBSD or other sources,
// and are covered by the appropriate copyright disclaimers included herein.
//
// -------------------------------------------
//
//####BSDCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):    gthomas
// Contributors: gthomas
// Date:         2000-01-10
// Purpose:      
// Description:  
//              
//
//####DESCRIPTIONEND####
//
//==========================================================================


/*
%%% copyright-nrl-95
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
rights under this copyright have been assigned to the US Naval Research
Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
1.1 (January 17, 1995) applies to this software.
You should have received a copy of the license with this software. If you
didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.

*/
#ifndef _NETINET6_IPV6_VAR_H
#define _NETINET6_IPV6_VAR_H 1

#include <netinet6/in6.h>

/*
 * IPv6 multicast "options".  Session state for multicast, including
 * weird per-session multicast things.
 */

struct ipv6_moptions
{
  struct ifnet *i6mo_multicast_ifp;     /* ifp for outgoing multicasts */
  u_char i6mo_multicast_ttl;            /* TTL for outgoing multicasts.
					   Does this matter in IPv6? */
  u_char i6mo_multicast_loop;           /* 1 => hear sends if a member */
  u_short i6mo_num_memberships;         /* no. memberships this socket */
  struct in6_multi *i6mo_membership[IN6_MAX_MEMBERSHIPS];
};

/*
 * IPv6 stats.
 */

#if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802
#define _IPV6STAT_TYPE u_quad_t
#else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
#define _IPV6STAT_TYPE u_long
#endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */

struct	ipv6stat {
	_IPV6STAT_TYPE	ips_total;		/* total packets received */
	_IPV6STAT_TYPE	ips_tooshort;		/* packet too short */
	_IPV6STAT_TYPE	ips_toosmall;		/* not enough data */
	_IPV6STAT_TYPE	ips_fragments;		/* fragments received */
	_IPV6STAT_TYPE	ips_fragdropped;	/* frags dropped (dups, out of space) */
	_IPV6STAT_TYPE	ips_fragtimeout;	/* fragments timed out */
	_IPV6STAT_TYPE	ips_forward;		/* packets forwarded */
	_IPV6STAT_TYPE	ips_cantforward;	/* packets rcvd for unreachable dest */
	_IPV6STAT_TYPE	ips_redirectsent;	/* packets forwarded on same net */
	_IPV6STAT_TYPE	ips_noproto;		/* unknown or unsupported protocol */
	_IPV6STAT_TYPE	ips_delivered;		/* datagrams delivered to upper level*/
	_IPV6STAT_TYPE	ips_localout;		/* total ip packets generated here */
	_IPV6STAT_TYPE	ips_odropped;		/* lost packets due to nobufs, etc. */
	_IPV6STAT_TYPE	ips_reassembled;	/* total packets reassembled ok */
	_IPV6STAT_TYPE	ips_fragmented;		/* datagrams sucessfully fragmented */
	_IPV6STAT_TYPE	ips_ofragments;		/* output fragments created */
	_IPV6STAT_TYPE	ips_cantfrag;		/* don't fragment flag was set, etc. */
	_IPV6STAT_TYPE	ips_badoptions;		/* error in option processing */
	_IPV6STAT_TYPE	ips_noroute;		/* packets discarded due to no route */
	_IPV6STAT_TYPE	ips_badvers;            /* IPv6 version != 6 */
	_IPV6STAT_TYPE	ips_rawout;		/* total raw ip packets generated */
};

#if defined(_KERNEL) || defined(KERNEL)
/*
 * The IPv6 fragment queue entry structure.
 * Notes:
 *   Nodes are stored in ttl order.
 *   prefix comes from whichever packet gets here first.
 *   data contains a chain of chains of mbufs (m_next down a chain, m_nextpkt
 *     chaining chains together) where the chains are ordered by assembly
 *     position. When two chains are contiguous for reassembly, they are
 *     combined and the frag header disappears.
 *   The structure is deliberately sized so MALLOC will round up on the order
 *     of much less than the total size instead of doubling the size.
 */

struct ipv6_fragment
{
  struct ipv6_fragment *next;		/* Next fragment chain */
  struct mbuf *prefix;			/* Headers before frag header(s) */
  struct mbuf *data;			/* Frag headers + whatever data */
  u_char ttl;				/* Fragment chain TTL. */
  u_char flags;				/* Bit 0 indicates got end of chain */
};

/*
 * Structures and definitions for discovery mechanisms in IPv6.
 */

/*
 * Neighbor cache:
 *
 *     Number of unanswered probes is in discq.
 *     "Time of next event" will be in rt->rt_rmx.rmx_expire
 *          (rmx_expire will actually be quite overloaded, actually.)
 *     Status REACHABLE will be dq_unanswered < 0
 *     Status PROBE will be dq_unanswered >= 0
 *     Status INCOMPLETE will be link addr length of 0 if held,
 *     or deleted if not held.
 *
 *     If held, but INCOMPLETE fails set RTF_REJECT and make sure
 *     IPv6 and HLP's know how to deal with RTF_REJECT being set.
 */

struct discq   /* Similar to v4's llinfo_arp, discovery's "neighbor entry". */
{
  struct discq *dq_next,*dq_prev;        /* For {ins,rem}que(). */
  struct rtentry *dq_rt;                 /* Back pointer to routing entry for
					    an address that may be dead. */
  struct mbuf *dq_queue;                 /* Queue of outgoing messages. */
  int dq_unanswered;                     /* Number of unanswered probes. */
};

#if !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802)
/* Routing flag redefinitions */
#define RTF_ISAROUTER RTF_PROTO2         /* Neighbor is a router. */
#define RTF_DEFAULT RTF_PROTO1           /* Default route. */
#endif /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */

/*
 * These should be configurable parameters, see ipv6_discovery.c.
 * All units are in comments besides constants.
 */

#define MAX_INITIAL_RTR_ADVERT_INTERVAL		16  /* seconds */
#define MAX_INITIAL_RTR_ADVERTISEMENTS          3   /* transmissions */
#define MAX_RTR_RESPONSE_DELAY                  2   /* seconds */

#define MAX_RTR_SOLICITATION_DELAY              1   /* second */
#define RTR_SOLICITATION_INTERVAL               3   /* seconds */
#define MAX_RTR_SOLICITATIONS                   3   /* transmissions */

#define MAX_MULTICAST_SOLICIT                   3   /* transmissions */
#define MAX_UNICAST_SOLICIT                     3   /* transmissions */
#define MAX_ANYCAST_DELAY_TIME                  1   /* seconds */
#define MAX_NEIGHBOR_ADVERTISEMENTS             3   /* transmissions */
#define MIN_NEIGHBOR_ADVERT_INTERVAL            16  /* seconds */
#define REACHABLE_TIME                          30  /* seconds */
#define RETRANS_TIMER				3   /* seconds */
#define DELAY_FIRST_PROBE_TIME                  3   /* seconds */
/* Need to somehow define random factors. */

#define NEXTHOP_CLEAN_INTERVAL                  600 /* seconds */
#define REJECT_TIMER                            20 /* seconds */

/* 
 * Child of a router or tunnel.  Is a "meta-entry" for garbage collection.
 */

struct v6child
{
  struct v6child *v6c_next,*v6c_prev;   /* For {ins,rem}que() */
  struct v6router *v6c_parent;         /* Parent router.  I'm null if
					  I'm the router, or a tunnel
					  child. */
  struct rtentry *v6c_route;           /* Next-hop cache entry.  I won't
					  be holding it, but I'm attached
					  to it, like discq is to neighbor
					  cache entries. */
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -