File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / pimd / include / sunos-cc / netinet / in.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jun 12 07:59:38 2017 UTC (7 years, 1 month ago) by misho
Branches: pimd, MAIN
CVS tags: v2_3_2, HEAD
pimd 2.3.2

    1: /*	@(#)in.h 1.19 90/07/27 SMI; from UCB 7.5 2/22/88	*/
    2: 
    3: /*
    4:  * Copyright (c) 1982, 1986 Regents of the University of California.
    5:  * All rights reserved.
    6:  *
    7:  * Redistribution and use in source and binary forms are permitted
    8:  * provided that this notice is preserved and that due credit is given
    9:  * to the University of California at Berkeley. The name of the University
   10:  * may not be used to endorse or promote products derived from this
   11:  * software without specific prior written permission. This software
   12:  * is provided ``as is'' without express or implied warranty.
   13:  */
   14: 
   15: /*
   16:  * Constants and structures defined by the internet system,
   17:  * Per RFC 790, September 1981.
   18:  */
   19: 
   20: #ifndef _netinet_in_h
   21: #define _netinet_in_h
   22: 
   23: /*
   24:  * Protocols
   25:  */
   26: #define	IPPROTO_IP		0		/* dummy for IP */
   27: #define	IPPROTO_ICMP		1		/* control message protocol */
   28: #define IPPROTO_IGMP		2		/* group control protocol */
   29: #define	IPPROTO_GGP		3		/* gateway^2 (deprecated) */
   30: #define IPPROTO_IPIP		4		/* IP inside IP */
   31: #define	IPPROTO_TCP		6		/* tcp */
   32: #define	IPPROTO_EGP		8		/* exterior gateway protocol */
   33: #define	IPPROTO_PUP		12		/* pup */
   34: #define	IPPROTO_UDP		17		/* user datagram protocol */
   35: #define	IPPROTO_IDP		22		/* xns idp */
   36: #define IPPROTO_HELLO		63		/* "hello" routing protocol */
   37: #define	IPPROTO_ND		77		/* UNOFFICIAL net disk proto */
   38: #define IPPROTO_RSVP            46              /* resource reservation proto*/
   39: #define IPPROTO_PIM		103		/* Protocol Independent Mcast*/
   40: #define	IPPROTO_RAW		255		/* raw IP packet */
   41: #define	IPPROTO_MAX		256
   42: 
   43: /*
   44:  * Port/socket numbers: network standard functions
   45:  */
   46: #define	IPPORT_ECHO		7
   47: #define	IPPORT_DISCARD		9
   48: #define	IPPORT_SYSTAT		11
   49: #define	IPPORT_DAYTIME		13
   50: #define	IPPORT_NETSTAT		15
   51: #define	IPPORT_FTP		21
   52: #define	IPPORT_TELNET		23
   53: #define	IPPORT_SMTP		25
   54: #define	IPPORT_TIMESERVER	37
   55: #define	IPPORT_NAMESERVER	42
   56: #define	IPPORT_WHOIS		43
   57: #define	IPPORT_MTP		57
   58: 
   59: /*
   60:  * Port/socket numbers: host specific functions
   61:  */
   62: #define	IPPORT_TFTP		69
   63: #define	IPPORT_RJE		77
   64: #define	IPPORT_FINGER		79
   65: #define	IPPORT_TTYLINK		87
   66: #define	IPPORT_SUPDUP		95
   67: 
   68: /*
   69:  * UNIX TCP sockets
   70:  */
   71: #define	IPPORT_EXECSERVER	512
   72: #define	IPPORT_LOGINSERVER	513
   73: #define	IPPORT_CMDSERVER	514
   74: #define	IPPORT_EFSSERVER	520
   75: 
   76: /*
   77:  * UNIX UDP sockets
   78:  */
   79: #define	IPPORT_BIFFUDP		512
   80: #define	IPPORT_WHOSERVER	513
   81: #define	IPPORT_ROUTESERVER	520	/* 520+1 also used */
   82: 
   83: /*
   84:  * Ports < IPPORT_RESERVED are reserved for
   85:  * privileged processes (e.g. root).
   86:  * Ports > IPPORT_USERRESERVED are reserved
   87:  * for servers, not necessarily privileged.
   88:  */
   89: #define	IPPORT_RESERVED		1024
   90: #define	IPPORT_USERRESERVED	5000
   91: 
   92: /*
   93:  * Link numbers
   94:  */
   95: #define	IMPLINK_IP		155
   96: #define	IMPLINK_LOWEXPER	156
   97: #define	IMPLINK_HIGHEXPER	158
   98: 
   99: /*
  100:  * Internet address
  101:  *	This definition contains obsolete fields for compatibility
  102:  *	with SunOS 3.x and 4.2bsd.  The presence of subnets renders
  103:  *	divisions into fixed fields misleading at best.  New code
  104:  *	should use only the s_addr field.
  105:  */
  106: struct in_addr {
  107: 	union {
  108: 		struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
  109: 		struct { u_short s_w1,s_w2; } S_un_w;
  110: 		u_long S_addr;
  111: 	} S_un;
  112: #define	s_addr	S_un.S_addr		/* should be used for all code */
  113: #define	s_host	S_un.S_un_b.s_b2	/* OBSOLETE: host on imp */
  114: #define	s_net	S_un.S_un_b.s_b1	/* OBSOLETE: network */
  115: #define	s_imp	S_un.S_un_w.s_w2	/* OBSOLETE: imp */
  116: #define	s_impno	S_un.S_un_b.s_b4	/* OBSOLETE: imp # */
  117: #define	s_lh	S_un.S_un_b.s_b3	/* OBSOLETE: logical host */
  118: };
  119: 
  120: /*
  121:  * Definitions of bits in internet address integers.
  122:  * On subnets, the decomposition of addresses to host and net parts
  123:  * is done according to subnet mask, not the masks here.
  124:  */
  125: #define	IN_CLASSA(i)		(((long)(i) & 0x80000000) == 0)
  126: #define	IN_CLASSA_NET		0xff000000
  127: #define	IN_CLASSA_NSHIFT	24
  128: #define	IN_CLASSA_HOST		0x00ffffff
  129: #define	IN_CLASSA_MAX		128
  130: 
  131: #define	IN_CLASSB(i)		(((long)(i) & 0xc0000000) == 0x80000000)
  132: #define	IN_CLASSB_NET		0xffff0000
  133: #define	IN_CLASSB_NSHIFT	16
  134: #define	IN_CLASSB_HOST		0x0000ffff
  135: #define	IN_CLASSB_MAX		65536
  136: 
  137: #define	IN_CLASSC(i)		(((long)(i) & 0xe0000000) == 0xc0000000)
  138: #define	IN_CLASSC_NET		0xffffff00
  139: #define	IN_CLASSC_NSHIFT	8
  140: #define	IN_CLASSC_HOST		0x000000ff
  141: 
  142: #define	IN_CLASSD(i)		(((long)(i) & 0xf0000000) == 0xe0000000)
  143: #define	IN_CLASSD_NET		0xf0000000	/* These ones aren't really */
  144: #define	IN_CLASSD_NSHIFT	28		/* net and host fields, but */
  145: #define	IN_CLASSD_HOST		0x0fffffff	/* routing needn't know.    */
  146: #define	IN_MULTICAST(i)		IN_CLASSD(i)
  147: 
  148: #define	IN_EXPERIMENTAL(i)	(((long)(i) & 0xe0000000) == 0xe0000000)
  149: #define	IN_BADCLASS(i)		(((long)(i) & 0xf0000000) == 0xf0000000)
  150: 
  151: #define	INADDR_ANY		(u_long)0x00000000
  152: #define	INADDR_LOOPBACK		(u_long)0x7F000001
  153: #define	INADDR_BROADCAST	(u_long)0xffffffff	/* must be masked */
  154: 
  155: #define	INADDR_UNSPEC_GROUP	(u_long)0xe0000000	/* 224.0.0.0   */
  156: #define	INADDR_ALLHOSTS_GROUP	(u_long)0xe0000001	/* 224.0.0.1   */
  157: #define	INADDR_MAX_LOCAL_GROUP 	(u_long)0xe00000ff	/* 224.0.0.255 */
  158: 
  159: #define	IN_LOOPBACKNET		127			/* official! */
  160: 
  161: /*
  162:  * Define a macro to stuff the loopback address into an Internet address
  163:  */
  164: #define IN_SET_LOOPBACK_ADDR(a)	{(a)->sin_addr.s_addr  = htonl(INADDR_LOOPBACK); \
  165: 	(a)->sin_family = AF_INET;}
  166: 
  167: /*
  168:  * Socket address, internet style.
  169:  */
  170: struct sockaddr_in {
  171: 	short	sin_family;
  172: 	u_short	sin_port;
  173: 	struct	in_addr sin_addr;
  174: 	char	sin_zero[8];
  175: };
  176: 
  177: /*
  178:  * Options for use with [gs]etsockopt at the IP level.
  179:  */
  180: #define	IP_OPTIONS		1	/* set/get IP per-packet options   */
  181: #define	IP_MULTICAST_IF		2	/* set/get IP multicast interface  */
  182: #define	IP_MULTICAST_TTL	3	/* set/get IP multicast timetolive */
  183: #define	IP_MULTICAST_LOOP	4	/* set/get IP multicast loopback   */
  184: #define	IP_ADD_MEMBERSHIP	5	/* add  an IP group membership     */
  185: #define	IP_DROP_MEMBERSHIP	6	/* drop an IP group membership     */
  186: #define	IP_MULTICAST_VIF	7	/* set/get IP mcast vir. interface */
  187: #define IP_RSVP_ON		8	/* set rsvp var. in kernel         */
  188: #define IP_RSVP_OFF		9	/* unset rsvp var in kernel        */
  189: #define IP_RSVP_VIF_ON         10	/* set rsvp per-vif socket         */
  190: #define IP_RSVP_VIF_OFF        11	/* unset rsvp per-vif socket       */
  191: 
  192: #define	IP_DEFAULT_MULTICAST_TTL   1	/* normally limit m'casts to 1 hop  */
  193: #define	IP_DEFAULT_MULTICAST_LOOP  1	/* normally hear sends if a member  */
  194: #define	IP_MAX_MEMBERSHIPS         20	/* per socket; must fit in one mbuf */
  195: 
  196: /*
  197:  * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
  198:  */
  199: struct ip_mreq {
  200: 	struct in_addr	imr_multiaddr;	/* IP multicast address of group */
  201: 	struct in_addr	imr_interface;	/* local IP address of interface */
  202: };
  203: 
  204: #if !defined(vax) && !defined(ntohl)  && !defined(i386)
  205: /*
  206:  * Macros for number representation conversion.
  207:  */
  208: #define	ntohl(x)	(x)
  209: #define	ntohs(x)	(x)
  210: #define	htonl(x)	(x)
  211: #define	htons(x)	(x)
  212: #endif
  213: 
  214: #if !defined(ntohl) && (defined(vax) || defined(i386))
  215: u_short	ntohs(), htons();
  216: u_long	ntohl(), htonl();
  217: #endif
  218: 
  219: #ifdef KERNEL
  220: extern	struct domain inetdomain;
  221: extern	struct protosw inetsw[];
  222: struct	in_addr in_makeaddr();
  223: u_long	in_netof(), in_lnaof();
  224: #endif
  225: 
  226: #endif /*!_netinet_in_h*/

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>