예제 #1
0
int edit_product_reference (void)
{
    char query[2048];
    
    system("clear");
    printf("\n");
    printf("Qual a nova referencia de '%s'?\n", current_goods.name);
    
    gets(inputed_info.reference);
    
    sprintf(query, "UPDATE Produtos SET Referencia = %s WHERE ID = %d", inputed_info.reference, inputed_info.ID);
    
    if (mysql_query(con, query))
    {
        finish_with_error(con);
    }
    else
    {
        get_product_info();
        
        printf("\n");
        printf("A referencia foi alterada com sucesso para '%s'!\n", current_goods.reference);
        printf("\n");
        printf("Aperte enter para continuar:\n");
        
        getchar();
        
        return -1;
    }
    
    return 0;
}
예제 #2
0
// Main Function
int editar_produto (void)
{
    int menu_selection = 1;
    
    do
    {
        switch (menu_selection)
        {
            case -1:
                menu_selection = continue_editing();
                break;
                
            case 1:
                intro();
                menu_selection = get_goods_id();
                get_product_info();
                break;
            case 2:
                edit_product_info(get_wich_info_to_edit());
                break;
                
            default:
                return 0;
                break;
        }
    } while (1);
    
    return 0;
}
예제 #3
0
int edit_product_manufacturer (void)
{
    char query[2048];
    
    system("clear");
    printf("\n");
    printf("Qual o novo Fabricante que voce deseja atribuir a %s?\n", current_goods.name);
    
    gets(inputed_info.manufacturer);
    
    sprintf(query, "UPDATE Produtos SET Fabricante = %s WHERE ID = %d", inputed_info.manufacturer, inputed_info.ID);
    
    if (mysql_query(con, query))
    {
        finish_with_error(con);
    }
    else
    {
        get_product_info();
        
        
        printf("\n");
        printf("O Fabricante foi alterado com sucesso para '%s'!\n", current_goods.manufacturer);
        printf("\n");
        printf("Aperte Enter apra continuar:\n");
        
        getchar();
        
        return -1;
    }
    
    return 0;
}
예제 #4
0
void
snmp_tipc_session_init(void) {
	manage_session session;
	manage_tipc_addr local_tipc;
	memset(&session, 0, sizeof(manage_session));
	memset(&local_tipc, 0, sizeof(manage_tipc_addr));

	session.flags |= MANAGE_FLAGS_TIPC_SOCKET;

	unsigned int local_slot_id = 0;
	if(VALID_DBM_FLAG == get_dbm_effective_flag())
	{
		local_slot_id = get_product_info(PRODUCT_LOCAL_SLOTID);
	}
	if(0 == local_slot_id || local_slot_id > SLOT_MAX_NUM) {
		syslog(LOG_WARNING, "snmp_tipc_session_init: get active local slot id failed!\n");
		return ;
	}

	local_tipc.type = SNMP_TIPC_TYPE;	/*ac sample tipc type*/
	local_tipc.instance = (0x1000 + local_slot_id);

	session.local = (void *)&local_tipc;
	session.local_len = sizeof(manage_tipc_addr);

	snmp_session = manage_open(&session);
	if(NULL == snmp_session) {
		syslog(LOG_ERR, "snmp_tipc_session_init: s_manage_errno = %d, s_errno = %d\n",
						session.s_manage_errno, session.s_errno);
		return ;
	}
}
예제 #5
0
int edit_product_warranty (void)
{
    char query[2048];
    
    system("clear");
    printf("\n");
    printf("Quanto tempo de garantia voce deseja atribuir a '%s'?\n", current_goods.name);
    
    scanf("%f", &inputed_info.warranty);
    getchar();
    
    sprintf(query, "UPDATE Produtos SET Tempo_de_garantia = %f WHERE ID = %d", inputed_info.warranty, inputed_info.ID);
    
    if (mysql_query(con, query))
    {
        finish_with_error(con);
    }
    else
    {
        get_product_info();
        
        if (current_goods.warranty >= 2)
        {
            printf("\n");
            printf("A garantia foi alterada com sucesso para '%f' anos!\n", current_goods.warranty);
            printf("\n");
            printf("Aperte enter para continuar:\n");
        }
        else
        {
            printf("\n");
            printf("A garantia foi alterada com sucesso para '%f' ano!\n", current_goods.warranty);
            printf("\n");
            printf("Aperte enter para continuar:\n");
        }
        
        getchar();
        
        return-1
    }
    
    return 0;
}
예제 #6
0
/*state为"enable"或"disable"*/
int config_pppoe_snooping_enable_cmd(char *if_name,char *state)/*返回0表示失败,返回1表示成功*/
																		/*返回-1表示bad command parameter*/
																		/*返回-2表示Interface name is too long*/
																		/*返回-3表示if_name is not a ve-interface name*/
																		/*返回-4表示get local_slot_id error*/
																		/*返回-5表示error*/
{
	if((NULL == if_name) && (NULL == state))
		return 0;
	
	int ret = 0;
	unsigned short mru = 0;
	unsigned int enable_flag = 0;
	char ifname[IFNAMESIZE];
	char tmp_ifname[IFNAMESIZE];
	//char *ptr = NULL;
	int slotid = 0, vrrpid = 0, num = 0, local_flag = 0;
	DBusMessage *query = NULL, *reply = NULL;
	DBusError err;

	if(!strncmp("enable", state, strlen(state))) {
		enable_flag = 1;
	} else if (!strncmp("disable", state, strlen(state))) {
		enable_flag = 0;
	} else {
		return -1;
	}

	if(strlen(if_name) > IFNAMESIZE){
		return -2;
	}

	memset(ifname, 0, sizeof(ifname));
	memcpy(ifname, if_name, strlen(if_name));

	memset(tmp_ifname, 0, sizeof(tmp_ifname));
	if(-1 == ve_ifname_transfer_conversion(tmp_ifname, ifname))
	{
		return -3;
	}
	memcpy(ifname, tmp_ifname, strlen(tmp_ifname));

	/************dcli_pppoe_snp_convert_ifname*************/
	if(!ifname) {
		return 0;
	}

	//if (CONFIG_NODE == vty->node) {
		if ((slotid = get_product_info(PRODUCT_LOCAL_SLOTID)) < 0) {
			return -4;
		}
		vrrpid = 0;
		local_flag = 1;
	//}

	/* hansi node or config node */
	if (!local_flag) {
		if (0 == strncmp(ifname, "wlan", 4)) {
			sscanf(ifname, "wlan%d", &num);	
			memset(ifname, 0, strlen(ifname));
			sprintf(ifname, "wlan%d-%d-%d", slotid, vrrpid, num);
		} else if (0 == strncmp(ifname, "ebr", 3)) {
			sscanf(ifname, "ebr%d", &num);	
			memset(ifname, 0, strlen(ifname));	
			sprintf(ifname, "ebr%d-%d-%d", slotid, vrrpid, num);
		} else {
			sprintf(ifname, "%s", ifname);
		}

	/* local-hansi node */
	} else {
		if (!strncmp(ifname, "wlan", 4)) {
			sscanf(ifname, "wlan%d", &num);	
			memset(ifname, 0, strlen(ifname));
			sprintf(ifname, "wlanl%d-%d-%d", slotid, vrrpid, num);
		} else if (!strncmp(ifname, "ebr", 3)) {
			sscanf(ifname, "ebr%d", &num);			
			memset(ifname, 0, strlen(ifname));
			sprintf(ifname, "ebrl%d-%d-%d", slotid, vrrpid, num);
		} else {
			sprintf(ifname, "%s", ifname);
		}
	}

	#if 0
	if (argc == 3) {
		mru = (unsigned short)strtol((char*)argv[2], &ptr, 10); 
		if (*ptr) {
			vty_out (vty, "%% Invalid MRU %s\n", (char*)argv[2]);
			return CMD_WARNING;
		}

		if ((mru < MRU_MIN) || (mru > MRU_MAX)) {
			vty_out (vty, "%% MRU range: %d - %d\n", MRU_MIN, MRU_MAX);
			return CMD_WARNING;
		}
	}
	#endif
	
	/************dcli_pppoe_snp_iface_enable*************/
	char *temp_ifname = (char *)malloc(sizeof(ifname)+1);
	if(NULL == temp_ifname)
		return 0;

	memset(temp_ifname, 0, sizeof(temp_ifname)+1);
	strcpy(temp_ifname, ifname);
	
	query = dbus_message_new_method_call(DHCP_DBUS_BUSNAME, 
									DHCP_DBUS_OBJPATH, 
									DHCP_DBUS_INTERFACE, 
									DHCP_DBUS_METHOD_PPPOE_SNP_IFACE_ENABLE);

	dbus_error_init(&err);
	dbus_message_append_args(query,
							DBUS_TYPE_STRING, &temp_ifname,
							DBUS_TYPE_UINT32, &enable_flag,
							DBUS_TYPE_UINT16, &mru,
							DBUS_TYPE_INVALID);

	reply = dbus_connection_send_with_reply_and_block (ccgi_dbus_connection, query, -1, &err);

	FREE_OBJECT(temp_ifname);

	dbus_message_unref(query);
	
	if (NULL == reply) {
		if (dbus_error_is_set(&err)) {
			dbus_error_free(&err);
		}
		return 0;
	}

	if (dbus_message_get_args (reply, &err,
					DBUS_TYPE_UINT32, &ret,
					DBUS_TYPE_INVALID)) {
		dbus_message_unref(reply);
	} 
	else {
		if (dbus_error_is_set(&err)) {
			dbus_error_free(&err);
		}
		dbus_message_unref(reply);
	}	

	if (!ret) {
		return 1;
	} else {	
		return -5;
	}
}
예제 #7
0
	int
