DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

udi_tagtype_t(3udi)


Buffer tag type

SYNOPSIS

#include <udi.h>

typedef udi_ubit32_t udi_tagtype_t;
 
/* Tag Category Masks */
 
#define  UDI_BUFTAG_ALL				0xffffffff
 
#define  UDI_BUFTAG_VALUES				0x000000ff
 
#define  UDI_BUFTAG_UPDATES				0x0000ff00
 
#define  UDI_BUFTAG_STATUS				0x00ff0000
 
#define  UDI_BUFTAG_DRIVERS				0xff000000
 
#define  /* Value Category Tag Types */
 
#define  UDI_BUFTAG_BE16_CHECKSUM				(1U<<0)
 
#define  /* Update Category Tag Types */
 
#define  UDI_BUFTAG_SET_iBE16_CHECKSUM				(1U<<8)
 
#define  UDI_BUFTAG_SET_TCP_CHECKSUM				(1U<<9)
 
#define  UDI_BUFTAG_SET_UDP_CHECKSUM				(1U<<10)
 
#define  /* Status Category Tag Types */
 
#define  UDI_BUFTAG_TCP_CKSUM_GOOD				(1U<<17)
 
#define  UDI_BUFTAG_UDP_CKSUM_GOOD				(1U<<18)
 
#define  UDI_BUFTAG_IP_CKSUM_GOOD				(1U<<19)
 
#define  UDI_BUFTAG_TCP_CKSUM_BAD				(1U<<21)
 
#define  UDI_BUFTAG_UDP_CKSUM_BAD				(1U<<22)
 
#define  UDI_BUFTAG_IP_CKSUM_BAD				(1U<<23)
 
#define  /* Drivers Category Tag Types */
 
#define  UDI_BUFTAG_DRIVER1				(1U<<24)
 
#define  UDI_BUFTAG_DRIVER2				(1U<<25)
 
#define  UDI_BUFTAG_DRIVER3				(1U<<26)
 
#define  UDI_BUFTAG_DRIVER4				(1U<<27)
 
#define  UDI_BUFTAG_DRIVER5				(1U<<28)
 
#define  UDI_BUFTAG_DRIVER6				(1U<<29)
 
#define  UDI_BUFTAG_DRIVER7				(1U<<30)
 
#define  UDI_BUFTAG_DRIVER8				(1U<<31)
 

DESCRIPTION The udi_tagtype_t type definition specifies the tag type used to specify a bitmask of one or more tags. These tags are subdivided into categories according to the general meaning of the tag. Each category can be easily identified or selected by using the appropriate category mask defined above.

The value tags defined in the Values category are typically used to store a numeric value associated with the portion of the buffer that the tag applies to. Since buffer data is stored in raw form any value tag must indicate the endianness interpretation of the buffer data as part of the tag type where appropriate. The value associated with the tag itself is passed to/from environment service calls in the driver's endianness regardless of the endianness of the buffer data.

UDI_BUFTAG_BE16_CHECKSUM - This tag's value is a 16-bit checksum that has been computed for the tagged range of the buffer. The tag value is in the driver's endianness but the checksum is computed as if the buffer contents are in big-endian 16-bit format.

The checksum is calculated by treating the specified portion of the buffer as an array of udi_ubit16_t elements and computing the sum of all elements modulo 216. If the length of the buffer portion is odd the "missing" low order byte of the last array element is treated as zero.

The update tags defined in the Updates category are used to request an update of the buffer based on a computation or scan of the associated portion of the buffer. The tag value for these tags usually represents a location in the buffer where the result of the computation or scan is to be written.

UDI_BUFTAG_SET_TCP_CHECKSUM - This tag is used to indicate that the associated portion of the buffer is a TCP/IP packet for which the TCP checksum is to be set before transmission, The associated buffer section includes the data and both the TCP and IP headers. The tag's value is ignored.

The TCP checksum is computed by taking the unsigned sum of 16-bit elements modulo 216, then applying a ones-complement; the following elements are included in this checksum: the TCP header and data areas, the IP source and destination addresses, the IP specified length, and the IP protocol byte (0 extended). The TCP checksum is written as a 16-bit big-endian value at bytes 16 and 17 of the TCP header.

