184 lines
6.6 KiB
C
184 lines
6.6 KiB
C
/*
|
|
******************************************************************************
|
|
* HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipike_dynamic_ip.h,v $ $Revision: 1.7.16.1 $
|
|
* $Source: /home/interpeak/CVSRoot/ipike/src/ipike_dynamic_ip.h,v $
|
|
* $Author: svc-cmnet $ $Date: 2013-03-13 07:45:26 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* Copyright Interpeak AB <www.interpeak.se>. All rights reserved.
|
|
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPIKE_DYNAMIC_IP_H
|
|
#define IPIKE_DYNAMIC_IP_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/* Dynamic IP address handling */
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipike_config.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_initiate_address_reference
|
|
*===========================================================================
|
|
* Description: Initiate reference counter for specified address.
|
|
* Parameters: id - id of interface
|
|
* ifname - name of interface
|
|
* addr - ip address.
|
|
* netmask - ip netmask.
|
|
* expire - number of seconds until address expire.
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_initiate_address_reference(
|
|
const char *id,
|
|
const char *ifname,
|
|
union Ip_sockaddr_union *netmask,
|
|
union Ip_sockaddr_union *addr);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_has_valid_address_reference
|
|
*===========================================================================
|
|
* Description: Ask if a reference counter is available for specified address.
|
|
* Parameters: id - id of interface
|
|
* Returns: IP_TRUE if available (else IP_FALSE)
|
|
*/
|
|
IP_GLOBAL Ip_bool
|
|
ipike_has_valid_address_reference(const char *id);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_remove_address_reference
|
|
*===========================================================================
|
|
* Description: Remove a reference counter if available for specified address.
|
|
* Parameters: id - id of interface
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_remove_address_reference(const char *id);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_increase_address_reference
|
|
*===========================================================================
|
|
* Description: Increase reference counter for specified address. Will create
|
|
* a new reference if ifname not null (initialize to zero).
|
|
* Parameters: ifname - name of interface
|
|
* addr - ip address.
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_increase_address_reference(union Ip_sockaddr_union *addr);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_decrease_address_reference
|
|
*===========================================================================
|
|
* Description: Decrease reference counter for specified address, delete from
|
|
* interface when reach zero references.
|
|
* Parameters: addr - ip address.
|
|
* Returns:
|
|
*/
|
|
IP_GLOBAL void
|
|
ipike_decrease_address_reference(union Ip_sockaddr_union *addr);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_update_interface_addresses
|
|
*===========================================================================
|
|
* Description: Update ip addresses on specified interface.
|
|
* Parameters: id - The id to be used (ipsec_sa id)
|
|
* ifname - Interface name, set to IP_NULL to get first available
|
|
* interface.
|
|
* addr - new ip address.
|
|
* netmask - new ip netmask.
|
|
* dns - new dns address.
|
|
* nbns - new nbns address.
|
|
* Returns: IPIKE_SUCCESS, IPIKE_FAILED
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_update_interface_addresses(
|
|
const char *id,
|
|
const char *ifname,
|
|
union Ip_sockaddr_union *addr,
|
|
union Ip_sockaddr_union *netmask,
|
|
union Ip_sockaddr_union **dns,
|
|
union Ip_sockaddr_union **nbns);
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipike_get_interface_addresses
|
|
*===========================================================================
|
|
* Description: Get ip addresses for specified interface.
|
|
* Parameters: ip4 - Set to IP_TRUE to get Ipv4 address (IP_FALSE for IPv6)
|
|
* peer_id - Id of peer that will get the address
|
|
* addr - will get ip address.
|
|
* netmask - will get ip netmask.
|
|
* dns - will get dns address (set to IP_NULL if not wanted).
|
|
* nbns - will get nbns address (set to IP_NULL if not wanted).
|
|
* Returns: IPIKE_SUCCESS, IPIKE_FAILED
|
|
*/
|
|
IP_GLOBAL Ipike_error
|
|
ipike_get_interface_addresses(
|
|
Ip_bool ip4,
|
|
Ipike_value *peer_id,
|
|
Ip_u32 counter,
|
|
union Ip_sockaddr_union *addr,
|
|
union Ip_sockaddr_union *netmask,
|
|
union Ip_sockaddr_union ***dns,
|
|
union Ip_sockaddr_union ***nbns);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|