📄 ip_var.h
字号:
/***************************************************************************
*
* Copyright (c) 1993 READY SYSTEMS CORPORATION.
*
* All rights reserved. READY SYSTEMS' source code is an unpublished
* work and the use of a copyright notice does not imply otherwise.
* This source code contains confidential, trade secret material of
* READY SYSTEMS. Any attempt or participation in deciphering, decoding,
* reverse engineering or in any way altering the source code is
* strictly prohibited, unless the prior written consent of
* READY SYSTEMS is obtained.
*
*
* Module Name: ip_var.h
*
* Identification: @(#) 1.3 ip_var.h
*
* Date: 1/6/94 16:36:51
*
****************************************************************************
*/
/*
RCS header identifier - ip_var.h,v 1.2 1995/01/05 16:32:27 sriram Exp
*/
/*
* Copyrighted as an unpublished work.
* (c) Copyright 1987-1993 Lachman Technology, Incorporated
* All rights reserved.
*
* RESTRICTED RIGHTS
*
* These programs are supplied under a license. They may be used,
* disclosed, and/or copied only as permitted under such license
* agreement. Any copy must contain the above copyright notice and
* this restricted rights notice. Use, copying, and/or disclosure
* of the programs is strictly prohibited unless otherwise provided
* in the license agreement.
*/
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* **********************************************************************
*
* CHANGE HISTORY:
*
* ----------------------------------------------------------------------
* DATE CHANGES
* ----------------------------------------------------------------------
*
* 12/14/94 Included the Version 5 TCP compatible code for SNMP_V2.
* Check for #ifdef VER5_COMPAT.
*
* ********************************************************************* */
#ifdef SNX
#ifndef VER5_COMPAT
#define VER5_COMPAT /* This needs to be compiled, SNX */
#endif
#endif
#ifndef ip_var_h
#define ip_var_h
#ifndef route_h
#include "net/route.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* ip_var.h 6.1 83/07/29 */
/*
* Overlay for ip header used by other protocols (tcp, udp).
*/
struct ipovly {
caddr_t ih_next;/* for protocol sequence q's */
mblk_t *ih_mblk;
u_char ih_x1; /* (unused) */
u_char ih_pr; /* protocol */
short ih_len; /* protocol length */
struct in_addr ih_src; /* source internet address */
struct in_addr ih_dst; /* destination internet address */
};
/*
* Ip reassembly queue structure. Each fragment being reassembled is
* attached to one of these structures. They are timed out after ipq_ttl
* drops to 0, and may also be reclaimed if memory becomes tight.
*/
struct ipq {
struct ipq *next, *prev; /* to other reass headers */
u_char ipq_ttl; /* time for reass q to live */
u_char ipq_p; /* protocol of this fragment */
u_short ipq_id; /* sequence id for reassembly */
struct ipasfrag *ipq_next;
/* to ip headers of fragments */
struct in_addr ipq_src, ipq_dst;
};
/*
* Ip header, when holding a fragment.
*
* Note: ipf_next must be at same offset as ipq_next above.
*/
struct ipasfrag {
#if defined(vax) || defined(i386) || defined(I960)
u_char ip_hl:4, ip_v:4;
#else
u_char ip_v:4, ip_hl:4;
#endif
u_char ipf_mff; /* copied from (ip_off&IP_MF) */
short ip_len;
u_short ip_id;
short ip_off;
u_char ip_ttl;
u_char ip_p;
u_short ip_sum;
struct ipasfrag *ipf_next; /* next fragment */
mblk_t *ipf_mblk; /* The mblk header for this data */
};
/* get a pointer to an IP header from a pointer to a fragment */
#define IPHDR(ip) ((struct ip *) (ip))
#define IPASFRAG(ip) ((struct ipasfrag *) (ip))
/*
* Structure stored in mbuf in inpcb.ip_options and passed to ip_output when
* ip options are in use. The actual length of the options (including
* ipopt_dst) is in m_len.
*/
#define MAX_IPOPTLEN 40
struct ipoption {
struct in_addr ipopt_dst; /* first-hop dst if source routed */
char ipopt_list[MAX_IPOPTLEN]; /* options proper */
};
struct ipstat {
long ips_total; /* total packets received */
long ips_badsum; /* checksum bad */
long ips_tooshort; /* packet too short */
long ips_toosmall; /* not enough data */
long ips_badhlen; /* ip header length < data size */
long ips_badlen; /* ip length < ip header length */
long ips_fragments; /* fragments received */
long ips_fragdropped; /* frags dropped (dups, out of space) */
long ips_fragtimeout; /* fragments timed out */
long ips_forward; /* packets forwarded */
long ips_cantforward; /* packets rcvd for unreachable dest */
long ips_redirectsent; /* packets forwarded on same net */
long ips_unknownproto; /* unknown protocol */
long ips_inerrors; /* input errors */
long ips_indelivers; /* packets delivered */
long ips_outrequests; /* ip packets sent */
long ips_outerrors; /* output errors */
long ips_noroutes; /* no route found */
long ips_reasms; /* packets reassembled */
long ips_pfrags; /* packets fragmented */
long ips_fragfails; /* packets which could not be fragmented */
long ips_frags; /* fragments created */
#ifdef VER5_COMPAT
u_long ips_badver; /* ip version # != Current Ver # */
u_long ips_badbcast; /* LL bcast but IP unicast addr */
u_long ips_badsrcaddr; /* bad originating address */
#endif
};
#ifdef KERNEL
/* flags passed to ip_output as last parameter */
#define IP_FORWARDING 0x1 /* most of ip header exists */
#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */
#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
extern struct ipstat ip_stat;
extern u_short ip_id; /* ip packet ctr, for ids */
mblk_t *ip_srcroute();
#endif
#ifdef VER5_COMPAT
/* mgmt. ioctls and related structures */
/*
All these should have been in socket.h. But as i was changing these
files, i thought it might be good to add them here.
*/
#ifndef __MGMT
#define __MGMT 'M'
#endif
#ifndef SIOCSMGMT
#define SIOCSMGMT ((__MGMT << 8) | 10)
#endif
#define SIOCGIFALL ((__MGMT << 8) | 2)
#define SIOCGICMPSTATS ((__MGMT << 8) | 3)
#define SIOCGIPSTUFF ((__MGMT << 8) | 4)
#define SIOCSIPMISC ((__MGMT << 8) | 5)
#define SIOCSIPTRAP ((__MGMT << 8) | 13)
#define SIOCGINMEMSTATS ((__MGMT << 8) | 14)
#define SIOCGINLOCKSTATS ((__MGMT << 8) | 15)
#define SIOCGIFNUM ((__MGMT << 8) | 20)
#define MACIOC_GETADDR ((__MGMT << 8) | 31)
#define MACIOC_GETSTAT ((__MGMT << 8) | 32)
struct ip_stuff {
struct ipstat ip_stat; /* IP statistics */
struct rtstat rt_stat; /* routing statistics */
int ip_forwarding; /* are we forwarding? */
int ip_default_ttl; /* ip TTL */
int ipq_ttl; /* fragment TTL */
int ipq_reasm_reqds; /* datagrams waiting for reassembly */
int icmp_answermask; /* authoritative for mask replies */
int ip_sendredirects; /* sending redirects */
};
struct ip_misc {
int arg; /* set either to 1 or 2 */
int ip_forwarding;
int ip_default_ttl;
};
struct link_msg
{
int idx;
int up;
} ;
#endif /* __netinet_ip_var_h */
#ifdef __cplusplus
}
#endif
#endif /* ip_var_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -