Changeset 1728

Show
Ignore:
Timestamp:
08/12/08 17:11:23 (4 months ago)
Author:
xkovah
Message:

removed all the superflous stuff from when I was trying different ways to signal to the visit thread

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • capture-mod/trunk/CaptureSoapServer.cpp

    r1727 r1728  
    1111#include "Visitor.h" 
    1212 
    13 Visitor * globVisitor; 
    14  
    1513CaptureSoapServer::CaptureSoapServer(Visitor* v){ 
    16  
    17     globVisitor = v; 
    1814    CaptureSoapServerThread = new Thread(this); 
    1915    CaptureSoapServerThread->start("CaptureSoapServer"); 
    20  
    2116} 
    2217 
     
    3126   SOCKET m, s; // master and slave sockets 
    3227 
    33    ///loadClientPlugins(); 
    3428 
    3529   soap_init(&soap); 
     
    7165   return SOAP_OK; 
    7266}  
    73  
    74 void CaptureSoapServer::test(){ 
    75  
    76 //  printf("myVisitor = %#x\n", CaptureSoapServer::myVisitor); 
    77  
    78 } 
    7967 
    8068int ns__ping(struct soap *soap, char * a, char ** result)  
     
    125113*/ 
    126114 
    127 void 
    128 CaptureSoapServer::loadClientPlugins() 
    129 { 
    130     WIN32_FIND_DATA FindFileData; 
    131     HANDLE hFind = INVALID_HANDLE_VALUE; 
    132     wchar_t pluginDirectoryPath[1024]; 
    133  
    134     GetFullPathName(L"plugins\\Application_*.dll", 1024, pluginDirectoryPath, NULL); 
    135     DebugPrint(L"Capture-SOAP Server: Plugin directory - %ls\n", pluginDirectoryPath); 
    136     hFind = FindFirstFile(pluginDirectoryPath, &FindFileData); 
    137  
    138     if (hFind != INVALID_HANDLE_VALUE)  
    139     { 
    140         typedef void (*AppPlugin)(void*); 
    141         do 
    142         { 
    143             wstring pluginDir = L"plugins\\"; 
    144             pluginDir += FindFileData.cFileName;             
    145             HMODULE hPlugin = LoadLibrary(pluginDir.c_str()); 
    146  
    147             if(hPlugin != NULL) 
    148             { 
    149                 list<ApplicationPlugin*>* apps = new std::list<ApplicationPlugin*>(); 
    150                 applicationPlugins.insert(PluginPair(hPlugin, apps)); 
    151                 ApplicationPlugin* applicationPlugin = createApplicationPluginObject(hPlugin); 
    152                 if(applicationPlugin == NULL) { 
    153                     FreeLibrary(hPlugin); 
    154                 } else { 
    155                     printf("Loaded plugin: %ls\n", FindFileData.cFileName); 
    156                     unsigned int g = applicationPlugin->getPriority(); 
    157                     wchar_t** supportedApplications = applicationPlugin->getSupportedApplicationNames(); 
    158                     for(int i = 0; supportedApplications[i] != NULL; i++) 
    159                     { 
    160                         stdext::hash_map<wstring, ApplicationPlugin*>::iterator it; 
    161                         it = applicationMap.find(supportedApplications[i]); 
    162                         /* Check he application isn't already being handled by a plugin */ 
    163                         if(it != applicationMap.end()) 
    164                         { 
    165                             /* Check the priority of the existing application plugin */ 
    166                             unsigned int p = it->second->getPriority(); 
    167                             if(applicationPlugin->getPriority() > p) 
    168                             { 
    169                                 /* Over ride the exisiting plugin if the priority of the loaded one 
    170                                    is greater */ 
    171                                 applicationMap.erase(supportedApplications[i]); 
    172                                 printf("\toverride: added application: %ls\n", supportedApplications[i]); 
    173                                 applicationMap.insert(ApplicationPair(supportedApplications[i], applicationPlugin)); 
    174                             } else { 
    175                                 printf("\tplugin overridden: not adding application: %ls\n", supportedApplications[i]); 
    176                             } 
    177                         } else { 
    178                             printf("\tinserted: added application: %ls\n", supportedApplications[i]); 
    179                             applicationMap.insert(ApplicationPair(supportedApplications[i], applicationPlugin));  
    180                         } 
    181                     } 
    182                 } 
    183             } 
    184         } while(FindNextFile(hFind, &FindFileData) != 0); 
    185         FindClose(hFind); 
    186     } 
    187      
    188 } 
    189  
    190 ApplicationPlugin* 
    191 CaptureSoapServer::createApplicationPluginObject(HMODULE hPlugin) 
    192 { 
    193     typedef void (*PluginExportInterface)(void*); 
    194     PluginExportInterface pluginCreateInstance = NULL; 
    195     ApplicationPlugin* applicationPlugin = NULL; 
    196     /* Get the function address to create a plugin object */ 
    197     pluginCreateInstance = (PluginExportInterface)GetProcAddress(hPlugin,"New"); 
    198     /* Create a new plugin object in the context of the plugin */ 
    199     pluginCreateInstance(&applicationPlugin); 
    200     /* If the object was created then add it to a list so we can track it */ 
    201     if(applicationPlugin != NULL) 
    202     { 
    203         stdext::hash_map<HMODULE, std::list<ApplicationPlugin*>*>::iterator it; 
    204         it = applicationPlugins.find(hPlugin); 
    205         if(it != applicationPlugins.end()) 
    206         { 
    207             list<ApplicationPlugin*>* apps = it->second; 
    208             apps->push_back(applicationPlugin); 
    209         } 
    210     } 
    211     return applicationPlugin; 
    212 } 
    213  
    214 void 
    215 CaptureSoapServer::onServerEvent(Element* pElement) 
    216 { 
    217     wstring applicationName = L"iexplore"; 
    218     wstring url = L""; 
    219     int time = 30; 
    220     vector<Attribute>::iterator it; 
    221     for(it = pElement->attributes.begin(); it != pElement->attributes.end(); it++) 
    222     { 
    223         if(it->name == L"url") { 
    224             url = it->value; 
    225         } else if(it->name == L"program") { 
    226             applicationName = it->value; 
    227         } else if(it->name == L"time") { 
    228             time = boost::lexical_cast<int>(it->value); 
    229         } 
    230     } 
    231     if(url != L"") 
    232     { 
    233         url = CaptureGlobal::urlDecode(url); 
    234         stdext::hash_map<wstring, ApplicationPlugin*>::iterator vit; 
    235         vit = applicationMap.find(applicationName); 
    236         if(vit != applicationMap.end()) 
    237         { 
    238             ApplicationPlugin* applicationPlugin = vit->second; 
    239             Url* visiturl = new Url(url, applicationName, time); 
    240             DWORD minorErrorCode = 0; 
    241             DWORD majorErrorCode = 0; 
    242             printf("Visiting: %ls -> %ls\n", visiturl->getApplicationName().c_str(), visiturl->getUrl().c_str()); 
    243          
    244             /* Pass the actual visitation process of to the application plugin */ 
    245             majorErrorCode = applicationPlugin->visitUrl(visiturl, &minorErrorCode); 
    246             ///toVisit.push(VisitPair(applicationPlugin, visiturl)); 
    247             ///SetEvent(hQueueNotEmpty); 
    248         } else { 
    249             printf("CaptureSoapServer-onServerEvent: ERROR could not find client %ls path, url not queued for visitation\n", applicationName.c_str()); 
    250         } 
    251     } else { 
    252         printf("CaptureSoapServer-onServerEvent: ERROR no url specified for visit event\n"); 
    253     } 
    254 } 
  • capture-mod/trunk/CaptureSoapServer.h

    r1727 r1728  
    3737public: 
    3838    typedef boost::signal<void (DWORD, DWORD, wstring, wstring)> signal_visitEvent; 
    39   typedef pair <HMODULE, std::list<ApplicationPlugin*>*> PluginPair; 
    40   typedef pair <wstring, ApplicationPlugin*> ApplicationPair; 
    41   typedef pair <ApplicationPlugin*, Url*> VisitPair; 
     39///   typedef pair <HMODULE, std::list<ApplicationPlugin*>*> PluginPair; 
     40///   typedef pair <wstring, ApplicationPlugin*> ApplicationPair; 
     41///   typedef pair <ApplicationPlugin*, Url*> VisitPair; 
    4242public: 
    4343    CaptureSoapServer(Visitor *); 
     
    4747 
    4848    //Stolen from Visitor 
    49     void loadClientPlugins(); 
    50     ApplicationPlugin* createApplicationPluginObject(HMODULE hPlugin); 
    51     void onServerEvent(Element* pElement); 
     49    ///void loadClientPlugins(); 
     50    ///ApplicationPlugin* createApplicationPluginObject(HMODULE hPlugin); 
     51    ///void onServerEvent(Element* pElement); 
     52 
    5253 
    5354    Thread * CaptureSoapServerThread; 
     55 
     56    /* 
    5457    signal_visitEvent signalVisitEvent; 
    5558    stdext::hash_map<HMODULE, std::list<ApplicationPlugin*>*> applicationPlugins; 
    5659    boost::signals::connection onServerVisitEventConnection; 
    5760    stdext::hash_map<wstring, ApplicationPlugin*> applicationMap; 
     61    */ 
    5862 
    59     static void test(); 
    6063    static Visitor * myVisitor; 
    6164 
  • capture-mod/trunk/captureGSOAP.h

    r1727 r1728  
    1313    char * last; 
    1414} ns__myStruct2; 
     15*/ 
    1516 
    16 int ns__junks(char * a, ns__myStruct2 &result); 
    17 */ 
     17//int ns__junks(char * a, ns__myStruct2 &result); 
     18 
    1819 
    1920int ns__add(int a, int b, int &result);  
  • capture-mod/trunk/client.pl

    r1724 r1728  
    77use Data::Dumper; 
    88 
    9 #$pingDataA = SOAP::Data->name(a => "http://www.cnn.com"); 
     9$pingDataA = SOAP::Data->name(a => "http://www.cnn.com"); 
    1010 
    11 #$calcDataA = SOAP::Data->name(a => $ARGV[0]); 
    12 #$calcDataB = SOAP::Data->name(b => 2); 
     11$calcDataA = SOAP::Data->name(a => $ARGV[0]); 
     12$calcDataB = SOAP::Data->name(b => 2); 
    1313 
    1414$structData = SOAP::Data->name(a => "a"); 
     
    1616$res = SOAP::Lite 
    1717    -> proxy('http://192.168.0.131:1234/') 
    18     -> ns('calculator') 
    19     -> struct($structData
     18    -> ns('capture') 
     19    -> ping($pingDataA
    2020    -> result; 
    2121