233 lines
7.0 KiB
C
233 lines
7.0 KiB
C
|
|
/*
|
|
******************************************************************************
|
|
* INTERPEAK SOURCE FILE
|
|
*
|
|
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcpc6_ia_ta.c,v $ $Revision: 1.12 $
|
|
* $Source: /home/interpeak/CVSRoot/ipdhcpc6/src/ipdhcpc6_ia_ta.c,v $
|
|
* $Author: zluo0 $
|
|
* $State: Exp $ $Locker: $
|
|
*
|
|
* INTERPEAK_COPYRIGHT_STRING
|
|
* Design and implementation by Joel Hortelius <joel.hortelis@interpeak.se>
|
|
******************************************************************************
|
|
*/
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 1 DESCRIPTION
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 2 CONFIGURATION
|
|
****************************************************************************
|
|
*/
|
|
#ifdef IPDHCPC6_IA_TA_SUPPORT
|
|
#include "ipdhcpc6_config.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 3 INCLUDE FILES
|
|
****************************************************************************
|
|
*/
|
|
|
|
#define IPCOM_USE_CLIB_PROTO
|
|
#include <ipcom_clib.h>
|
|
#include <ipcom_sock.h>
|
|
#include <ipcom_sock6.h>
|
|
#include <ipcom_tmo2.h>
|
|
#include <ipcom_list.h>
|
|
#include <ipcom_hash.h>
|
|
|
|
#include "ipdhcpc6.h"
|
|
#include "ipdhcpc6_h.h"
|
|
#include "ipdhcpc6_msg.h"
|
|
#include "ipdhcpc6_if.h"
|
|
#include "ipdhcpc6_ia.h"
|
|
#include "ipdhcpc6_ia_na.h"
|
|
#include "ipdhcpc6_attr.h"
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 4 DEFINES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 5 TYPES
|
|
****************************************************************************
|
|
*/
|
|
typedef struct Ipdhcpc6_ia_ta
|
|
{
|
|
Ipdhcpc6_ia_t ia;
|
|
Ipdhcpc6_attr_ia_binding_t hints;
|
|
} Ipdhcpc6_ia_ta_t;
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 6 EXTERN PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 7 LOCAL PROTOTYPES
|
|
****************************************************************************
|
|
*/
|
|
IP_STATIC Ip_bool ipdhcpc6_ia_ta_configure(Ipdhcpc6_ia_ta_t *iap);
|
|
IP_STATIC void ipdhcpc6_ia_ta_deallocate(Ipdhcpc6_ia_ta_t *iap);
|
|
IP_STATIC void ipdhcpc6_ia_ta_reconfigure(Ipdhcpc6_ia_ta_t *iap);
|
|
IP_STATIC Ipdhcpc6_ia_t *ipdhcpc6_ia_ta_allocate(void);
|
|
IP_STATIC void ipdhcpc6_ia_ta_attributes(Ip_u32 cmd,
|
|
Ipdhcpc6_ia_ta_t *ia,
|
|
Ipdhcpc6_tagcomm_tag_t *tag,
|
|
Ipdhcpc6_tagcomm_buffer_t *response);
|
|
IP_STATIC void ipdhcpc6_ia_ta_ifevent(Ipdhcpc6_ia_ta_t *ia,
|
|
Ipcom_hash *table,
|
|
Ip_u32 ostate,
|
|
Ip_u32 nstate);
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 8 DATA
|
|
****************************************************************************
|
|
*/
|
|
|
|
Ipdhcpc6_ia_table_t ipdhcpc6_ia_ta_table =
|
|
{
|
|
IPDHCPC6_IA_TYPE_TA,
|
|
"ia_ta",
|
|
(Ipdhcpc6_ia_configure_t)ipdhcpc6_ia_ta_configure,
|
|
(Ipdhcpc6_ia_deallocate_t)ipdhcpc6_ia_ta_deallocate,
|
|
(Ipdhcpc6_ia_allocate_t)ipdhcpc6_ia_ta_allocate,
|
|
(Ipdhcpc6_ia_attributes_t)ipdhcpc6_ia_ta_attributes,
|
|
(Ipdhcpc6_ia_ifevent_t)ipdhcpc6_ia_ta_ifevent,
|
|
(Ipdhcpc6_ia_reconfigure_t)ipdhcpc6_ia_ta_reconfigure
|
|
};
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 9 STATIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
|
|
IP_STATIC Ip_bool
|
|
ipdhcpc6_ia_ta_configure(Ipdhcpc6_ia_ta_t *iap)
|
|
{
|
|
/* Read the configuration parameters for this IA_TA */
|
|
ipdhcpc6_ia_sysvar_hints(&iap->ia, &iap->hints);
|
|
|
|
return IP_TRUE;
|
|
}
|
|
|
|
IP_STATIC void
|
|
ipdhcpc6_ia_ta_deallocate(Ipdhcpc6_ia_ta_t *iap)
|
|
{
|
|
ipdhcpc6_attr_array_free(&iap->hints.binding,
|
|
(Ipdhcpc6_attr_array_free_t)ipdhcpc6_attr_binding_free);
|
|
}
|
|
|
|
IP_STATIC Ipdhcpc6_ia_t *
|
|
ipdhcpc6_ia_ta_allocate(void)
|
|
{
|
|
Ipdhcpc6_ia_ta_t *iap = ipcom_calloc(1, sizeof(*iap));
|
|
if (iap)
|
|
{
|
|
/* Return it */
|
|
return &iap->ia;
|
|
}
|
|
|
|
return IP_NULL;
|
|
}
|
|
|
|
|
|
IP_STATIC void
|
|
ipdhcpc6_ia_ta_attributes(Ip_u32 cmd,
|
|
Ipdhcpc6_ia_ta_t *ia,
|
|
Ipdhcpc6_tagcomm_tag_t *tag,
|
|
Ipdhcpc6_tagcomm_buffer_t *response)
|
|
{
|
|
ipdhcpc6_tagcomm_enter_tag(response,
|
|
IPDHCPC6_IA_OBJECT_IA,
|
|
IPDHCPC6_TAGCOMM_STATUS_OK);
|
|
|
|
ipdhcpc6_ia_attr_header(&ia->ia, response);
|
|
|
|
if (cmd == IPDHCPC6_CMD_IA_INFO)
|
|
{
|
|
/* Dump all information */
|
|
|
|
/* Dump hints */
|
|
ipdhcpc6_ia_attr_bindings(&ia->hints, response, IP_TRUE);
|
|
}
|
|
else if (cmd == IPDHCPC6_CMD_IA_HISTORY_FLUSH)
|
|
{
|
|
ipdhcpc6_attr_array_free(&ia->ia.history, (Ipdhcpc6_attr_array_free_t) ipdhcpc6_util_free);
|
|
}
|
|
|
|
|
|
ipdhcpc6_tagcomm_leave_tag(response);
|
|
}
|
|
|
|
|
|
IP_STATIC void
|
|
ipdhcpc6_ia_ta_ifevent(Ipdhcpc6_ia_ta_t *ia,
|
|
Ipcom_hash *table,
|
|
Ip_u32 ostate,
|
|
Ip_u32 nstate)
|
|
{
|
|
if (nstate == IPDHCPC6_IF_STATE_UP)
|
|
{
|
|
}
|
|
else if (nstate == IPDHCPC6_IF_STATE_DOWN)
|
|
{
|
|
if (ostate == IPDHCPC6_IF_STATE_UP)
|
|
{
|
|
/* REMOVE ALL TRANSACTIONS */
|
|
}
|
|
else if (ostate == IPDHCPC6_IF_STATE_DETACHED)
|
|
{
|
|
/* RE-ADD ANY BINDINGS PRIOR TO CONFIRM */
|
|
}
|
|
}
|
|
else if (nstate == IPDHCPC6_IF_STATE_DETACHED)
|
|
{
|
|
if (ostate != IPDHCPC6_IF_STATE_DOWN)
|
|
{
|
|
/* REMOVE ALL TRANSACTIONS */
|
|
}
|
|
|
|
/* REMOVE ALL BINDINGS */
|
|
}
|
|
}
|
|
|
|
IP_STATIC void
|
|
ipdhcpc6_ia_ta_reconfigure(Ipdhcpc6_ia_ta_t *iap)
|
|
{
|
|
}
|
|
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 10 GLOBAL FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* 11 PUBLIC FUNCTIONS
|
|
****************************************************************************
|
|
*/
|
|
|
|
/*
|
|
****************************************************************************
|
|
* END OF FILE
|
|
****************************************************************************
|
|
*/
|
|
#endif
|