Fill in missing IPTOS defines (from Linux/OpenBSD)

This commit is contained in:
christos 2011-07-24 18:06:08 +00:00
parent bf72748657
commit 20d3618cc7

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip.h,v 1.31 2007/12/25 18:33:46 perry Exp $ */
/* $NetBSD: ip.h,v 1.32 2011/07/24 18:06:08 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -73,22 +73,48 @@ struct ip {
/*
* Definitions for IP type of service (ip_tos)
*/
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
/* IPTOS_LOWCOST 0x02 XXX */
/*
* Definitions for IP precedence (also in ip_tos) (hopefully unused)
* Definitions for DiffServ Codepoints as per RFC2474
*/
#define IPTOS_PREC_NETCONTROL 0xe0
#define IPTOS_PREC_INTERNETCONTROL 0xc0
#define IPTOS_PREC_CRITIC_ECP 0xa0
#define IPTOS_PREC_FLASHOVERRIDE 0x80
#define IPTOS_PREC_FLASH 0x60
#define IPTOS_PREC_IMMEDIATE 0x40
#define IPTOS_PREC_PRIORITY 0x20
#define IPTOS_PREC_ROUTINE 0x00
#define IPTOS_DSCP_CS0 0x00
#define IPTOS_DSCP_CS1 0x20
#define IPTOS_DSCP_AF11 0x28
#define IPTOS_DSCP_AF12 0x30
#define IPTOS_DSCP_AF13 0x38
#define IPTOS_DSCP_CS2 0x40
#define IPTOS_DSCP_AF21 0x48
#define IPTOS_DSCP_AF22 0x50
#define IPTOS_DSCP_AF23 0x58
#define IPTOS_DSCP_CS3 0x60
#define IPTOS_DSCP_AF31 0x68
#define IPTOS_DSCP_AF32 0x70
#define IPTOS_DSCP_AF33 0x78
#define IPTOS_DSCP_CS4 0x80
#define IPTOS_DSCP_AF41 0x88
#define IPTOS_DSCP_AF42 0x90
#define IPTOS_DSCP_AF43 0x98
#define IPTOS_DSCP_CS5 0xa0
#define IPTOS_DSCP_EF 0xb8
#define IPTOS_DSCP_CS6 0xc0
#define IPTOS_DSCP_CS7 0xe0
/*
* Definitions for DiffServ Class Selector Codepoints
*/
#define IPTOS_CLASS_CS0 0x00
#define IPTOS_CLASS_CS1 0x20
#define IPTOS_CLASS_CS2 0x40
#define IPTOS_CLASS_CS3 0x60
#define IPTOS_CLASS_CS4 0x80
#define IPTOS_CLASS_CS5 0xa0
#define IPTOS_CLASS_CS6 0xc0
#define IPTOS_CLASS_CS7 0xe0
#define IPTOS_CLASS_DEFAULT IPTOS_CLASS_CS0
#define IPTOS_CLASS_MASK 0xe0
#define IPTOS_CLASS(cs) ((cs) & IPTOS_CLASS_MASK)
#define IPTOS_DSCP_MASK 0xfc
#define IPTOS_DSCP(cp) ((cp) & IPTOS_DSCP_MASK)
/*
* ECN (Explicit Congestion Notification) codepoints in RFC3168
@ -99,6 +125,32 @@ struct ip {
#define IPTOS_ECN_ECT0 0x02 /* ECN-capable transport (0) */
#define IPTOS_ECN_CE 0x03 /* congestion experienced */
#define IPTOS_ECN_MASK 0x03 /* ECN field mask */
#define IPTOS_ECN(cn) ((cn) & IPTOS_ECN_MASK)
#define IPTOS_ECN_NOT_ECT 0x00
/*
* Definitions for IP type of service per RFC1349 (ip_tos)
* DEPRECATED
*/
#define IPTOS_LOWDELAY 0x10
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST 0x02
/* ECN RFC3168 obsoletes RFC2481, and these will be deprecated soon. */
#define IPTOS_CE 0x01 /* congestion experienced */
#define IPTOS_ECT 0x02 /* ECN-capable transport */
/*
* Definitions for IP precedence per RFC1195 (also in ip_tos) (hopefully unused)
*/
#define IPTOS_PREC_NETCONTROL 0xe0
#define IPTOS_PREC_INTERNETCONTROL 0xc0
#define IPTOS_PREC_CRITIC_ECP 0xa0
#define IPTOS_PREC_FLASHOVERRIDE 0x80
#define IPTOS_PREC_FLASH 0x60
#define IPTOS_PREC_IMMEDIATE 0x40
#define IPTOS_PREC_PRIORITY 0x20
#define IPTOS_PREC_ROUTINE 0x00
/*
* Definitions for options.
@ -191,4 +243,3 @@ struct ippseudo {
u_int16_t ippseudo_len; /* protocol length */
} __packed;
#endif /* !_NETINET_IP_H_ */