Changeset 1777
- Timestamp:
- 08/29/08 16:35:43 (3 months ago)
- Files:
-
- capture-mod/trunk/CaptureClient.sln (modified) (2 diffs)
- capture-mod/trunk/CaptureSoapServer.cpp (modified) (21 diffs)
- capture-mod/trunk/capture.wsdl (modified) (1 diff)
- capture-mod/trunk/captureGSOAP.h (modified) (1 diff)
- capture-mod/trunk/soapC.cpp (modified) (1 diff)
- capture-mod/trunk/soapClient.cpp (modified) (8 diffs)
- capture-mod/trunk/soapServer.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
capture-mod/trunk/CaptureClient.sln
r1776 r1777 17 17 GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 18 {4A258E9F-0B4B-40EF-B6C6-E69C630E5CAC}.Debug|Win32.ActiveCfg = Debug|Win32 19 {4A258E9F-0B4B-40EF-B6C6-E69C630E5CAC}.Debug|Win32.Build.0 = Debug|Win32 19 20 {4A258E9F-0B4B-40EF-B6C6-E69C630E5CAC}.Release|Win32.ActiveCfg = Release|Win32 20 21 {4A258E9F-0B4B-40EF-B6C6-E69C630E5CAC}.Release|Win32.Build.0 = Release|Win32 … … 23 24 {AE2C8E80-7D21-47AD-987B-43E0708AE549}.Release|Win32.Build.0 = Release|Win32 24 25 {4EF34E6D-B30C-46E5-9FC5-967ECEADE2CD}.Debug|Win32.ActiveCfg = Debug|Win32 26 {4EF34E6D-B30C-46E5-9FC5-967ECEADE2CD}.Debug|Win32.Build.0 = Debug|Win32 25 27 {4EF34E6D-B30C-46E5-9FC5-967ECEADE2CD}.Release|Win32.ActiveCfg = Release|Win32 26 28 {4EF34E6D-B30C-46E5-9FC5-967ECEADE2CD}.Release|Win32.Build.0 = Release|Win32 capture-mod/trunk/CaptureSoapServer.cpp
r1776 r1777 48 48 //The below code is taken mostly from the gsoap standalone server example page 49 49 soap_init(&soap); 50 // FIXME TODO: This needs to be configurable51 m = soap_bind(&soap, " 192.168.0.131", 1234, 100);50 //TODO: change this to the desired port 51 m = soap_bind(&soap, "0.0.0.0", 1234, 100); 52 52 if (m < 0) 53 53 soap_print_fault(&soap, stderr); … … 86 86 { 87 87 char debug = 0; 88 printf("CaptureSoapServer::onRegistryEvent got an event for time = %ls, length = %d\n", time.c_str(), time.length());88 if(debug) printf("CaptureSoapServer::onRegistryEvent got an event for time = %ls, length = %d\n", time.c_str(), time.length()); 89 89 90 90 //now begins the arduous process of converting the values into char *s 91 //TODO: use a soap function to make r92 91 ns__regEvent_t r; 93 92 r.time = (char *)malloc(time.length()+1); … … 117 116 sprintf(r.valueData, "%ls", extra.at(3).c_str()); 118 117 119 int * b = (int *)&r; 120 for(int i = 0; i < 8; i++){ 121 printf("r[%d] = %#x\n", i, b[i]); 118 if(debug){ 119 int * b = (int *)&r; 120 for(int i = 0; i < 8; i++){ 121 printf("r[%d] = %#x\n", i, b[i]); 122 } 122 123 } 123 124 124 125 regList.push_back(r); 125 printf("added one event to regList. Now there are %d elements in the list\n", regList.size());126 if(debug) printf("added one event to regList. Now there are %d elements in the list\n", regList.size()); 126 127 } 127 128 … … 133 134 { 134 135 char debug = 0; 135 printf("CaptureSoapServer::onFileEvent got an event for time = %ls\n", time.c_str());136 if(debug) printf("CaptureSoapServer::onFileEvent got an event for time = %ls\n", time.c_str()); 136 137 ns__fileEvent_t f; 137 138 f.time = (char *)malloc(time.length()+1); … … 159 160 } 160 161 fileList.push_back(f); 161 printf("added one event to fileList. Now there are %d elements in the list\n", fileList.size());162 if(debug) printf("added one event to fileList. Now there are %d elements in the list\n", fileList.size()); 162 163 163 164 } … … 167 168 DWORD processId, wstring process) 168 169 { 169 printf("CaptureSoapServer::onProcessEvent got an event for time = %ls\n", time.c_str()); 170 char debug = 0; 171 if(debug) printf("CaptureSoapServer::onProcessEvent got an event for time = %ls\n", time.c_str()); 170 172 ns__procEvent_t p; 171 173 p.time = (char *)malloc(time.length()+1); … … 191 193 192 194 procList.push_back(p); 193 printf("added one event to procList. Now there are %d elements in the list\n", procList.size());195 if(debug) printf("added one event to procList. Now there are %d elements in the list\n", procList.size()); 194 196 195 197 } … … 206 208 //Give it a url to browse to 207 209 int ns__visitURL(struct soap *soap, char * url, struct ns__allEvents &result){ 210 char debug = 1; 208 211 wchar_t xURL[1024]; 209 212 wsprintf(xURL, L"%hs", url); … … 218 221 e.data = NULL; 219 222 e.dataLength = 0; 220 printf("visiting %s\n", url); 223 if(debug) printf("visitURL to %s\n", url); 224 EventController::getInstance()->notifyListeners(&e); 225 221 226 //TODO: We currently run the browser visit event as a black box. 222 227 //In the future we will want to be able to report back about events before 223 228 //it times out or it's cleanly done with the browse. 224 EventController::getInstance()->notifyListeners(&e); 225 226 struct ns__allEvents all; 227 memset(&all, 0, sizeof(struct ns__allEvents)); 228 229 //NOTE: For now, telling the browser to run is not a blocking operation. 230 //The alternate way I had done it in the past (calling Visitor::onServerEvent directly IIRC) 231 //was a blocking way, and might need to be brought back, both for the blocking, and for 232 //being able to get richer information back 233 234 //hack, becase of the above 235 Sleep(5000); 229 236 if(!regList.empty() || !fileList.empty() || !procList.empty()){ 230 return ns__returnEvents(soap, -1, all); 237 goto done; 238 } 239 Sleep(5000); 240 if(!regList.empty() || !fileList.empty() || !procList.empty()){ 241 goto done; 242 } 243 Sleep(5000); 244 if(!regList.empty() || !fileList.empty() || !procList.empty()){ 245 goto done; 246 } 247 Sleep(5000); 248 249 done: 250 struct ns__allEvents * all = soap_new_ns__allEvents(soap, 1); 251 memset(all, 0, sizeof(struct ns__allEvents)); 252 253 if(!regList.empty() || !fileList.empty() || !procList.empty()){ 254 int ret = ns__returnEvents(soap, -1, *all); 255 if(debug) printf("all->regEvents = %#x, all->fileEvents = %#x, all->procEvents = %#x\n", all->regEvents, all->fileEvents, all->procEvents); 256 return ret; 231 257 } 232 258 else{ … … 236 262 237 263 int ns__sendFileBase64(struct soap *soap, char * fileName, char * data, unsigned int encodedLength, unsigned int decodedLength, int &result){ 238 printf("in ns__sendFileBase64\n"); 239 240 printf("encodedLength = %d, decodedLength = %d, data[0][1][2][3] = %c%c%c%c\n", encodedLength, decodedLength, 264 char debug = 0; 265 if(debug) printf("in ns__sendFileBase64\n"); 266 267 if(debug) printf("encodedLength = %d, decodedLength = %d, data[0][1][2][3] = %c%c%c%c\n", encodedLength, decodedLength, 241 268 data[0], data[1], data[2], data[3]); 242 269 … … 263 290 BOOL b = WriteFile(myHandle, decodedData, decodedLength, &numWrote, NULL); 264 291 if(b){ 265 printf("Wrote %d bytes of data to %s\n", numWrote, fileName);292 if(debug) printf("Wrote %d bytes of data to %s\n", numWrote, fileName); 266 293 } 267 294 CloseHandle(myHandle); … … 312 339 unsigned int encodedLength = (unsigned int)b64::b64_encode(buffer, fileSize, NULL, NULL); 313 340 if(debug) printf("encodedLength = %d\n", encodedLength); 341 //TODO: make this a soap_malloc() 314 342 char * encodedData = new char[encodedLength]; 315 343 memset(encodedData, 0, encodedLength); … … 346 374 // have an 'unsigned int' type by default, and I didn't want to make one. Make sure you cast it to DWORD. 347 375 int ns__openDocument(struct soap *soap, char * fileName, int waitTimeMillisec, int &result){ 348 int debug = 1;376 int debug = 0; 349 377 if(debug) printf("in ns__openDocument, waitTimeMillisec = %d\n", waitTimeMillisec); 350 378 … … 373 401 } 374 402 375 //Add the process to the job object 403 //Add the process to the job object. 376 404 b = AssignProcessToJobObject(myJobObj, procInfo.hProcess); 377 405 if(!b){ … … 387 415 //TODO: Before we terminate the jobs, see if it created any events. If so, let it run, and tell the 388 416 //HC Manager about it. The Manager should then request the information about events separately. 417 //This is the sort of check we would like for browsing as well 389 418 390 419 b = TerminateJobObject(myJobObj, 0); … … 393 422 return SOAP_ERR; 394 423 } 395 //Just incase. I don't know if this is still needed396 424 CloseHandle(procInfo.hProcess); 397 425 CloseHandle(procInfo.hThread); … … 403 431 //If maxEventsReturned == -1, then then send as many as possible. 404 432 int ns__returnEvents(struct soap *soap, int maxEventsToReturn, struct ns__allEvents &result){ 405 char debug = 1;433 char debug = 0; 406 434 407 435 struct ns__allEvents * all = soap_new_ns__allEvents(soap, 1); … … 425 453 dRegArray->__size = maxEventsToReturn; 426 454 } 427 printf("Sending back %d registy events\n",dRegArray->__size);455 if(debug) printf("Sending back %d registy events\n",dRegArray->__size); 428 456 429 457 //Allocate a flat array to hold our ns__regEvents in … … 464 492 dFileArray->__size = maxEventsToReturn; 465 493 } 466 printf("Sending back %d file events\n",dFileArray->__size);494 if(debug) printf("Sending back %d file events\n",dFileArray->__size); 467 495 468 496 struct ns__fileEvent * ns__fileEventArray = (struct ns__fileEvent *)soap_malloc(soap, dFileArray->__size*sizeof(struct ns__fileEvent)); … … 489 517 dProcArray->__size = maxEventsToReturn; 490 518 } 491 printf("Sending back %d process events\n",dProcArray->__size);519 if(debug) printf("Sending back %d process events\n",dProcArray->__size); 492 520 493 521 struct ns__procEvent * ns__procEventArray = (struct ns__procEvent *)soap_malloc(soap, dProcArray->__size*sizeof(struct ns__procEvent)); … … 502 530 503 531 result = *all; 504 printf("all->regEvents = %#x, all->fileEvents = %#x, all->procEvents = %#x\n", all->regEvents, all->fileEvents, all->procEvents); 505 // printf("&dRegArray = %#x, dRegArray->__ptr = %#x\n",&dRegArray, dRegArray->__ptr); 506 // printf("dRegArray->__ptr[0][1][2][3] = %#x %#x %#x %#x\n", dRegArray->__ptr[0], dRegArray->__ptr[1], dRegArray->__ptr[2], dRegArray->__ptr[3]); 507 printf("regList.size() = %d, fileList.size() = %d, procList.size() = %d\n", regList.size(), fileList.size(), procList.size()); 532 if(debug) printf("all->regEvents = %#x, all->fileEvents = %#x, all->procEvents = %#x\n", all->regEvents, all->fileEvents, all->procEvents); 533 if(debug) printf("regList.size() = %d, fileList.size() = %d, procList.size() = %d\n", regList.size(), fileList.size(), procList.size()); 508 534 509 535 return SOAP_OK; capture-mod/trunk/capture.wsdl
r1776 r1777 257 257 <documentation>gSOAP 2.7.10 generated service definition</documentation> 258 258 <port name="capture" binding="tns:capture"> 259 <SOAP:address location="http:// 192.168.0.131:1234"/>259 <SOAP:address location="http://0.0.0.0:1234"/> 260 260 </port> 261 261 </service> capture-mod/trunk/captureGSOAP.h
r1776 r1777 7 7 //gsoap ns service style: rpc 8 8 //gsoap ns service encoding: encoded 9 //gsoap ns service port: http:// 192.168.0.131:12349 //gsoap ns service port: http://0.0.0.0:1234 10 10 //gsoap ns service namespace: capture 11 11 capture-mod/trunk/soapC.cpp
r1776 r1777 8 8 #include "soapH.h" 9 9 10 SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.7.10 2008-08-29 0 3:46:42GMT")10 SOAP_SOURCE_STAMP("@(#) soapC.cpp ver 2.7.10 2008-08-29 08:12:30 GMT") 11 11 12 12 capture-mod/trunk/soapClient.cpp
r1776 r1777 7 7 #include "soapH.h" 8 8 9 SOAP_SOURCE_STAMP("@(#) soapClient.cpp ver 2.7.10 2008-08-29 0 3:46:42GMT")9 SOAP_SOURCE_STAMP("@(#) soapClient.cpp ver 2.7.10 2008-08-29 08:12:30 GMT") 10 10 11 11 … … 14 14 struct ns__pingResponse *soap_tmp_ns__pingResponse; 15 15 if (!soap_endpoint) 16 soap_endpoint = "http:// 192.168.0.131:1234";16 soap_endpoint = "http://0.0.0.0:1234"; 17 17 soap->encodingStyle = ""; 18 18 soap_tmp_ns__ping.a = a; … … 66 66 { struct ns__visitURL soap_tmp_ns__visitURL; 67 67 if (!soap_endpoint) 68 soap_endpoint = "http:// 192.168.0.131:1234";68 soap_endpoint = "http://0.0.0.0:1234"; 69 69 soap->encodingStyle = ""; 70 70 soap_tmp_ns__visitURL.URL = URL; … … 117 117 struct ns__sendFileBase64Response *soap_tmp_ns__sendFileBase64Response; 118 118 if (!soap_endpoint) 119 soap_endpoint = "http:// 192.168.0.131:1234";119 soap_endpoint = "http://0.0.0.0:1234"; 120 120 soap->encodingStyle = ""; 121 121 soap_tmp_ns__sendFileBase64.fileName = fileName; … … 171 171 { struct ns__receiveFileBase64 soap_tmp_ns__receiveFileBase64; 172 172 if (!soap_endpoint) 173 soap_endpoint = "http:// 192.168.0.131:1234";173 soap_endpoint = "http://0.0.0.0:1234"; 174 174 soap->encodingStyle = ""; 175 175 soap_tmp_ns__receiveFileBase64.fileName = fileName; … … 222 222 struct ns__openDocumentResponse *soap_tmp_ns__openDocumentResponse; 223 223 if (!soap_endpoint) 224 soap_endpoint = "http:// 192.168.0.131:1234";224 soap_endpoint = "http://0.0.0.0:1234"; 225 225 soap->encodingStyle = ""; 226 226 soap_tmp_ns__openDocument.fileName = fileName; … … 274 274 { struct ns__returnEvents soap_tmp_ns__returnEvents; 275 275 if (!soap_endpoint) 276 soap_endpoint = "http:// 192.168.0.131:1234";276 soap_endpoint = "http://0.0.0.0:1234"; 277 277 soap->encodingStyle = ""; 278 278 soap_tmp_ns__returnEvents.maxEventsToReturn = maxEventsToReturn; … … 325 325 struct ns__sendMIMEResponse *soap_tmp_ns__sendMIMEResponse; 326 326 if (!soap_endpoint) 327 soap_endpoint = "http:// 192.168.0.131:1234";327 soap_endpoint = "http://0.0.0.0:1234"; 328 328 soap->encodingStyle = ""; 329 329 soap_tmp_ns__sendMIME.magicNumber = magicNumber; capture-mod/trunk/soapServer.cpp
r1776 r1777 7 7 #include "soapH.h" 8 8 9 SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.7.10 2008-08-29 0 3:46:42GMT")9 SOAP_SOURCE_STAMP("@(#) soapServer.cpp ver 2.7.10 2008-08-29 08:12:30 GMT") 10 10 11 11
