📄 in.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: in.h
*
* Identification: @(#) 1.5 in.h
*
* Date: 1/12/94 09:45:47
*
****************************************************************************
*/
/*
RCS header identifier - $Id: in.h,v 1.1 1995/04/12 22:19:21 nenad Exp nenad $
*/
/*
* 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.
*/
#ifndef in_h
#define in_h
#ifdef __cplusplus
extern "C" {
#endif
/*
* Constants and structures defined by the internet system, Per RFC 790,
* September 1981.
*/
/*
* Protocols
*/
#define IPPROTO_IP 0 /* dummy for IP */
#define IPPROTO_ICMP 1 /* control message protocol */
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
#define IPPROTO_TCP 6 /* tcp */
#define IPPROTO_EGP 8 /* exterior gateway protocol */
#define IPPROTO_PUP 12 /* pup */
#define IPPROTO_UDP 17 /* user datagram protocol */
#define IPPROTO_IDP 22 /* xns idp */
#define IPPROTO_HELLO 63 /* hello routing protocol */
#define IPPROTO_ND 77 /* net disk proto, UNOFFICIAL */
#define IPPROTO_RAW 255 /* raw IP packet */
#define IPPROTO_MAX 256
/*
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root).
* Ports > IPPORT_USERRESERVED are reserved for servers, not necessarily
* privileged.
*/
#define IPPORT_RESERVED 1024
#define IPPORT_USERRESERVED 5000
/*
* Link numbers
*/
#define IMPLINK_IP 155
#define IMPLINK_LOWEXPER 156
#define IMPLINK_HIGHEXPER 158
/*
* Internet address (a structure for historical reasons)
*/
struct in_addr {
u_long s_addr;
};
/*
* Definitions of bits in internet address integers. On subnets, the
* decomposition of addresses to host and net parts is done according to
* subnet mask, not the masks here.
*/
#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
#define IN_CLASSA_NET 0xff000000
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST 0x00ffffff
#define IN_CLASSA_MAX 128
#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
#define IN_CLASSB_NET 0xffff0000
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST 0x0000ffff
#define IN_CLASSB_MAX 65536
#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
#define IN_CLASSC_NET 0xffffff00
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST 0x000000ff
#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
#define IN_MULTICAST(i) (((long)(i) & 0xf0000000) == 0xe0000000)
#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000)
#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000)
#define INADDR_ANY (u_long)0x00000000
#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */
#ifndef KERNEL
#define INADDR_NONE (long)0xffffffff /* -1 return */
#endif /* KERNEL */
#define IN_LOOPBACKNET 127 /* official! */
/*
* Socket address, internet style.
*/
struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
/*
* The transport providers allow any address length between
* IN_MINADDRLEN and IN_MAXADDRLEN. The minimum length corresponds to
* a sockaddr_in without the sin_zero field. The maximum length is
* the size of the sockaddr_in structure.
*
* in_chkaddrlen returns true if the given length is valid.
*/
#define IN_MINADDRLEN (sizeof(struct sockaddr_in) - 8)
#define IN_MAXADDRLEN (sizeof(struct sockaddr_in))
#define in_chkaddrlen(x) ((x) >= IN_MINADDRLEN && (x) <= IN_MAXADDRLEN)
/*
* Options for use with [gs]etsockopt at the IP level.
*/
#define IP_OPTIONS 1 /* set/get IP per-packet options */
#define IP_TOS 2 /* set/get IP per-packet tos */
#if !defined(vax) && !defined(i386) && !defined(ntohl) && !defined(I960)
/*
* Macros for number representation conversion.
*/
#define ntohl(x) (x)
#define ntohs(x) (x)
#define htonl(x) (x)
#define htons(x) (x)
#else
#define ntohl(x) (u_long)(((x)<<24 & 0xff000000) | ((x)<<8 & 0x00ff0000) | \
((x)>>24 & 0x000000ff) | ((x)>>8 & 0x0000ff00))
#define ntohs(x) (u_short)(((x)<<8 & 0x0000ff00) | ((x)>>8 & 0x000000ff))
#define htonl(x) ntohl(x)
#define htons(x) ntohs(x)
#endif
#if 0
#if !defined(ntohl) && (defined(i386) || defined(vax))
u_short ntohs(u_short x), htons(u_short x);
u_long ntohl(u_long x), htonl(u_long x);
#endif
#endif
#ifdef KERNEL
struct iocblk_in {
struct iocblk iocblk;
queue_t *ioc_transport_client;
queue_t *ioc_network_client;
int ioc_ifflags;
};
/*
* Useful defines, should be in stream.h
*/
#define msgbavail(bp) ((bp)->b_datap->db_lim - (bp)->b_wptr)
#define msgblen(bp) ((bp)->b_wptr - (bp)->b_rptr)
#define satosin(sa) ((struct sockaddr_in *) (sa))
#define INET
struct in_addr in_makeaddr();
extern u_long in_netof(), in_lnaof();
#endif
/* Trace data
*
*/
#define HDR_802_3_LEN 14
#define HDR_802_2_LEN 8
#define E_TYPE_OFFSET_802_2 6
#define IP_ID_OFFSET 4
#ifndef EADDRLEN
#define EADDRLEN 6
#endif
/* extern long sc_gtime(_ANSIPROT0); */
extern unsigned char sw_trace_ip_in ;
extern unsigned char sw_trace_ip_out;
extern unsigned char sw_trace_lgif_in;
extern unsigned char sw_trace_lgif_out;
extern unsigned char sw_trace_ip_not_for_us_include;
extern unsigned char sw_trace_lgif_not_bound_include;
extern unsigned long counter_trace_ip_in;
extern unsigned long counter_trace_ip_out;
extern unsigned long counter_trace_lgif_in;
extern unsigned long counter_trace_lgif_out;
extern unsigned short size_trace_ip_in;
extern unsigned short size_trace_ip_out;
extern unsigned short size_trace_lgif_in;
extern unsigned short size_trace_lgif_out;
struct struct_trace_ip_in
{
unsigned short time;
u_short ip_id;
unsigned short error_code;
unsigned short resvd;
u_long peer_ip_addr;
#define IP_TRACE_ERR_NO_ERROR 0x0000
#define IP_TRACE_ERR_PROVIDER_DOWN 0x0001
#define IP_TRACE_ERR_MSG_TOO_SHORT 0x0002
#define IP_TRACE_ERR_INVAL_IP_VER 0x0003
#define IP_TRACE_ERR_HDR_LEN_TOO_SHORT 0x0004
#define IP_TRACE_ERR_BAD_HDR_LEN 0x0005
#define IP_TRACE_ERR_CHKSUM_ERR 0x0006
#define IP_TRACE_ERR_BAD_LEN 0x0007
#define IP_TRACE_ERR_SIZE_SMALLER_THAN_MIN 0x0008
#define IP_TRACE_ERR_DATA_SHORTER_THAN_TOTAL_LEN 0x0009
#define IP_TRACE_ERR_IPOPT_ERROR 0x000a
#define IP_TRACE_ERR_NOT_FOR_US 0x000b
#define IP_TRACE_ERR_REASS_ERROR 0x000c
#define IP_TRACE_ERR_UNKNOWN_PROTO 0x000d
#define IP_TRACE_ERR_INSUFFICIENT_MEMORY 0x000e
#define IP_TRACE_ERR_CLIENT_FULL 0x000f
};
struct struct_trace_ip_out
{
unsigned short time;
u_short ip_id;
u_long peer_ip_addr;
};
struct struct_trace_lgif_in
{
unsigned short time;
unsigned short getmsg_status;
#define LGIF_TRACE_ERR_SAP_NOT_BOUND 100
unsigned short eth_type;
u_short ip_id;
unsigned char peer_ether_addr[EADDRLEN];
};
struct struct_trace_lgif_out
{
unsigned short time;
unsigned short putmsg_status;
unsigned short eth_type;
u_short ip_id;
unsigned char peer_ether_addr[EADDRLEN];
};
extern struct struct_trace_ip_in array_trace_ip_in[];
extern struct struct_trace_ip_out array_trace_ip_out[];
extern struct struct_trace_lgif_in array_trace_lgif_in[];
extern struct struct_trace_lgif_out array_trace_lgif_out[];
#ifdef __cplusplus
}
#endif
#endif /* in_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -