/* ****************************************************************************** * INTERPEAK SOURCE FILE * * Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipmip6mn_service_selection.c,v $ $Revision: 1.5 $ * $Source: /home/interpeak/CVSRoot/ipmip6mn/config/ipmip6mn_service_selection.c,v $ * $Author: jhorteli $ * $State: Exp $ $Locker: $ * * INTERPEAK_COPYRIGHT_STRING * Design and implementation by Joel Hortelius ****************************************************************************** */ /* **************************************************************************** * 1 DESCRIPTION **************************************************************************** */ /* **************************************************************************** * 2 CONFIGURATION **************************************************************************** */ #include "ipmip6mn_config.h" /* **************************************************************************** * 3 INCLUDE FILES **************************************************************************** */ #define IPCOM_USE_CLIB_PROTO #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ipmip6mn_h.h" #include "ipmip6mn_pktbuf.h" #include "ipmip6mn_bc.h" #include "ipmip6mn_mh.h" #include "ipmip6mn_mh_ha.h" #include "ipmip6mn_mib_update.h" #include "ipmip6mn_route.h" #include "ipmip6mn_attr_h.h" /* **************************************************************************** * 4 DEFINES **************************************************************************** */ #define IPMIP6MN_SERVICE_SELECTION_NAME "service-selection" /* **************************************************************************** * 5 TYPES **************************************************************************** */ typedef struct Ipmip6mn_service_selection_config { Ipmip6_mh_mo_service_selection_mobility_option_t *selection; } Ipmip6mn_service_selection_config_t; /* **************************************************************************** * 6 EXTERN PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 7 LOCAL PROTOTYPES **************************************************************************** */ /* **************************************************************************** * 8 DATA **************************************************************************** */ /* **************************************************************************** * 9 STATIC FUNCTIONS **************************************************************************** */ IP_STATIC void ipmip6mn_service_selection_request_apply(struct Ipmip6mn_context *ctx, struct Ipmip_proc *proc, struct Ipmip6mn_node *node, struct Ipmip6mn_node_config *cfg, Ipmip6mn_service_selection_config_t *priv_cfg, void *node_data, struct Ipmip6mn_pktbuf *pbuf, struct Ipmip6_bc *bc) { IPMIP_UNUSED_PARAMETER(node_data); IPMIP_UNUSED_PARAMETER(node); IPMIP_UNUSED_PARAMETER(cfg); if (priv_cfg->selection != IP_NULL) { /* This BC is not yet registered? */ if (bc->mip6MnBLTable.mip6MnBLAccepted == IP_FALSE) { IPMIP6_EVENT_IF(INFO, proc, ipmip_log_event_add(&ctx->ipmip6.ipmip, proc, "%s requesting service selection '%s'", node->name, (char *)&priv_cfg->selection->identifier[0])); ipmip6_mh_pkt_opt_add_mo(&ctx->ipmip6, proc, &pbuf->ipmip6, &priv_cfg->selection->hdr); } } } IP_STATIC void ipmip6mn_service_selection_config(struct Ipmip6mn_context *ctx, struct Ipmip_proc *proc, int action, struct Ipmip6mn_node *node, struct Ipmip6mn_node_config *cfg, Ipmip6mn_service_selection_config_t *priv_cfg, Ipmip_cli_message_t *request) { IPMIP_UNUSED_PARAMETER(ctx); IPMIP_UNUSED_PARAMETER(proc); IPMIP_UNUSED_PARAMETER(cfg); if (action == IPMIP_CALLBACK_CONFIG_READ) { priv_cfg->selection = ipmip6_sysext_service_selection("ipmip6mn.%s.service_selection", node->name); } else if (action == IPMIP_CALLBACK_CONFIG_FREE) { if (priv_cfg->selection) ipcom_free(priv_cfg->selection); } else if (action == IPMIP_CALLBACK_CONFIG_DUMP) { if (priv_cfg->selection) { ipmip_cli_config_printf(&request->message, "ipmip6mn.%s.service_selection=%s", node->name, (char *)&priv_cfg->selection->identifier[0]); } } } /* **************************************************************************** * 10 GLOBAL FUNCTIONS **************************************************************************** */ IP_GLOBAL void ipmip6mn_service_selection_install(struct Ipmip6mn_context *ctx); IP_GLOBAL void ipmip6mn_service_selection_install(struct Ipmip6mn_context *ctx) { static Ipmip6mn_extension_t srv; srv.name = IPMIP6MN_SERVICE_SELECTION_NAME; srv.node_config_size = sizeof(Ipmip6mn_service_selection_config_t); srv.config = (Ipmip6mn_extension_config_t)ipmip6mn_service_selection_config; srv.pkt_req_apply = (Ipmip6mn_extension_req_apply_t)ipmip6mn_service_selection_request_apply; /* This is a PMIP only feature */ ipmip6mn_context_register_extension(ctx, &srv); } /* **************************************************************************** * 11 PUBLIC FUNCTIONS **************************************************************************** */ /* **************************************************************************** * END OF FILE **************************************************************************** */