/* ipmip_attr.h - ipmip_attr.h */ /* ****************************************************************************** * HEADER FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip_attr.h,v $ $Revision: 1.11 $ * $Source: /home/interpeak/CVSRoot/ipmip/include/private/ipmip_attr.h,v $ * $Author: jhorteli $ $Date: 2011-01-21 15:31:28 $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ #ifndef IPMIP_ATTR_H #define IPMIP_ATTR_H /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* DESCRIPTION MIP attribute functions required for mobile ip. Deals with retrieval and assignment of MIP attributes. MIP Attributes are mainly used when communicating with a MIP instance, either between MIP instances or for example when retrieving connectivity, statistics or other information from a currently active entity. EXAMPLE A basic example of how the attribute functions can be used in a command line interface command hook. See the examples in ipmip_context.h for 'example' type definitions. .CS /@ Define some attributes that the node have @/ enum { IPMIP_MY_NODE_NONE, IPMIP_MY_NODE_INFO }; enum { IPMIP_MY_NODE_ATTR_NONE, IPMIP_MY_NODE_ATTR_NAME, IPMIP_MY_NODE_ATTR_IDENTITY, IPMIP_MY_NODE_ATTR_MAX }; Ip_u32 dump_node_to_buffer(struct Ipmip_my_entities *node, Ipmip_buffer_t *buffer) { Ip_u32 rta; /@ We will store all information related to this node within another attribute. Nesting attributes like this allows you to store information regarding multiple nodes in one buffer. Each IPMIP_MY_NODE_INFO contains the information of one node @/ rta = ipmip_attr_begin(buffer, IPMIP_MY_NODE_INFO); /@ Store the nodes name @/ ipmip_attr_put_str(buffer, IPMIP_MY_NODE_ATTR_NAME, node->name); /@ Store the nodes identity @/ ipmip_attr_put_u32(buffer, IPMIP_MY_NODE_ATTR_IDENTITY, node->identity); /@ End this attribute. @/ ipmip_attr_end(buffer, rta); /@ Return the offset of the IPMIP_MY_NODE_INFO @/ return rta; } /@ Print all known information regarding the node provided by the node_info @/ void get_and_print_node_info(Ipmip_attr_t *node_info) { ipcom_printf("NAME: %s IDENTITY: %d", ipmip_attr_payload_find_str(node_info, IPMIP_MY_NODE_ATTR_NAME)): ipmip_attr_payload_find_u32(node_info, IPMIP_MY_NODE_ATTR_IDENTITY)): } /@ This is the entry function taking a 'node' as argument @/ void node_attr_func(struct Ipmip_my_entities *node) { Ipmip_buffer_t mybuf; Ip_u32 rta; /@ Initialize the buffer @/ ipmip_buffer_init(&mybuf); /@ Dump the information in the node to attribute form in the buffer @/ rta = dump_node_to_buffer(node, &mybuf); /@ Print the information in the buffer. Send the IPMIP_MY_NODE_INFO attribute to the dump function @/ get_and_print_node_info((Ipmip_attr_t *)ipmip_buffer_offset(buffer, rta)); /@ Free the resources associated with the buffer @/ ipmip_buffer_release(&mybuf); } .CE */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #ifdef __cplusplus extern "C" { #endif /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define IPMIP_ATTR_HEADER_ACK (1 << 0) #define IPMIP_ATTR_LENGTH(len) ((len) + sizeof(struct Ipmip_attr)) #define IPMIP_ATTR_DATA(attr) ((void*)(((char*)(attr)) + IPMIP_ATTR_LENGTH(0))) #define IPMIP_ATTR_OK(attr,len) (((signed)(len)) >= ((signed)IPMIP_ATTR_LENGTH(0)) && IPMIP_ATTR_SIZE(attr) >= IPMIP_ATTR_LENGTH(0) && IPMIP_ATTR_SIZE(attr) <= (len)) #define IPMIP_ATTR_SIZE(attr) IP_GET_NTOHS(&(attr)->attr_len) #define IPMIP_ATTR_TYPE(attr) IP_GET_NTOHS(&(attr)->attr_type) #define IPMIP_ATTR_PAYLOAD(attr) (IPMIP_ATTR_SIZE(attr) - IPMIP_ATTR_LENGTH(0)) #define IPMIP_ATTR_NEXT(attr,attrlen) ((attrlen) -= IPMIP_ATTR_SIZE(attr), (struct Ipmip_attr*)(((char*)(attr)) + IPMIP_ATTR_SIZE(attr))) #define IPMIP_ATTR_HDR_LENGTH(len) ((len) + sizeof(struct Ipmip_attr_header)) #define IPMIP_ATTR_HDR_DATA(ahdr) ((void*)(((char*)ahdr) + IPMIP_ATTR_HDR_LENGTH(0))) #define IPMIP_ATTR_HDR_SIZE(ahdr) IP_GET_NTOHL(&(ahdr)->ah_len) #define IPMIP_ATTR_HDR_SYSTEM(ahdr) IP_GET_NTOHL(&(ahdr)->ah_subsystem) #define IPMIP_ATTR_HDR_ERROR(ahdr) IP_GET_NTOHL(&(ahdr)->ah_errcode) #define IPMIP_ATTR_HDR_TYPE(ahdr) IP_GET_NTOHS(&(ahdr)->ah_type) #define IPMIP_ATTR_HDR_FLAGS(ahdr) IP_GET_NTOHS(&(ahdr)->ah_flags) #define IPMIP_ATTR_HDR_SEQUENCE(ahdr) IP_GET_32ON8(&(ahdr)->ah_sequence) #define IPMIP_ATTR_HDR_PAYLOAD(ahdr) (IPMIP_ATTR_HDR_SIZE(ahdr) - IPMIP_ATTR_HDR_LENGTH(0)) #define IPMIP_ATTR_HDR_OK(ahdr, len) ((len) >= IPMIP_ATTR_HDR_LENGTH(0) && IPMIP_ATTR_HDR_SIZE(ahdr) >= IPMIP_ATTR_HDR_LENGTH(0) && IPMIP_ATTR_HDR_SIZE(ahdr) <= (len)) #define IPMIP_ATTR_HDR_NEXT(ahdr, len) ((len) -= IPMIP_ATTR_HDR_SIZE(ahdr), (struct Ipmip_attr_header *) (((char *)(ahdr)) + IPMIP_ATTR_HDR_SIZE(ahdr))) #define IPMIP_ATTR_HDR_ACK(ahdr) ((IP_GET_NTOHS(&(ahdr)->ah_flags) & IPMIP_ATTR_HEADER_ACK) != 0) enum { IPMIP_ATTR_NONE, IPMIP_ATTR_MESSAGE, IPMIP_ATTR_MAX }; /* **************************************************************************** * 5 TYPES **************************************************************************** */ struct Ipmip_context; struct Ipmip_proc; struct Ipmip_cli_message; struct Ipmip_buffer; struct Ip_in6_addr; struct Ipmip_attr_header { Ip_u32 ah_len; /* Length of message including header */ Ip_u32 ah_sequence; /* Sequence number */ Ip_u32 ah_subsystem; /* Sending process PID */ Ip_u32 ah_errcode; Ip_u16 ah_type; /* Message content */ Ip_u16 ah_flags; /* Flags */ }; struct Ipmip_attr { Ip_u16 attr_len; Ip_u16 attr_type; }; typedef struct Ipmip_attr_iter { struct Ipmip_attr *rta; Ip_size_t rta_size; } Ipmip_attr_iter_t; /* **************************************************************************** * 6 FUNCTIONS **************************************************************************** */ /******************************************************************************* * * ipmip_attr_command - ipmip_attr_command * * This function is invoked internally to parse global MIP commands. I.e. * commands that are identical between various MIP entities, such as loglevel, * history and events. * * Parameters: * \is * \i ctx * The generic mobility singleton context for IPMIP. For each started mobility * entity, there exists a mobility context which tracks configuration, system * events, available features and started processes. The mobility context is * created using ipmip_context_create(). See ipmip_context.h for more information * regarding the mobility entity context singleton. * \i proc * The process context associated with the currently executing thread. Each * thread and/or process in MIP must have its own unique process context. * If a process is started using ipmip_proc_start, the process context will * be allocated automatically by the IPMIP framework. Otherwise it must * be allocated using ipmip_proc_alloc(). * \i request * The request to process. * \ie * * RETURNS: 0 on success, < 0 otherwise. * * ERRNO: * * NOMANUAL */ IP_GLOBAL int ipmip_attr_command ( struct Ipmip_context *ctx, struct Ipmip_proc *proc, struct Ipmip_cli_message *request ); /******************************************************************************* * * ipmip_attr_put_u64 - ipmip_attr_put_u64 * * Add a u64 value to a MIP message. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_u64 ( struct Ipmip_buffer *buf, Ip_u16 attrtype, Ip_u64 attrval ); /******************************************************************************* * * ipmip_attr_put_time_t - ipmip_attr_put_time_t * * Add a time_t value to a message. Will be stored as a 64 bit value, * in order to be compatible with 64 bit platforms. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_time_t ( struct Ipmip_buffer *buf, Ip_u16 attrtype, Ip_time_t attrval ); /******************************************************************************* * * ipmip_attr_put_u32 - ipmip_attr_put_u32 * * Add a u32 value to a message. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_u32 ( struct Ipmip_buffer *buf, Ip_u16 attrtype, Ip_u32 attrval ); #ifdef IPCOM_USE_INET /******************************************************************************* * * ipmip_attr_put_inet - ipmip_attr_put_inet * * Add a INET address. Will be stored in network byte order in the message. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_inet ( struct Ipmip_buffer *buf, Ip_u16 attrtype, Ip_u32 attrval ); #endif #ifdef IPCOM_USE_INET6 /******************************************************************************* * * ipmip_attr_put_inet6 - ipmip_attr_put_inet6 * * Add a INET6 address to a message. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_inet6 ( struct Ipmip_buffer *buf, Ip_u16 attrtype, const struct Ip_in6_addr *attrval ); #endif /******************************************************************************* * * ipmip_attr_put_strn - ipmip_attr_put_strn * * Add a size delimited string data value and add a zero termination. This * function is typically used when dealing with string data with no or * unsecure zero termination. By providing a length parameter, the MIP * attriute routine will properly terminate the string after size bytes if * no zero termination is located. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \i str * string * \i size * Size of string * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_strn ( struct Ipmip_buffer *buf, Ip_u16 attrtype, const char *str, Ip_size_t size ); /******************************************************************************* * * ipmip_attr_put_str - ipmip_attr_put_str * * Add a string data value to a message. The string must be zero terminated. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \i str * string * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put_str ( struct Ipmip_buffer *buf, Ip_u16 attrtype, const char *str ); /******************************************************************************* * * ipmip_attr_put - ipmip_attr_put * * Add an opaque data value * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \i attrval * Attribute value * \i data * Data to add * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_put ( struct Ipmip_buffer *buf, Ip_u16 attrtype, Ip_u32 attrval, const void *data ); /******************************************************************************* * * ipmip_attr_begin - ipmip_attr_begin * * Start an attribute block. An attribute block is an attributes within attribute * construct, mainly used when providing multiple information instances within * a single information block. For example, it may be used for returning * statistics, where statistics may be a top level attribute and octets in/out * and packets in/out could be internal attributes within the statistics block. * An attribute block is not completed until ipmip_attr_end is invoked. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i attrtype * Attribute type * \ie * * RETURNS: The offset to the begining of the block. * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_begin ( struct Ipmip_buffer *buf, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_end - ipmip_attr_end * * End an attribute block. Will close an attribute block started by * ipmip_attr_begin. * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i off * The offset returned by ipmip_attr_begin * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL void ipmip_attr_end ( struct Ipmip_buffer *buf, Ip_size_t off ); /******************************************************************************* * * ipmip_attr_parse - ipmip_attr_parse * * Parse an attribute block and store result in array. * * Parameters: * \is * \i maxattr * Size of attrtable array * \i attr * First attribute * \i attrlen * Size of attribute block * \i attrtable * Attribute array * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip_attr_parse ( int maxattr, struct Ipmip_attr *attr, Ip_size_t attrlen, struct Ipmip_attr **attrtable ); /******************************************************************************* * * ipmip_attr_hdr_parse - ipmip_attr_hdr_parse * * Parse an attribute header block and store result in array. Will in turn * invoke ipmip_attr_parse, once the length and start of attribute data * has been extraceted from the attribute header. * * Parameters: * \is * \i maxattr * Size of attrtable array * \i attrhdr * Attribute header * \i attrtable * Attribute array * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip_attr_hdr_parse ( int maxattr, struct Ipmip_attr_header *attrhdr, struct Ipmip_attr **attrtable ); /******************************************************************************* * * ipmip_attr_find - ipmip_attr_find * * Locate a particular attribute in an attribute block * * Parameters: * \is * \i attr * First attribute * \i attrlen * Size of attribute block * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The attribute if found, or IP_NULL * * ERRNO: * */ IP_GLOBAL struct Ipmip_attr *ipmip_attr_find ( struct Ipmip_attr *attr, Ip_size_t attrlen, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_payload_find - ipmip_attr_payload_find * * Locate a particular attribute in the payload of an attribute. Used to * locate attributes within blocks created using ipmip_attr_begin and * ipmip_attr_end. * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The attribute if found, or IP_NULL * * ERRNO: * */ IP_GLOBAL struct Ipmip_attr *ipmip_attr_payload_find ( struct Ipmip_attr *attr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_payload_find_u32 - ipmip_attr_payload_find_u32 * * Locate a particular attribute in the payload of an attribute and return * as a u32 value * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The u32 value or 0 * * ERRNO: * */ IP_GLOBAL Ip_u32 ipmip_attr_payload_find_u32 ( struct Ipmip_attr *attr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_payload_find_time_t - ipmip_attr_payload_find_time_t * * Locate a particular attribute in the payload of an attribute and return * as a time_t value * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The time_t value or 0 * * ERRNO: * */ IP_GLOBAL Ip_time_t ipmip_attr_payload_find_time_t ( struct Ipmip_attr *attr, Ip_u16 attrtype ); #ifdef IPCOM_USE_INET /******************************************************************************* * * ipmip_attr_payload_find_inet - ipmip_attr_payload_find_inet * * Locate a particular attribute in the payload of an attribute and return * as a inet value * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The inet value or 0 * * ERRNO: * */ IP_GLOBAL Ip_u32 ipmip_attr_payload_find_inet ( struct Ipmip_attr *attr, Ip_u16 attrtype ); #endif #ifdef IPCOM_USE_INET /******************************************************************************* * * ipmip_attr_payload_find_inet6 - ipmip_attr_payload_find_inet6 * * Locate a particular attribute in the payload of an attribute and return * as a inet6 address * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The inet6 address or IP_NULL * * ERRNO: * */ IP_GLOBAL struct Ip_in6_addr *ipmip_attr_payload_find_inet6 ( struct Ipmip_attr *attr, Ip_u16 attrtype ); #endif /******************************************************************************* * * ipmip_attr_payload_find_data - ipmip_attr_payload_find_data * * Locate a particular attribute in the payload of an attribute and return * as data * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The data or IP_NULL * * ERRNO: * */ IP_GLOBAL void *ipmip_attr_payload_find_data ( struct Ipmip_attr *attr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_payload_find_str - ipmip_attr_payload_find_str * * Locate a particular attribute in the payload of an attribute and return * as string * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The string or IP_NULL * * ERRNO: * */ IP_GLOBAL char *ipmip_attr_payload_find_str ( struct Ipmip_attr *attr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_payload_find_u64 - ipmip_attr_payload_find_u64 * * Locate a particular attribute in the payload of an attribute and return * as a u64 value * * Parameters: * \is * \i attr * Attribute * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The u64 value or 0 * * ERRNO: * */ IP_GLOBAL Ip_u64 ipmip_attr_payload_find_u64 ( struct Ipmip_attr *attr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_hdr_find - ipmip_attr_hdr_find * * Locate a particular attribute in an attribute header * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The attribute if found, or IP_NULL * * ERRNO: * */ IP_GLOBAL struct Ipmip_attr *ipmip_attr_hdr_find ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_hdr_find_u32 - ipmip_attr_hdr_find_u32 * * Locate a particular attribute in an attribute header and return as * a u32 * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The u32 value or 0. * * ERRNO: * */ IP_GLOBAL Ip_u32 ipmip_attr_hdr_find_u32 ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_hdr_find_u64 - ipmip_attr_hdr_find_u64 * * Locate a particular attribute in an attribute header and return as * a u64 * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The u64 value or 0. * * ERRNO: * */ IP_GLOBAL Ip_u64 ipmip_attr_hdr_find_u64 ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); #ifdef IPCOM_USE_INET /******************************************************************************* * * ipmip_attr_hdr_find_inet - ipmip_attr_hdr_find_inet * * Locate a particular attribute in an attribute header and return as * a inet * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The inet value or 0. * * ERRNO: * */ IP_GLOBAL Ip_u32 ipmip_attr_hdr_find_inet ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); #endif #ifdef IPCOM_USE_INET6 /******************************************************************************* * * ipmip_attr_hdr_find_inet6 - ipmip_attr_hdr_find_inet6 * * Locate a particular attribute in an attribute header and return as * a inet6 address * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The inet6 address or IP_NULL * * ERRNO: * */ IP_GLOBAL struct Ip_in6_addr *ipmip_attr_hdr_find_inet6 ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); #endif /******************************************************************************* * * ipmip_attr_hdr_find_str - ipmip_attr_hdr_find_str * * Locate a particular attribute in an attribute header and return as * a string * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The string or IP_NULL * * ERRNO: * */ IP_GLOBAL char *ipmip_attr_hdr_find_str ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_hdr_find_data - ipmip_attr_hdr_find_data * * Locate a particular attribute in an attribute header and return as * a data * * Parameters: * \is * \i attrhdr * Attribute header * \i attrtype * Attribute we're looking for * \ie * * RETURNS: The data or IP_NULL * * ERRNO: * */ IP_GLOBAL void *ipmip_attr_hdr_find_data ( struct Ipmip_attr_header *attrhdr, Ip_u16 attrtype ); /******************************************************************************* * * ipmip_attr_get_u32 - ipmip_attr_get_u32 * * Convert a particular attribute to an u32 value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The u32 or 0 if not available. * * ERRNO: * */ IP_GLOBAL Ip_u32 ipmip_attr_get_u32 ( struct Ipmip_attr *attr ); /******************************************************************************* * * ipmip_attr_get_u64 - ipmip_attr_get_u64 * * Convert a particular attribute to an u64 value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The u64 or 0 if not available. * * ERRNO: * */ IP_GLOBAL Ip_u64 ipmip_attr_get_u64 ( struct Ipmip_attr *attr ); /******************************************************************************* * * ipmip_attr_get_time_t - ipmip_attr_get_time_t * * Convert a particular attribute to an Ip_time_t value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The Ip_time_t or 0 if not available. * * ERRNO: * */ IP_GLOBAL Ip_time_t ipmip_attr_get_time_t ( struct Ipmip_attr *attr ); #ifdef IPCOM_USE_INET /******************************************************************************* * * ipmip_attr_get_inet - ipmip_attr_get_inet * * Convert a particular attribute to an INET value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The INET or 0 if not available. * * ERRNO: * */ IP_GLOBAL Ip_u32 ipmip_attr_get_inet ( struct Ipmip_attr *attr ); #endif #ifdef IPCOM_USE_INET6 /******************************************************************************* * * ipmip_attr_get_inet6 - ipmip_attr_get_inet6 * * Convert a particular attribute to an INET6 value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The INET6 or IP_NULL if not available. * * ERRNO: * */ IP_GLOBAL struct Ip_in6_addr *ipmip_attr_get_inet6 ( struct Ipmip_attr *attr ); #endif /******************************************************************************* * * ipmip_attr_get_str - ipmip_attr_get_str * * Convert a particular attribute to an STR value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The STR or IP_NULL if not available. * * ERRNO: * */ IP_GLOBAL char *ipmip_attr_get_str ( struct Ipmip_attr *attr ); /******************************************************************************* * * ipmip_attr_get_strlen0 - ipmip_attr_get_strlen0 * * Return the length of the string attribute excluding any terminating * nulls. * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The length * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_get_strlen0 ( struct Ipmip_attr *attr ); /******************************************************************************* * * ipmip_attr_get_data - ipmip_attr_get_data * * Convert a particular attribute to a data value * * Parameters: * \is * \i attr * Attribute * \ie * * RETURNS: The data or IP_NULL if not available. * * ERRNO: * */ IP_GLOBAL void * ipmip_attr_get_data ( struct Ipmip_attr *attr ); /******************************************************************************* * * ipmip_attr_hdr_req_create - ipmip_attr_hdr_req_create * * Create a request header * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i subsystem * Subsystem identifier * \i sequence * Sequence number * \i type * Type value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_hdr_req_create ( struct Ipmip_buffer *buf, Ip_u32 subsystem, Ip_u32 seq, Ip_u16 type ); /******************************************************************************* * * ipmip_attr_hdr_ack_create - ipmip_attr_hdr_ack_create * * Create an ack header * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i subsystem * Subsystem identifier * \i sequence * Sequence number * \i type * Type value * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_hdr_ack_create ( struct Ipmip_buffer *buf, Ip_u32 subsystem, Ip_u32 seq, Ip_u16 type ); /******************************************************************************* * * ipmip_attr_hdr_ack_create - ipmip_attr_hdr_ack_create * * Create an ack header * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i hdr * Header we're acknowledging * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_hdr_ack ( struct Ipmip_buffer *buf, struct Ipmip_attr_header *hdr ); /******************************************************************************* * * ipmip_attr_hdr_err_create - ipmip_attr_hdr_err_create * * Create an error header * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i subsystem * Subsystem identifier * \i sequence * Sequence number * \i type * Type value * \i errcode * Error code * \i errmsg * Error message * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_hdr_err_create ( struct Ipmip_buffer *buf, Ip_u32 subsystem, Ip_u32 seq, Ip_u16 type, Ip_u32 errcode, const char *errmsg ); /******************************************************************************* * * ipmip_attr_hdr_err - ipmip_attr_hdr_err * * Create an error header * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i hdr * Header we're replying to * \i errcode * Error code * \i errmsg * Error message * \ie * * RETURNS: The offset * * ERRNO: * */ IP_GLOBAL Ip_size_t ipmip_attr_hdr_err ( struct Ipmip_buffer *buf, struct Ipmip_attr_header *hdr, Ip_u32 errcode, const char *errmsg ); /******************************************************************************* * * ipmip_attr_hdr_finalize - ipmip_attr_hdr_finalize * * Finalize an attribute header * * Parameters: * \is * \i buf * A pointer to an initialized dynamic mobility buffer. See ipmip_buffer.h * for more information regarding dynamic buffers and their capabilities. * \i off * Offset * \ie * * RETURNS: No return value * * ERRNO: * */ IP_GLOBAL void ipmip_attr_hdr_finalize ( struct Ipmip_buffer *buf, Ip_size_t off ); /******************************************************************************* * * ipmip_attr_hdr_iter_init - ipmip_attr_hdr_iter_init * * Initialize an iterator based on a header structure * * Parameters: * \is * \i hdr * Header structure * \i iter * Iterator * \ie * * RETURNS: The iterator * * ERRNO: * */ IP_GLOBAL Ipmip_attr_iter_t *ipmip_attr_hdr_iter_init ( struct Ipmip_attr_header *hdr, Ipmip_attr_iter_t *iter ); /******************************************************************************* * * ipmip_attr_payload_iter_init - ipmip_attr_payload_iter_init * * Initialize an iterator based on an attribute block * * Parameters: * \is * \i rta * RTA structure * \i iter * Iterator * \ie * * RETURNS: The iterator * * ERRNO: * */ IP_GLOBAL Ipmip_attr_iter_t *ipmip_attr_payload_iter_init ( struct Ipmip_attr *rta, Ipmip_attr_iter_t *iter ); /******************************************************************************* * * ipmip_attr_iter_next - ipmip_attr_iter_next * * Find next attribute of the specified type; The iter structure * contains current position and left remaining size. * * Parameters: * \is * \i iter * Iterator * \i type * Type of attribute * \ie * * RETURNS: The next matching attribute or IP_NULL * * ERRNO: * */ IP_GLOBAL struct Ipmip_attr *ipmip_attr_iter_next ( Ipmip_attr_iter_t *iter, Ip_u16 type ); #ifdef __cplusplus } #endif #endif /* **************************************************************************** * END OF FILE **************************************************************************** */