Files
2026-07-30 11:19:44 +05:30

422 lines
8.7 KiB
C

/* ipmip6_util.h - ipmip6_util.h */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6_util.h,v $ $Revision: 1.11 $
* $Source: /home/interpeak/CVSRoot/ipmip6/include/private/ipmip6_util.h,v $
* $Author: jhorteli $ $Date: 2010-10-21 12:21:32 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPMIP6_UTIL_H
#define IPMIP6_UTIL_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
Miscellaneous utility functions used by the MIP6 system
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <private/ipmip_util.h>
#include <private/ipmip6_mh_pkt.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPMIP6_EVENT_IF(x, proc, call) IPMIP_DO_IF(x, IPMIP6_EVENT_PRIORITY, proc, call)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
union Ipmip6_mib_InetAddress;
struct Ipmip_lladdr;
struct Ip_timeval;
typedef struct Ipmip6_util_timediff
{
Ip_bool future;
struct Ip_timeval diff;
} Ipmip6_util_timediff_t;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipmip6_util_InetAddress_cmp - ipmip6_util_InetAddress_cmp
*
* Compare two mib defined address instances.
*
* Parameters:
* \is
* \i inetAddressType1
* The MIB type of address 1
* \i inetAddress1
* The data of address 1.
* \i inetAddressType2
* The MIB type of address 2
* \i inetAddress2
* The data of address 2
* \ie
*
* RETURNS: IP_TRUE if they are equal.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip6_util_InetAddress_cmp
(
Ip_u32 inetAddressType1,
union Ipmip6_mib_InetAddress *inetAddress1,
Ip_u32 inetAddressType2,
union Ipmip6_mib_InetAddress *inetAddress2
);
/*******************************************************************************
*
* ipmip6_util_access_type_to_ll_type - ipmip6_util_access_type_to_ll_type
*
* Convert an access type to an LLADDR definition.
*
* Parameters:
* \is
* \i att
* The access type to convert
* \i ll_type
* Pointer to where to store the LLADDR type
* \i ll_subtype
* Pointer to where to store the LLADDR subtype
* \ie
*
* RETURNS: IP_TRUE if successful.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_bool ipmip6_util_access_type_to_ll_type
(
Ip_u8 att,
Ip_u8 *ll_type,
Ip_u8 *ll_subtype
);
/*******************************************************************************
*
* ipmip6_util_access_type_to_lladdr - ipmip6_util_access_type_to_lladdr
*
* Convert an access type and a link-layer definition to an LLADDR definition.
*
* Parameters:
* \is
* \i mo_access_type
* The access type mobility option
* \i mo_link_layer_id
* The link layer mobility option.
* \ie
*
* RETURNS: An LLADDR object if successful.
*
* ERRNO:
*
*/
IP_GLOBAL struct Ipmip_lladdr *ipmip6_util_access_type_to_lladdr
(
Ipmip6_mh_mo_pmipv6_access_technology_type_t *mo_access_type,
Ipmip6_mh_mo_pmipv6_mn_link_layer_id_t *mo_link_layer_id
);
/*******************************************************************************
*
* ipmip6_util_access_type_to_str - ipmip6_util_access_type_to_str
*
* Convert an access type to a human readable string
*
* Parameters:
* \is
* \i att
* The access type
* \ie
*
* RETURNS: An human readable string
*
* ERRNO:
*
*/
IP_GLOBAL const char *ipmip6_util_access_type_to_str
(
Ip_u8 att
);
/*******************************************************************************
*
* ipmip6_util_handoff_indicator_to_str - ipmip6_util_handoff_indicator_to_str
*
* Convert an handoff type to a human readable string
*
* Parameters:
* \is
* \i htt
* The handoff type
* \ie
*
* RETURNS: An human readable string
*
* ERRNO:
*
*/
IP_GLOBAL const char *ipmip6_util_handoff_indicator_to_str
(
Ip_u8 htt
);
/*******************************************************************************
*
* ipmip6_util_timestamp - ipmip6_util_timestamp
*
* Calculate a MIP6 timestamp.
*
* Parameters:
* \is
* \i stamp
* The timestamp
* \i diff
* The timestamp diff object.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_util_timestamp
(
Ip_u64 *stamp,
Ipmip6_util_timediff_t *diff
);
/*******************************************************************************
*
* ipmip6_util_tv_to_timestamp - ipmip6_util_tv_to_timestamp
*
* Calculate a MIP6 timestamp from a timeval object-
*
* Parameters:
* \is
* \i stamp
* The timestamp
* \i tv
* The timeval object.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_util_tv_to_timestamp
(
Ip_u64 *stamp,
struct Ip_timeval *tv
);
/*******************************************************************************
*
* ipmip6_util_timestamp_to_tv - ipmip6_util_timestamp_to_tv
*
* Create a timeval value based on a MIP6 timestamp
*
* Parameters:
* \is
* \i stamp
* The timestamp
* \i tv
* The timeval object.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_util_timestamp_to_tv
(
Ip_u64 *stamp,
struct Ip_timeval *tv
);
/*******************************************************************************
*
* ipmip6_util_timestamp_diff_tv - ipmip6_util_timestamp_diff_tv
*
* Calculate the difference between a timestamp and local time and store
* it in the diff object.
*
* Parameters:
* \is
* \i ltime
* The local time
* \i stamp
* The timestamp
* \i diff
* The diff object.
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_util_timestamp_diff_tv
(
struct Ip_timeval *ltime,
struct Ip_timeval *stamp,
Ipmip6_util_timediff_t *diff
);
/*******************************************************************************
*
* ipmip6_util_timestamp_diff_apply - ipmip6_util_timestamp_diff_apply
*
* Apply two timestamps and store the result in rdiff.
*
* Parameters:
* \is
* \i rdiff
* The remote diff
* \i ndiff
* The new diff
* \ie
*
* RETURNS:
*
* ERRNO:
*
*/
IP_GLOBAL void ipmip6_util_timestamp_diff_apply
(
Ipmip6_util_timediff_t *rdiff,
Ipmip6_util_timediff_t *ndiff
);
/*******************************************************************************
*
* ipmip6_util_mo_service_selection - ipmip6_util_mo_service_selection
*
* Create a service selection mobility object based on a selector
*
* Parameters:
* \is
* \i sel
* The selector
* \ie
*
* RETURNS: A service selection mobility option
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip6_mh_mo_service_selection_mobility_option_t *ipmip6_util_mo_service_selection
(
const char *sel
);
/*******************************************************************************
*
* ipmip6_util_mo_vendor_extension - ipmip6_util_mo_vendor_extension
*
* Create a vendor extension object
*
* Parameters:
* \is
* \i vendor_id
* The vendor id
* \i subtype
* The vendor subtype
* \i data
* The data
* \i data_size
* The size of data
* \ie
*
* RETURNS: A vendor extension mobility object
*
* ERRNO:
*
*/
IP_GLOBAL Ipmip6_mh_mo_vendor_specific_mobility_option_t *ipmip6_util_mo_vendor_extension
(
Ip_u32 vendor_id,
Ip_u8 subtype,
Ip_u8 *data,
Ip_size_t data_size
);
/*******************************************************************************
*
* ipmip6_util_tunnelmask_to_type - ipmip6_util_tunnelmask_to_type
*
* Convert a tunnelmask to a tunneltype
*
* Parameters:
* \is
* \i mask
* The tunnel mask
* \ie
*
* RETURNS: The tunnel type.
*
* ERRNO:
*
*/
IP_GLOBAL Ip_u8 ipmip6_util_tunnelmask_to_type
(
Ip_u32 mask
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/