udi_buf_tag_apply(3udi)


Apply modifications to tagged buffer data

SYNOPSIS

#include <udi.h>

void udi_buf_tag_apply (

	udi_buf_tag_apply_call_t *callback,

	udi_cb_t *gcb,

	udi_buf_t *buf,

	udi_tagtype_t tag_type );
 
typedef void udi_buf_tag_apply_call_t (

	udi_cb_t *gcb,

	udi_buf_t *new_buf );
 

ARGUMENTS callback, gcb are standard arguments described in the "Asynchronous Service Calls" section of "Calling Sequence and Naming Conventions".

buf is the buffer for which tag values are to be computed and set.

tag_type is a bitmask of tag types for which the tag values are to be set. Only bit values corresponding to the UDI_BUFTAG_UPDATES mask may be used; for convenience the mask value itself may be specified.

new_buf is the buffer returned to the caller after tags have been computed and have been written into the buffer.

DESCRIPTION The udi_buf_tag_apply utility routine is used to process any Update category tags in the buffer. These buffer tags specify various tag values that are to be generated and inserted into the buffer as part of the handling of that buffer (e.g. for TCP/IP network checksum generation before transmitting the buffer).

This utility will process all tags attached to the buffer which correspond to bits set in the specified tag_type. For each tag it will compute the tag value for the indicated section of the buffer (as if by a call to udi_buf_tag_compute) and then write the result into the buffer according to the description of that tag_type. The requested update tags will not be processed in any particular order; if a specific order of computation is desired multiple calls to udi_buf_tag_apply should be made with the required sequence of tag types.

This utility function is typically used by Network Interface Card (NIC) Drivers which do not provide a checksum off-load capability and need to insert various TCP or other protocol-specific checksums into the packet before it is transmitted.

Note - This function could be implemented entirely as a series of calls to various UDI service calls such as udi_buf_write and udi_buf_tag_get, but is expected in most environments to be implemented more directly in terms of the underlying implementation-specific data structures for greater efficiency.

WARNINGS Control block usage must follow the rules described in the "Asynchronous Service Calls" section of "Calling Sequence and Naming Conventions".

On successful completion, buf will no longer be valid and new_buf is substituted, even if buf was not specified as NULL; new_buf may return the same handle value as the input value of buf.

If this operation is cancelled with udi_cancel, any pre-existing buf buffer will be discarded (see udi_cancel for an explanation of why this is so).

REFERENCES udi_buf_tag_t, udi_buf_tag_get, udi_buf_tag_compute


UDI Core Specification Contents