2362N/A Differentiate Services Code Point Support
0N/A$Id: dscp,v 1.1.2.1 2012/02/24 05:20:36 marka Exp $
0N/ADifferentiate Services Code Point (DSCP) is implemented in IPv4 using the
2362N/ATOS octet and in IPv6 using the TCLASS octet.
2362N/ARFC 3542 defines the api to manipulate the TCLASS octet as part of
0N/Athe advanced socket API. TCLASS is settable on both a socket and
0N/Ausing recvmsg over UDP. Retrieval is undefined for TCP.
0N/AThe Advanced socket API was not incorporated into the POSIX socket
0N/AAPI for IPv6 and may not be completely implemented in any OS.
0N/AFor TOS setsockopt() supports setting of the field on a persocket
0N/Abasis. TOS may also be set on a per packet basis on some OS using
0N/Asendmsg. If it is not supported the sendmsg call reports a error.
0N/ASupport can only be determined by attempted to send a packet with
2362N/Athe option set. Retrieval of the sent TOS value is retrievable on
2362N/ALinux. This can be determined at compile time.
0N/ADSCP values need to be compatible with TOS values as it is a re-use
0N/AWe will need to be able to probe for the level of DSCP support. We
0N/Aneed to know if we can set it at the socket level, packet level and
0N/Aif we can retrieve the DSCP value sent. This needs to be done
0N/Aindependently for IPv4 and IPv6.
0N/A#define ISC_NET_DSCPRECVV4 0x01 /* Can receive sent DSCP value IPv4 */
0N/A#define ISC_NET_DSCPRECVV6 0x02 /* Can receive sent DSCP value IPv6 */
0N/A#define ISC_NET_DSCPSETV4 0x04 /* Can set DSCP on socket IPv4 */
0N/A#define ISC_NET_DSCPSETV6 0x08 /* Can set DSCP on socket IPv6 */
0N/A#define ISC_NET_DSCPPKTV4 0x10 /* Can set DSCP on per packet IPv4 */
0N/A#define ISC_NET_DSCPPKTV6 0x20 /* Can set DSCP on per packet IPv6 */
0N/A#define ISC_NET_DSCPALL 0x3f /* All valid flags */
0N/Aisc_net_probedscp(void);
0N/A * Probe the level of DSCP support.
0N/AWe also need to be able to set DSCP values on a per socket basis, per packet
0N/Abasis and to retrieve dscp values from received packet.
0N/ASetting dscp on a per socket basis shall be done using isc_socket_dscp.
0N/Aisc_socket_dscp(isc_socket_t *sock, unsigned int dscp);
0N/A *\li 'sock' is a valid socket.
0N/Aisc_socketevent shall be extended to support the sending of and retrieval
0N/Aof DSCP values. If ISC_SOCKEVENTATTR_DSCP is set then isc_socket_sendto2
0N/Ashall set the DSCP value. isc_socket_recv shall set ISC_SOCKEVENTATTR_DSCP
0N/Aand the dscp element if the OS returns the value via recvmsg.
0N/A#define ISC_SOCKEVENTATTR_DSCP 0x00040000U /* public */
0N/Astruct isc_socketevent {
0N/A ISC_EVENT_COMMON(isc_socketevent_t);
0N/A isc_result_t result; /*%< OK, EOF, whatever else */
0N/A unsigned int minimum; /*%< minimum i/o for event */
0N/A unsigned int n; /*%< bytes read or written */
0N/A unsigned int offset; /*%< offset into buffer list */
0N/A isc_region_t region; /*%< for single-buffer i/o */
0N/A isc_bufferlist_t bufferlist; /*%< list of buffers */
0N/A isc_sockaddr_t address; /*%< source address */
0N/A isc_time_t timestamp; /*%< timestamp of packet recv */
0N/A struct in6_pktinfo pktinfo; /*%< ipv6 pktinfo */
0N/A isc_uint32_t attributes; /*%< see below */
0N/A isc_eventdestructor_t destroy; /*%< original destructor */
0N/A unsigned int dscp; /*%< UDP dscp value */
0N/AA convience function will be provided to allocate and intialize the structure.
0N/Aisc_socket_socketevent(isc_socket_t *sock0, isc_eventtype_t eventtype,
0N/A isc_taskaction_t action, const void *arg)
0N/ANamed needs to be able to set the DSCP value of sent traffic. We should
0N/Abe able to set DSCP for all TCP connections.
For UDP we should have a default DSCP value for when we can't set this on
a per packet basis with the ability to override for specific destinations.
DSCP Name DS Field Value IP Precedence
CS Class Selector (RFC 2474)
AFxy Assured Forwarding (x=class, y=drop precedence) (RFC2597)
EF Expedited Forwarding (RFC 3246)
value should be one of these or a numeric 0..63. The default value is 0.