conf_drp_get_domain_ip(DBusConnection *connection,
							int local_slot_id, int hansitype, int insid, 
							domain_pt *domain, domain_ct *domain_ret)
{
	DBusMessage *query, *reply;
	DBusError err;
	DBusMessageIter  iter;
	DBusMessageIter  iter_array;
	int iRet=0;
	int i = 0, num = 0;
	static int distributed = 0;
	static int active_master_slot_id = 0;
	int active_master_slot_id_tmp = 0;
	static DBusConnection *remote_dbus_conn = NULL;
	DBusConnection *remote_dbus_conn_tmp = NULL;
	DBusConnection *connection_real = NULL;
		

	query = dbus_message_new_method_call(
			DRP_DBUS_BUSNAME,
			DRP_DBUS_OBJPATH,
			DRP_DBUS_INTERFACE, 
			DRP_DBUS_METHOD_GET_DOMAIN_IP );
	dbus_error_init(&err);
	dbus_message_append_args( query,
			DBUS_TYPE_STRING, &(domain->domain_name),
			DBUS_TYPE_INVALID );

/*init remote dbus connection*/
	distributed = init_distributed_flag();
	if (distributed == 1){
		active_master_slot_id_tmp = get_product_info(ACTIVE_MASTER_SLOT_FILE);
		if (0 == active_master_slot_id || active_master_slot_id_tmp != active_master_slot_id){
			if (NULL == remote_dbus_conn){
				remote_dbus_conn_tmp = dbus_get_tipc_connection(active_master_slot_id_tmp,local_slot_id, hansitype, insid);
				if (NULL == remote_dbus_conn_tmp){
					syslog(LOG_ERR,"connect to drp dbus_get_tipc_connection error!");
					dbus_message_unref(query);
					iRet = DRP_ERR_REMOTE_DBUS_CONNECT_FAILED;
					goto error;
				}
			}else{
				dbus_connection_close(remote_dbus_conn);
				remote_dbus_conn = NULL;
				remote_dbus_conn_tmp = dbus_get_tipc_connection(active_master_slot_id_tmp,local_slot_id, hansitype, insid);
				if (NULL == remote_dbus_conn_tmp){
					syslog(LOG_ERR,"connect to drp dbus_get_tipc_connection error!");
					dbus_message_unref(query);
					iRet = DRP_ERR_REMOTE_DBUS_CONNECT_FAILED;
					goto error;
				}
			}
		}
		active_master_slot_id = active_master_slot_id_tmp;
		remote_dbus_conn = remote_dbus_conn_tmp;
		connection_real = remote_dbus_conn;
		syslog(LOG_INFO,"connect to drp remote active_master_slot_id is %d ",active_master_slot_id);
	}else if( 0 == distributed ){
		connection_real = connection;
	}else{
		syslog(LOG_ERR, "connect to drp error distributed state wrong! flag = %d \n use local dbus connection to drp!",distributed);
		connection_real = connection;
	}
	
	reply = dbus_connection_send_with_reply_and_block (
										connection_real, query, -1, &err );
	dbus_message_unref(query);

	if ( NULL == reply ){	
		if (dbus_error_is_set(&err)){
			dbus_error_free(&err);
		}
		return DRP_ERR_DBUS_FAILED;
	}else{
		memset (domain_ret, 0, sizeof(domain_ret));
		dbus_message_iter_init(reply,&iter);
		dbus_message_iter_get_basic(&iter, &iRet);

		if( DRP_RETURN_OK == iRet ){
			dbus_message_iter_next(&iter);
			dbus_message_iter_get_basic(&iter, &num);
			if( num > MAX_DOMAIN_IPADDR ){
				num = MAX_DOMAIN_IPADDR;
			}

			strncpy(domain_ret->domain_name, domain->domain_name,\
					sizeof(domain_ret->domain_name));
			domain_ret->num = num;

			if( num > 0 ){
				dbus_message_iter_next(&iter);	
				dbus_message_iter_recurse(&iter,&iter_array);			

				for( i=0; i<num; i++ ){
					DBusMessageIter iter_struct;
					dbus_message_iter_recurse(&iter_array,&iter_struct);
					dbus_message_iter_get_basic(&iter_struct, &(domain_ret->domain_ip[i].index));
					dbus_message_iter_get_basic(&iter_struct, &(domain_ret->domain_ip[i].ipaddr));
					dbus_message_iter_next(&iter_array);
				}
			}
		}
	}


	dbus_message_unref(reply);
error:

	return iRet;
}
예제 #8
0
		OSInfo::OSInfo()
			: version_(VERSION_PRE_XP),
			architecture_(OTHER_ARCHITECTURE),
			wow64_status_(GetWOW64StatusForProcess(GetCurrentProcess())) {
			OSVERSIONINFOEX version_info = { sizeof version_info };
			::GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
			version_number_.major = version_info.dwMajorVersion;
			version_number_.minor = version_info.dwMinorVersion;
			version_number_.build = version_info.dwBuildNumber;
			if ((version_number_.major == 5) && (version_number_.minor > 0)) {
				// Treat XP Pro x64, Home Server, and Server 2003 R2 as Server 2003.
				version_ = (version_number_.minor == 1) ? VERSION_XP : VERSION_SERVER_2003;
			}
			else if (version_number_.major == 6) {
				switch (version_number_.minor) {
				case 0:
					// Treat Windows Server 2008 the same as Windows Vista.
					version_ = VERSION_VISTA;
					break;
				case 1:
					// Treat Windows Server 2008 R2 the same as Windows 7.
					version_ = VERSION_WIN7;
					break;
				case 2:
					// Treat Windows Server 2012 the same as Windows 8.
					version_ = VERSION_WIN8;
					break;
				default:
					DCHECK_EQ(version_number_.minor, 3);
					version_ = VERSION_WIN8_1;
					break;
				}
			}
			else if (version_number_.major > 6) {
				NOTREACHED();
				version_ = VERSION_WIN_LAST;
			}
			service_pack_.major = version_info.wServicePackMajor;
			service_pack_.minor = version_info.wServicePackMinor;

			SYSTEM_INFO system_info = { 0 };
			::GetNativeSystemInfo(&system_info);
			switch (system_info.wProcessorArchitecture) {
			case PROCESSOR_ARCHITECTURE_INTEL: architecture_ = X86_ARCHITECTURE; break;
			case PROCESSOR_ARCHITECTURE_AMD64: architecture_ = X64_ARCHITECTURE; break;
			case PROCESSOR_ARCHITECTURE_IA64:  architecture_ = IA64_ARCHITECTURE; break;
			}
			processors_ = system_info.dwNumberOfProcessors;
			allocation_granularity_ = system_info.dwAllocationGranularity;

			GetProductInfoPtr get_product_info;
			DWORD os_type;

			if (version_info.dwMajorVersion == 6) {
				// Only present on Vista+.
				get_product_info = reinterpret_cast<GetProductInfoPtr>(
					::GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "GetProductInfo"));

				get_product_info(version_info.dwMajorVersion, version_info.dwMinorVersion,
					0, 0, &os_type);
				switch (os_type) {
				case PRODUCT_CLUSTER_SERVER:
				case PRODUCT_DATACENTER_SERVER:
				case PRODUCT_DATACENTER_SERVER_CORE:
				case PRODUCT_ENTERPRISE_SERVER:
				case PRODUCT_ENTERPRISE_SERVER_CORE:
				case PRODUCT_ENTERPRISE_SERVER_IA64:
				case PRODUCT_SMALLBUSINESS_SERVER:
				case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
				case PRODUCT_STANDARD_SERVER:
				case PRODUCT_STANDARD_SERVER_CORE:
				case PRODUCT_WEB_SERVER:
					version_type_ = SUITE_SERVER;
					break;
				case PRODUCT_PROFESSIONAL:
				case PRODUCT_ULTIMATE:
				case PRODUCT_ENTERPRISE:
				case PRODUCT_BUSINESS:
					version_type_ = SUITE_PROFESSIONAL;
					break;
				case PRODUCT_HOME_BASIC:
				case PRODUCT_HOME_PREMIUM:
				case PRODUCT_STARTER:
				default:
					version_type_ = SUITE_HOME;
					break;
				}
			}
			else if (version_info.dwMajorVersion == 5 &&
				version_info.dwMinorVersion == 2) {
				if (version_info.wProductType == VER_NT_WORKSTATION &&
					system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
					version_type_ = SUITE_PROFESSIONAL;
				}
				else if (version_info.wSuiteMask & VER_SUITE_WH_SERVER) {
					version_type_ = SUITE_HOME;
				}
				else {
					version_type_ = SUITE_SERVER;
				}
			}
			else if (version_info.dwMajorVersion == 5 &&
				version_info.dwMinorVersion == 1) {
				if (version_info.wSuiteMask & VER_SUITE_PERSONAL)
					version_type_ = SUITE_HOME;
				else
					version_type_ = SUITE_PROFESSIONAL;
			}
			else {
				// Windows is pre XP so we don't care but pick a safe default.
				version_type_ = SUITE_HOME;
			}
		}
