original files of m241
This commit is contained in:
@@ -0,0 +1,300 @@
|
||||
/* ipdhcpc6.h - Public API of Wind River DHCPv6 Client */
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* INTERPEAK API HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcpc6.h,v $ $Revision: 1.12.12.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipdhcpc6/include/ipdhcpc6.h,v $
|
||||
* $Author: zluo0 $ $Date: 2013-09-26 02:33:16 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Kenneth Jonsson <kenneth@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPDHCPC6_H
|
||||
#define IPDHCPC6_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains the APIs used for configuration of Wind River DHCPv6
|
||||
Client.
|
||||
INCLUDE FILES: ipcom_type.h, ipcom_cstyle.h
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipdhcpc6_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include <ipcom_type.h>
|
||||
#include <ipcom_cstyle.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* IPDHCPC6 release XYyZz,
|
||||
X = major version
|
||||
Yy = minor version (two different versions might be incompatible)
|
||||
Zz = patch version (two different versions are always compatible) */
|
||||
#define IPDHCPC6_RELEASE 60600
|
||||
#define IPDHCPC6_IPD_EVENT_REFRESH 100
|
||||
|
||||
#define IPDHCPC6_IA_TYPE_NA 0
|
||||
#define IPDHCPC6_IA_TYPE_PD 1
|
||||
|
||||
#if !defined(IPDHCPC6_IA_TA_SUPPORT)
|
||||
#define IPDHCPC6_IA_TYPE_MAX 2
|
||||
#else
|
||||
#define IPDHCPC6_IA_TYPE_TA 2
|
||||
#define IPDHCPC6_IA_TYPE_MAX 3
|
||||
#endif
|
||||
|
||||
#define IPDHCPC6_MODE_UNINITIALIZED 0
|
||||
#define IPDHCPC6_MODE_DISABLED 1
|
||||
#define IPDHCPC6_MODE_ENABLED 2
|
||||
#define IPDHCPC6_MODE_AUTOMATIC 3
|
||||
|
||||
#define IPDHCPC6_IF_STATE_UNINITIALIZED 0
|
||||
#define IPDHCPC6_IF_STATE_DETACHED 1
|
||||
#define IPDHCPC6_IF_STATE_DOWN 2
|
||||
#define IPDHCPC6_IF_STATE_UP 3
|
||||
#define IPDHCPC6_IF_STATE_MAX 4
|
||||
|
||||
#define IPDHCPC6_IA_ADDRESS_UNBOUND 0
|
||||
#define IPDHCPC6_IA_ADDRESS_BOUND 1
|
||||
|
||||
/* The max number of binding downlink interfaces */
|
||||
#define IPDHCPC6_IAPD_MAX_BOUND_IFNUM 20
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
/* dhcpc6 API common arguments */
|
||||
typedef struct Ipdhcpc6_common_args
|
||||
{
|
||||
char *if_name; /* interface name */
|
||||
char *ia_type_name; /* IA type name like "ia_na","ia_pd" or "ia_ta" */
|
||||
char *ia_name; /* IA name */
|
||||
} Ipdhcpc6_common_args_t;
|
||||
|
||||
/* dhcpc6 API bind specific arguments */
|
||||
typedef struct Ipdhcpc6_bound_args
|
||||
{
|
||||
Ip_u32 ifnum; /* The number of downlink interfaces which are bound to uplink interface */
|
||||
char *ifnames[IPDHCPC6_IAPD_MAX_BOUND_IFNUM]; /* Name array for all down link interfaces */
|
||||
} Ipdhcpc6_bound_args_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipdhcpc6_refresh - Refresh the IA.
|
||||
*
|
||||
* This routine requests confirmation of current configuration information.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <refresh_args>
|
||||
* A pointer to an 'Ipdhcpc6_common_args_t' structure to which we will apply to the refresh process.
|
||||
* Please refer to the definition of Ipdhcpc6_common_args_t.
|
||||
* Argument rules for Ipdhcpc6_common_args_t elements if you define or ignore some of them:
|
||||
* \i [if_name,ia_type_name,ia_name]: The specific IA will be refreshed.
|
||||
* \i [if_name,ia_type_name,NULL]: All IA for interface named if_name with ia_type_name type will be refreshed.
|
||||
* \i [if_name,NULL,NULL]: All IA for interface named if_name with all IA type supported will be refreshed.
|
||||
* \i [NULL,NULL,NULL]: All existing IA will be refreshed.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or one of the
|
||||
* following errors:
|
||||
* \is
|
||||
* \i 'IPCOM_ERR_INVALID_ARG'
|
||||
* If the parameter is incorrect.
|
||||
* \i 'IPCOM_ERR_SOCKCALLFAILED'
|
||||
* If the call to socket related API fails.
|
||||
* \i 'IPCOM_ERR_INVALID_TAG_VALUE'
|
||||
* If the parse for tag is incorrect.
|
||||
* \ie
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_PUBLIC int ipdhcpc6_refresh
|
||||
(
|
||||
Ipdhcpc6_common_args_t *refresh_args
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipdhcpc6_release - Release the IA.
|
||||
*
|
||||
* This routine releases current configuration information.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <release_args>
|
||||
* A pointer to an 'Ipdhcpc6_common_args_t' structure to which we will apply to the release process.
|
||||
* Please refer to the definition of Ipdhcpc6_common_args_t.
|
||||
* Argument rules for Ipdhcpc6_common_args_t elements if you define or ignore some of them:
|
||||
* \i [if_name,ia_type_name,ia_name]: The specific IA will be released.
|
||||
* \i [if_name,ia_type_name,NULL]: All IA for interface named if_name with ia_type_name type will be released.
|
||||
* \i [if_name,NULL,NULL]: All IA for interface named if_name with all IA type supported will be released.
|
||||
* \i [NULL,NULL,NULL]: All existing IA will be released.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or one of the
|
||||
* following errors:
|
||||
* \is
|
||||
* \i 'IPCOM_ERR_INVALID_ARG'
|
||||
* If the parameter is incorrect.
|
||||
* \i 'IPCOM_ERR_SOCKCALLFAILED'
|
||||
* If the call to socket related API fails.
|
||||
* \i 'IPCOM_ERR_INVALID_TAG_VALUE'
|
||||
* If the parsing for tag is incorrect.
|
||||
* \ie
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_PUBLIC int ipdhcpc6_release
|
||||
(
|
||||
Ipdhcpc6_common_args_t *release_args
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipdhcpc6_iapd_bind_add - Add interface(s) to an interface binding (IA_PD only).
|
||||
*
|
||||
* This routine adds the downstream interface(s) to the binding configuration for an IA_PD.
|
||||
* This binding associates a distinct IA_PD with each of its downstream network interfaces
|
||||
* and use that IA_PD to obtain a prefix for the interface(s) from the delegating router
|
||||
* interface.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <bind_args>
|
||||
* A pointer to an 'Ipdhcpc6_common_args_t' structure to which we will apply to the binding process.
|
||||
* All the elements in Ipdhcpc6_common_args_t must be filled.
|
||||
* \i <down_ifs>
|
||||
* A pointer to an 'Ipdhcpc6_bound_args_t' structure to which we will config the binding relationship.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or one of the
|
||||
* following errors:
|
||||
* \is
|
||||
* \i 'IPCOM_ERR_INVALID_ARG'
|
||||
* If the parameter is incorrect.
|
||||
* \i 'IPCOM_ERR_SOCKCALLFAILED'
|
||||
* If the call to socket related API fails.
|
||||
* \i 'IPCOM_ERR_INVALID_TAG_VALUE'
|
||||
* If the parsing for tag is incorrect.
|
||||
* \ie
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
|
||||
IP_PUBLIC int ipdhcpc6_iapd_bind_add
|
||||
(
|
||||
Ipdhcpc6_common_args_t *bind_args,
|
||||
Ipdhcpc6_bound_args_t *down_ifs
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipdhcpc6_iapd_bind_delete - Remove interface(s) from an interface binding(IA_PD only).
|
||||
*
|
||||
* This routine removes the downstream interface(s) from an binding configuration for an IA_PD.
|
||||
* This binding associates a distinct IA_PD with each of its downstream network interfaces
|
||||
* and use that IA_PD to obtain a prefix for the interface(s) from the delegating router
|
||||
* interface.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <bind_args>
|
||||
* A pointer to an 'Ipdhcpc6_common_args_t' structure to which we will apply to the binding process.
|
||||
* All the elements in Ipdhcpc6_common_args_t must be filled.
|
||||
* \i <down_ifs>
|
||||
* A pointer to an 'Ipdhcpc6_bound_args_t' structure to which we will config the binding relationship.
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: Either 'IPCOM_SUCCESS', if the call was successful, or one of the
|
||||
* following errors:
|
||||
* \is
|
||||
* \i 'IPCOM_ERR_INVALID_ARG'
|
||||
* If the parameter is incorrect.
|
||||
* \i 'IPCOM_ERR_SOCKCALLFAILED'
|
||||
* If the call to socket related API fails.
|
||||
* \i 'IPCOM_ERR_INVALID_TAG_VALUE'
|
||||
* If the parsing for tag is incorrect.
|
||||
* \ie
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
|
||||
IP_PUBLIC int ipdhcpc6_iapd_bind_delete
|
||||
(
|
||||
Ipdhcpc6_common_args_t *bind_args,
|
||||
Ipdhcpc6_bound_args_t *down_ifs
|
||||
);
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipdhcpc6_reply_callback - apply user-defined actions based on DHCPv6 reply
|
||||
*
|
||||
* This callback routine examines each DHCPv6 reply returned by a DHCP server and
|
||||
* can execute user-defined operations for specific replies.
|
||||
*
|
||||
*
|
||||
* Parameter:
|
||||
* \is
|
||||
* \i <event>
|
||||
* The type of event
|
||||
* \ie
|
||||
* RETURNS: Either 'IP_TRUE' or 'IP_FALSE'
|
||||
*
|
||||
* ERRNO:
|
||||
*/
|
||||
IP_PUBLIC Ip_err ipdhcpc6_reply_callback
|
||||
(
|
||||
int event
|
||||
);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,631 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcpc6_attr.h,v $ $Revision: 1.14.38.3 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipdhcpc6/include/ipdhcpc6_attr.h,v $
|
||||
* $Author: jren $ $Date: 2015-06-29 08:24:49 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPDHCPC6_ATTR_H
|
||||
#define IPDHCPC6_ATTR_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include "ipdhcpc6_tagcomm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPDHCPC6_ATTR_TAG_STATUS_UNKNOWN_INTERFACE (IPDHCPC6_TAGCOMM_USER_DEFINED + 1)
|
||||
#define IPDHCPC6_ATTR_TAG_STATUS_UNKNOWN_IA (IPDHCPC6_TAGCOMM_USER_DEFINED + 2)
|
||||
|
||||
#define IPDHCPC6_CMD_IA_INFO IPDHCPC6_TAGCOMM_TAG_CMD(1)
|
||||
#define IPDHCPC6_CMD_IA_REFRESH IPDHCPC6_TAGCOMM_TAG_CMD(2)
|
||||
#define IPDHCPC6_CMD_IA_RELEASE IPDHCPC6_TAGCOMM_TAG_CMD(3)
|
||||
#define IPDHCPC6_CMD_IA_HISTORY_FLUSH IPDHCPC6_TAGCOMM_TAG_CMD(4)
|
||||
#define IPDHCPC6_CMD_IA_RTSOL IPDHCPC6_TAGCOMM_TAG_CMD(5)
|
||||
#define IPDHCPC6_CMD_IA_BOUND_ADD IPDHCPC6_TAGCOMM_TAG_CMD(6)
|
||||
#define IPDHCPC6_CMD_IA_BOUND_DEL IPDHCPC6_TAGCOMM_TAG_CMD(7)
|
||||
|
||||
#define IPDHCPC6_IA_OBJECT_IF IPDHCPC6_TAGCOMM_TAG_OBJ(100) /* attribute if list */
|
||||
/* IPDHCPC6_IA_IDENT_NAME */
|
||||
# define IPDHCPC6_IA_ATTR_IF_MODE IPDHCPC6_TAGCOMM_TAG_ATTR(101) /* u32: mode of interface */
|
||||
# define IPDHCPC6_IA_ATTR_IF_LINK_STATE IPDHCPC6_TAGCOMM_TAG_ATTR(102) /* u32: state of interface */
|
||||
# define IPDHCPC6_IA_ATTR_IF_VR IPDHCPC6_TAGCOMM_TAG_ATTR(103) /* int: VR */
|
||||
# define IPDHCPC6_IA_OBJECT_IF_CONFIG IPDHCPC6_TAGCOMM_TAG_OBJ(200) /* attribute if config list */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_RAPID_COMMIT IPDHCPC6_TAGCOMM_TAG_ATTR(201) /* u32: rapid commit E/D */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_INFO_ONLY IPDHCPC6_TAGCOMM_TAG_ATTR(202) /* u32: information only commit E/D */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_DNS IPDHCPC6_TAGCOMM_TAG_ATTR(203) /* u32: information only commit E/D */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_SNTP IPDHCPC6_TAGCOMM_TAG_ATTR(204) /* u32: information only commit E/D */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_INFO_REFRESH IPDHCPC6_TAGCOMM_TAG_OBJ(205) /* u32: enabled disabled */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_SIP IPDHCPC6_TAGCOMM_TAG_OBJ(206) /* u32: information only commit E/D */
|
||||
# define IPDHCPC6_IA_ATTR_IF_CONFIG_FQDN IPDHCPC6_TAGCOMM_TAG_ATTR(207) /* u32: enabled disabled */
|
||||
# define IPDHCPC6_IA_OBJECT_IF_AUTOMATIC IPDHCPC6_TAGCOMM_TAG_OBJ(300) /* attribute if automatic list */
|
||||
/* IPDHCPC6_IA_OBJECT_SERVER */
|
||||
# define IPDHCPC6_IA_ATTR_IF_AUTOMATIC_MANAGED IPDHCPC6_TAGCOMM_TAG_ATTR(301) /* u32: managed E/D */
|
||||
# define IPDHCPC6_IA_ATTR_IF_AUTOMATIC_OTHER IPDHCPC6_TAGCOMM_TAG_ATTR(302) /* u32: other information E/D */
|
||||
# define IPDHCPC6_IA_OBJECT_IA IPDHCPC6_TAGCOMM_TAG_OBJ(400) /* attribute list */
|
||||
/* IPDHCPC6_IA_OBJECT_SERVER */
|
||||
/* IPDHCPC6_IA_ATTR_TIMESTAMP */
|
||||
/* IPDHCPC6_IA_IDENT_NAME */
|
||||
# define IPDHCPC6_IA_IDENT_IA_IANAME IPDHCPC6_TAGCOMM_TAG_IDENT(401)/* str: IA name */
|
||||
# define IPDHCPC6_IA_IDENT_IA_IAID IPDHCPC6_TAGCOMM_TAG_IDENT(402)/* u32: IAID */
|
||||
# define IPDHCPC6_IA_IDENT_IA_IATYPE IPDHCPC6_TAGCOMM_TAG_IDENT(403)/* u32: IATYPE */
|
||||
# define IPDHCPC6_IA_ATTR_IA_T1 IPDHCPC6_TAGCOMM_TAG_ATTR(404) /* u32: T1 */
|
||||
# define IPDHCPC6_IA_ATTR_IA_T2 IPDHCPC6_TAGCOMM_TAG_ATTR(405) /* u32: T2 */
|
||||
# define IPDHCPC6_IA_ATTR_IA_T1_HINT IPDHCPC6_TAGCOMM_TAG_ATTR(406) /* u32: T1 HINT */
|
||||
# define IPDHCPC6_IA_ATTR_IA_T2_HINT IPDHCPC6_TAGCOMM_TAG_ATTR(407) /* u32: T2 HINT */
|
||||
|
||||
# define IPDHCPC6_IA_OBJECT_STATE IPDHCPC6_TAGCOMM_TAG_OBJ(410) /* struct Ip_in6_addr: dhcp server */
|
||||
/* IPDHCPC6_IA_ATTR_TIMESTAMP */
|
||||
# define IPDHCPC6_IA_ATTR_STATE_STATUS IPDHCPC6_TAGCOMM_TAG_ATTR(411) /* u32: Status */
|
||||
# define IPDHCPC6_IA_ATTR_STATE_ACTION IPDHCPC6_TAGCOMM_TAG_ATTR(412) /* u32: Action */
|
||||
|
||||
# define IPDHCPC6_IA_OBJECT_HISTORY IPDHCPC6_TAGCOMM_TAG_OBJ(429)
|
||||
/* IPDHCPC6_IA_OBJECT_STATE */
|
||||
|
||||
# define IPDHCPC6_IA_OBJECT_BINDING IPDHCPC6_TAGCOMM_TAG_OBJ(430) /* attribute list */
|
||||
# define IPDHCPC6_IA_OBJECT_BINDING_HINT IPDHCPC6_TAGCOMM_TAG_OBJ(431) /* attribute list */
|
||||
/* IPDHCPC6_IA_ATTR_ADDRESS */
|
||||
/* IPDHCPC6_IA_ATTR_TIMESTAMP */
|
||||
# define IPDHCPC6_IA_ATTR_BINDING_PREFIX_PLEN IPDHCPC6_TAGCOMM_TAG_ATTR(432) /* struct u32: Prefix length */
|
||||
# define IPDHCPC6_IA_ATTR_BINDING_PREFIX_PREFERRED IPDHCPC6_TAGCOMM_TAG_ATTR(433) /* struct u32: Preferred time */
|
||||
# define IPDHCPC6_IA_ATTR_BINDING_PREFIX_VALID IPDHCPC6_TAGCOMM_TAG_ATTR(434) /* struct u32: Valid time */
|
||||
# define IPDHCPC6_IA_ATTR_BINDING_PREFIX_STATUS IPDHCPC6_TAGCOMM_TAG_ATTR(435) /* struct u32: Valid time */
|
||||
# define IPDHCPC6_IA_OBJECT_SERVER IPDHCPC6_TAGCOMM_TAG_OBJ(500) /* struct Ip_in6_addr: dhcp server */
|
||||
/* IPDHCPC6_IA_IDENT_DUID */
|
||||
/* IPDHCPC6_IA_ATTR_ADDRESS */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_UNICAST IPDHCPC6_TAGCOMM_TAG_ATTR(501) /* struct Ip_in6_addr: dhcp server */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_DNS_SERVER IPDHCPC6_TAGCOMM_TAG_ATTR(502) /* struct Ip_in6_addr: DNS server */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_DOMAIN_LIST IPDHCPC6_TAGCOMM_TAG_ATTR(503) /* str: Domain Search List */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_INFO_REFRESH IPDHCPC6_TAGCOMM_TAG_OBJ(504) /* u32: time interval */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_SNTP_SERVER IPDHCPC6_TAGCOMM_TAG_ATTR(505) /* struct Ip_in6_addr: SNTP server */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_SIP_D IPDHCPC6_TAGCOMM_TAG_ATTR(506) /* str: SIP server domain list */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_SIP_A IPDHCPC6_TAGCOMM_TAG_ATTR(507) /* struct Ip_in6_addr: SIP server Address */
|
||||
# define IPDHCPC6_IA_ATTR_SERVER_FQDN IPDHCPC6_TAGCOMM_TAG_ATTR(508) /* str: FQDN */
|
||||
|
||||
|
||||
|
||||
#define IPDHCPC6_IA_IDENT_DUID IPDHCPC6_TAGCOMM_TAG_IDENT(900)/* byte array: duid */
|
||||
#define IPDHCPC6_IA_IDENT_NAME IPDHCPC6_TAGCOMM_TAG_IDENT(901)/* str: name */
|
||||
#define IPDHCPC6_IA_ATTR_ADDRESS IPDHCPC6_TAGCOMM_TAG_ATTR(902) /* struct Ip_in6_addr */
|
||||
#define IPDHCPC6_IA_ATTR_TIMESTAMP IPDHCPC6_TAGCOMM_TAG_ATTR(903) /* u32: timestamp */
|
||||
#define IPDHCPC6_IA_ATTR_BIF_INFO IPDHCPC6_TAGCOMM_TAG_ATTR(904) /* str: bound interface name */
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
typedef void (*Ipdhcpc6_attr_array_free_t) (void **ptrp);
|
||||
|
||||
typedef struct Ipdhcpc6_attr_iaident
|
||||
{
|
||||
char *ianame;
|
||||
Ip_u32 iaid;
|
||||
} Ipdhcpc6_attr_iaident_t;
|
||||
|
||||
|
||||
typedef struct Ipdhcpc6_attr_prefix
|
||||
{
|
||||
struct Ip_in6_addr addr;
|
||||
Ip_u32 plen;
|
||||
} Ipdhcpc6_attr_prefix_t;
|
||||
|
||||
|
||||
typedef struct Ipdhcpc6_attr_array
|
||||
{
|
||||
Ip_u32 num;
|
||||
Ip_u32 size;
|
||||
void **array;
|
||||
} Ipdhcpc6_attr_array_t;
|
||||
|
||||
typedef struct Ipdhcpc6_attr_binding
|
||||
{
|
||||
Ipdhcpc6_attr_prefix_t prefix; /* Prefix info for this binding */
|
||||
Ip_u32 preferred; /* Preferred time */
|
||||
Ip_u32 valid; /* Valid time */
|
||||
|
||||
Ip_u32 timestamp; /* Last time T1 / T2 was updated */
|
||||
Ip_u32 status; /* IPDHCPC6_IA_ADDRESS_xx */
|
||||
} Ipdhcpc6_attr_binding_t;
|
||||
|
||||
|
||||
typedef struct Ipdhcpc6_attr_ia_binding
|
||||
{
|
||||
Ip_u32 T1; /* Renew */
|
||||
Ip_u32 T2; /* Rebind */
|
||||
Ip_u32 timestamp; /* Timestamp, relative to T1/T2 */
|
||||
|
||||
Ipdhcpc6_attr_array_t binding; /* Binding: preferred, valid, prefix, etc */
|
||||
Ip_u32 status; /* Status of attribute action (tagcomm status) */
|
||||
} Ipdhcpc6_attr_ia_binding_t;
|
||||
|
||||
|
||||
typedef struct Ipdhcpc6_attr_if_server
|
||||
{
|
||||
struct Ip_in6_addr address; /* Server address */
|
||||
struct Ip_in6_addr unicast; /* Unicast address for the server */
|
||||
|
||||
/* Identity vector */
|
||||
void *id_vector;
|
||||
Ip_size_t id_size;
|
||||
|
||||
Ip_u32 info_refresh; /* Information request interval */
|
||||
|
||||
Ipdhcpc6_attr_array_t dns; /* Collection of known DNS servers */
|
||||
Ipdhcpc6_attr_array_t domain; /* Collection of known DNS domain names */
|
||||
Ipdhcpc6_attr_array_t sntp; /* Collection of known SNTP servers */
|
||||
Ipdhcpc6_attr_array_t sip_d; /* Collection of known sip servers Domain Name List */
|
||||
Ipdhcpc6_attr_array_t sip_a; /* Collection of known sip servers IPv6 Address List */
|
||||
Ipdhcpc6_attr_array_t fqdn; /* Collection of known FQDN */
|
||||
Ipdhcpc6_attr_array_t vendor_spec_info; /* Collection of Vendor-specific Information Option */
|
||||
|
||||
Ip_u32 timestamp;
|
||||
} Ipdhcpc6_attr_if_server_t;
|
||||
|
||||
typedef struct Ipdhcpc6_attr_ia_state
|
||||
{
|
||||
Ip_u32 timestamp; /* Time this ia state was updated */
|
||||
Ip_u32 state; /* Identity association state (Bound, Solicit, etc) */
|
||||
Ip_u32 action; /* Idle, Soliciting, Renewing, etc */
|
||||
} Ipdhcpc6_attr_ia_state_t;
|
||||
|
||||
typedef struct Ipdhcpc6_attr_ia
|
||||
{
|
||||
Ip_u16 status; /* Status of attribute action (tagcomm status) */
|
||||
Ip_u32 iatype; /* Identity association type */
|
||||
char *ianame; /* Identity association name */
|
||||
Ip_u32 iaid; /* Identity association identifier */
|
||||
|
||||
Ipdhcpc6_attr_ia_state_t state; /* Timestamp, state, action attributes */
|
||||
Ipdhcpc6_attr_if_server_t *router; /* Server attributes */
|
||||
|
||||
Ipdhcpc6_attr_ia_binding_t hints; /* Collection of hints (preferred, valid, prefix, etc) */
|
||||
Ipdhcpc6_attr_ia_binding_t bindings; /* Collection of actual bindings */
|
||||
|
||||
Ipdhcpc6_attr_array_t history; /* Collection of IA state (Ipdhcpc6_attr_ia_state) history */
|
||||
} Ipdhcpc6_attr_ia_t;
|
||||
|
||||
/* Configuration attributes for this interface */
|
||||
struct Ipdhcpc6_util_buffer;
|
||||
typedef struct Ipdhcpc6_attr_if_config_fqdn
|
||||
{
|
||||
struct Ipdhcpc6_util_buffer *data; /*buffer for name configured*/
|
||||
Ip_u32 fqdn; /*switch*/
|
||||
Ip_u32 update; /*switch of updating*/
|
||||
Ip_u32 request; /*swithch of requesting in oro*/
|
||||
} Ipdhcpc6_attr_if_config_fqdn_t;
|
||||
typedef struct Ipdhcpc6_attr_if_config
|
||||
{
|
||||
Ip_u32 rapid_commit;
|
||||
Ip_u32 information_only;
|
||||
Ip_u32 dns;
|
||||
Ip_u32 sntp;
|
||||
Ip_u32 info_refresh;
|
||||
Ip_u32 sip;
|
||||
Ip_u32 vendor_spec_info;
|
||||
Ipdhcpc6_attr_if_config_fqdn_t fqdn; /*attribute for controling fqdn on interface*/
|
||||
} Ipdhcpc6_attr_if_config_t;
|
||||
|
||||
typedef struct Ipdhcpc6_attr_if_runtime
|
||||
{
|
||||
Ip_u32 managed; /* Managed mode enabled / disabled */
|
||||
Ip_u32 other; /* Other mode enabled / disabled */
|
||||
} Ipdhcpc6_attr_if_runtime_t;
|
||||
|
||||
/* Configuration parameters for the interface container */
|
||||
typedef struct Ipdhcpc6_attr_if_automatic
|
||||
{
|
||||
struct Ip_in6_addr rtr; /* Server addr */
|
||||
Ipdhcpc6_attr_if_runtime_t runtime; /* Runtime mode (see Ipdhcpc6_attr_if_runtime_t */
|
||||
} Ipdhcpc6_attr_if_automatic_t;
|
||||
|
||||
typedef struct Ipdhcpc6_attr_if
|
||||
{
|
||||
Ip_u16 status; /* Status of attribute action (tagcomm status) */
|
||||
char *ifname; /* Interface name */
|
||||
|
||||
Ipdhcpc6_attr_if_automatic_t *automatic; /* See Ipdhcpc6_attr_if_automatic_t */
|
||||
Ipdhcpc6_attr_if_config_t *config; /* Configuration attributes */
|
||||
Ip_u32 state; /* Interface state (Up / Down / Detached) */
|
||||
Ip_u32 mode; /* Interface mode (Enabled / Disabled / Automatic) */
|
||||
int vr; /* VR */
|
||||
|
||||
Ipdhcpc6_attr_array_t ias; /* Collection of identity associations */
|
||||
Ipdhcpc6_attr_array_t servers; /* Collection of known servers */
|
||||
} Ipdhcpc6_attr_if_t;
|
||||
|
||||
/* Generic 'read' buffer structure */
|
||||
typedef struct Ipdhcpc6_attr_readbuf
|
||||
{
|
||||
Ip_u8 *buffer;
|
||||
|
||||
Ip_size_t total_size;
|
||||
Ip_size_t read_size;
|
||||
} Ipdhcpc6_attr_readbuf_t;
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
extern char *ipdhcpc6_attr_if_link_state_name[];
|
||||
extern char *ipdhcpc6_attr_mode_name[];
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_parse
|
||||
*===========================================================================
|
||||
* Description: Parse an IPDHCPC6_ATTR_IA_IF_OBJECT tag.
|
||||
* Parameters: tag - The tag.
|
||||
* mask - The type of objects we'll parse; 0 = all.
|
||||
* Returns: The interface pointer with its associated IA/BINDINGS.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_attr_if_t *ipdhcpc6_attr_if_parse(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u32 mask);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_free
|
||||
*===========================================================================
|
||||
* Description: Free any resources previously allocated by parse. Will also
|
||||
* free any ias
|
||||
* Parameters: ifobjp - The interface object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_if_free(Ipdhcpc6_attr_if_t **ifobjp);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_automatic_parse
|
||||
*===========================================================================
|
||||
* Description: Parse an IPDHCPC6_IA_OBJECT_IF_AUTOMATIC tag.
|
||||
* Parameters: tag - The tag.
|
||||
* mask - The type of objects we'll parse; 0 = all.
|
||||
* Returns: The interface config pointer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_attr_if_automatic_t *ipdhcpc6_attr_if_automatic_parse(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u32 mask);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_automatic_free
|
||||
*===========================================================================
|
||||
* Description: Free any resources previously allocated by parse.
|
||||
* Parameters: ifautop - The interface automatic object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_if_automatic_free(Ipdhcpc6_attr_if_automatic_t **ifautop);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_config_parse
|
||||
*===========================================================================
|
||||
* Description: Parse an IPDHCPC6_IA_OBJECT_IF_CONFIG tag.
|
||||
* Parameters: tag - The tag.
|
||||
* mask - The type of objects we'll parse; 0 = all.
|
||||
* Returns: The interface config pointer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_attr_if_config_t *ipdhcpc6_attr_if_config_parse(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u32 mask);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_config_free
|
||||
*===========================================================================
|
||||
* Description: Free any resources previously allocated by parse.
|
||||
* Parameters: ifconfigp - The interface config object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_if_config_free(Ipdhcpc6_attr_if_config_t **ifconfigp);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_ia_parse
|
||||
*===========================================================================
|
||||
* Description: Parse an IPDHCPC6_ATTR_IA_IF_IA_OBJECT tag.
|
||||
* Parameters: tag - The tag.
|
||||
* mask - The type of objects we'll parse; 0 = all.
|
||||
* Returns: The identity association pointer with its associated BINDINGS.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_attr_ia_t *ipdhcpc6_attr_ia_parse(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u32 mask);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_server_parse
|
||||
*===========================================================================
|
||||
* Description: Parse an IPDHCPC6_IA_OBJECT_SERVER tag.
|
||||
* Parameters: tag - The tag.
|
||||
* mask - The type of objects we'll parse; 0 = all.
|
||||
* Returns: The interface server pointer
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_attr_if_server_t *ipdhcpc6_attr_if_server_parse(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u32 mask);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_if_server_free
|
||||
*===========================================================================
|
||||
* Description: Free any resources previously allocated by parse.
|
||||
* Parameters: ifsrvp - The interface server object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_if_server_free(Ipdhcpc6_attr_if_server_t **ifsrvp);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_ia_free
|
||||
*===========================================================================
|
||||
* Description: Free any resources previously allocated by parse. Will also
|
||||
* free any bindings
|
||||
* Parameters: iaobjp - The IA object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_ia_free(Ipdhcpc6_attr_ia_t **iaobjp);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_binding_parse
|
||||
*===========================================================================
|
||||
* Description: Parse an IPDHCPC6_IA_OBJECT_BINDING or
|
||||
* IPDHCPC6_IA_OBJECT_BINDING_HINT tag.
|
||||
* Parameters: tag - The tag.
|
||||
* Returns: The binding object
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_attr_binding_t *ipdhcpc6_attr_binding_parse(Ipdhcpc6_tagcomm_tag_t *tag);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_binding_free
|
||||
*===========================================================================
|
||||
* Description: Free any resources previously allocated by parse.
|
||||
* Parameters: bobjp - The binding object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_binding_free(Ipdhcpc6_attr_binding_t **bobjp);
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
* ipdhcpc6_attr_connect
|
||||
*===========================================================================
|
||||
* Description: Create a TCP connection to the DHCPv6 Client
|
||||
* Parameters:
|
||||
* Returns: A file descriptor if successful, IP_INVALID_SOCKET otherwise.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_fd ipdhcpc6_attr_connect(void);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_errno
|
||||
*===========================================================================
|
||||
* Description: Return human readable string representation for error
|
||||
* Parameters: errcode - The errcode
|
||||
* Returns: The human readable string
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL const char *ipdhcpc6_attr_errno(Ip_u32 errcode);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_sendmsg
|
||||
*===========================================================================
|
||||
* Description: Send a message over fd
|
||||
* Parameters: fd - File descriptor.
|
||||
* buf - Pointer to buffer.
|
||||
* Returns: IP_TRUE if successful.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_attr_sendmsg(Ip_fd fd,
|
||||
Ipdhcpc6_tagcomm_buffer_t *buf);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_recvmsg
|
||||
*===========================================================================
|
||||
* Description: Read a message. A buffer holding the entire message will
|
||||
* be dynamically allocated on success.
|
||||
* Parameters: fd - File descriptor.
|
||||
* rbuf - Pointer to buffer pointer. Will hold the
|
||||
* dynamically allocated buffer on success.
|
||||
* Returns: IP_TRUE if successful.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_attr_recvmsg(Ip_fd fd,
|
||||
Ipdhcpc6_attr_readbuf_t *rbuf);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_read
|
||||
*===========================================================================
|
||||
* Description: Read the number of bytes specified by rbuf
|
||||
* Parameters: fd - The filedescriptor to read from
|
||||
* rbuf - The read buffer
|
||||
* block - Block until the entire command is read.
|
||||
* Returns: The number of remaining bytes to read.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_attr_read(Ip_fd fd,
|
||||
Ipdhcpc6_attr_readbuf_t *rbuf,
|
||||
Ip_bool block);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_recvhdr
|
||||
*===========================================================================
|
||||
* Description: Read the header of a command, and allocate the required
|
||||
* buffer space.
|
||||
* Parameters: fd - File descriptor
|
||||
* rbuf - Read buffer.
|
||||
* Returns: IP_TRUE if successful.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_attr_recvhdr(Ip_fd fd,
|
||||
Ipdhcpc6_attr_readbuf_t *rbuf);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_ia_action
|
||||
*===========================================================================
|
||||
* Description: Return the human readable name of the action
|
||||
* Parameters: action - The action
|
||||
* Returns: The human readable name
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL const char *ipdhcpc6_attr_ia_action(Ip_u32 action);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_ia_status
|
||||
*===========================================================================
|
||||
* Description: Return the human readable name of the status
|
||||
* Parameters: status - The status
|
||||
* Returns: The human readable name
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL const char *ipdhcpc6_attr_ia_status(Ip_u32 status);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_array_add
|
||||
*===========================================================================
|
||||
* Description: Add an element to an array; allocate the array or increase
|
||||
* it if required.
|
||||
* Parameters: array - Pointer to the array
|
||||
* object - Object
|
||||
* size - Size of object; if zero, don't copy. Store as is.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_array_add(Ipdhcpc6_attr_array_t *array,
|
||||
void *object,
|
||||
Ip_size_t size);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_array_free
|
||||
*===========================================================================
|
||||
* Description: Free the array and its elements.
|
||||
* Parameters: array - The array
|
||||
* freefunc - Option function to invoke per element.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_array_free(Ipdhcpc6_attr_array_t *array,
|
||||
Ipdhcpc6_attr_array_free_t freefunc);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_array_remove
|
||||
*===========================================================================
|
||||
* Description: Remove a particular element from the array
|
||||
* Parameters: array - The array
|
||||
* obj - The object
|
||||
* freefunc - The free function.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_array_remove(Ipdhcpc6_attr_array_t *array,
|
||||
void *obj,
|
||||
Ipdhcpc6_attr_array_free_t freefunc);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_server_set_unicast
|
||||
*===========================================================================
|
||||
* Description: Set a unicast address
|
||||
* Parameters: srv - The server attributes
|
||||
* addr - Address
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_attr_server_set_unicast(Ipdhcpc6_attr_if_server_t *srv,
|
||||
const struct Ip_in6_addr *addr);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_server_unicast
|
||||
*===========================================================================
|
||||
* Description: Returns the unicast address for a server
|
||||
* Parameters: srv - The server attributes
|
||||
* Returns: The unicast address if it exists.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL const struct Ip_in6_addr *ipdhcpc6_attr_server_unicast(Ipdhcpc6_attr_if_server_t *srv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,474 @@
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
* HEADER FILE
|
||||
*
|
||||
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcpc6_tagcomm.h,v $ $Revision: 1.4.56.1 $
|
||||
* $Source: /home/interpeak/CVSRoot/ipdhcpc6/include/ipdhcpc6_tagcomm.h,v $
|
||||
* $Author: ulf $ $Date: 2011-11-16 10:33:26 $
|
||||
* $State: Exp $ $Locker: $
|
||||
*
|
||||
* INTERPEAK_COPYRIGHT_STRING
|
||||
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef IPDHCPC6_TAGCOMM_H
|
||||
#define IPDHCPC6_TAGCOMM_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
#define IPDHCPC6_TAGCOMM_STATUS_OK (0)
|
||||
#define IPDHCPC6_TAGCOMM_STATUS_UNKNOWN_TAG (1)
|
||||
#define IPDHCPC6_TAGCOMM_STATUS_PARSE_FAILED (2)
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_USER_DEFINED (2000)
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ATTRIBUTE (0x80000000)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_OBJECT (0x40000000)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_COMMAND (0x20000000)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_IDENTITY (0x10000000)
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_TAG_MASK (0xff000000)
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ATTR(x) ((x) | IPDHCPC6_TAGCOMM_TAG_ATTRIBUTE)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_OBJ(x) ((x) | IPDHCPC6_TAGCOMM_TAG_OBJECT)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_IDENT(x) ((x) | IPDHCPC6_TAGCOMM_TAG_IDENTITY)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_CMD(x) ((x) | IPDHCPC6_TAGCOMM_TAG_COMMAND)
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ISTYPE(x,t) (((x) & IPDHCPC6_TAGCOMM_TAG_MASK) == (t))
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ISATTR(x) IPDHCPC6_TAGCOMM_TAG_ISTYPE(x, IPDHCPC6_TAGCOMM_TAG_ATTRIBUTE)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ISOBJ(x) IPDHCPC6_TAGCOMM_TAG_ISTYPE(x, IPDHCPC6_TAGCOMM_TAG_OBJECT)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ISIDENT(x) IPDHCPC6_TAGCOMM_TAG_ISTYPE(x, IPDHCPC6_TAGCOMM_TAG_IDENTITY)
|
||||
#define IPDHCPC6_TAGCOMM_TAG_ISCMD(x) IPDHCPC6_TAGCOMM_TAG_ISTYPE(x, IPDHCPC6_TAGCOMM_TAG_COMMAND)
|
||||
|
||||
|
||||
#define IPDHCPC6_TAGCOMM_TAG_DATA(tag) ((Ip_u8 *)(tag) + sizeof(Ipdhcpc6_tagcomm_tag_t))
|
||||
#define IPDHCPC6_TAGCOMM_TAG_SIZE(tag) ((tag)->length - sizeof(Ipdhcpc6_tagcomm_tag_t))
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
typedef struct Ipdhcpc6_tagcomm_tag
|
||||
{
|
||||
Ip_u32 tag;
|
||||
Ip_u16 length;
|
||||
Ip_u16 status;
|
||||
} Ipdhcpc6_tagcomm_tag_t;
|
||||
|
||||
|
||||
typedef struct Ipdhcpc6_tagcomm_buffer
|
||||
{
|
||||
Ip_u8 *head;
|
||||
Ip_u16 offset;
|
||||
|
||||
Ip_u16 data_offset[8];
|
||||
Ip_u8 data_depth;
|
||||
|
||||
Ip_size_t size_alloc;
|
||||
Ip_size_t size_remain;
|
||||
} Ipdhcpc6_tagcomm_buffer_t;
|
||||
|
||||
|
||||
typedef struct Ipdhcpc6_tagcomm_parse
|
||||
{
|
||||
Ip_u8 *buf;
|
||||
Ip_size_t buf_size;
|
||||
Ip_size_t next_tag;
|
||||
Ip_size_t tag_count;
|
||||
} Ipdhcpc6_tagcomm_parse_t;
|
||||
|
||||
|
||||
typedef int (*Ipdhcpc6_tagcomm_parse_object_t)
|
||||
(
|
||||
void *opaque,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag
|
||||
);
|
||||
|
||||
typedef struct Ipdhcpc6_tagcomm_parser
|
||||
{
|
||||
Ip_u32 tag; /* Tag to match */
|
||||
Ipdhcpc6_tagcomm_parse_object_t func;
|
||||
} Ipdhcpc6_tagcomm_parser_t;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_add_tag
|
||||
*===========================================================================
|
||||
* Description: Add a tag.
|
||||
* Parameters: buf - The buffer
|
||||
* tag - The tag
|
||||
* status - Status
|
||||
* data - Data block; May be NULL.
|
||||
* size - The size of data.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_add_tag(Ipdhcpc6_tagcomm_buffer_t *buf,
|
||||
Ip_u32 tag,
|
||||
Ip_u16 status,
|
||||
void *data,
|
||||
Ip_size_t size);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_enter_tag
|
||||
*===========================================================================
|
||||
* Description: Enter a tag.
|
||||
* Parameters: buf - The buffer to enter the tag in.
|
||||
* tag - The tag to enter.
|
||||
* status - Status of the tag.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_enter_tag(Ipdhcpc6_tagcomm_buffer_t *buf,
|
||||
Ip_u32 tag,
|
||||
Ip_u16 status);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_add_data
|
||||
*===========================================================================
|
||||
* Description: Add data to the current tag.
|
||||
* Parameters: buf - The buffer
|
||||
* data - Data to add
|
||||
* size - The size.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_add_data(Ipdhcpc6_tagcomm_buffer_t *buf,
|
||||
void *data,
|
||||
Ip_size_t size);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_leave_tag
|
||||
*===========================================================================
|
||||
* Description: Leave a tag
|
||||
* Parameters: buf - The buffer to leave the tag in.
|
||||
* Returns: The size of the just left tag.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_u16 ipdhcpc6_tagcomm_leave_tag(Ipdhcpc6_tagcomm_buffer_t *buf);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_buffer_alloc
|
||||
*===========================================================================
|
||||
* Description: Allocate an API buffer.
|
||||
* Parameters:
|
||||
* Returns: A buffer if successful
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_tagcomm_buffer_t *ipdhcpc6_tagcomm_buffer_alloc(void);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_buffer_free
|
||||
*===========================================================================
|
||||
* Description: Free an ATTR buffer
|
||||
* Parameters: bufp - Pointer to placeholder of buffer.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_buffer_free(Ipdhcpc6_tagcomm_buffer_t **bufp);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_verify_tag
|
||||
*===========================================================================
|
||||
* Description: Verify that a tag is sane.
|
||||
* Parameters: tag - The tag.
|
||||
* tot_len - Total length.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_tagcomm_verify_tag(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_size_t tot_len);
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_attr_api_parse_init
|
||||
*===========================================================================
|
||||
* Description: Initialize a block for parsing
|
||||
* Parameters: parse - The parse context
|
||||
* data - The data block
|
||||
* dsize - The size of the data block.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_parse_init(Ipdhcpc6_tagcomm_parse_t *parse,
|
||||
void *data,
|
||||
Ip_size_t dsize);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_next
|
||||
*===========================================================================
|
||||
* Description: Retrieve the next tag from the parse context.
|
||||
* Parameters: parse - Parse context.
|
||||
* Returns: The next tag, or IP_NULL if there's no more valid tags.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ipdhcpc6_tagcomm_tag_t *ipdhcpc6_tagcomm_parse_next(Ipdhcpc6_tagcomm_parse_t *parse);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_restart
|
||||
*===========================================================================
|
||||
* Description: Reset a parse object to its initial values.
|
||||
* Parameters: parse - The parse object.
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_parse_restart(Ipdhcpc6_tagcomm_parse_t *parse);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_failure
|
||||
*===========================================================================
|
||||
* Description: Generate a tag failure reply
|
||||
* Parameters:
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL void ipdhcpc6_tagcomm_failure(Ipdhcpc6_tagcomm_buffer_t *response,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u16 status);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse
|
||||
*===========================================================================
|
||||
* Description: Parse a command based on tag a data block and a parse array.
|
||||
* Parameters: parser - The parser array
|
||||
* errfunc - Function invoked if encountering an unknown tag
|
||||
* tag - tag data block
|
||||
* opaque - Opaque.
|
||||
* Returns: The return code.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse(Ipdhcpc6_tagcomm_parser_t *parser,
|
||||
Ipdhcpc6_tagcomm_parse_object_t errfunc,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_attributes
|
||||
*===========================================================================
|
||||
* Description: Parse all attribute flagged tags
|
||||
* Parameters: parsefunc - Parser callback.
|
||||
* tag - Tag data block
|
||||
* opaque - Opaque.
|
||||
* Returns: The return code.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_attributes(Ipdhcpc6_tagcomm_parse_object_t parsefunc,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_objects
|
||||
*===========================================================================
|
||||
* Description: Parse all object flagged tags
|
||||
* Parameters: parsefunc - Parser callback.
|
||||
* tag - Tag data block
|
||||
* opaque - Opaque.
|
||||
* Returns: The return code.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_objects(Ipdhcpc6_tagcomm_parse_object_t parsefunc,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_identity
|
||||
*===========================================================================
|
||||
* Description: Parse all identity flagged tags
|
||||
* Parameters: parsefunc - Parser callback.
|
||||
* tag - Tag data block
|
||||
* opaque - Opaque.
|
||||
* Returns: The return code.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_identities(Ipdhcpc6_tagcomm_parse_object_t parsefunc,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
void *opaque);
|
||||
|
||||
#if 0 /* no use for coverage */
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_all
|
||||
*===========================================================================
|
||||
* Description: Parse all tags
|
||||
* Parameters: parsefunc - Parser callback.
|
||||
* tag - Tag data block
|
||||
* opaque - Opaque.
|
||||
* Returns: The return code.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_all(Ipdhcpc6_tagcomm_parse_object_t parsefunc,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_count
|
||||
*===========================================================================
|
||||
* Description: Count all tags of the specified type
|
||||
* Parameters: tagval - The value to look for
|
||||
* tag - Tag data block
|
||||
* Returns: The number of matching tags.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_count(Ip_u32 tagval,
|
||||
Ipdhcpc6_tagcomm_tag_t *tag);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_count_identities
|
||||
*===========================================================================
|
||||
* Description: Count all identity tags
|
||||
* Parameters: tag - Tag data block
|
||||
* Returns: The number of matching tags.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_count_identities(Ipdhcpc6_tagcomm_tag_t *tag);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_count_attributes
|
||||
*===========================================================================
|
||||
* Description: Count all attribute tags
|
||||
* Parameters: tag - Tag data block
|
||||
* Returns: The number of matching tags.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_count_attributes(Ipdhcpc6_tagcomm_tag_t *tag);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_parse_count_objects
|
||||
*===========================================================================
|
||||
* Description: Count all object tags
|
||||
* Parameters: tag - Tag data block
|
||||
* Returns: The number of matching tags.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL int ipdhcpc6_tagcomm_parse_count_objects(Ipdhcpc6_tagcomm_tag_t *tag);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_tag_string
|
||||
*===========================================================================
|
||||
* Description: Verify that a tag's string is properly zero terminated.
|
||||
* Parameters: tag - The tag
|
||||
* strp - Where to store the string if successful
|
||||
* Returns: IP_TRUE if successful.
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_tagcomm_tag_string(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
char **strp);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_tag_u32
|
||||
*===========================================================================
|
||||
* Description: Verify that a tag's u32 value is proper
|
||||
* Parameters: tag - The tag
|
||||
* valp - Value pointer
|
||||
* Returns: IP_TRUE if successful
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_tagcomm_tag_u32(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
Ip_u32 *valp);
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* ipdhcpc6_tagcomm_tag_in6_addr
|
||||
*===========================================================================
|
||||
* Description: Verify that a tag's v6 address value is proper
|
||||
* Parameters: tag - The tag
|
||||
* in6p - Value pointer
|
||||
* Returns: IP_TRUE if successful
|
||||
*
|
||||
*/
|
||||
IP_GLOBAL Ip_bool ipdhcpc6_tagcomm_tag_in6_addr(Ipdhcpc6_tagcomm_tag_t *tag,
|
||||
struct Ip_in6_addr *in6p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
Reference in New Issue
Block a user