Files
m241Neelima/components/ip_net2-6.9/ipmip6mn/src/ipmip6mn_bc.c
T
2026-07-30 11:19:44 +05:30

220 lines
6.8 KiB
C

/*
******************************************************************************
* INTERPEAK SOURCE FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_bc.c,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipmip6mn/src/ipmip6mn_bc.c,v $
* $Author: jhorteli $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
******************************************************************************
*/
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipmip6mn_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_clib.h>
#include <ipcom_os.h>
#include <ipcom_sock.h>
#include <ipcom_sock6.h>
#include <ipcom_inet.h>
#include <ipcom_list.h>
#include <ipcom_hash.h>
#include <ipcom_syslog.h>
#include <ipmip.h>
#include <ipmip6.h>
#include <private/ipmip6_mh_pkt.h>
#include <private/ipmip6_util.h>
#include "ipmip6mn_h.h"
#include "ipmip6mn_bc.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 EXTERN PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 7 LOCAL PROTOTYPES
****************************************************************************
*/
/*
****************************************************************************
* 8 DATA
****************************************************************************
*/
/*
****************************************************************************
* 9 STATIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6_bc_key_hash_compare
*===========================================================================
* Description:
* Parameters:
* Returns:
*/
IP_STATIC Ip_bool
ipmip6mn_bc_key_hash_compare(Ipmip6_bc_t *bc,
Ipmip6mn_bc_key_t *key)
{
/* Base peer comparison */
if (ipmip6_bc_key_hash_compare(bc, &key->key))
{
/* Verify that we've gotten the right kind of binding */
if ((bc->flags & IPMIP6_MH_BU_H) != 0)
return IP_TRUE;
#ifdef IPMIP6MN_CN
/* Do the CN RO comparison */
return ipmip6mn_mh_cn_key_compare(bc, key);
#endif
}
return IP_FALSE;
}
/*
****************************************************************************
* 10 GLOBAL FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipmip6mn_lookup_binding
*===========================================================================
* Description: Lookup a particular correspondent binding in the binding cache
* belonging to a specific mobile node entry.
* Parameters: me - Mobile node entry.
* key - The lookup key
* func - Extended matching callback function.
* data - Data used in the extended matching.
* Returns:
*
*/
IP_GLOBAL Ipmip6_bc_t *
ipmip6mn_lookup_binding(Ipmip6mn_node_t *node,
Ipmip6mn_bc_key_t *key)
{
Ipmip6_bc_t *bc;
/* We've found the right node, look up the particular binding */
if ((bc = ipcom_hash_get(node->ha.bc->bch_hash, key)) != IP_NULL)
return bc;
/* Try find it in the correspondent node cache. */
if ((bc = ipcom_hash_get(node->cn.bc->bch_hash, key)) != IP_NULL)
return bc;
/* Try find it in the MAP node cache. */
if ((bc = ipcom_hash_get(node->map.bc->bch_hash, key)) != IP_NULL)
return bc;
/* Return it */
return IP_NULL;
}
/*
*===========================================================================
* ipmip6mn_lookup
*===========================================================================
* Description: Lookup a particular correspondent binding in the binding cache.
* Parameters: instance - The instance
* home - The home address specifying which mobile node
* context to look in, or IP_NULL if unspecified.
* key - The lookup key
* Returns:
*
*/
IP_GLOBAL Ipmip6_bc_t *
ipmip6mn_lookup(Ipmip6mn_context_t *instance,
struct Ip_in6_addr *home,
Ipmip6mn_bc_key_t *key)
{
IPMIP_UNUSED_PARAMETER(instance);
IPMIP_UNUSED_PARAMETER(home);
IPMIP_UNUSED_PARAMETER(key);
/* No match */
return IP_NULL;
}
/*
*===========================================================================
* ipmi6mn_bc_create
*===========================================================================
* Description: Create a binding cache hash table.
* Parameters: notify - The notification function
* opaque - Opaque data.
* Returns: The binding cache hash table.
*
*/
IP_GLOBAL Ipmip6_bc_hash_t *
ipmi6mn_bc_hash_create(Ipmip6_bc_hash_notify_t notify,
void *opaque)
{
/* Create the MN hash */
return ipmip6_bc_hash_create(notify,
opaque,
(Ipcom_hash_cmp_func) ipmip6mn_bc_key_hash_compare);
}
/*
****************************************************************************
* 11 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/