示例#1
0
int read_remote_proxy(char *file, struct nd_proxy_info *proxy_info )
{
	int ret;
	ndxml  *xml_node, *xml_read ;
	ndxml_root xmlroot;

	nd_assert(file) ;
	ret = ndxml_load(file, &xmlroot) ;
	if(0!=ret) {
		return -1;
	}
	xml_node = ndxml_getnode(&xmlroot,"server_config") ;
	if(!xml_node) {		
		ndxml_destroy(&xmlroot);
		return -1;
	}

	//read proxy
	xml_read = ndxml_refsub(xml_node, "proxy") ;
	if(xml_read) {

		ndxml *xmltmp = ndxml_refsub(xml_read, "proxy_type") ;
		if (!xmltmp) 	goto CFG_EXIT ;		
		proxy_info->proxy_type = ndxml_getval_int(xmltmp);
		if(0==proxy_info->proxy_type )goto CFG_EXIT ;

		xmltmp = ndxml_refsub(xml_read, "proxy_host") ;
		if (!xmltmp) 	goto CFG_EXIT ;		
		ndxml_getval_buf(xmltmp, proxy_info->proxy_host, sizeof(proxy_info->proxy_host)) ;


		xmltmp = ndxml_refsub(xml_read, "proxy_port") ;
		if (!xmltmp) 	goto CFG_EXIT ;		
		proxy_info->proxy_port = ndxml_getval_int(xmltmp) ;

		xmltmp = ndxml_refsub(xml_read, "proxy_user") ;
		if (xmltmp)
			ndxml_getval_buf(xmltmp, proxy_info->user, sizeof(proxy_info->user)) ;

		xmltmp = ndxml_refsub(xml_read, "proxy_password") ;
		if (xmltmp) 
			ndxml_getval_buf(xmltmp, proxy_info->password, sizeof(proxy_info->password)) ;
	}

CFG_EXIT:
	ndxml_destroy(&xmlroot);
	return 0;

}
示例#2
0
int read_base_port(ndxml *xmlroot)
{
	ndxml *xml_sub = ndxml_refsub(xmlroot,"base_port") ;
	if (!xml_sub){
		T_ERROR("read base port error") ;
	}
	return ndxml_getval_int(xml_sub) ;
};
示例#3
0
bool startDialog::getScriptExpDebugInfo(ndxml *scriptXml)
{
	ndxml *moduleInfo = ndxml_getnode(scriptXml, "moduleInfo");
	if (moduleInfo){
		ndxml *node = ndxml_getnode(moduleInfo, "script_with_debug");
		if (node){
			return ndxml_getval_int(node) ? true : false;
		}
	}
	return false;
}
示例#4
0
int startDialog::getScriptExpEncodeType(ndxml *scriptXml)
{
	ndxml *moduleInfo = ndxml_getnode(scriptXml, "moduleInfo");
	if (moduleInfo){
		ndxml *node = ndxml_getnode(moduleInfo, "script_out_encode");
		if (node){
			return ndxml_getval_int(node);
		}
	}
	return 0;
}