/* ****************************************************************************** * INTERPEAK SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6_sysext.c,v $ $Revision: 1.5 $ * $Source: /home/interpeak/CVSRoot/ipmip6/src/ipmip6_sysext.c,v $ * $Author: jhorteli $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipmip6_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #define IPCOM_USE_CLIB_PROTO #include #include #include #include #include #include #include #include #include #include #include "ipmip6_h.h" #include #include /* **************************************************************************** * 4 DEFINES **************************************************************************** */ /* **************************************************************************** * 5 TYPES **************************************************************************** */ /* **************************************************************************** * 6 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 STATIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * 10 GLOBAL FUNCTIONS **************************************************************************** */ /* *=========================================================================== * ipmip4_sysext_nai_mn *=========================================================================== * Description: Parse and create a NAI MN from a sysvar * Parameters: format - The sysvar format key. * ... - Optional arguments * Returns: * */ IP_GLOBAL Ipmip6_mh_mo_hdr_t * ipmip6_sysext_nai(Ip_u8 subtype, const char *format, /* args */ ...) { va_list ap; char *nai; Ipmip6_mh_mo_hdr_t *mo = IP_NULL; va_start(ap, format); nai = ipmip_vsysvar(format, ap); va_end(ap); if (nai != IP_NULL) { Ip_size_t nai_len = ipcom_strlen(nai); if (nai_len >= 3) { mo = ipcom_calloc(1, nai_len + 2 + sizeof(*mo)); /* */ if (mo != IP_NULL) { Ip_u8 *dptr = (Ip_u8 *)(mo + 1); mo->val = IPMIP6_MH_MO_MOBILE_NODE_IDENTIFIER; mo->len = nai_len + 1; *dptr++ = subtype; ipcom_memcpy(dptr, nai, nai_len); } } ipcom_free(nai); } return mo; } /* *=========================================================================== * ipmip4_sysext_nai_mn *=========================================================================== * Description: Parse and create a NAI MN from a sysvar * Parameters: format - The sysvar format key. * ... - Optional arguments * Returns: * */ IP_GLOBAL Ipmip6_mh_mo_service_selection_mobility_option_t * ipmip6_sysext_service_selection(const char *format, /* args */ ...) { va_list ap; char *sel; Ipmip6_mh_mo_service_selection_mobility_option_t *mo = IP_NULL; va_start(ap, format); sel = ipmip_vsysvar(format, ap); va_end(ap); if (sel != IP_NULL) { mo = ipmip6_util_mo_service_selection(sel); ipcom_free(sel); } return mo; } /* **************************************************************************** * 11 PUBLIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * END OF FILE **************************************************************************** */