1053 lines
27 KiB
C
1053 lines
27 KiB
C
/* ipdhcps6.h - Public API of Wind River DHCPv6 Server */
|
|
|
|
/*
|
|
******************************************************************************
|
|
* INTERPEAK API HEADER FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcps6.h,v $ $Revision: 1.25.12.4 $
|
|
* $Source: /home/interpeak/CVSRoot/ipdhcps6/include/ipdhcps6.h,v $
|
|
* $Author: zluo0 $ $Date: 2013-01-07 02:14:02 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
#ifndef IPDHCPS6_H
|
|
#define IPDHCPS6_H
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
This library contains the APIs used for configuration of Wind River DHCPv6
|
|
Server.
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include "ipdhcps6_config.h"
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#include <ipcom_auth.h>
|
|
#include <ipcom_cstyle.h>
|
|
#include <ipcom_sock.h>
|
|
#include <ipcom_type.h>
|
|
|
|
#include "ipdhcps6_option.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
/* IPNET release XYyZz,
|
|
X = major version
|
|
Yy = minor version (two different versions might be incompatible)
|
|
Zz = patch version (two different versions are always compatible) */
|
|
#define IPDHCPS6_RELEASE 60701
|
|
|
|
|
|
#define IPDHCPS6_KEY_LEN 16
|
|
#define IPDHCPS6_PREFIX_PER_USER 1
|
|
|
|
#define IPDHCPS6_IPD_NAME "ipdhcps6"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
typedef struct Ipdhcps6_poolinfo_struct
|
|
{
|
|
/* The first address in the pool (inclusive) */
|
|
struct Ip_in6_addr first;
|
|
/* The last address in the pool (inclusive) */
|
|
struct Ip_in6_addr last;
|
|
/* The preferred lifetime in seconds of addresses drawn from this pool */
|
|
Ip_u32 preferred_lifetime;
|
|
/* The valid lifetime in seconds of addresses drawn from this pool */
|
|
Ip_u32 valid_lifetime;
|
|
/* Prefix information */
|
|
Ip_u8 prefix_len;
|
|
}
|
|
Ipdhcps6_poolinfo;
|
|
|
|
|
|
/* Specification of a prefix option that can be added in a DHCPv6 message */
|
|
typedef struct Ipdhcps6_prefix_struct
|
|
{
|
|
/* The ID given to this prefix */
|
|
char key[IPDHCPS6_KEY_LEN];
|
|
/* The time this prefix should be preferred after assigned to a requesting
|
|
router, 0xffffffff = infinite */
|
|
Ip_u32 preferred;
|
|
/* The time this prefix should be valid after assigned to a requesting
|
|
router, 0xffffffff = infinite */
|
|
Ip_u32 valid;
|
|
/* The IPv6 prefix */
|
|
struct Ip_in6_addr prefix;
|
|
/* The number of bits that is significant in the prefix */
|
|
int prefix_len;
|
|
}
|
|
Ipdhcps6_prefix;
|
|
|
|
|
|
typedef struct Ipdhcps6_subnet_struct
|
|
{
|
|
/* NOTE! The prefix and ifindex members must have the specified order or lookups will fail */
|
|
struct Ip_in6_addr prefix;
|
|
/* Interface index for link local prefix */
|
|
Ip_u32 ifindex;
|
|
/* Prefix length in bits */
|
|
int prefix_len;
|
|
}
|
|
Ipdhcps6_subnet;
|
|
|
|
|
|
typedef struct Ipdhcps6_user_struct
|
|
{
|
|
/* The name of this user */
|
|
char name[IPCOM_AUTH_USERNAME_MAX];
|
|
|
|
/* Array of prefix ID that should be added to this user */
|
|
char prefix_ids[IPDHCPS6_PREFIX_PER_USER][IPDHCPS6_KEY_LEN];
|
|
}
|
|
Ipdhcps6_user;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_all_dhcp_relay_agents_and_servers
|
|
*===========================================================================
|
|
* Multicast address used by a client to communicate with
|
|
* neighboring (i.e., on-link) relay agents and servers.
|
|
* All servers and relay agents are members of this multicast group.
|
|
* Should always be FF02::1:2.
|
|
*/
|
|
IP_EXTERN struct Ip_in6_addr ipdhcps6_all_dhcp_relay_agents_and_servers;
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_all_dhcp_servers
|
|
*===========================================================================
|
|
* A site-scoped multicast address used
|
|
* by a relay agent to communicate with servers, either
|
|
* because the relay agent wants to send messages to
|
|
* all servers or because it does not know the unicast
|
|
* addresses of the servers. Note that in order for
|
|
* a relay agent to use this address, it must have an
|
|
* address of sufficient scope to be reachable by the
|
|
* servers. All servers within the site are members of
|
|
* this multicast group.
|
|
* Should always be FF05::1:3
|
|
*/
|
|
IP_EXTERN struct Ip_in6_addr ipdhcps6_all_dhcp_servers;
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_client_port
|
|
*===========================================================================
|
|
* UDP port that the clients listen to.
|
|
* Should always be 546.
|
|
*/
|
|
IP_EXTERN Ip_u16 ipdhcps6_client_port;
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_server_port
|
|
*===========================================================================
|
|
* UDP port that the servers and relay agents listen to.
|
|
* Should always be 547.
|
|
*/
|
|
IP_EXTERN Ip_u16 ipdhcps6_server_port;
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_log_id
|
|
*===========================================================================
|
|
* The string used as identification when open the syslog.
|
|
*/
|
|
IP_EXTERN char *ipdhcps6_log_id;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_subnet_from_ifname - Creates the subnet information that represents
|
|
* the specified link.
|
|
*
|
|
* This routine adds a new subnet to the DHCP server configuration based on the
|
|
* values provided by the interface.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to an 'Ipdhcps6_subnet' structure that will hold the subnet
|
|
* \i <ifindex>
|
|
* The interface index used to create the subnet.
|
|
* \ie
|
|
*
|
|
* RETURNS:
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC void ipdhcps6_subnet_from_ifindex
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ip_u32 ifindex
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_subnet_add - Adds a new subnet to the DHCP server configuration.
|
|
*
|
|
* This routine adds a new subnet to the DHCP server configuration.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to an 'Ipdhcps6_subnet' structure.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or the following
|
|
* error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If the specified <subnet> could not be created due to out of memory.
|
|
* \i 'IPCOM_ERR_DUPLICATE'
|
|
* If the specified <subnet> already exist
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_subnet_add
|
|
(
|
|
Ipdhcps6_subnet *subnet
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_subnet_delete - delete subnet from the DHCP server configuration
|
|
*
|
|
* Deletes <subnet> from the DHCP server configuration all options and address
|
|
* pools associated with this <subnet> is also deleted.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to an 'Ipdhcps6_subnet' structure.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or the following
|
|
* error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If the specified <subnet> has not been added.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_subnet_delete
|
|
(
|
|
Ipdhcps6_subnet *subnet
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_subnet_list - list all added subnets
|
|
*
|
|
* This routine lists all added <subnets>.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnets>
|
|
* An array of 'ipdhcps6_subnet' structures for holding the subnets, or
|
|
* 'IP_NULL','' if the required size of the buffer should be written to
|
|
* <num_subnets>.
|
|
* \i <num_subnets>
|
|
* A pointer to an integer value for the number of elements that can be stored in
|
|
* the subnets array; when the function returns, <num_subnets> points to the
|
|
* number of elements copied to the <subnets> array.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or the following
|
|
* error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If the <subnets> array is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_subnet_list
|
|
(
|
|
Ipdhcps6_subnet subnets[],
|
|
int *num_subnets
|
|
);
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_subnet_to_string - return a string representation of the specified
|
|
* subnet
|
|
*
|
|
* This routine returns a string representation of the specified <subnet>.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to an 'Ipdhcps6_subnet' structure.
|
|
* \i <str>
|
|
* The buffer for storing the string representation of the subnet.
|
|
* \i <str_len>
|
|
* The length of the <str> buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or the following
|
|
* error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If the <str> buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_subnet_to_string
|
|
(
|
|
const Ipdhcps6_subnet *subnet,
|
|
char *str,
|
|
int str_len
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_pool_add - add Adds a pool of addresses to the specified subnet.
|
|
*
|
|
* This routine adds a pool of addresses to the specified subnet.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to an 'ipdhcps6_subnet' structure to which we will add the pool.
|
|
* \i <pool>
|
|
* A pointer to the 'Ipdhcps6_poolinfo' structure containing the pool to be
|
|
* added.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or one of the
|
|
* following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If no enough memory could be allocated to add the pool.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If the <subnet> specified is not added to the server.
|
|
* \i 'IPCOM_ERR_DUPLICATE'
|
|
* If one or more of the addresses in the pool is already included in a pool
|
|
* in the specified <subnet>
|
|
* \i 'IPCOM_ERR_INVALID_ARG'
|
|
* the addresses of the pool is not on the specified <subnet>.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_pool_add
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ipdhcps6_poolinfo *pool
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_pool_delete - delete a DHCPv6 pool from a specified subnet
|
|
*
|
|
* This routine deletes a DHCPv6 pool from the specified subnet.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to the 'ipdhcps6_subnet' structure from which the pool is
|
|
* to be deleted
|
|
* \i <pool>
|
|
* A pointer to the 'Ipdhcps6_poolinfo' structure containing the pool to delete.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* Either the subnet or the pool specified has not been added to the server.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_pool_delete
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ipdhcps6_poolinfo *pool
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_pool_get - Gets the address pool specification on a specific subnet.
|
|
* subnet
|
|
*
|
|
* This routine gets the address pool specification on a specific subnet. The
|
|
* data returned is dynamically allocated and must be freed by the invoker.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* A pointer to an 'ipdhcps6_subnet' structure from which we will get the pool.
|
|
* \i <pools>
|
|
* A pointer to the 'Ipdhcps6_poolinfo' pointer which will hold the pool
|
|
* information on success. The array will be dynamically allocated
|
|
* \i <pools_size>
|
|
* A pointer to the size variable which will indicate the size of the <pools>
|
|
* array on success
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* The specified <subnet> does not exist.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_pool_get
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ipdhcps6_poolinfo **pools,
|
|
Ip_u32 *pools_size
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_option_add - add a DHCPv6 option
|
|
*
|
|
* This routine adds a DHCPv6 option, either globally or to a specified <subnet>.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* Either a pointer to an 'ipdhcps6_subnet' structure for holding the option or
|
|
* 'IP_NULL', if the option is to apply to all subnets.
|
|
* \i <option>
|
|
* A pointer to the 'ipdhcps6_option' structure containing the option to be
|
|
* added.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or one of the
|
|
* following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If no enough memory could be allocated to add the option.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If the <subnet> specified is not added to the server.
|
|
* \i 'IPCOM_ERR_DUPLICATE'
|
|
* If an option of that type already exists at the specified <subnet>.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_option_add
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ipdhcps6_option *option
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_option_delete - delete a DHCPv6 option from a specified subnet
|
|
*
|
|
* This routine deletes a DHCPv6 option from the specified subnet.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnet>
|
|
* Either a pointer to the 'ipdhcps6_subnet' structure from which the option is
|
|
* to be deleted or 'IP_NULL', if the option is to be deleted from the global
|
|
* scope.
|
|
* \i <option>
|
|
* A pointer to the 'ipdhcps6_option' structure containing the option to delete.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* Either the subnet or the option specified was not been added to the server.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_option_delete
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ipdhcps6_option *option
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_option_list - list all DHCPv6 options assigned to the specified
|
|
* subnet
|
|
*
|
|
* This routine lists all DHCPv6 options assigned to the specified <subnet>.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <subnets>
|
|
* Either a pointer to the 'ipdhcps6_subnet' structure containing the subnet for
|
|
* which all options are to be listed or 'IP_NULL,' if options assigned to the
|
|
* global scope should be listed.
|
|
* \i <options>
|
|
* An array of 'ipdhcps6_option' structures for holding the options or 'IP_NULL',
|
|
* if the required buffer size is to be returned in the <opts_len> parameter.
|
|
* \i <opts_len>
|
|
* A pointer to an integer value for the size, in bytes, of the <options> buffer.
|
|
* When the function returns, a pointer to the number of bytes copied to the
|
|
* options buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: Either 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If the options buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_option_list
|
|
(
|
|
Ipdhcps6_subnet *subnet,
|
|
Ipdhcps6_option options[],
|
|
int *opts_len
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_option_to_string - return a string representation of the specified
|
|
* option
|
|
*
|
|
* This routine returns a string representation of the specified option.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <opt>
|
|
* A DHCP option.
|
|
* \i <str>
|
|
* A buffer for holding the string representation.
|
|
* \i <str_len>
|
|
* The length of the string.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If the <str> buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_option_to_string
|
|
(
|
|
const Ipdhcps6_option *opt,
|
|
char *str,
|
|
int str_len
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_prefix_add - add a prefix that this DHCP server can distribute to
|
|
* routers
|
|
*
|
|
* This routine adds a prefix that this DHCP server can distribute to requesting
|
|
* routers.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <prefix>
|
|
* A pointer to a 'ipdhcps6_prefix' structure containing the prefix to add. The
|
|
* key field of the structure must either be unique or set to
|
|
* 'IPDHCPS6_PREFIX_KEY_UNSPECIFIED', if IPDHCPS6 is to select a free ID.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If not enough memory could be allocated to add the <prefix>.
|
|
* \i 'IPCOM_ERR_DUPLICATE'
|
|
* If a <prefix> with the specified <prefix-\>key> already exists.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_prefix_add
|
|
(
|
|
Ipdhcps6_prefix *prefix
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_prefix_delete - delete a prefix
|
|
*
|
|
* This routine deletes a prefix.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <prefix>
|
|
* A pointer to a 'ipdhcps6_prefix' structure containing the prefix to delete.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If the specified <prefix> could be found.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_prefix_delete
|
|
(
|
|
Ipdhcps6_prefix *prefix
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_prefix_get - fetch the prefix that matches a specified key
|
|
*
|
|
* This routine fetches the prefix matching a specified <key>.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <key>
|
|
* The <key> of the prefix to be returned.
|
|
* \i <prefix>
|
|
* A pointer to an 'ipdhcps6_prefix' structure for holding <prefix> information
|
|
* when the routine returns.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
*
|
|
* ERRNO: \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If the specified <prefix> could be found.
|
|
* \ie
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_prefix_get
|
|
(
|
|
int key,
|
|
Ipdhcps6_prefix *prefix
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_prefix_list - list all DHCPv6 prefixes
|
|
*
|
|
* This routine lists all DHCPv6 prefixes added to IPDHCPS6.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <prefixes>
|
|
* A array of 'ipdhcps6_prefix' structures for the holding DHCPv6 <prefixes> when
|
|
* the routine returns or 'IP_NULL,' if the number of <prefixes> is to be
|
|
* returned in the <num_elem> parameter.
|
|
* \i <num_elem>
|
|
* A pointer to an integer value for holding the number of <prefixes> in the
|
|
* prefix list. When the function returns, a pointer to the number of <prefixes>
|
|
* in the prefix list.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_MEMORY'
|
|
* If the <prefixes> buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_prefix_list
|
|
(
|
|
Ipdhcps6_prefix prefixes[],
|
|
int *num_elem
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_host_list - list all DHCPv6 hosts in the database
|
|
*
|
|
* This routine lists all DHCPv6 hosts in the database.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <duids>
|
|
* A pointer to an 'ipdhcps6_option' structure for holding the client IDs. The
|
|
* pointer can be 'IP_NULL,' if the required size of the duid buffer is to be
|
|
* returned in the <duid_len> parameter.
|
|
* \i <duids_len>
|
|
* A pointer to an integer value for the size, in bytes, of the duids buffer.
|
|
* When the routine returns, the number of bytes copied to the duids buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If <duids> buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_host_list
|
|
(
|
|
Ipdhcps6_option *duids,
|
|
int *duids_len
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_host_to_string - create a string representation of the host entry
|
|
*
|
|
* This routine creates a string representation of the host entry.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <duid>
|
|
* A pointer to an 'ipdhcps6_option' structure containing the client ID of the
|
|
* host.
|
|
* \i <str>
|
|
* A buffer for holding the string representation.
|
|
* \i <str_len>
|
|
* The length of the string.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If <str> buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_host_to_string
|
|
(
|
|
Ipdhcps6_option *duid,
|
|
char *str,
|
|
int str_len
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_host_get_user - gets the username that the host used when it
|
|
* authenticated
|
|
*
|
|
* This routine gets the username that the host used when it authenticated. The
|
|
* routine succeeds only if the link used requires authentication.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <duid>
|
|
* A pointer to the 'ipdhcps6_option' structure containing the client ID of the
|
|
* host.
|
|
* \i <username>
|
|
* The username that was used in authentication on the link.
|
|
* \i <username_len>
|
|
* The size of the username buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If <username> buffer is too small.
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If no host matches the DUID.
|
|
* \i 'IPCOM_ERR_NOT_SUPPORTED'
|
|
* If the host exits but the link used does not provide <username>.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_host_get_user
|
|
(
|
|
Ipdhcps6_option *duid,
|
|
char *username,
|
|
int username_len
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_host_add - add a DHCPv6 host to the database
|
|
*
|
|
* This routine adds a DHCPv6 host to the database.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <duid>
|
|
* A pointer to an 'ipdhcps6_option' structure containing the client ID option
|
|
* for the host(using network byte order when assigning duid).
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_MEMORY'
|
|
* If not enough memory could be allocated to add the host.
|
|
* \i 'IPCOM_ERR_DUPLICATE'
|
|
* If the host has already been added.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_host_add
|
|
(
|
|
Ipdhcps6_option *duid
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_host_delete - delete a DHCPv6 host from the database
|
|
*
|
|
* This routine deletes a DHCPv6 host from the database.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <duid>
|
|
* A pointer to an 'ipdhcps6_option' structure containing the client ID option
|
|
* for the host(using network byte order when assigning duid).
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If no host matching the DUID has been added.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_host_delete
|
|
(
|
|
Ipdhcps6_option *duid
|
|
);
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_user_add - add a new user to the server
|
|
*
|
|
* This routine adds a new user to the server. Users can be bound to zero or more
|
|
* DHCP prefix options.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <user>
|
|
* A pointer to an 'ipdhcps6_user' structure containing the user to add.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If not enough memory could be allocated to add the user.
|
|
* \ie
|
|
*
|
|
* ERRNO
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_user_add
|
|
(
|
|
Ipdhcps6_user *user
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_user_delete - delete a user from the DHCP server
|
|
*
|
|
* This routine deletes a user from the DHCP server.
|
|
*
|
|
* Parameter:
|
|
* \is
|
|
* \i <username>
|
|
* The name of the user to delete.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or the following error:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NOT_FOUND'
|
|
* If no user with the specified name was found.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_user_delete
|
|
(
|
|
const char *username
|
|
);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_user_list - list all DHCPv6 users in the database
|
|
*
|
|
* This routine lists all DHCPv6 users in the database.
|
|
*
|
|
* Parameters:
|
|
* \is
|
|
* \i <users>
|
|
* An array of 'ipdhcps6_user' structures for holding the user definitions. The
|
|
* value can be 'IP_NULL,' if the required size, in bytes, of the buffer is to be
|
|
* returned in the <users_len> parameter.
|
|
* \i <users_len>
|
|
* The size, in bytes, of the <users> buffer. When the routine returns, the
|
|
* buffer contains the number of bytes copied to the <users> buffer.
|
|
* \ie
|
|
*
|
|
* RETURNS: 'IPCOM_SUCCESS', or one of the following errors:
|
|
* \is
|
|
* \i 'IPCOM_ERR_NO_MEMORY'
|
|
* If users buffer is too small.
|
|
* \ie
|
|
*
|
|
* ERRNO:
|
|
*/
|
|
IP_PUBLIC Ip_err ipdhcps6_user_list
|
|
(
|
|
Ipdhcps6_user users[],
|
|
int *users_len
|
|
);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_create
|
|
*===========================================================================
|
|
* Description: Allocates global memory that will be used by the server.
|
|
* Registers all shell commands associtated with the server.
|
|
* Sets the server ID.
|
|
* Parameters:
|
|
* Returns: IPCOM_SUCCESS - operation was successful.
|
|
* IPCOM_ERR_NO_MEMORY - could not allocate enough memory.
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err
|
|
ipdhcps6_create(void);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_configure
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns: IPCOM_SUCCESS - operation was successful.
|
|
* IPCOM_ERR_NO_MEMORY - could not allocate enough memory.
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err
|
|
ipdhcps6_configure(void);
|
|
|
|
|
|
/*
|
|
*===========================================================================
|
|
* ipdhcps6_start
|
|
*===========================================================================
|
|
* Description:
|
|
* Parameters:
|
|
* Returns: IPCOM_SUCCESS - operation was successful.
|
|
* IPCOM_ERR_NO_MEMORY - could not allocate enough memory.
|
|
*
|
|
*/
|
|
IP_PUBLIC Ip_err
|
|
ipdhcps6_start(void);
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* ipdhcps6_version - returns the version string
|
|
*
|
|
* This routine returns the version string for the IPDHCPS6 server.
|
|
*
|
|
* Parameters:
|
|
*
|
|
* None.
|
|
*
|
|
* RETURNS: The product version string.
|
|
*
|
|
* ERRNO:
|
|
*
|
|
*/
|
|
IP_PUBLIC const char *ipdhcps6_version
|
|
(
|
|
void
|
|
);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|