From 8fd3869ab347498ef26871357da1a29318c1f2b5 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 2 Feb 2012 01:43:11 +0200 Subject: cleanup --- server/server/Makefile.mingw32 | 2 +- server/server/p_process.cpp | 16 --- server/server/p_process.h | 6 - server/server/p_xml.cpp | 245 ----------------------------------------- server/server/p_xml.h | 12 -- 5 files changed, 1 insertion(+), 280 deletions(-) delete mode 100755 server/server/p_process.cpp delete mode 100755 server/server/p_process.h delete mode 100755 server/server/p_xml.cpp delete mode 100755 server/server/p_xml.h (limited to 'server') diff --git a/server/server/Makefile.mingw32 b/server/server/Makefile.mingw32 index 11a6139..277cff9 100644 --- a/server/server/Makefile.mingw32 +++ b/server/server/Makefile.mingw32 @@ -1,5 +1,5 @@ all: - i686-pc-mingw32-g++ -c *.cpp -I/home/sss/temp/mingw/usr/i686-pc-mingw32/include -I../../libs/rapidxml-1.13 -O2 -pipe -msse -fomit-frame-pointer -DWIN32 -D_WIN32 -DBOOST_THREAD_USE_LIB + i686-pc-mingw32-g++ -c *.cpp -I/home/sss/temp/mingw/usr/i686-pc-mingw32/include -O2 -pipe -msse -fomit-frame-pointer -DWIN32 -D_WIN32 -DBOOST_THREAD_USE_LIB i686-pc-mingw32-g++ -o server.exe *.o -lssl -lcrypto -lwldap32 -lcurl -lidn -lintl -liconv -lssh2 -lwldap32 -lz -lgnutls -lnettle -lhogweed -lgmp -lz -lssh2 -lgcrypt -lgpg-error -lboost_system-mt -lboost_date_time-mt -lboost_thread_win32-mt -lboost_random-mt -lboost_filesystem-mt -lmswsock -lws2_32 -lgdi32 -lz -Wl,-O1 -s clean: rm *.o diff --git a/server/server/p_process.cpp b/server/server/p_process.cpp deleted file mode 100755 index 1d50044..0000000 --- a/server/server/p_process.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "headers.h" -/* -extern config *cfg; - -bool p_start(char *path) -{ - Poco::Process *p = new Poco::Process; - if(!path) - p->launch(cfg->proxifier_path()+"proxifier.exe", Poco::Process::Args()); - else - p->launch(path, Poco::Process::Args()); - if(p->id() > 0) - return true; - return false; -} -*/ \ No newline at end of file diff --git a/server/server/p_process.h b/server/server/p_process.h deleted file mode 100755 index 02fa070..0000000 --- a/server/server/p_process.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef P_PROCESS_H -#define P_PROCESS_H -/* -bool p_start(char *path = NULL); -*/ -#endif \ No newline at end of file diff --git a/server/server/p_xml.cpp b/server/server/p_xml.cpp deleted file mode 100755 index 3d41428..0000000 --- a/server/server/p_xml.cpp +++ /dev/null @@ -1,245 +0,0 @@ -#include "headers.h" -/* -using namespace rapidxml; - -bool p_load_proxy_list(std::list *list, config *cfg, const char *path) -{ - if(!list->empty()) - list->clear(); - std::ifstream file; - if(!path) - file.open(std::string(cfg->proxifier_path()+"/Default/Default.ppx").c_str(), std::ios::in); //TODO: handle different locations - else - file.open(path, std::ios::in); - if(file.is_open()) - { - std::string data((std::istreambuf_iterator(file)), std::istreambuf_iterator()); - file.close(); - xml_document<> doc; - doc.parse<0>(doc.allocate_string(data.c_str())); - xml_node<> *proxy_list = doc.first_node()->first_node("ProxyList"); - if(!proxy_list) - return false; - for(xml_node<> *node = proxy_list->first_node("Proxy"); node; node = node->next_sibling("Proxy")) - { - config::p_proxy_entry e; - e.id = atoi(node->first_attribute("id")->value()); - std::string type = node->first_attribute("type")->value(); - if(type == "HTTP") - e.type = config::HTTP; - if(type == "HTTPS") - e.type = config::HTTPS; - if(type == "SOCKS4") - e.type = config::SOCKS4; - if(type == "SOCKS5") - e.type = config::SOCKS5; - e.host = node->first_node("Address")->value(); - e.port = atoi(node->first_node("Port")->value()); - e.options = atoi(node->first_node("Options")->value()); - xml_node<> *auth = node->first_node("Authentication"); - if(auth) - { - e.enable_auth = atoi(auth->first_attribute("enabled")->value()); - e.login = auth->first_node("Username")->value(); - e.password = auth->first_node("Password")->value(); //TODO: detect kind of hash, decrypt (needed for set auth settings in proxy list) - } - list->push_back(e); - } - if(!list->empty()) - return true; // succesfully loaded some entries - } - return false; -} - -bool p_load_proxy_chains(std::list *list, config *cfg, const char *path) -{ - if(!list->empty()) - list->clear(); - std::ifstream file; - if(!path) - file.open(std::string(cfg->proxifier_path()+"/Default/Default.ppx").c_str(), std::ios::in); //TODO: handle different locations - else - file.open(path, std::ios::in); - if(file.is_open()) - { - std::string data((std::istreambuf_iterator(file)), std::istreambuf_iterator()); - file.close(); - xml_document<> doc; - doc.parse<0>(doc.allocate_string(data.c_str())); - xml_node<> *chain_list = doc.first_node()->first_node("ChainList"); - if(!chain_list) - return false; - for(xml_node<> *node = chain_list->first_node("Chain"); node; node = node->next_sibling("Chain")) - { - config::p_proxy_chain c; - c.id = atoi(node->first_attribute("id")->value()); - c.name = node->first_node("Name")->value(); - for(xml_node<> *proxy = node->first_node("Proxy"); proxy; proxy = proxy->next_sibling("Proxy")) - { - config::p_proxy_chain::chain_entry e; - e.enabled = atoi(proxy->first_attribute("enabled")->value()); - e.id = atoi(proxy->value()); - c.chain.push_back(e); - } - list->push_back(c); - } - if(!list->empty()) - return true; - } - return false; -} - -bool p_save_proxy_list(std::list *list, config *cfg, const char *path) -{ - std::list *p_list = cfg->make_p_proxy_list(); - if(p_list->empty()) - return false; - std::ifstream infile; - if(!path) - infile.open(std::string(cfg->proxifier_path()+"/Default/Default.ppx").c_str(), std::ios::in); //TODO: handle different locations - else - infile.open(path, std::ios::in); - if(infile.is_open()) - { - std::string data((std::istreambuf_iterator(infile)), std::istreambuf_iterator()); - infile.close(); - xml_document<> doc; - doc.parse<0>(doc.allocate_string(data.c_str())); - xml_node<> *proxy_list = doc.first_node()->first_node("ProxyList"); - if(proxy_list) - { - proxy_list->remove_all_nodes(); - proxy_list->remove_all_attributes(); - } - else - { - proxy_list = doc.allocate_node(node_element, "ProxyList"); - doc.append_node(proxy_list); - } - for(std::list::iterator i = p_list->begin(), end = p_list->end(); i != end; ++i) - { - xml_node<> *proxy = doc.allocate_node(node_element, "Proxy"); - char val[8]; - snprintf(val, 7, "%d", i->id); - xml_attribute<> *attr = doc.allocate_attribute("id", doc.allocate_string(val)); - proxy->append_attribute(attr); - std::string type; - switch(i->type) - { - case config::HTTP: - type = "HTTP"; - break; - case config::HTTPS: - type = "HTTPS"; - break; - case config::SOCKS4: - type = "SOCKS4"; - break; - case config::SOCKS5: - type = "SOCKS5"; - break; - } - attr = doc.allocate_attribute("type", doc.allocate_string(type.c_str())); - proxy->append_attribute(attr); - xml_node<> *node = doc.allocate_node(node_element, "Address"); - node->value(doc.allocate_string(i->host.c_str())); - proxy->append_node(node); - node = doc.allocate_node(node_element, "Port"); - snprintf(val, 7, "%d", i->port); - node->value(doc.allocate_string(val)); - proxy->append_node(node); - node = doc.allocate_node(node_element, "Options"); - snprintf(val, 7, "%d", i->options); - node->value(doc.allocate_string(val)); - proxy->append_node(node); - if(!i->login.empty()) - { - xml_node<> *auth = doc.allocate_node(node_element, "Authentication"); - attr = doc.allocate_attribute("enabled", i->enable_auth?"true":"false"); - auth->append_attribute(attr); - node = doc.allocate_node(node_element, "Username"); - node->value(doc.allocate_string(i->login.c_str())); - auth->append_node(node); - node = doc.allocate_node(node_element, "Password"); - node->value(doc.allocate_string(i->password.c_str())); - auth->append_node(node); - proxy->append_node(auth); - } - proxy_list->append_node(proxy); - } - std::ofstream outfile; - if(!path) - outfile.open(std::string(cfg->proxifier_path()+"/Default/Default.ppx").c_str()); //TODO: handle different locations - else - outfile.open(path); - if(outfile.is_open()) - { - outfile<<"\n"; - outfile< *p_list = cfg->make_p_proxy_list(); - if(p_list->empty()) - return false; - std::ifstream infile; - if(!path) - infile.open(std::string(cfg->proxifier_path()+"/Default/Default.ppx").c_str(), std::ios::in); //TODO: handle different locations - else - infile.open(path, std::ios::in); - if(infile.is_open()) - { - std::string data((std::istreambuf_iterator(infile)), std::istreambuf_iterator()); - infile.close(); - xml_document<> doc; - doc.parse<0>(doc.allocate_string(data.c_str())); - xml_node<> *rule_list = doc.first_node()->first_node("RuleList"); - if(!rule_list) - { - rule_list = doc.allocate_node(node_element, "RuleList"); - doc.append_node(rule_list); - } - xml_node<> *default_rule = NULL; - for(xml_node<> *rule = rule_list->first_node("Chain"); rule; rule = rule->next_sibling("Chain")) - { - xml_node<> *name = rule->first_node("Name"); - if(name) - { - if(!strcmp(name->value(), "Default")) - { - default_rule = rule; - break; - } - } - } - char val[8]; - snprintf(val, 7, "%d", entry->id); - if(default_rule) //no validation here, assuming valid config - { - default_rule->first_attribute("enabled")->value("true"); - xml_node<> *action = default_rule->first_node("Action"); - action->first_attribute("type")->value("Proxy"); - action->value(doc.allocate_string(val)); - } - else - { - default_rule = doc.allocate_node(node_element, "Rule"); - rule_list->append_node(default_rule); - default_rule->append_attribute(doc.allocate_attribute("enabled", "true")); - default_rule->append_node(doc.allocate_node(node_element, "Name", "Default")); - xml_node<> *action = doc.allocate_node(node_element, "Action", doc.allocate_string(val)); - action->append_attribute(doc.allocate_attribute("type","Proxy")); - default_rule->append_node(action); - } - } -} - -bool p_save_proxy_chains(std::list *list, config *cfg, const char *path) -{ -} -*/ \ No newline at end of file diff --git a/server/server/p_xml.h b/server/server/p_xml.h deleted file mode 100755 index 58e34d4..0000000 --- a/server/server/p_xml.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef XML_H -#define XML_H - -/* -bool p_load_proxy_list(std::list *list, config *cfg, const char* path = NULL); -bool p_load_proxy_chains(std::list *list, config *cfg, const char *path = NULL); -bool p_save_proxy_list(std::list *list, config *cfg, const char *path = NULL); -bool p_sset_default_rule(config::p_proxy_entry *entry, config *cfg, const char *path = NULL); -bool p_save_proxy_chains(std::list *list, config *cfg, const char *path = NULL); - * */ - -#endif \ No newline at end of file -- cgit v1.2.3