void QTPcapReplay::startReplay() { // prepare information for replay m_adapterName = GetAdapterName(); if (SetOutputAdapter() == -1) return; m_bBeforePlay = false; if (ui.speed_LineEdit->text() == "") { ui.speed_LineEdit->setText(QString::number(1)); } m_speed = std::stod(ui.speed_LineEdit->text().toUtf8().constData()); if (m_speed <= 0) { m_speed = 1; ui.speed_LineEdit->setText(QString::number(1)); } m_offSet = std::stod(ui.offSet_lineEdit->text().toUtf8().constData()); m_bOnlyFirstFileOffSet = ui.onlyFirstFile_checkbox->isChecked(); emit m_jobReplay->updatePlayingStatus(true); while (m_playerTimer->IsStop()) Sleep(1); for (int i = ui.listWidget->currentRow(); i < ui.listWidget->count(); i++) { if (i < 0) break; m_bFirstFileOfReplayList = i == 0 ? true : false; if (m_playerTimer->IsStop()) break; QListWidgetItem *item = ui.listWidget->item(i); std::string fileName = item->text().toUtf8().constData(); ui.listWidget->setCurrentRow(i); ReplayFile(fileName); } ui.listWidget->setCurrentRow(0); emit m_jobReplay->updatePlayingStatus(false); }
// Set required graphics adapter for output bool spoutDirectX::SetAdapter(int index) { char adaptername[128]; IDXGIAdapter* pAdapter = nullptr; g_AdapterIndex = D3DADAPTER_DEFAULT; // DX9 g_pAdapterDX11 = nullptr; // DX11 // Reset if(index == -1) { return true; } // printf("spoutDirectX::SetAdapter(%d)\n", index); // Is the requested adapter available if(index > GetNumAdapters()-1) { // printf("Index greater than number of adapters\n"); return false; } if(!GetAdapterName(index, adaptername, 128)) { // printf("Incompatible adapter\n"); return false; } // Set the global adapter pointer for DX11 pAdapter = GetAdapterPointer(index); if(pAdapter == nullptr) { // printf("Could not get pointer for adapter %d\n", index); return false; } // Set the global adapter pointer for DX11 g_pAdapterDX11 = pAdapter; // Set the global adapter index for DX9 g_AdapterIndex = index; // LJ DEBUG - in case of incompatibility - test everything here // 2.005 what is the directX mode ? DWORD dwDX9 = 0; ReadDwordFromRegistry(&dwDX9, "Software\\Leading Edge\\Spout", "DX9"); if(dwDX9 == 1) { // Try to create a DX9 object and device IDirect3D9Ex* pD3D; // DX9 object IDirect3DDevice9Ex* pDevice; // DX9 device pD3D = CreateDX9object(); if(pD3D == NULL) { // printf("SetAdapter - could not create DX9 object\n"); g_AdapterIndex = D3DADAPTER_DEFAULT; // DX9 g_pAdapterDX11 = nullptr; // DX11 return false; } pDevice = CreateDX9device(pD3D, NULL); if(pDevice == NULL) { // printf("SetAdapter - could not create DX9 device\n"); pD3D->Release(); g_AdapterIndex = D3DADAPTER_DEFAULT; // DX9 g_pAdapterDX11 = nullptr; // DX11 return false; } pD3D->Release(); pDevice->Release(); // printf("SetAdapter - created DX9 device OK\n"); } else { // Try to create a DirectX 11 device ID3D11Device* pd3dDevice; pd3dDevice = CreateDX11device(); if(pd3dDevice == NULL) { // printf("SetAdapter - could not create DX11 device\n"); // Close it because not initialized yet and is just a test pd3dDevice->Release(); g_AdapterIndex = D3DADAPTER_DEFAULT; // DX9 g_pAdapterDX11 = nullptr; // DX11 return false; } // printf("SetAdapter - created DX11 device OK\n"); } return true; }
int ParseCommandLine(int argc, char *argv[]) { int CurrentItem; CurrentItem= 1; // Default values ConfigParams.PromiscuousMode= 1; // PCAP_OPENFLAG_PROMISCUOUS; ConfigParams.CaptureFileName= NULL; ConfigParams.AdapterName[0]= 0; ConfigParams.SaveFileName= NULL; ConfigParams.FilterString= NULL; ConfigParams.UseJit= false; ConfigParams.PrintingMode= DEFAULT; ConfigParams.RotateFiles= 0; ConfigParams.NPackets= -1; ConfigParams.NBackends= 1; strcpy(ConfigParams.DumpCodeFilename, nbNETPFLCOMPILER_DEBUG_NETIL_CODE_FILENAME); ConfigParams.StopAfterDumpCode= false; ConfigParams.DumpCode= true; ConfigParams.Backends[0].Id= 0; ConfigParams.Backends[0].Optimization= true; ConfigParams.Backends[1].Id= -1; ConfigParams.Backends[1].Optimization= true; ConfigParams.IPAnonFileName= NULL; ConfigParams.IPAnonFieldsList= NULL; #ifdef ENABLE_SQLITE3 ConfigParams.SQLDatabaseFileBasename= NULL; ConfigParams.SQLTableName= (char*) "DefaultDump"; ConfigParams.SQLTransactionSize= 0; #endif // End defaults while (CurrentItem < argc) { if (strcmp(argv[CurrentItem], "-h") == 0) { Usage(); return nbFAILURE; } if (strcmp(argv[CurrentItem], "-netpdl") == 0) { ConfigParams.NetPDLFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-r") == 0) { if (ConfigParams.AdapterName[0] != 0) { printf("Cannot specify the capture interface and a capture file at the same time.\n"); return nbFAILURE; } ConfigParams.CaptureFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-w") == 0) { ConfigParams.SaveFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-C") == 0) { ConfigParams.RotateFiles= atoi(argv[CurrentItem+1]); CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-c") == 0) { ConfigParams.NPackets= atoi(argv[CurrentItem+1]); CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-cp") == 0) { if (ConfigParams.PrintingMode != DEFAULT) { printf("Error with output specifier '-cp': another format specifier has already been specified.\n"); return nbFAILURE; } ConfigParams.PrintingMode= CP; CurrentItem++; continue; } if (strcmp(argv[CurrentItem], "-scp") == 0) { if (ConfigParams.PrintingMode != DEFAULT) { printf("Error with output specifier '-scp': another format specifier has already been specified.\n"); return nbFAILURE; } ConfigParams.PrintingMode= SCP; CurrentItem++; continue; } if (strcmp(argv[CurrentItem], "-scpt") == 0) { if (ConfigParams.PrintingMode != DEFAULT) { printf("Error with output specifier '-scpt': another format specifier has already been specified.\n"); return nbFAILURE; } ConfigParams.PrintingMode= SCPT; CurrentItem++; continue; } if (strcmp(argv[CurrentItem], "-scpn") == 0) { if (ConfigParams.PrintingMode != DEFAULT) { printf("Error with output specifier '-scpn': another format specifier has already been specified.\n"); return nbFAILURE; } ConfigParams.PrintingMode= SCPN; CurrentItem++; continue; } #ifdef ENABLE_SQLITE3 if (strcmp(argv[CurrentItem], "-sqldb") == 0) { if (ConfigParams.PrintingMode != DEFAULT) { printf("Error with output specifier '-sqldb': another format specifier has already been specified.\n"); return nbFAILURE; } ConfigParams.PrintingMode= SQLITE3; ConfigParams.SQLDatabaseFileBasename = argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-sqltable") == 0) { ConfigParams.SQLTableName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-sqltransize") == 0) { // Please note that in SQLite 3 no changes can be made to the database except within a transaction. // Any command that changes the database (basically, any SQL command other than SELECT) // will automatically start a transaction if one is not already in effect. // Automatically started transactions are committed when the last query finishes. // // The 'SQLTransactionSize' is used to define manually the transactions and group // multiple insertions in the same commit, which boosts the efficiency quite a lot. ConfigParams.SQLTransactionSize = atoi( argv[CurrentItem+1] ); CurrentItem+= 2; continue; } #endif if (strcmp(argv[CurrentItem], "-anonip") == 0) { ConfigParams.IPAnonFileName= argv[CurrentItem+1]; ConfigParams.IPAnonFieldsList= argv[CurrentItem+2]; CurrentItem+= 3; continue; } if (strcmp(argv[CurrentItem], "-jit") == 0) { ConfigParams.UseJit= true; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-p") == 0) { ConfigParams.PromiscuousMode=0; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-D") == 0) { PrintAdapters(); return nbFAILURE; } if (strcmp(argv[CurrentItem], "-noopt") == 0) { ConfigParams.Backends[0].Optimization= false; CurrentItem+=1; continue; } if (strcmp(argv[CurrentItem], "-backends") == 0) { PrintBackends(); return nbFAILURE; } if (strcmp(argv[CurrentItem], "-d") == 0) { nvmBackendDescriptor *BackendList; CurrentItem++; int id= -1; // Get the list of available backends BackendList= nvmGetBackendList(&(ConfigParams.NBackends)); // We consider also the 'netil' backend, which is not returned back by the previous function ConfigParams.NBackends++; if (CurrentItem < argc) // we have to avoid the case in which no other parameters follow sscanf(argv[CurrentItem], "%d", &id); if (id == -1) { if (CurrentItem < argc) { id= GetBackendIdFromName(argv[CurrentItem], BackendList); if (id == -1) { printf("\n\tBackend '%s' is not supported. Please use the '-backends' switch to get\n", argv[CurrentItem]); printf("\tthe list of available backends.\n"); return nbFAILURE; } else CurrentItem++; } else { printf("\n\tAfter the -d switch you need to specify the backend to use. Please use the '-backends'\n"); printf("\tswitch to get the list of available backends.\n"); return nbFAILURE; } } else CurrentItem++; if (id == 0) { // the default backend should be used ConfigParams.Backends[1].Id= -1; ConfigParams.Backends[1].Inline= 0; ConfigParams.Backends[1].Optimization= true; } int bid=id; if (id > 0) { bid= 1; ConfigParams.Backends[bid].Id= id; } if ((CurrentItem < argc) && strcmp(argv[CurrentItem], "noopt")==0) { ConfigParams.Backends[bid].Optimization= false; CurrentItem++; } if ((CurrentItem < argc) && strcmp(argv[CurrentItem], "inline")==0) { ConfigParams.Backends[bid].Inline= true; CurrentItem++; } if (ValidateDumpBackend(id, BackendList) == true) { ConfigParams.StopAfterDumpCode= true; ConfigParams.DumpCode=true; } continue; } if (strcmp(argv[CurrentItem], "-i") == 0) { char* Interface; int InterfaceNumber; if (ConfigParams.CaptureFileName != NULL) { printf("Cannot specify the capture interface and a capture file at the same time.\n"); return nbFAILURE; } Interface= argv[CurrentItem+1]; InterfaceNumber= atoi(Interface); // If we specify the interface by name, let's copy it in the proper structure // Otherwise, let's transform the interface index into a name if (InterfaceNumber == 0) { strncpy(ConfigParams.AdapterName, Interface, sizeof(ConfigParams.AdapterName)); ConfigParams.AdapterName[sizeof(ConfigParams.AdapterName) - 1]= 0; } else { if (GetAdapterName(InterfaceNumber, ConfigParams.AdapterName, sizeof(ConfigParams.AdapterName)) == nbFAILURE) { printf("Error: the requested adapter is out of range.\n"); return nbFAILURE; } } CurrentItem+=2; continue; } if (argv[CurrentItem][0] == '-') { printf("\n\tError: parameter '%s' is not valid.\n", argv[CurrentItem]); return nbFAILURE; } // We do not have any '-' switch; so, it should be the filter string ConfigParams.FilterString = argv[CurrentItem]; CurrentItem += 1; continue; } if ((ConfigParams.CaptureFileName == NULL) && (ConfigParams.AdapterName[0] == 0)) { printf("Neither the capture file nor the capturing interface has been specified.\n"); printf("Using the first adapter as default.\n"); if (GetAdapterName(1, ConfigParams.AdapterName, sizeof(ConfigParams.AdapterName)) == nbFAILURE) { printf("Error when trying to retrieve the name of the first network interface.\n"); printf(" Make sure that %s is installed, and that you have the right\n", pcap_lib); printf(" permissions to open the network adapters.\n\n"); return nbFAILURE; } } if (ConfigParams.FilterString == NULL) { printf("\n\tCommand line error: missing the filtering/extraction string\n (e.g. 'ip extractfields(ip.src,ip.dst)').\n"); return nbFAILURE; } if ((ConfigParams.IPAnonFileName != NULL) && (ConfigParams.IPAnonFieldsList == NULL)) { printf("\n\tCommand line error: IP anonymization argument missing!\n"); return nbFAILURE; } return nbSUCCESS; }
int ParseCommandLine(int argc, char *argv[]) { int CurrentItem; int InterfaceNumber= -1; CurrentItem= 1; // Default values ConfigParams.PromiscuousMode= 1; //PCAP_OPENFLAG_PROMISCUOUS; ConfigParams.UseJit= 0; ConfigParams.NetPFLExtractString = DEFAULT_EXTRACTSTRING; ConfigParams.CaptureFileName= DEFAULT_CAPTUREFILENAME; // End defaults while (CurrentItem < argc) { if (strcmp(argv[CurrentItem], "-netpdl") == 0) { ConfigParams.NetPDLFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-r") == 0) { ConfigParams.CaptureFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-jit") == 0) { ConfigParams.UseJit= 1; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-p") == 0) { ConfigParams.PromiscuousMode= 0; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-i") == 0) { char* Interface; ConfigParams.CaptureFileName= NULL; Interface= argv[CurrentItem+1]; InterfaceNumber= atoi(Interface); if (InterfaceNumber == 0) { strncpy(ConfigParams.AdapterName, Interface, sizeof(ConfigParams.AdapterName)); ConfigParams.AdapterName[sizeof(ConfigParams.AdapterName) - 1]=0; continue; } CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-h") == 0) { Usage(); return nbFAILURE; } if (argv[CurrentItem][0] == '-') { printf("\n\tError: parameter '%s' is not valid.\n", argv[CurrentItem]); return nbFAILURE; } // Current parameter is the filter string, which does not have any switch (e.g. '-something') in front ConfigParams.NetPFLExtractString = argv[CurrentItem++]; } if ((ConfigParams.CaptureFileName == NULL) && (ConfigParams.AdapterName[0] == 0)) { printf("Neither the capture file nor the capturing interface has been specified.\n"); printf("Using the first adapter as default.\n"); if (GetAdapterName(1, ConfigParams.AdapterName, sizeof(ConfigParams.AdapterName)) == nbFAILURE) { printf("Error when trying to retrieve the name of the first network interface.\n"); printf(" Make sure that WinPcap/libpcap is installed, and that you have\n"); printf(" the right permissions to open the network adapters.\n\n"); return nbFAILURE; } } return nbSUCCESS; }
int ParseCommandLine(int argc, char *argv[]) { int CurrentItem; CurrentItem= 1; // Default values ConfigParams.PromiscuousMode= 1;//PCAP_OPENFLAG_PROMISCUOUS; ConfigParams.DebugLevel= 0; ConfigParams.CaptureFileName= NULL; ConfigParams.AdapterName[0]= 0; ConfigParams.FilterString= NULL; ConfigParams.NPackets= -1; ConfigParams.SnapLen= 65535; ConfigParams.SaveFileName= NULL; ConfigParams.PcapDumpFile= NULL; ConfigParams.StopAfterDumpCode= false; ConfigParams.DumpCode= true; ConfigParams.QuietMode= false; ConfigParams.RotateFiles= 0; ConfigParams.UseJit= false; ConfigParams.NBackends= 1; ConfigParams.Backends[0].Id= 0; ConfigParams.Backends[0].Optimization= true; ConfigParams.Backends[1].Id= -1; ConfigParams.Backends[1].Optimization= true; #ifdef _DEBUG ConfigParams.DumpCodeFilename = nbNETPFLCOMPILER_DEBUG_NETIL_CODE_FILENAME; ConfigParams.DumpHIRCodeFilename = nbNETPFLCOMPILER_DEBUG_HIR_CODE_FILENAME; ConfigParams.DumpLIRCodeFilename = nbNETPFLCOMPILER_DEBUG_LIR_CODE_FILENAME; ConfigParams.DumpNetILGraphFilename = nbNETPFLCOMPILER_DEBUG_NETIL_GRAPH_FILENAME; ConfigParams.DumpNoCodeGraphFilename = nbNETPFLCOMPILER_DEBUG_NO_CODE_GRAPH_FILENAME; ConfigParams.DumpLIRNoOptGraphFilename = nbNETPFLCOMPILER_DEBUG_LIR_NOOPT_GRAPH_FILENAME; ConfigParams.DumpLIRGraphFilename = nbNETPFLCOMPILER_DEBUG_LIR_GRAPH_FILENAME; ConfigParams.DumpProtoGraphFilename = nbNETPFLCOMPILER_DEBUG_PROTOGRAH_DUMP_FILENAME; #endif // End defaults while (CurrentItem < argc) { if (strcmp(argv[CurrentItem], "-netpdl") == 0) { ConfigParams.NetPDLFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-r") == 0) { if (ConfigParams.AdapterName[0] != 0) { printf("Cannot specify the capture interface and a capture file at the same time.\n"); return nbFAILURE; } ConfigParams.CaptureFileName= argv[CurrentItem+1]; CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-w") == 0) { ConfigParams.SaveFileName= argv[CurrentItem+1]; CurrentItem+= 2; //Set quiet mode to 'true' ConfigParams.QuietMode= true; continue; } if (strcmp(argv[CurrentItem], "-C") == 0) { ConfigParams.RotateFiles= atoi(argv[CurrentItem+1]); CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-h") == 0) { Usage(); return nbFAILURE; } if (strcmp(argv[CurrentItem], "-jit") == 0) { ConfigParams.UseJit = true; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-p") == 0) { ConfigParams.PromiscuousMode=0; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-c") == 0) { ConfigParams.NPackets= atoi(argv[CurrentItem+1]); CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-s") == 0) { ConfigParams.SnapLen= atoi(argv[CurrentItem+1]); CurrentItem+= 2; continue; } if (strcmp(argv[CurrentItem], "-n") == 0) { ConfigParams.DoNotPrintNetworkNames=true; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-q") == 0) { ConfigParams.QuietMode= true; CurrentItem+= 1; continue; } if (strcmp(argv[CurrentItem], "-D") == 0) { PrintAdapters(); return nbFAILURE; } if (strcmp(argv[CurrentItem], "-backends") == 0) { PrintBackends(); return nbFAILURE; } if (strcmp(argv[CurrentItem], "-i") == 0) { char* Interface; int InterfaceNumber; if (ConfigParams.CaptureFileName != NULL) { printf("Cannot specify the capture interface and a capture file at the same time.\n"); return nbFAILURE; } Interface= argv[CurrentItem+1]; InterfaceNumber= atoi(Interface); // If we specify the interface by name, let's copy it in the proper structure // Otherwise, let's transform the interface index into a name if (InterfaceNumber == 0) { strncpy(ConfigParams.AdapterName, Interface, sizeof(ConfigParams.AdapterName)); ConfigParams.AdapterName[sizeof(ConfigParams.AdapterName) - 1]= 0; } else { if (GetAdapterName(InterfaceNumber, ConfigParams.AdapterName, sizeof(ConfigParams.AdapterName)) == nbFAILURE) { printf("Error: the requested adapter is out of range.\n"); return nbFAILURE; } } CurrentItem+=2; continue; } // Limit the number of optimization cycles if (strcmp(argv[CurrentItem], "-noopt") == 0) { ConfigParams.Backends[0].Optimization=false; CurrentItem+=1; continue; } // Debugging info levels if (strcmp(argv[CurrentItem], "-debug") == 0) { ConfigParams.DebugLevel= atoi(argv[CurrentItem+1]); CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-d") == 0) { nvmBackendDescriptor *BackendList; CurrentItem++; int id= -1; // Get the list of available backends BackendList= nvmGetBackendList(&(ConfigParams.NBackends)); // We consider also the 'netil' backend, which is not returned back by the previous function ConfigParams.NBackends++; if (CurrentItem < argc) // we have to avoid the case in which no other parameters follow sscanf(argv[CurrentItem], "%d", &id); if (id == -1) { if (CurrentItem < argc) { id= GetBackendIdFromName(argv[CurrentItem], BackendList); if (id == -1) { printf("\n\tBackend '%s' is not supported. Please use the '-backends' switch\n", argv[CurrentItem]); printf("\tto get the list of available backends.\n"); return nbFAILURE; } else CurrentItem++; } else { printf("\n\tAfter the -d switch you need to specify the backend to use. Please use\n"); printf("\tthe '-backends' switch to get the list of available backends.\n"); return nbFAILURE; } } else CurrentItem++; if (id == 0) { // the default backend should be used ConfigParams.Backends[1].Id= -1; ConfigParams.Backends[1].Inline= false; ConfigParams.Backends[1].Optimization= true; } int bid=id; if (id > 0) { bid=1; ConfigParams.Backends[bid].Id=id; } if ((CurrentItem < argc) && strcmp(argv[CurrentItem], "noopt")==0) { ConfigParams.Backends[bid].Optimization=false; CurrentItem++; } if ((CurrentItem < argc) && strcmp(argv[CurrentItem], "inline")==0) { ConfigParams.Backends[bid].Inline= true; CurrentItem++; } if ((CurrentItem < argc) && strcmp(argv[CurrentItem], "-o") == 0) { ConfigParams.DumpCodeFilename = argv[CurrentItem+1]; CurrentItem += 2; } if (ValidateDumpBackend(id, BackendList)==true) { ConfigParams.StopAfterDumpCode = true; ConfigParams.DumpCode=true; } continue; } #ifdef _DEBUG if (strcmp(argv[CurrentItem], "-dump_netil_code") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpCodeFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_lir_code") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpLIRCodeFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_hir_code") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpHIRCodeFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_netil_graph") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpNetILGraphFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_lir_graph") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpLIRGraphFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_lir_no_opt_graph") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpLIRNoOptGraphFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_no_code_graph") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpNoCodeGraphFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } if (strcmp(argv[CurrentItem], "-dump_proto_graph") == 0) { if (strncmp(argv[CurrentItem+1], "-", 255) != 0) ConfigParams.DumpProtoGraphFilename = argv[CurrentItem+1]; CurrentItem+=2; continue; } #endif if (argv[CurrentItem][0] == '-') { printf("\n\tError: parameter '%s' is not valid.\n", argv[CurrentItem]); return nbFAILURE; } // Current parameter is the filter string, which does not have any switch (e.g. '-something') in front if (ConfigParams.FilterString != NULL) { printf("\n\tError: only one filter must be defined without an option switch.\n"); return nbFAILURE; } ConfigParams.FilterString = argv[CurrentItem]; CurrentItem += 1; continue; } if ((ConfigParams.DumpCode) && (ConfigParams.StopAfterDumpCode) && ((ConfigParams.FilterString==NULL) || (ConfigParams.FilterString[0]=='\0'))) { printf("\n\tNo filter specified! To dump the generated code you need to specify the filter to use.\n"); return nbFAILURE; } if ((ConfigParams.DumpCode == false || ConfigParams.StopAfterDumpCode == false)) { if ((ConfigParams.CaptureFileName == NULL) && (ConfigParams.AdapterName[0] == 0)) { printf("Neither the capture file nor the capturing interface has been specified.\n"); printf("Using the first adapter as default.\n"); if (GetAdapterName(1, ConfigParams.AdapterName, sizeof(ConfigParams.AdapterName)) == nbFAILURE) { printf("Error when trying to retrieve the name of the first network interface.\n"); printf(" Make sure that %s is installed, and that you have the right\n", pcap_lib); printf(" permissions to open the network adapters.\n\n"); return nbFAILURE; } } } return nbSUCCESS; }