Files
m241Neelima/components/ip_net2-6.9/ipmip4/include/private/ipmip4_lla.h
T
2026-07-30 11:19:44 +05:30

442 lines
12 KiB
C

/* ipmip4_lla.h - ipmip4_lla.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip4_lla.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipmip4/include/private/ipmip4_lla.h,v $
* $Author: jhorteli $ $Date: 2010-12-07 09:55:10 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP4_LLA_H
#define IPMIP4_LLA_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* Utility class that provides functions to create, interpret and modify
* LLA identifiers.
*/
/*
DESCRIPTION
Utility class that provides functions to create, interpret and modify
LLA identifiers. LLA identifiers are a MIP4 specific hardware definition
used by low-latency handovers. They are not commonly used by the MIP4
entities, unless they are to be added or parsed from a MIP4 registration
request/reply. In all internal state and processing the LLADDR definitions
provided by ipmip_lladdr.h are used, which are a superset of the LLA. That is,
a LLA can be converted to a LLADDR without loss of information, but the
reverse is not necessarily true.
These functions are mostly internal and used for specific events defined
by low latency handoffs and proxy mobility registrations.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_lladdr.h>
#include <private/ipmip4_msgext.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_3GPP2_MOBILE_STATION 1 /* 3GPP2 Mobile Station ID: n byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_3GPP_MOBILE_SUBSCRIBER 2 /* 3GPP Mobile Subscriber Id: n byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_MAC 3 /* Ethernet 48 bit MAC address: 6 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_EUID64 4 /* EUID64 address: 8 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_SOLICITED_ADDRESS 5 /* Solicited IPv4 Address: 4 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_ACCESS_POINT 6 /* Access Point Identifier: 4 byte identifier */
#define IPMIP4_ICMP_LLA_EXT_SUBTYPE_FA_ADDRESS 7 /* FA IPv4 Address: 4 byte identifier */
/* Calculate the required memory allocation depending
* on the size of the link layer address/identifier */
#define IPMIP4_ICMP_LLA_EXT_SIZE(llsize) ((sizeof(Ipmip4_icmp_lla_ext_t) + (llsize) - 1))
/* The value of the 'length' field */
#define IPMIP4_ICMP_LLA_EXT_LENGTH(llsize) ((llsize) + 1)
/* The total size required to make a copy of an LLA */
#define IPMIP4_ICMP_LLA_EXT_TOTAL_SIZE(lla) ((lla)->length + 2)
/* The LLA size of an LLA */
#define IPMIP4_ICMP_LLA_EXT_LLA_SIZE(lla) ((lla)->length - 1)
/* PMIPv4 definition and types */
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_3 1
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_11ABG 2
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_16E 3
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_802_16M 4
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP_EUTRAN_LTE 5
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP_UTRAN_GERAN 6
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP2_1XRTT_HRPD 7
#define IPMIP4_LLA_PMIPV4_ACCESS_TECHNOLOGY_3GPP2_UMB 8
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
struct Ipmip4_msgext_array;
union Ipmip4_msgext_uhdr;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip4_lla_llh_find_array_subtype - ipmip4_lla_llh_find_array_subtype
*
* Return a usable source LLA address based on found
* extensions and a subtype
*
* Parameters:
* \is
* \i subtype
* The specific subtype
* \i ext
* The found LLA extensions.
* \ie
*
* RETURNS: The LLA address if it found; IP_NULL Otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip4_icmp_lla_ext_t * ipmip4_lla_llh_find_array_subtype
(
Ip_u8 subtype,
struct Ipmip4_msgext_array *ext
);
/*******************************************************************************
*
* ipmip4_lla_llh_convert_array_to_lladdr - ipmip4_lla_llh_convert_array_to_lladdr
*
* Return a dynamically allocated source LLADDR address based on found
* extensions and a subtype
*
* Parameters:
* \is
* \i lladdr
* The LLADDR of the receiving interface
* \i ext
* The found LLA extensions.
* \ie
*
* RETURNS: The LLADDR address if it found; IP_NULL Otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t * ipmip4_lla_llh_convert_array_to_lladdr
(
Ipmip_lladdr_t *lladdr,
struct Ipmip4_msgext_array *ext
);
/*******************************************************************************
*
* ipmip4_lla_llh_convert_lla_to_lladdr - ipmip4_lla_llh_convert_lla_to_lladdr
*
* Return a dynamically allocated source LLADDR address based on found
* extensions and a subtype
*
* Parameters:
* \is
* \i lladdr
* The LLADDR of the receiving interface
* \i lla
* The found LLA extension
* \ie
*
* RETURNS: The LLADDR address if it found; IP_NULL Otherwise.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t *ipmip4_lla_llh_convert_lla_to_lladdr
(
Ipmip_lladdr_t *lladdr,
Ipmip4_icmp_lla_ext_t *lla
);
/*******************************************************************************
*
* ipmip4_lla_llh_lladdr_buffer_icmp_append - ipmip4_lla_llh_lladdr_buffer_icmp_append
*
* Append an LLA to a buffer in ICMP mode
*
* 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 lla
* The LLA
* \ie
*
* RETURNS: The offset
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_lla_llh_lladdr_buffer_icmp_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_llh_lladdr_buffer_udp_append - ipmip4_lla_llh_lladdr_buffer_udp_append
*
* Append an LLA to a buffer in UDP mode
*
* 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 lla
* The LLA
* \ie
*
* RETURNS: The offset
*
* ERRNO:
*
*/
IP_GLOBAL int ipmip4_lla_llh_lladdr_buffer_udp_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_lladdr_buffer_access_type_append - ipmip4_lla_pmipv4_lladdr_buffer_access_type_append
*
* Append an PMIPv4 Access Type option to a buffer based on the LLADDR
*
* 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 lladdr
* The LLADDR
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_lla_pmipv4_lladdr_buffer_access_type_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_lladdr_buffer_interface_id_append - ipmip4_lla_pmipv4_lladdr_buffer_interface_id_append
*
* Append an PMIPv4 Interface ID option to a buffer based on the LLADDR
*
* 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 lladdr
* The LLADDR
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_lla_pmipv4_lladdr_buffer_interface_id_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_lladdr_buffer_device_id_append - ipmip4_lla_pmipv4_lladdr_buffer_device_id_append
*
* Append an PMIPv4 Device ID option to a buffer based on the LLADDR
*
* 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 lladdr
* The LLADDR
* \ie
*
* RETURNS: No return value
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip4_lla_pmipv4_lladdr_buffer_device_id_append
(
Ipmip_buffer_t *buf,
Ipmip_lladdr_t *lladdr
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_interface_id_convert_to_lladdr - ipmip4_lla_pmipv4_interface_id_convert_to_lladdr
*
* Convert a PMIPv4 interface identifier to a LLADDR type. The lladdr provided to
* the function MUST be the corresponding interface's own LLADDR, which will be used
* as hint when converting. The interface id does not contain any information regarding
* interface type, since it is implicitly known by the MIP agent due to its knowledge
* regarding serving interface.
*
* Parameters:
* \is
* \i lladdr
* The serving interface's link local address
* \i ifid
* The interface identifier
* \ie
*
* RETURNS: A newly allocated LLADDR containing the appropriate values.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t *ipmip4_lla_pmipv4_interface_id_convert_to_lladdr
(
Ipmip_lladdr_t *lladdr,
union Ipmip4_msgext_uhdr *ifid
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_device_id_convert_to_lladdr - ipmip4_lla_pmipv4_device_id_convert_to_lladdr
*
* Convert a PMIPv4 device identifier to a LLADDR type. The lladdr provided to
* the function MUST be the corresponding interface's own LLADDR, which will be used
* as hint when converting. The device id does not contain any information regarding
* interface type, since it is implicitly known by the MIP agent due to its knowledge
* regarding serving interface.
*
* Parameters:
* \is
* \i lladdr
* The serving interface's link local address
* \i ifid
* The interface identifier
* \ie
*
* RETURNS: A newly allocated LLADDR containing the appropriate values.
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip_lladdr_t *ipmip4_lla_pmipv4_device_id_convert_to_lladdr
(
Ipmip_lladdr_t *lladdr,
union Ipmip4_msgext_uhdr *ifid
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_access_type_from_lladdr_types - ipmip4_lla_pmipv4_access_type_from_lladdr_types
*
* Convert a LLADDR type and subtype to the corresponding access type
*
* Parameters:
* \is
* \i type
* The interface major type
* \i subtype
* The interface minor type
* \ie
*
* RETURNS: The access type corresponding to the interface values.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u8 ipmip4_lla_pmipv4_access_type_from_lladdr_types
(
Ip_u8 type,
Ip_u8 subtype
);
/*******************************************************************************
*
* ipmip4_lla_pmipv4_device_id_type_from_lladdr_types - ipmip4_lla_pmipv4_device_id_type_from_lladdr_types
*
* Convert a LLADDR type and subtype to the corresponding device id type
*
* Parameters:
* \is
* \i type
* The interface major type
* \i subtype
* The interface minor type
* \ie
*
* RETURNS: The device id type corresponding to the interface values.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u8 ipmip4_lla_pmipv4_device_id_type_from_lladdr_types
(
Ip_u8 type,
Ip_u8 subtype
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/