/* Lookup all interface information. */ void interface_list (struct zebra_vrf *zvrf) { if (zvrf->vrf_id != VRF_DEFAULT) { zlog_warn ("interface_list: ignore VRF %u", zvrf->vrf_id); return; } interface_list_ioctl (AF_INET); interface_list_ioctl (AF_INET6); interface_list_ioctl (AF_UNSPEC); }
/* Lookup all interface information. */ void interface_list () { /* Linux can do both proc & ioctl, ioctl is the only way to get interface aliases in 2.2 series kernels. */ #ifdef HAVE_PROC_NET_DEV #ifdef BRCM_LIST_SUPPORT interface_list_proc (); #endif #endif /* HAVE_PROC_NET_DEV */ interface_list_ioctl (); /* After listing is done, get index, address, flags and other interface's information. */ interface_info_ioctl (); #ifdef HAVE_GETIFADDRS if_getaddrs (); #endif /* HAVE_GETIFADDRS */ #if defined(HAVE_IPV6) && defined(HAVE_PROC_NET_IF_INET6) /* Linux provides interface's IPv6 address via /proc/net/if_inet6. */ ifaddr_proc_ipv6 (); #endif /* HAVE_IPV6 && HAVE_PROC_NET_IF_INET6 */ }
static int s_black_content_of_page( STPageInfo *pstPageInfo ) { int i; if( NULL == pstPageInfo ) { return -1; } fprintf(cgiOut," <table>\n"); fprintf(cgiOut," <tr>\n"\ " <td colspan='3'>\n"\ " <table>\n"\ " <tr>\n"\ " <td>ID:</td>\n"\ " <td>\n"\ " <select name='plotid' style='width:100%%;height:auto' onchange='on_id_change(this);'>\n"); instance_parameter *pq = NULL; char temp[10] = { 0 }; for (pq=paraHead1;(NULL != pq);pq=pq->next) { memset(temp,0,sizeof(temp)); snprintf(temp,sizeof(temp)-1,"%d-%d-%d",pq->parameter.slot_id,pq->parameter.local_id,pq->parameter.instance_id); if (strcmp(plotid, temp) == 0) fprintf(cgiOut,"<option value='%s' selected>%s</option>\n",temp,temp); else fprintf(cgiOut,"<option value='%s'>%s</option>\n",temp,temp); } fprintf(cgiOut," </select>\n" ); fprintf( cgiOut," <script type=text/javascript>\n"\ " function on_id_change(obj)\n" " {\n"\ " window.location.href='wp_black_list.cgi?UN=%s&plotid='+obj.value;\n"\ " }\n",pstPageInfo->encry ); fprintf( cgiOut, " </script>\n" ); fprintf(cgiOut," </td>\n"\ " </tr>\n"); fprintf( cgiOut,"<tr>\n"\ "<td>Mode:</td>\n"\ "<td>\n"\ "<select name='plotid' style='width:100%%;height:auto' onchange='on_mode_change(this);'>\n"\ "<option value=0 selected>Ip</option>"\ "<option value=1 >Domain</option>"\ "</select>\n"); fprintf( cgiOut,"<script type=text/javascript>\n"\ "function on_mode_change(obj)\n" "{\n"\ "window.location.href='wp_black_list_domain.cgi?UN=%s&plotid='+%d;\n",pstPageInfo->encry,atoi((pstPageInfo->stUserInput).id)); fprintf( cgiOut,"}\n"); fprintf( cgiOut, "</script>\n </td>\n </tr>\n"\ " <tr>\n"\ " <td>IP Begin:</td>\n"\ " <td>\n" ); fprintf( cgiOut, "<div style='border-width:1px;border-color:#a5acb2;border-style:solid;width:147px;font-size:9pt'>"); if(pstPageInfo->iUserGroup == 0) { fprintf( cgiOut, "<input type=text name='begin_ip1' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='begin_ip2' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='begin_ip3' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='begin_ip4' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />",search(pstPageInfo->lpublic,"ip_error")); } else { fprintf( cgiOut, "<input type=text name='begin_ip1' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='begin_ip2' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='begin_ip3' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='begin_ip4' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />",search(pstPageInfo->lpublic,"ip_error")); } fprintf( cgiOut, "</div>\n" ); fprintf( cgiOut," </td>\n"\ " <td></td>\n"\ " </tr>\n" ); //ip end fprintf( cgiOut," <tr>\n"\ " <td>IP End:</td>\n"\ " <td>\n" ); fprintf( cgiOut, "<div style='border-width:1px;border-color:#a5acb2;border-style:solid;width:147px;font-size:9pt'>"); if(pstPageInfo->iUserGroup == 0) { fprintf( cgiOut, "<input type=text name='end_ip1' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='end_ip2' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='end_ip3' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='end_ip4' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" onbeforepaste=mask_c() />",search(pstPageInfo->lpublic,"ip_error")); } else { fprintf( cgiOut, "<input type=text name='end_ip1' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='end_ip2' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='end_ip3' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />.",search(pstPageInfo->lpublic,"ip_error")); fprintf( cgiOut, "<input type=text name='end_ip4' maxlength=3 class=a3 onKeyUp=\"mask(this,%s)\" disabled onbeforepaste=mask_c() />",search(pstPageInfo->lpublic,"ip_error")); } fprintf( cgiOut, "</div>\n" ); fprintf( cgiOut," </td>\n"\ " <td></td>\n"\ " </tr>\n" ); // port fprintf( cgiOut," <tr>\n"\ " <td>Port:</td>\n"); if(pstPageInfo->iUserGroup == 0) fprintf( cgiOut," <td><input type=text name=port value='' /></td>\n"); else fprintf( cgiOut," <td><input type=text name=port disabled value='' /></td>\n"); fprintf( cgiOut," </tr>\n" ); fprintf( cgiOut," <tr>\n"\ " <td>Intf:</td>\n"); fprintf(cgiOut,"<td><select name=intf>"); fprintf(cgiOut,"<option value=''></option>"); infi interf; interface_list_ioctl (0,&interf); char dupinf[20] = {0}; infi * q ; q = interf.next; while(q) { memset(dupinf,0,sizeof(dupinf)); if(NULL != q->next) { strcpy(dupinf,q->next->if_name); } if( !strcmp(q->if_name,"lo") ) { q = q->next; continue; } if( !strcmp(q->if_name,dupinf) ) { q = q->next; continue; } fprintf(cgiOut,"<option value=%s>%s</option>",q->if_name,q->if_name); q = q->next; } fprintf(cgiOut,"</select></td>\n" " </tr>\n"); fprintf( cgiOut," </table>\n"\ " </td>\n"\ " </tr>\n"); fprintf(cgiOut," <tr>\n"); fprintf(cgiOut," <td>\n"\ " <table frame=below rules=rows border=1 style='border-collapse:collapse;align:left;overflow:visible'>\n" ); #if 1 fprintf( cgiOut, " <tr height=30 bgcolor=#eaeff9 id=td1 align=left>\n"); fprintf(cgiOut," <td width=150 style=font-size:12px><font id=%s>IP</font></th>\n",search(pstPageInfo->lpublic,"menu_thead")); fprintf(cgiOut," <td width=20></th>\n"); fprintf(cgiOut," </tr>\n"); #endif int ret=-1; int hansitype; int insid; RULE_TYPE type; struct bw_rules black; ret = eag_show_black_list(ccgi_connection, parameter.local_id, parameter.instance_id, &black); if(ret == 0) { int num; num = black.curr_num; if(num >0 ) { char ipbegin[32]; char ipend[32]; char ports[CP_MAX_PORTS_BUFF_LEN]={0}; char intf[MAX_IF_NAME_LEN]={0}; for(i = 0 ; i < num ; i++) { type =black.rule[i].type; if(type == RULE_IPADDR) { ccgi_ip2str(black.rule[i].key.ip.ipbegin,ipbegin,sizeof(ipbegin)); ccgi_ip2str(black.rule[i].key.ip.ipend,ipend,sizeof(ipend)); strcpy(ports,black.rule[i].key.ip.ports); strcpy(intf,black.rule[i].intf); fprintf(cgiOut," <tr height=25>\n"); fprintf(cgiOut," <td style=font-size:12px align=left>%s%s%s%s%s%s%s</td>\n",ipbegin,"-",ipend,":",ports," ",intf); fprintf(cgiOut," <td>\n" ); fprintf( cgiOut, " <script type=text/javascript>\n" ); fprintf( cgiOut, " var popMenu%d = new popMenu('popMenu%d','%d');\n", i, i,num-i); fprintf( cgiOut, " popMenu%d.addItem( new popMenuItem( '%s', 'wp_black_list.cgi?del_opt=%s&UN=%s&plotid=%s&ip_begin=%s&ip_end=%s&ip_port=%s&ip_intf=%s' ) );\n", i,"delete","delete", pstPageInfo->encry, plotid ,ipbegin,ipend,ports,intf ); fprintf( cgiOut, " popMenu%d.show();\n", i ); fprintf( cgiOut, " </script>\n" ); fprintf( cgiOut, " </td>\n"); fprintf(cgiOut," </tr>\n"); } } } } fprintf(cgiOut," </table>"\ " </td>"); fprintf(cgiOut," <td width='50'> </td>\n"); fprintf( cgiOut, "<td></td>" ); fprintf(cgiOut," </tr>\n"\ " </table>\n"); fprintf(cgiOut,"<input type=hidden name=UN value=%s>",pstPageInfo->encry); return 0; }
/** * load cache data * * TODO:350:M: Implement dot11ConfigWlanTable cache load * * @param container container to which items should be inserted * * @retval MFD_SUCCESS : success. * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source * @retval MFD_ERROR : other error. * * This function is called to cache the index(es) (and data, optionally) * for the every row in the data set. * * @remark * While loading the cache, the only important thing is the indexes. * If access to your data is cheap/fast (e.g. you have a pointer to a * structure in memory), it would make sense to update the data here. * If, however, the accessing the data invovles more work (e.g. parsing * some other existing data, or peforming calculations to derive the data), * then you can limit yourself to setting the indexes and saving any * information you will need later. Then use the saved information in * dot11ConfigWlanTable_row_prep() for populating data. * * @note * If you need consistency between rows (like you want statistics * for each row to be from the same time frame), you should set all * data here. * */ int dot11ConfigWlanTable_cache_load(netsnmp_container *container) { snmp_log(LOG_DEBUG, "enter dot11ConfigWlanTable_cache_load\n"); dot11ConfigWlanTable_rowreq_ctx *rowreq_ctx; size_t count = 0; DEBUGMSGTL(("verbose:dot11ConfigWlanTable:dot11ConfigWlanTable_cache_load","called\n")); /* *************************************************** *** START EXAMPLE CODE *** ***---------------------------------------------***/ /* * open our data file. */ //filep = fopen("/etc/dummy.conf", "r"); //if(NULL == filep) { //return MFD_RESOURCE_UNAVAILABLE; //} /* ***---------------------------------------------*** *** END EXAMPLE CODE *** ***************************************************/ /* * TODO:351:M: |-> Load/update data in the dot11ConfigWlanTable container. * loop over your dot11ConfigWlanTable data, allocate a rowreq context, * set the index(es) [and data, optionally] and insert into * the container. */ infi if_head = { 0 }; interface_list_ioctl(0, &if_head); instance_parameter *para_head = NULL, *para_node = NULL; list_instance_parameter(¶_head, SNMPD_INSTANCE_MASTER); for(para_node = para_head; NULL != para_node; para_node = para_node->next) { int ret = 0; struct WLAN_INFO *wlan_info = NULL; struct WLAN_INFO *wlan_info_show = NULL; int i = 0; struct ifi *ifi_show = NULL; char bind_interface[256]= { 0 }; char wlanBindIf[255] = { 0 }; size_t wlanBindIf_len = 0; char rate[20] = { 0 }; char wlanUsrWirelessResoUseRate[255] = { 0 }; size_t wlanUsrWirelessResoUseRate_len = 0; char wlanInterfaceName[32] = { 0 }; snmp_log(LOG_DEBUG, "enter show_wlan_of_all_cmd\n"); ret = show_wlan_of_all_cmd(para_node->parameter, para_node->connection,&wlan_info); snmp_log(LOG_DEBUG, "exit show_wlan_of_all_cmd,ret=%d\n", ret); if(ret == 1) { for(wlan_info_show = wlan_info->wlan_info_list; (NULL != wlan_info_show); wlan_info_show = wlan_info_show->next) { unsigned long globalwlanID = local_to_global_ID(para_node->parameter, wlan_info_show->Wlanid, WIRELESS_MAX_NUM); /* *************************************************** *** START EXAMPLE CODE *** ***---------------------------------------------***/ /* * get a line (skip blank lines) */ //do { //if (!fgets(line, sizeof(line), filep)) { /* we're done */ //fclose(filep); //filep = NULL; //} //} while (filep && (line[0] == '\n')); /* * check for end of data */ //if(NULL == filep) //break; /* * parse line into variables */ /* ***---------------------------------------------*** *** END EXAMPLE CODE *** ***************************************************/ /* * TODO:352:M: | |-> set indexes in new dot11ConfigWlanTable rowreq context. */ rowreq_ctx = dot11ConfigWlanTable_allocate_rowreq_ctx(); if (NULL == rowreq_ctx) { snmp_log(LOG_ERR, "memory allocation failed\n"); free_inf(&if_head); Free_show_wlan_of_all_cmd(wlan_info); free_instance_parameter_list(¶_head); return MFD_RESOURCE_UNAVAILABLE; } if(MFD_SUCCESS != dot11ConfigWlanTable_indexes_set(rowreq_ctx , globalwlanID )) { snmp_log(LOG_ERR,"error setting index while loading " "dot11ConfigWlanTable cache.\n"); dot11ConfigWlanTable_release_rowreq_ctx(rowreq_ctx); continue; } /* * TODO:352:r: | |-> populate dot11ConfigWlanTable data context. * Populate data context here. (optionally, delay until row prep) */ /* * TRANSIENT or semi-TRANSIENT data: * copy data or save any info needed to do it in row_prep. */ /* * setup/save data for wlanBindSecurity * wlanBindSecurity(1)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h */ /* * TODO:246:r: |-> Define wlanBindSecurity mapping. * Map values between raw/native values and MIB values * * Integer based value can usually just do a direct copy. */ memcpy(&(rowreq_ctx->data.parameter), &(para_node->parameter), sizeof(dbus_parameter)); rowreq_ctx->data.local_wlanID = wlan_info_show->Wlanid; rowreq_ctx->data.wlanBindSecurity = wlan_info_show->wlanBindSecurity; /* * setup/save data for wlanBindIf * wlanBindIf(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H */ /* * TODO:246:r: |-> Define wlanBindIf mapping. * Map values between raw/native values and MIB values * * if(MFD_SUCCESS != * wlanBindIf_map(&rowreq_ctx->data.wlanBindIf, &rowreq_ctx->data.wlanBindIf_len, * wlanBindIf, wlanBindIf_len, 0)) { * return MFD_ERROR; * } */ /* * make sure there is enough space for wlanBindIf data */ /*if ((NULL == rowreq_ctx->data.wlanBindIf) || (rowreq_ctx->data.wlanBindIf_len < (wlanBindIf_len * sizeof(rowreq_ctx->data.wlanBindIf[0])))) { snmp_log(LOG_ERR,"not enough space for value\n"); return MFD_ERROR; }*/ memset(bind_interface,0,sizeof(bind_interface)); for(i=0,ifi_show = wlan_info_show->ifi_head; ((i<wlan_info_show->bifnum)&&(NULL != ifi_show)); i++,ifi_show = ifi_show->ifi_next) { if(i == 0) { strncat(bind_interface,ifi_show->ifi_name,sizeof(bind_interface)-strlen(bind_interface)-1); } else { strncat(bind_interface,",",sizeof(bind_interface)-strlen(bind_interface)-1); strncat(bind_interface,ifi_show->ifi_name,sizeof(bind_interface)-strlen(bind_interface)-1); } } wlanBindIf_len = MIN(strlen(bind_interface),sizeof(wlanBindIf)-1); memset(wlanBindIf,0,sizeof(wlanBindIf)); memcpy(wlanBindIf,bind_interface,wlanBindIf_len); rowreq_ctx->data.wlanBindIf_len = wlanBindIf_len * sizeof(rowreq_ctx->data.wlanBindIf[0]); memcpy( rowreq_ctx->data.wlanBindIf, wlanBindIf, rowreq_ctx->data.wlanBindIf_len ); /* * setup/save data for wlanHideEssid * wlanHideEssid(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ /* * TODO:246:r: |-> Define wlanHideEssid mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanHideEssid_map(&rowreq_ctx->data.wlanHideEssid, wlanHideEssid )) { return MFD_ERROR; }*/ rowreq_ctx->data.wlanHideEssid = wlan_info_show->wlanHideEssid; /* * setup/save data for wlanServiceEnable * wlanServiceEnable(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ /* * TODO:246:r: |-> Define wlanServiceEnable mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanServiceEnable_map(&rowreq_ctx->data.wlanServiceEnable, wlanServiceEnable )) { return MFD_ERROR; }*/ if(wlan_info_show->wlanServiceEnable == 1) rowreq_ctx->data.wlanServiceEnable = 0; else rowreq_ctx->data.wlanServiceEnable = 1; /* * setup/save data for wlanMaxConnectUsr * wlanMaxConnectUsr(5)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/R/d/h */ /* * TODO:246:r: |-> Define wlanMaxConnectUsr mapping. * Map values between raw/native values and MIB values * * Integer based value can usually just do a direct copy. */ rowreq_ctx->data.wlanMaxConnectUsr = wlan_info_show->wlanMaxConnectUsr; /* * setup/save data for wlanLoadBalanceStatus * wlanLoadBalanceStatus(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ /* * TODO:246:r: |-> Define wlanLoadBalanceStatus mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanLoadBalanceStatus_map(&rowreq_ctx->data.wlanLoadBalanceStatus, wlanLoadBalanceStatus )) { return MFD_ERROR; }*/ if(wlan_info_show->wlanLoadBalanceFunction == 1) { if(wlan_info_show->wlanLoadBalanceStatus == 1) { rowreq_ctx->data.wlanLoadBalanceStatus = 1; } else { rowreq_ctx->data.wlanLoadBalanceStatus = 2; } } else { rowreq_ctx->data.wlanLoadBalanceStatus = 0; } /* * setup/save data for wlanLoadBalanceStatusBaseOnFlow * wlanLoadBalanceStatusBaseOnFlow(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ /* * TODO:246:r: |-> Define wlanLoadBalanceStatusBaseOnFlow mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanLoadBalanceStatusBaseOnFlow_map(&rowreq_ctx->data.wlanLoadBalanceStatusBaseOnFlow, wlanLoadBalanceStatusBaseOnFlow )) { return MFD_ERROR; }*/ if(wlan_info_show->wlanLoadBalanceFunction == 1) { if(wlan_info_show->wlanLoadBalanceStatus == 1) { rowreq_ctx->data.wlanLoadBalanceStatusBaseOnFlow = 0; } else { rowreq_ctx->data.wlanLoadBalanceStatusBaseOnFlow = 1; } } else { rowreq_ctx->data.wlanLoadBalanceStatusBaseOnFlow = 0; } /* * setup/save data for wlanLoadBalanceStatusBaseOnUsr * wlanLoadBalanceStatusBaseOnUsr(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */ /* * TODO:246:r: |-> Define wlanLoadBalanceStatusBaseOnUsr mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanLoadBalanceStatusBaseOnUsr_map(&rowreq_ctx->data.wlanLoadBalanceStatusBaseOnUsr, wlanLoadBalanceStatusBaseOnUsr )) { return MFD_ERROR; }*/ if(wlan_info_show->wlanLoadBalanceFunction == 1) { if(wlan_info_show->wlanLoadBalanceStatus == 1) { rowreq_ctx->data.wlanLoadBalanceStatusBaseOnUsr = 1; } else { rowreq_ctx->data.wlanLoadBalanceStatusBaseOnUsr = 0; } } else { rowreq_ctx->data.wlanLoadBalanceStatusBaseOnUsr = 0; } /* * setup/save data for wlanLoadBalanceTrafficDiffThreshhd * wlanLoadBalanceTrafficDiffThreshhd(9)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h */ /* * TODO:246:r: |-> Define wlanLoadBalanceTrafficDiffThreshhd mapping. * Map values between raw/native values and MIB values * * Integer based value can usually just do a direct copy. */ rowreq_ctx->data.wlanLoadBalanceTrafficDiffThreshhd = wlan_info_show->wlanLoadBalanceTrafficDiffThreshhd; /* * setup/save data for wlanLoadBalanceUsersDiffThreshhd * wlanLoadBalanceUsersDiffThreshhd(10)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h */ /* * TODO:246:r: |-> Define wlanLoadBalanceUsersDiffThreshhd mapping. * Map values between raw/native values and MIB values * * Integer based value can usually just do a direct copy. */ rowreq_ctx->data.wlanLoadBalanceUsersDiffThreshhd = wlan_info_show->wlanLoadBalanceUsersDiffThreshhd; /* * setup/save data for wlanStaOnlineNum * wlanStaOnlineNum(11)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h */ /* * TODO:246:r: |-> Define wlanStaOnlineNum mapping. * Map values between raw/native values and MIB values * * Integer based value can usually just do a direct copy. */ rowreq_ctx->data.wlanStaOnlineNum = wlan_info_show->wlanStaOnlineNum; /* * setup/save data for wlanUsrWirelessResoUseRate * wlanUsrWirelessResoUseRate(12)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H */ /* * TODO:246:r: |-> Define wlanUsrWirelessResoUseRate mapping. * Map values between raw/native values and MIB values * * if(MFD_SUCCESS != * wlanUsrWirelessResoUseRate_map(&rowreq_ctx->data.wlanUsrWirelessResoUseRate, &rowreq_ctx->data.wlanUsrWirelessResoUseRate_len, * wlanUsrWirelessResoUseRate, wlanUsrWirelessResoUseRate_len, 0)) { * return MFD_ERROR; * } */ /* * make sure there is enough space for wlanUsrWirelessResoUseRate data */ /*if ((NULL == rowreq_ctx->data.wlanUsrWirelessResoUseRate) || (rowreq_ctx->data.wlanUsrWirelessResoUseRate_len < (wlanUsrWirelessResoUseRate_len * sizeof(rowreq_ctx->data.wlanUsrWirelessResoUseRate[0])))) { snmp_log(LOG_ERR,"not enough space for value\n"); return MFD_ERROR; }*/ memset(rate,0,sizeof(rate)); snprintf(rate,sizeof(rate)-1,"%6.5f",wlan_info_show->wlanUsrWirelessResoUseRate); strncat(rate,"%",sizeof(rate)-strlen(rate)-1); wlanUsrWirelessResoUseRate_len = MIN(strlen(rate),sizeof(wlanUsrWirelessResoUseRate)-1); memset(wlanUsrWirelessResoUseRate,0,sizeof(wlanUsrWirelessResoUseRate)); memcpy(wlanUsrWirelessResoUseRate,rate,wlanUsrWirelessResoUseRate_len); rowreq_ctx->data.wlanUsrWirelessResoUseRate_len = wlanUsrWirelessResoUseRate_len * sizeof(rowreq_ctx->data.wlanUsrWirelessResoUseRate[0]); memcpy( rowreq_ctx->data.wlanUsrWirelessResoUseRate, wlanUsrWirelessResoUseRate, rowreq_ctx->data.wlanUsrWirelessResoUseRate_len ); /* * setup/save data for wlanBindSecType * wlanBindSecType(13)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ /* * TODO:246:r: |-> Define wlanBindSecType mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanBindSecType_map(&rowreq_ctx->data.wlanBindSecType, wlanBindSecType )) { return MFD_ERROR; }*/ rowreq_ctx->data.wlanBindSecType = wlan_info_show->wlanBindSecType+1; /* * setup/save data for wlanBindEncryType * wlanBindEncryType(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h */ /* * TODO:246:r: |-> Define wlanBindEncryType mapping. * Map values between raw/native values and MIB values * * enums usually need mapping. */ /*if(MFD_SUCCESS != wlanBindEncryType_map(&rowreq_ctx->data.wlanBindEncryType, wlanBindEncryType )) { return MFD_ERROR; }*/ rowreq_ctx->data.wlanBindEncryType = wlan_info_show->wlanBindEncryType+1; memset(wlanInterfaceName, 0, sizeof(wlanInterfaceName)); if(para_node->parameter.local_id) { snprintf(wlanInterfaceName, sizeof(wlanInterfaceName) - 1, "wlanl%d-%d-%d", para_node->parameter.slot_id, para_node->parameter.instance_id, wlan_info_show->Wlanid); } else { snprintf(wlanInterfaceName, sizeof(wlanInterfaceName) - 1, "wlan%d-%d-%d", para_node->parameter.slot_id, para_node->parameter.instance_id, wlan_info_show->Wlanid); } snmp_log(LOG_DEBUG, "wlanInterfaceName = %s\n", wlanInterfaceName); infi *if_node = NULL; for(if_node = if_head.next; NULL != if_node; if_node = if_node->next) { snmp_log(LOG_DEBUG, "if_node->if_name = %s\n", if_node->if_name); if(0 == strcmp(if_node->if_name, wlanInterfaceName)) { int mask = mask_bit(if_node->if_mask); snprintf(rowreq_ctx->data.wlanInterfaceIPAddr, sizeof(rowreq_ctx->data.wlanInterfaceIPAddr) - 1, "%s/%d", if_node->if_addr, mask); snmp_log(LOG_DEBUG, "rowreq_ctx->data.wlanInterfaceIPAddr = %s\n", rowreq_ctx->data.wlanInterfaceIPAddr); rowreq_ctx->data.wlanInterfaceIPAddr_len = strlen(rowreq_ctx->data.wlanInterfaceIPAddr); break; } } /* * insert into table container */ if(CONTAINER_INSERT(container, rowreq_ctx)) { dot11ConfigWlanTable_release_rowreq_ctx(rowreq_ctx); } ++count; } } Free_show_wlan_of_all_cmd(wlan_info); } free_instance_parameter_list(¶_head); free_inf(&if_head); /* *************************************************** *** START EXAMPLE CODE *** ***---------------------------------------------***/ //if(NULL != filep) //fclose(filep); /* ***---------------------------------------------*** *** END EXAMPLE CODE *** ***************************************************/ DEBUGMSGT(("verbose:dot11ConfigWlanTable:dot11ConfigWlanTable_cache_load", "inserted %d records\n", count)); snmp_log(LOG_DEBUG, "exit dot11ConfigWlanTable_cache_load\n"); return MFD_SUCCESS; } /* dot11ConfigWlanTable_cache_load */