int32_t tsc_selectors_ucm_setoptparams (struct cm_array_of_iv_pairs *pOptParams, struct nsc_selector_node_key* key_info) { uint32_t uiOptParamCnt; CM_CBK_DEBUG_PRINT ("Entered"); for (uiOptParamCnt = 0; uiOptParamCnt < pOptParams->count_ui; uiOptParamCnt++) { switch (pOptParams->iv_pairs[uiOptParamCnt].id_ui) { case CM_DM_TSC_SELECTOR_SIP_ID: CM_CBK_DEBUG_PRINT ("debug"); if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p,&(key_info->src_ip)) != OF_SUCCESS) return OF_FAILURE; break; case CM_DM_TSC_SELECTOR_DIP_ID: CM_CBK_DEBUG_PRINT ("debug"); if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p,&(key_info->dst_ip)) != OF_SUCCESS) return OF_FAILURE; break; case CM_DM_TSC_SELECTOR_DSTPORT_ID: CM_CBK_DEBUG_PRINT ("debug"); key_info->dst_port = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_TSC_SELECTOR_PROTOCOL_ID : CM_CBK_DEBUG_PRINT ("debug"); key_info->protocol = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; } } CM_CBK_PRINT_IVPAIR_ARRAY (pOptParams); return OF_SUCCESS; }
int32_t crm_subnet_ucm_setmandparams (struct cm_array_of_iv_pairs *pMandParams, struct crm_subnet_config_info *sub_config_info, struct cm_app_result ** presult_p) { uint32_t uiMandParamCnt; char *ip_addr=NULL; CM_CBK_DEBUG_PRINT ("Entered"); for (uiMandParamCnt = 0; uiMandParamCnt < pMandParams->count_ui;uiMandParamCnt++) { switch(pMandParams->iv_pairs[uiMandParamCnt].id_ui) { case CM_DM_SUBNET_NAME_ID: CM_CBK_DEBUG_PRINT ("subnet_name:%s",(char *) pMandParams->iv_pairs[uiMandParamCnt].value_p); of_strncpy (sub_config_info->subnet_name, (char *) pMandParams->iv_pairs[uiMandParamCnt].value_p, pMandParams->iv_pairs[uiMandParamCnt].value_length); break; case CM_DM_SUBNET_VNNAME_ID: CM_CBK_DEBUG_PRINT ("vn_name:%s",(char *) pMandParams->iv_pairs[uiMandParamCnt].value_p); of_strncpy (sub_config_info->vn_name, (char *) pMandParams->iv_pairs[uiMandParamCnt].value_p, pMandParams->iv_pairs[uiMandParamCnt].value_length); break; case CM_DM_SUBNET_CIDRIP_ID: CM_CBK_DEBUG_PRINT ("subnet_ip:%s",(char *) pMandParams->iv_pairs[uiMandParamCnt].value_p); if(cm_val_and_conv_aton((char *)pMandParams->iv_pairs[uiMandParamCnt].value_p,&(sub_config_info->cidr_ip))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_CIDRMASK_ID: CM_CBK_DEBUG_PRINT ("subnet_mask:%s",(char *) pMandParams->iv_pairs[uiMandParamCnt].value_p); if(cm_val_and_conv_aton((char *)pMandParams->iv_pairs[uiMandParamCnt].value_p,&(sub_config_info->cidr_mask))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_IP_VERSION_ID: CM_CBK_DEBUG_PRINT ("ip_version:%s",(char *) pMandParams->iv_pairs[uiMandParamCnt].value_p); if(of_atoi((char *)pMandParams->iv_pairs[uiMandParamCnt].value_p)==4) sub_config_info->ip_version=of_atoi((char *)pMandParams->iv_pairs[uiMandParamCnt].value_p); else return CM_GLU_SUBNET_IP_VERSION_INVALID; break; } } CM_CBK_PRINT_IVPAIR_ARRAY (pMandParams); return OF_SUCCESS; }
int32_t of_fw4_conntemplates_setoptparams ( struct cm_array_of_iv_pairs *pOptParams, struct fw4_conn_templates_config *config_info_p, struct cm_app_result ** presult_p) { uint32_t uiOptParamCnt; CM_CBK_DEBUG_PRINT ("Entered"); for (uiOptParamCnt = 0; uiOptParamCnt < pOptParams->count_ui; uiOptParamCnt++) { switch (pOptParams->iv_pairs[uiOptParamCnt].id_ui) { case CM_DM_CONNTEMPLATES_SOURCEIP_ID: CM_CBK_DEBUG_PRINT ("src_ip:%s",\ (char *)pOptParams->iv_pairs[uiOptParamCnt].value_p); if(cm_val_and_conv_aton( (char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,\ &(config_info_p->src_ip))!=OF_SUCCESS) { return OF_FAILURE; } break; case CM_DM_CONNTEMPLATES_DESTIP_ID: CM_CBK_DEBUG_PRINT ("dest_ip:%s", (char *)pOptParams->iv_pairs[uiOptParamCnt].value_p); if(cm_val_and_conv_aton( (char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,\ &(config_info_p->dst_ip))!=OF_SUCCESS) { return OF_FAILURE; } break; case CM_DM_CONNTEMPLATES_SOURCEPORT_ID: CM_CBK_DEBUG_PRINT ("src_port:%s", (char *)pOptParams->iv_pairs[uiOptParamCnt].value_p); config_info_p->src_port = of_atoi((char *) \ pOptParams->iv_pairs[uiOptParamCnt].value_p); break; default: break; } } return OF_SUCCESS; }
int32_t crm_subnet_ucm_setoptparams (struct cm_array_of_iv_pairs *pOptParams, struct crm_subnet_config_info *sub_config_info, struct cm_app_result ** presult_p) { uint32_t uiOptParamCnt; CM_CBK_DEBUG_PRINT ("Entered"); for (uiOptParamCnt = 0; uiOptParamCnt < pOptParams->count_ui; uiOptParamCnt++) { switch (pOptParams->iv_pairs[uiOptParamCnt].id_ui) { case CM_DM_SUBNET_GATEWAY_ID: CM_CBK_DEBUG_PRINT ("subnet_gw_ip:%s",(char *) pOptParams->iv_pairs[uiOptParamCnt].value_p); if(cm_val_and_conv_aton((char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,&(sub_config_info->gateway_ip))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_ENABLEDHCP_ID: sub_config_info->enable_dhcp_b=of_atoi((char *)pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_SUBNET_DNS_SERVER1_ID: if(cm_val_and_conv_aton((char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,&(sub_config_info->dns_nameservers[0]))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_DNS_SERVER2_ID: if(cm_val_and_conv_aton((char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,&(sub_config_info->dns_nameservers[1]))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_DNS_SERVER3_ID: if(cm_val_and_conv_aton((char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,&(sub_config_info->dns_nameservers[2]))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_DNS_SERVER4_ID: CM_CBK_DEBUG_PRINT ("dns4:%s",(char *) pOptParams->iv_pairs[uiOptParamCnt].value_p); if(cm_val_and_conv_aton((char *)pOptParams->iv_pairs[uiOptParamCnt].value_p,&(sub_config_info->dns_nameservers[3]))!=OF_SUCCESS) return OF_FAILURE; break; case CM_DM_SUBNET_POOL_START_ADDR_ID: CM_CBK_DEBUG_PRINT ("subnet_pool_start_ip:%s",(char *) pOptParams->iv_pairs[uiOptParamCnt].value_p); if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, &(sub_config_info->pool_start_address))!=OF_SUCCESS) { CM_CBK_DEBUG_PRINT("Invalid pool start address"); return OF_FAILURE; } break; case CM_DM_SUBNET_POOL_END_ADDR_ID: CM_CBK_DEBUG_PRINT ("subnet_pool_end_ip:%s",(char *) pOptParams->iv_pairs[uiOptParamCnt].value_p); if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, &(sub_config_info->pool_end_address))!=OF_SUCCESS) { CM_CBK_DEBUG_PRINT("Invalid pool end address : %ld ",sub_config_info->pool_start_address); return OF_FAILURE; } } } CM_CBK_PRINT_IVPAIR_ARRAY (pOptParams); return OF_SUCCESS; }
int32_t nsrm_bypassrule_ucm_setoptparams (struct cm_array_of_iv_pairs *pOptParams, struct nsrm_nwservice_bypass_rule_key* appl_bypassrule_info, struct nsrm_nwservice_bypass_rule_config_info* nsrm_bypassrule_config_info) { uint32_t uiOptParamCnt; char *src_mac; char *dst_mac; CM_CBK_DEBUG_PRINT ("Entered"); for (uiOptParamCnt = 0; uiOptParamCnt < pOptParams->count_ui; uiOptParamCnt++) { switch (pOptParams->iv_pairs[uiOptParamCnt].id_ui) { case CM_DM_BYPASSRULE_RELATIVE_NAME_ID: nsrm_bypassrule_config_info[8].value.relative_name_p = (char *) of_calloc(1, NSRM_MAX_NAME_LENGTH); CM_CBK_DEBUG_PRINT("rel name : %s",pOptParams->iv_pairs[uiOptParamCnt].value_p); of_strncpy (nsrm_bypassrule_config_info[8].value.relative_name_p, (char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, pOptParams->iv_pairs[uiOptParamCnt].value_length); CM_CBK_DEBUG_PRINT("rel name : %s",nsrm_bypassrule_config_info[8].value.relative_name_p); break; case CM_DM_BYPASSRULE_ENABLED_ID: nsrm_bypassrule_config_info[9].value.admin_status_e = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_PROTOCOL_ID: nsrm_bypassrule_config_info[7].value.ip_protocol = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_SRCMACTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[0].value.src_mac.mac_address_type_e = MAC_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[0].value.src_mac.mac_address_type_e = MAC_SINGLE; } break; case CM_DM_BYPASSRULE_ETHTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[2].value.eth_type.ethtype_type_e = ETHTYPE_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[2].value.eth_type.ethtype_type_e = ETHTYPE_SINGLE; } break; case CM_DM_BYPASSRULE_DSTMACTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[1].value.dst_mac.mac_address_type_e = MAC_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[1].value.dst_mac.mac_address_type_e = MAC_SINGLE; } break; case CM_DM_BYPASSRULE_SRCMAC_ID: CM_CBK_DEBUG_PRINT ("src_mac_address:%s",(char *) pOptParams->iv_pairs[uiOptParamCnt].value_p); src_mac = (char *) pOptParams->iv_pairs[uiOptParamCnt].value_p; if ((*src_mac == '0') && ((*(src_mac+1) == 'x') || (*(src_mac+1) == 'X'))) { of_flow_match_atox_mac_addr(src_mac+2, nsrm_bypassrule_config_info[0].value.src_mac.mac); } else { of_flow_match_atox_mac_addr(src_mac, nsrm_bypassrule_config_info[0].value.src_mac.mac); } CM_CBK_DEBUG_PRINT ("src_mac_address:%s",nsrm_bypassrule_config_info[0].value.src_mac.mac); break; case CM_DM_BYPASSRULE_DSTMAC_ID: CM_CBK_DEBUG_PRINT ("dst_mac_address:%s",(char *) pOptParams->iv_pairs[uiOptParamCnt].value_p); dst_mac = (char *) pOptParams->iv_pairs[uiOptParamCnt].value_p; if ((*dst_mac == '0') && ((*(dst_mac+1) == 'x') || (*(dst_mac+1) == 'X'))) { of_flow_match_atox_mac_addr(dst_mac+2, nsrm_bypassrule_config_info[1].value.dst_mac.mac); } else { of_flow_match_atox_mac_addr(dst_mac, nsrm_bypassrule_config_info[1].value.dst_mac.mac); } CM_CBK_DEBUG_PRINT ("dst_mac_address:%s",nsrm_bypassrule_config_info[1].value.dst_mac.mac); break; case CM_DM_BYPASSRULE_ETHTYPEVALUE_ID: nsrm_bypassrule_config_info[2].value.eth_type.ethtype = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_SPTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[5].value.sp.port_object_type_e = PORT_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[5].value.sp.port_object_type_e = PORT_SINGLE; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Range") ==0 ) { nsrm_bypassrule_config_info[5].value.sp.port_object_type_e = PORT_RANGE; } break; case CM_DM_BYPASSRULE_DPTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[6].value.dp.port_object_type_e = PORT_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[6].value.dp.port_object_type_e = PORT_SINGLE; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Range") ==0 ) { nsrm_bypassrule_config_info[6].value.dp.port_object_type_e = PORT_RANGE; } break; case CM_DM_BYPASSRULE_SPSTART_ID: nsrm_bypassrule_config_info[5].value.sp.port_start = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_SPEND_ID: nsrm_bypassrule_config_info[5].value.sp.port_end = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_DPEND_ID: nsrm_bypassrule_config_info[6].value.dp.port_end = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_DPSTART_ID: nsrm_bypassrule_config_info[6].value.dp.port_start = of_atoi(pOptParams->iv_pairs[uiOptParamCnt].value_p); break; case CM_DM_BYPASSRULE_SIPTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[3].value.sip.ip_object_type_e = IP_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[3].value.sip.ip_object_type_e = IP_SINGLE; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Range") ==0 ) { nsrm_bypassrule_config_info[3].value.sip.ip_object_type_e = IP_RANGE; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Subnet") ==0 ) { nsrm_bypassrule_config_info[3].value.sip.ip_object_type_e = IP_SUBNET; } break; case CM_DM_BYPASSRULE_DIPTYPE_ID: if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Any") ==0 ) { nsrm_bypassrule_config_info[4].value.dip.ip_object_type_e = IP_ANY; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Single") ==0 ) { nsrm_bypassrule_config_info[4].value.dip.ip_object_type_e = IP_SINGLE; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Range") ==0 ) { nsrm_bypassrule_config_info[4].value.dip.ip_object_type_e = IP_RANGE; } else if (strcmp(pOptParams->iv_pairs[uiOptParamCnt].value_p, "Subnet") ==0 ) { nsrm_bypassrule_config_info[4].value.dip.ip_object_type_e = IP_SUBNET; } break; case CM_DM_BYPASSRULE_SIPSTART_ID: if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, &nsrm_bypassrule_config_info[3].value.sip.ipaddr_start) != OF_SUCCESS) return OF_FAILURE; break; case CM_DM_BYPASSRULE_SIPEND_ID: if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, &nsrm_bypassrule_config_info[3].value.sip.ipaddr_end) != OF_SUCCESS) return OF_FAILURE; break; case CM_DM_BYPASSRULE_DIPSTART_ID: if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, &nsrm_bypassrule_config_info[4].value.dip.ipaddr_start) != OF_SUCCESS) return OF_FAILURE; break; case CM_DM_BYPASSRULE_DIPEND_ID: if(cm_val_and_conv_aton((char *) pOptParams->iv_pairs[uiOptParamCnt].value_p, &nsrm_bypassrule_config_info[4].value.dip.ipaddr_end) != OF_SUCCESS) return OF_FAILURE; break; } } CM_CBK_PRINT_IVPAIR_ARRAY (pOptParams); return OF_SUCCESS; }