예제 #9
0
void ShowWlanListPage(char *m,char *n,int p,struct list *lpublic,struct list *lwlan)
{    
  char IsDeleete[10] = { 0 };
  char IsSubmit[5] = { 0 };
  DCLI_WLAN_API_GROUP *WLANINFO = NULL;
  char wlan_id[10] = { 0 };    
  char whichinterface[WLAN_IF_NAME_LEN] = { 0 };
  char menu_id[10] = { 0 };
  char menu[15] = { 0 };
  int wnum = 0;             /*存放wlan的个数*/
  int i = 0,result = 0,retu = 1,cl = 1,limit = 0;                        /*颜色初值为#f9fafe*/
  int start_wlanno = 0,end_wlanno = 0,wlanno_page = 0,total_pnum = 0;    /*start_wtpno表示要显示的起始wtp id,end_wtpno表示要显示的结束wtp id,wtpno_page表示本页要显示的wtp数,total_pnum表示总页数*/
  char select_insid[10] = { 0 };
  instance_parameter *paraHead1 = NULL,*paraHead2 = NULL;
  instance_parameter *pq = NULL;
  char temp[10] = { 0 };
  dbus_parameter ins_para;

  memset(select_insid,0,sizeof(select_insid));
  cgiFormStringNoNewlines( "INSTANCE_ID", select_insid, 10 );
  if(strcmp(select_insid,"")==0)
  { 
	list_instance_parameter(&paraHead1, INSTANCE_STATE_WEB); 
	if(paraHead1)
	{
		snprintf(select_insid,sizeof(select_insid)-1,"%d-%d-%d",paraHead1->parameter.slot_id,paraHead1->parameter.local_id,paraHead1->parameter.instance_id);
	} 
  }  
  else
  {
	get_slotID_localID_instanceID(select_insid,&ins_para);	
	get_instance_dbus_connection(ins_para, &paraHead1, INSTANCE_STATE_WEB);
  }
  cgiHeaderContentType("text/html");
  fprintf(cgiOut,"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>");
  fprintf(cgiOut,"<meta http-equiv=Content-Type content=text/html; charset=gb2312>");
  fprintf(cgiOut,"<title>Wlan</title>");
  fprintf(cgiOut,"<link rel=stylesheet href=/style.css type=text/css>");
  fprintf(cgiOut,"<style>"\
    "#div1{ width:92px; height:18px; border:1px solid #666666; background-color:#f9f8f7;}"\
    "#div2{ width:90px; height:15px; padding-left:5px; padding-top:3px}"\
    "#link{ text-decoration:none; font-size: 12px}"\
"</style>"\
"</head>"\
	  "<script type=\"text/javascript\">"\
	   "function popMenu(objId)"\
	   "{"\
		  "var obj = document.getElementById(objId);"\
		  "if (obj.style.display == 'none')"\
		  "{"\
			"obj.style.display = 'block';"\
		  "}"\
		  "else"\
		  "{"\
			"obj.style.display = 'none';"\
		  "}"\
	  "}"\
	  "function page_change(obj)"\
	  "{"\
	     "var page_num = obj.options[obj.selectedIndex].value;"\
	   	 "var url = 'wp_wlanlis.cgi?UN=%s&PN='+page_num+'&INSTANCE_ID=%s';"\
	   	 "window.location.href = url;"\
	   	"}", m , select_insid);
	  fprintf(cgiOut,"</script>"\
	  "<script src=/instanceid_onchange.js>"\
	  "</script>"\
  "<body>");
  memset(IsDeleete,0,sizeof(IsDeleete));
  cgiFormStringNoNewlines("DeletWlan", IsDeleete, 10);
  memset(IsSubmit,0,sizeof(IsSubmit));  
  cgiFormStringNoNewlines("SubmitFlag", IsSubmit, 5);
  if((strcmp(IsDeleete,"true")==0)&&(strcmp(IsSubmit,"")))
  {
    memset(wlan_id,0,sizeof(wlan_id));
    cgiFormStringNoNewlines("WlanID", wlan_id, 10);
	if(paraHead1)
	{
		DeleteWlan(paraHead1,wlan_id,lpublic,lwlan);
	} 
  }
  fprintf(cgiOut,"<form>"\
  "<div align=center>"\
  "<table width=976 border=0 cellpadding=0 cellspacing=0>"\
  "<tr>"\
    "<td width=8 align=left valign=top background=/images/di22.jpg><img src=/images/youce4.jpg width=8 height=30/></td>"\
    "<td width=51 align=left valign=bottom background=/images/di22.jpg><img src=/images/youce33.jpg width=37 height=24/></td>"\
    "<td width=153 align=left valign=bottom id=titleen background=/images/di22.jpg>WLAN</td>"\
    "<td width=690 align=right valign=bottom background=/images/di22.jpg>");
	 
    	  fprintf(cgiOut,"<table width=155 border=0 cellspacing=0 cellpadding=0>"\
          "<tr>"\
          "<td width=62 align=center><a href=wp_wlan.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",m,search(lpublic,"img_ok"));
		  fprintf(cgiOut,"<td width=62 align=center><a href=wp_wlan.cgi?UN=%s target=mainFrame><img src=/images/%s border=0 width=62 height=20/></a></td>",m,search(lpublic,"img_cancel"));
		  fprintf(cgiOut,"</tr>"\
          "</table>");
      fprintf(cgiOut,"</td>"\
    "<td width=74 align=right valign=top background=/images/di22.jpg><img src=/images/youce3.jpg width=31 height=30/></td>"\
  "</tr>"\
  "<tr>"\
    "<td colspan=5 align=center valign=middle><table width=976 border=0 cellpadding=0 cellspacing=0 bgcolor=#f0eff0>"\
      "<tr>"\
        "<td width=12 align=left valign=top background=/images/di888.jpg>&nbsp;</td>"\
        "<td width=948><table width=947 border=0 cellspacing=0 cellpadding=0>"\
            "<tr height=4 valign=bottom>"\
              "<td width=120>&nbsp;</td>"\
              "<td width=827 valign=bottom><img src=/images/bottom_05.gif width=827 height=4/></td>"\
            "</tr>"\
            "<tr>"\
              "<td><table width=120 border=0 cellspacing=0 cellpadding=0>"\
                   "<tr height=25>"\
                    "<td id=tdleft>&nbsp;</td>"\
                  "</tr>");             
				  fprintf(cgiOut,"<tr height=26>"\
                    "<td align=left id=tdleft background=/images/bottom_bg.gif style=\"border-right:0\"><font id=yingwen_san>WLAN</font><font id=%s> %s</font></td>",search(lpublic,"menu_san"),search(lpublic,"list"));   /*突出显示*/
                  fprintf(cgiOut,"</tr>");
				  retu=checkuser_group(n);
				  if(retu==0)  /*管理员*/
				  {
                    fprintf(cgiOut,"<tr height=25>"\
					  "<td align=left id=tdleft><a href=wp_wlannew.cgi?UN=%s target=mainFrame class=top><font id=%s>%s</font><font id=yingwen_san> WLAN</font></a></td>",m,search(lpublic,"menu_san"),search(lpublic,"create"));                       
                    fprintf(cgiOut,"</tr>");
					fprintf(cgiOut,"<tr height=25>"\
					  "<td align=left id=tdleft><a href=wp_wlanbw.cgi?UN=%s target=mainFrame class=top><font id=yingwen_san>MAC</font><font id=%s> %s</font></a></td>",m,search(lpublic,"menu_san"),search(lwlan,"mac_filter"));                       
                    fprintf(cgiOut,"</tr>");
				  }
				  if(paraHead1)
				  {
					  result=show_wlan_list(paraHead1->parameter,paraHead1->connection,&WLANINFO);
				  } 
				  if(result == 1)
				  {
				  	wnum = WLANINFO->wlan_num;
				  }
				  
				  total_pnum=((wnum%MAX_PAGE_NUM)==0)?(wnum/MAX_PAGE_NUM):((wnum/MAX_PAGE_NUM)+1);
 				  start_wlanno=p*MAX_PAGE_NUM;   
				  end_wlanno=(((p+1)*MAX_PAGE_NUM)>wnum)?wnum:((p+1)*MAX_PAGE_NUM);
				  wlanno_page=end_wlanno-start_wlanno;
				  if((wlanno_page<(MAX_PAGE_NUM/2))||(wnum==(MAX_PAGE_NUM/2)))   /*该页显示1--14个或者一共有15个wtp*/
				  	limit=9;
				  else if((wlanno_page<MAX_PAGE_NUM)||(wnum==MAX_PAGE_NUM))  /*该页显示15--29个或者一共有30个wtp*/
				  	     limit=20;
				       else         /*大于30个翻页*/
					   	 limit=21;
				  if(retu==1)  /*普通用户*/
				  	limit+=2;
				  for(i=0;i<limit;i++)
	              {
  				    fprintf(cgiOut,"<tr height=25>"\
                      "<td id=tdleft>&nbsp;</td>"\
                    "</tr>");
	              }
                fprintf(cgiOut,"</table>"\
              "</td>"\
              "<td align=left valign=top style=\"background-color:#ffffff; border-right:1px solid #707070; padding-left:30px; padding-top:10px\">"\
              "<table width=763 border=0 bgcolor=#ffffff cellspacing=0 cellpadding=0>"\
   "<tr style=\"padding-bottom:15px\">"\
	  "<td width=70>%s ID:</td>",search(lpublic,"instance"));
	  fprintf(cgiOut,"<td width=693>"\
		  "<select name=instance_id id=instance_id style=width:72px onchange=instanceid_change(this,\"wp_wlanlis.cgi\",\"%s\")>",m);
		  list_instance_parameter(&paraHead2, INSTANCE_STATE_WEB);	 
		  for(pq=paraHead2;(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(select_insid,temp) == 0)
			   fprintf(cgiOut,"<option value='%s' selected=selected>%s",temp,temp);
			 else
			   fprintf(cgiOut,"<option value='%s'>%s",temp,temp);
		  } 		  
		  free_instance_parameter_list(&paraHead2);
		  fprintf(cgiOut,"</select>"\
	  "</td>"\
   "</tr>"\
   "<tr>"\
    "<td colspan=2 valign=top align=center style=\"padding-top:5px; padding-bottom:10px\">");
	if(result == 1)
	{ 
	  fprintf(cgiOut,"<table width=763 border=0 cellspacing=0 cellpadding=0>"\
      "<tr>"\
      "<td align=left colspan=3>");
	  if(wnum>0)           /*如果WLAN存在*/
	  {		
		fprintf(cgiOut,"<table frame=below rules=rows width=763 border=1>"\
		"<tr align=left>"\
        "<th width=100><font id=%s>%s</font></th>",search(lpublic,"menu_thead"),search(lpublic,"name"));
        fprintf(cgiOut,"<th width=50><font id=yingwen_thead>ID</font></th>");
		if(1 == get_product_info("/var/run/mesh_flag"))
		  fprintf(cgiOut,"<th width=100><font id=yingwen_thead>Mesh</font></th>");
		else
		  fprintf(cgiOut,"<th width=100><font id=yingwen_thead>WDS</font></th>");
        fprintf(cgiOut,"<th width=200><font id=yingwen_thead>ESSID</font></th>"\
        "<th width=70><font id=%s>%s</font></th>",search(lpublic,"menu_thead"),search(lwlan,"status"));
		fprintf(cgiOut,"<th width=120><font id=%s>%s</font><font id=yingwen_thead> ID</font></th>",search(lpublic,"menu_thead"),search(lpublic,"security"));
		fprintf(cgiOut,"<th width=110><font id=%s>%s</font></th>",search(lpublic,"menu_thead"),search(lwlan,"if_policy"));
        fprintf(cgiOut,"<th width=13>&nbsp;</th>"\
        "</tr>");
        for(i=start_wlanno;i<end_wlanno;i++)
		{
		  memset(menu,0,sizeof(menu));
		  strncat(menu,"menuLists",sizeof(menu)-strlen(menu)-1);
		  snprintf(menu_id,sizeof(menu_id)-1,"%d",i+1); 
		  strncat(menu,menu_id,sizeof(menu)-strlen(menu)-1);
		  fprintf(cgiOut,"<tr align=left bgcolor=%s>",setclour(cl));
		  if((WLANINFO)&&(WLANINFO->WLAN[i])&&(WLANINFO->WLAN[i]->WlanName))
		  {
			  fprintf(cgiOut,"<td>%s</td>",WLANINFO->WLAN[i]->WlanName);
		  }
		  if((WLANINFO)&&(WLANINFO->WLAN[i]))
		  {
			  fprintf(cgiOut,"<td>%d</td>",WLANINFO->WLAN[i]->WlanID);
		  }
 		  if((WLANINFO)&&(WLANINFO->WLAN[i])&&(WLANINFO->WLAN[i]->WDSStat==1))
			fprintf(cgiOut,"<td>enable</td>");
		  else
			fprintf(cgiOut,"<td>disable</td>");
		  if((WLANINFO)&&(WLANINFO->WLAN[i])&&(WLANINFO->WLAN[i]->ESSID))
		  {
			int len = 0;
			int j = 0;			
			len = strlen(WLANINFO->WLAN[i]->ESSID);
			fprintf(cgiOut,"<td>");
			for(j=0;((j<len)&&(j<ESSID_DEFAULT_LEN));j++)
			{
				if(WLANINFO->WLAN[i]->ESSID[j] == 32)/*html会将连续的多个空格显示为1个,只能通过&nbsp;代替空格*/
					fprintf(cgiOut,"&nbsp;");
				else
					fprintf(cgiOut,"%c",WLANINFO->WLAN[i]->ESSID[j]);
			}
			fprintf(cgiOut,"</td>");
		  }
		  if((WLANINFO)&&(WLANINFO->WLAN[i])&&(WLANINFO->WLAN[i]->Status==1))
			fprintf(cgiOut,"<td>disable</td>");
		  else
			fprintf(cgiOut,"<td>enable</td>");
		  if((WLANINFO)&&(WLANINFO->WLAN[i]))
		  {
			  if(WLANINFO->WLAN[i]->SecurityID==0)
			  {
				fprintf(cgiOut,"<td>%s</td>","NONE");
			  }
			  else
			  {
				fprintf(cgiOut,"<td>%d</td>",WLANINFO->WLAN[i]->SecurityID);
			  }
		  }
		  memset(whichinterface,0,sizeof(whichinterface));
		  if((WLANINFO)&&(WLANINFO->WLAN[i]))
		  {
			  CheckWIDIfPolicy(whichinterface,WLANINFO->WLAN[i]->wlan_if_policy);
		  }
		  fprintf(cgiOut,"<td>%s</td>",whichinterface);	
		  if((WLANINFO)&&(WLANINFO->WLAN[i]))
		  {
			  snprintf(wlan_id,sizeof(wlan_id)-1,"%d",WLANINFO->WLAN[i]->WlanID);	 /*int转成char*/
		  }
		  fprintf(cgiOut,"<td>"\
		                           "<div style=\"position:relative; z-index:%d\" onmouseover=\"popMenu('%s');\" onmouseout=\"popMenu('%s');\">",(wnum-i),menu,menu);
                                   fprintf(cgiOut,"<img src=/images/detail.gif>"\
                                   "<div id=%s style=\"display:none; position:absolute; top:5px; left:0;\">",menu);
                                   fprintf(cgiOut,"<div id=div1>");
								   if(retu==0)  /*管理员*/
								   {
								     fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlannew.cgi?UN=%s target=mainFrame>%s</a></div>",m,search(lpublic,"create"));   
									 if((p>0)&&(p==((wnum-1)/MAX_PAGE_NUM))&&(((wnum-1)%MAX_PAGE_NUM)==0))  /*如果是最后一页且删除该页的最后一项数据,跳转至上一页*/
									   fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlanlis.cgi?UN=%s&WlanID=%s&DeletWlan=%s&PN=%d&INSTANCE_ID=%s&SubmitFlag=1 target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",m,wlan_id,"true",p-1,select_insid,search(lpublic,"confirm_delete"),search(lpublic,"delete"));                             
									 else
									   fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlanlis.cgi?UN=%s&WlanID=%s&DeletWlan=%s&PN=%d&INSTANCE_ID=%s&SubmitFlag=1 target=mainFrame onclick=\"return confirm('%s')\">%s</a></div>",m,wlan_id,"true",p,select_insid,search(lpublic,"confirm_delete"),search(lpublic,"delete"));                             
									 if((WLANINFO)&&(WLANINFO->WLAN[i])&&(WLANINFO->WLAN[i]->WlanName))
								     {
										 fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlancon.cgi?UN=%s&Na=%s&ID=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></div>",m,WLANINFO->WLAN[i]->WlanName,wlan_id,p,select_insid,search(lpublic,"configure"));							   
								     }
									 else
									 {
										 fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlancon.cgi?UN=%s&Na=%s&ID=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></div>",m,"",wlan_id,p,select_insid,search(lpublic,"configure"));							   
								     }
	                                 fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlanmapinter.cgi?UN=%s&ID=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>L3%s</a></div>",m,wlan_id,p,select_insid,search(lpublic,"interface"));                             
								   }
	                               fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlandta.cgi?UN=%s&ID=%s&FL=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></div>",m,wlan_id,whichinterface,p,select_insid,search(lpublic,"details"));
	                               fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_stakind.cgi?UN=%s&ID=%s&ST=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></div>",m,wlan_id,"wlan",p,select_insid,search(lwlan,"station"));                             
								   fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlanblack.cgi?UN=%s&ID=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></div>",m,wlan_id,p,select_insid,search(lwlan,"black"));                             
								   fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlanwhite.cgi?UN=%s&ID=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></div>",m,wlan_id,p,select_insid,search(lwlan,"white"));        
								   if(retu==0)  /*管理员*/
								     fprintf(cgiOut,"<div id=div2 onmouseover=\"this.style.backgroundColor='#b6bdd2'\" onmouseout=\"this.style.backgroundColor='#f9f8f7'\"><a id=link href=wp_wlanmapvlan.cgi?UN=%s&ID=%s&FL=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>WLAN_VLAN%s</a></div>",m,wlan_id,whichinterface,p,select_insid,search(lpublic,"map"));                             	
								   fprintf(cgiOut,"</div>"\
                                   "</div>"\
                                   "</div>"\
          "</td></tr>");
		  cl=!cl;
		}	
		fprintf(cgiOut,"</table>");
	  }
	  else				 /*no wlan exist*/
		fprintf(cgiOut,"%s",search(lwlan,"no_wlan"));
	  fprintf(cgiOut,"</td></tr>");
	  if(wnum>MAX_PAGE_NUM)               /*大于30个wtp时,显示翻页的链接*/
	  {
	    fprintf(cgiOut,"<tr style=\"padding-top:20px\">");
		if(p!=0) 
	      fprintf(cgiOut,"<td align=left width=100><a href=wp_wlanlis.cgi?UN=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></td>",m,p-1,select_insid,search(lpublic,"up_page"));
		else
		  fprintf(cgiOut,"<td width=100>&nbsp;</td>");
	    fprintf(cgiOut,"<td align=center width=463>%s",search(lpublic,"jump_to_page1"));
			                             fprintf(cgiOut,"<select name=page_num id=page_num style=width:50px onchange=page_change(this)>");
										 for(i=0;i<total_pnum;i++)
										 {
										   if(i==p)
			                                 fprintf(cgiOut,"<option value=%d selected=selected>%d",i,i+1);
										   else
										     fprintf(cgiOut,"<option value=%d>%d",i,i+1);
										 }
			                             fprintf(cgiOut,"</select>"\
			                             "%s</td>",search(lpublic,"jump_to_page2"));
		if(p!=((wnum-1)/MAX_PAGE_NUM))
	      fprintf(cgiOut,"<td align=right width=100><a href=wp_wlanlis.cgi?UN=%s&PN=%d&INSTANCE_ID=%s target=mainFrame>%s</a></td>",m,p+1,select_insid,search(lpublic,"down_page"));
		else
		  fprintf(cgiOut,"<td width=100>&nbsp;</td>");
	    fprintf(cgiOut,"</tr>");
	  }
      fprintf(cgiOut,"</table>");
	}
	else if(result == -1)
	  fprintf(cgiOut,"%s",search(lwlan,"no_wlan"));
	else
      fprintf(cgiOut,"%s",search(lpublic,"contact_adm"));			
	fprintf(cgiOut,"</td>"\
  "</tr>"\
"</table>"\
              "</td>"\
            "</tr>"\
            "<tr height=4 valign=top>"\
              "<td width=120 height=4 align=right valign=top><img src=/images/bottom_07.gif width=1 height=10/></td>"\
              "<td width=827 height=4 valign=top bgcolor=#FFFFFF><img src=/images/bottom_06.gif width=827 height=15/></td>"\
            "</tr>"\
          "</table>"\
        "</td>"\
        "<td width=15 background=/images/di999.jpg>&nbsp;</td>"\
      "</tr>"\
    "</table></td>"\
  "</tr>"\
  "<tr>"\
    "<td colspan=3 align=left valign=top background=/images/di777.jpg><img src=/images/di555.jpg width=61 height=62/></td>"\
    "<td align=left valign=top background=/images/di777.jpg>&nbsp;</td>"\
    "<td align=left valign=top background=/images/di777.jpg><img src=/images/di666.jpg width=74 height=62/></td>"\
  "</tr>"\
"</table>"\
"</div>"\
"</form>"\
"</body>"\
"</html>");
if(result == 1)
{
  Free_wlan_head(WLANINFO);
}
free_instance_parameter_list(&paraHead1);
}