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

📄 ip_str.h

📁 VRTX 商用嵌入式实时操作系统
💻 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_str.h
*
*       Identification:         @(#) 1.4 ip_str.h
*
*       Date:                   1/6/94  16:36:08
*
****************************************************************************
*/

/*
 RCS header identifier - ip_str.h,v 1.2 1995/01/05 16:32:24 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.
 */
#ifndef ip_str_h
#define ip_str_h

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Definitions for stream driver control of the Internet Protocol. This
 * module defines the structures related to controlling the streams interface
 * itself, the structures related to various other protocol elements are in
 * other files. 
 */

#define NIP		8	/* Number of minor devices supported */
#define IP_PROVIDERS	16	/* Max Number of link level service providers */
#define IP_SAP		0x800	/* SAP for IP protocol - currently enet type */
#define ARP_SAP		0x806	/* SAP for ARP */

struct ip_pcb {
	queue_t        *ip_rdq;	/* Upper read queue for this client */
	ushort          ip_proto;	/* Client protocol number set with
					 * N_BIND */
	ushort          ip_state;	/* State flags for this client, see
					 * below */
};

#define IPOPEN	1		/* Minor device open when set */
#define IPTRAP  2		/* IPTRAP for interfaces coming & going */


struct ip_provider {		/* The description of each link service */
	char            name[IFNAMSIZ];	/* provider name (e.g., en0) */
	queue_t        *qbot;	/* lower write queue */
	int             l_index;/* unique ID of lower stream */
	short           if_flags;	/* up/down, broadcast, etc. */
	int             if_metric;	/* routing metric (external only) */
	int             if_maxtu;	/* maximum transmission unit */
	int             if_mintu;	/* minimum transmission unit */

	/*
	 * The following stuff is used for interfaces that can't handle
	 * back-to-back packets combined with systems that don't send
	 * packets as big as the MSS.  These values are actually used
	 * by TCP, but are kept here since they are set by IFCONFIG.
	 */
	int		if_spsize;	/* short packet size to watch for */
	int		if_spthresh;	/* short packet threshold */

	struct in_ifaddr ia;	/* address chain structure maintained by if */

#define SOCK_INADDR(sock) (&(((struct sockaddr_in *)(sock))->sin_addr))
#define PROV_INADDR(prov) SOCK_INADDR(&((prov)->ia.ia_ifa.ifa_addr))
#define LONG2INADDR(l) (*(struct in_addr *)(&(l)))

	/* The following defines are vestiges of */
	/* the socket based ip implementation */
#define if_addr		ia.ia_ifa.ifa_addr	/* interface address */
#define	if_broadaddr	ia.ia_broadaddr	/* broadcast address */
#define	if_dstaddr	ia.ia_dstaddr	/* other end of p-to-p link */

	long		if_lastchange; /* time of status change for SNMP */
};

/*
 * A special version of the unitdata request to be sent down through ip -> it
 * contains various ip specific extensions to the base structure 
 */

struct ip_unitdata_req {
	long            PRIM_type;	/* always N_UNITDATA_REQ */
	long            RA_length;	/* dest NSAP addr length - 4 for ip */
	long            RA_offset;	/* dest NSAP addr offset */
	long            SERV_class;	/* service class */
	long            FILLER_field;	/* 802.2 LLC2 field */
	mblk_t         *options;/* options for ip */
	struct route    route;	/* route for packet to follow */
	int             flags;
	u_char		tos;
	u_char		ttl;
	struct in_addr  ip_addr;/* the ip destination addr */
};

struct ip_unitdata_ind {
	long            PRIM_type;	/* always N_UNITDATA_REQ */
	long            RA_length;	/* dest NSAP addr length - 4 for ip */
	long            RA_offset;	/* dest NSAP addr offset */
	long            LA_length;	/* dest NSAP addr length - 4 for ip */
	long            LA_offset;	/* dest NSAP addr offset */
	long            SERV_class;	/* service class */
	mblk_t 		*options;	/* input options for ip */
	struct ip_provider *provider;	/* input provider for ip */
};


/*
 * ip_ctlmsg is the structure used to send control messages to the client
 * upper level protocols.  These messages are actually generated by icmp and
 * are passed down to ip to distribute among the clients. 
 */

struct ip_ctlmsg {
	int             command;
	struct in_addr  dst_addr;
	struct in_addr  src_addr;
	int             proto;
	char		data[8];
};

/*FT*/

#ifdef KERNEL

#define bpsize(bp) ((int) ((bp)->b_datap->db_lim - (bp)->b_datap->db_base))

#endif	/* KERNEL */
/*FT*/

#ifdef __cplusplus
}
#endif

#endif				/* ip_str_h */

⌨️ 快捷键说明

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