234 lines
5.2 KiB
C
234 lines
5.2 KiB
C
/* ipmip6_address.h - ipmip6_address.h */
|
|
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6_address.h,v $ $Revision: 1.5.10.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipmip6/include/private/ipmip6_address.h,v $
|
|
* $Author: jhorteli $ $Date: 2012-02-08 16:09:27 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPMIP6_ADDRESS_H
|
|
#define IPMIP6_ADDRESS_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
|
|
This module provides functions related to INET6 address management. For
|
|
example anycast address creation, applying prefixes and verifying if
|
|
an address is unicast routable.
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
struct Ipmip6_if;
|
|
struct Ipmip6_context;
|
|
union Ipmip6_mib_InetAddress;
|
|
|
|
/* Basic address data */
|
|
typedef struct Ipmip6_address
|
|
{
|
|
struct Ip_in6_addr prefix;
|
|
Ip_u8 len;
|
|
}
|
|
Ipmip6_address_t;
|
|
|
|
#ifdef IPMIP_USE_INET
|
|
typedef struct Ipmip6_inet
|
|
{
|
|
Ip_u32 prefix;
|
|
Ip_u8 len;
|
|
}
|
|
Ipmip6_inet_t;
|
|
#endif
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_address_unicast_routable - ipmip6_address_unicast_routable
|
|
*
|
|
* Verify whether or not an address is unicast routable.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i addr
|
|
* The INET6 address to verify
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if unicast routable, IP_FALSE otherwise.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip6_address_unicast_routable
|
|
(
|
|
struct Ip_in6_addr *addr
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_address_apply_prefix - ipmip6_address_apply_prefix
|
|
*
|
|
* Apply a prefix to an address. This is used to renumber an existing
|
|
* address - that is changing the prefix it belongs to.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i addr
|
|
* The INET6 address to renumber
|
|
* \i prefix
|
|
* The prefix to apply
|
|
* \i prefix_len
|
|
* The number of set bits in the prefix
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_address_apply_prefix
|
|
(
|
|
struct Ip_in6_addr *addr,
|
|
const struct Ip_in6_addr *prefix,
|
|
Ip_u8 prefix_len
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_address_create_prefix - ipmip6_address_create_prefix
|
|
*
|
|
* Set a prefix in an address structure.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i addr
|
|
* The address to create the prefix in
|
|
* \i prefix
|
|
* The prefix to apply
|
|
* \i prefix_len
|
|
* The bit length of the prefix
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_address_create_prefix
|
|
(
|
|
struct Ip_in6_addr *addr,
|
|
const struct Ip_in6_addr *prefix,
|
|
Ip_u8 prefix_len
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_address_cmp_prefix2prefix - ipmip6_address_cmp_prefix2prefix
|
|
*
|
|
* Compares two prefixes.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i prefix1
|
|
* The first prefix
|
|
* \i prefix2
|
|
* The second prefix
|
|
* \ie
|
|
*
|
|
* RETURNS: IP_TRUE if they are identical, IP_FALSE otherwise.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL Ip_bool ipmip6_address_cmp_prefix2prefix
|
|
(
|
|
Ipmip6_address_t *prefix1,
|
|
Ipmip6_address_t *prefix2
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipmip6_address_create_anycast - ipmip6_address_create_anycast
|
|
*
|
|
* Create an anycast address based on a prefix and an any cast address number
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i addr
|
|
* The data to store the anycast address in
|
|
* \i prefix
|
|
* The prefix
|
|
* \i anycast
|
|
* The anycast address
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_GLOBAL void ipmip6_address_create_anycast
|
|
(
|
|
Ipmip6_address_t *addr,
|
|
Ipmip6_address_t *prefix,
|
|
Ip_u8 anycast
|
|
);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|