More information regarding the TCP checksum algorithm may be obtained by consulting the following IETF RFCs:RFC 1071 "Computing the Internet checksum"; RFC 1141 "Incremental updating of the Internet checksum"; RFC 1624 "Computation of the Internet Checksum via Incremental Update"; and RFC 1936 "Implementing the Internet Checksum in Hardware".

UDI_BUFTAG_SET_UDP_CHECKSUM - This tag is used to indicate that the associated portion of the buffer is a UDP/IP packet for which the UDP checksum is to be set before transmission. The associated buffer section includes the data and both the UDP and IP headers. The tag's value is ignored.

The UDP checksum is the ones-complement of a 16-bit big-endian checksum of: the UDP header and data areas, the IP source and destination addresses, an additional copy of the UDP specified length, and the IP protocol byte (0 extended). The UDP checksum is written as a 16-bit big-endian value at bytes 6 and 7 of the UDP header.

More information regarding the UDP checksum algorithm may be obtained by consulting the IETF RFCs described above for the UDI_BUFTAG_SET_TCP_CHECKSUM buffer tag.

UDI_BUFTAG_SET_iBE16_CHECKSUM - This tag is used to indicate that a 16-bit big-endian ones-complement checksum is to be generated for the tagged portion of the buffer and that the result must be written into the buffer at the offset specified by the tag's value field before transmitting the buffer.

This buffer tag is commonly used to request that the IP header checksum is to be set before transmitting the buffer.

The status tags defined in the Status category are used to indicated the status of the associated portion of the buffer.

UDI_BUFTAG_TCP_CKSUM_GOOD - This tag is used to indicate that the associated portion of the buffer contains a TCP header and data portion and that the checksum contained in the header has been validated as correct for that buffer. This tag is typically set by a Network Adapter whose hardware validates TCP checksums for received packets. The checksum value itself, if known, may be specified as the tag_value for this tag; the header may no longer contain the checksum and this value in the packet header should not be reference.

UDI_BUFTAG_UDP_CKSUM_GOOD - This tag is used to indicate that the associated portion of the buffer contains a UDP header and data portion and that the checksum contained in the header has been validated as correct for that buffer. This tag is typically set by a Network Adapter whose hardware validates UDP checksums for received packets. The checksum value itself, if known, may be specified as the tag_value for this tag; the header may no longer contain the checksum and this value in the packet header should not be reference.

UDI_BUFTAG_IP_CKSUM_GOOD - This tag is used to indicate that the associated portion of the buffer contains an IP header (including options) and that the checksum contained in the header has been validated as correct for that buffer. This tag is typically set by a Network Adapter whose hardware validates IP checksums for received packets. The checksum value itself, if known, may be specified as the tag_value for this tag; the header may no longer contain the checksum and this value in the packet header should not be reference.

UDI_BUFTAG_TCP_CKSUM_BAD - This tag is used to indicate that the associated portion of the buffer contains a TCP header and data portion and that the checksum contained in the header does not match the calculated checksum (as typically determined by the driver or the hardware).

UDI_BUFTAG_UDP_CKSUM_BAD - This tag is used to indicate that the associated portion of the buffer contains a UDP header and data portion and that the checksum contained in the header does not match the calculated checksum (as typically determined by the driver or the hardware).

UDI_BUFTAG_IP_CKSUM_BAD - This tag is used to indicate that the associated portion of the buffer contains an IP header (including options) and that the checksum contained in the header does not match the calculated checksum.

The driver tags defined in the Drivers category are available for use by the driver for temporary or driver-internal use. This is especially useful when passing buffers in a multi-region driver. These tags are not visible to any other drivers; this protects against inter-driver confusion or tag assumptions but also means that these tags are not suitable for passing buffer information to other drivers in the UDI environment. Driver tags attached to a buffer which is passed to other drivers and subsequently returned will still have the current driver's tags attached and visible unless the associated region of the buffer was modified before being returned to the current driver; driver-specific tags set by other drivers will have no effect on the driver-specific tags set by the current driver.

REFERENCES udi_buf_tag_t


UDI Core Specification Contents