/*! \brief load_logviewer_file() loads a datalog file for playback \param iochannel is the The IO channel representing the source file */ G_MODULE_EXPORT void load_logviewer_file(GIOChannel *iochannel) { Log_Info *log_info = NULL; if (!iochannel) { MTXDBG(CRITICAL,_("IO Channel pointer is NULL, returning!!\n")); return; } log_info = initialize_log_info(); DATA_SET(global_data,"log_info",log_info); read_log_header(iochannel, log_info); read_log_data(iochannel, log_info); populate_limits(log_info); return; }
/*! \brief load_logviewer_file() loads a datalog file for playback \param iochannel The IO channel representing the source file */ G_MODULE_EXPORT void load_logviewer_file(GIOChannel *iochannel) { Log_Info *log_info = NULL; if (!iochannel) { dbg_func(CRITICAL,g_strdup(__FILE__": load_logviewer_file()\n\tIo_File pointer NULL,returning!!\n")); return; } log_info = initialize_log_info(); DATA_SET(global_data,"log_info",log_info); read_log_header(iochannel, log_info); read_log_data(iochannel, log_info); populate_limits(log_info); return; }
VOID FAR _loadds Strat1() { PRPH pRPH; USHORT Cmd; _asm { mov word ptr pRPH[0], bx mov word ptr pRPH[2], es } Cmd = pRPH->Cmd; pRPH->Status = STATUS_DONE; if ((Cmd == CMDInitBase) && !InitComplete ) { Init((PRPINITIN) pRPH); } #ifdef DEBUG else if(Cmd == CMDOpen) { /* Set the semaphore to prevent multiple opens */ /* if(DevHelp_SemRequest((ULONG)&open_sem, 0)) { */ /* pRPH->Status |= STERR; */ /* pRPH->Status |= 0x14; /- device already in use -/ */ /* } */ } else if(Cmd == CMDClose) { /* DevHelp_SemClear((ULONG)&open_sem); */ } else if(Cmd == CMDINPUT) { PRP_RWV pRP = (PRP_RWV) pRPH; USHORT rc; rc = read_log_data(pRP->XferAddr, pRP->NumSectors); if(rc) pRPH->Status |= STERR | rc; } else if(Cmd == CMDNDR) { RP_NONDESTRUCREAD *pRP = (RP_NONDESTRUCREAD *) pRPH; if(read_nowait(&pRP->character)); } #endif else pRPH->Status |= STATUS_ERR_UNKCMD; }
int main (int argc, char **argv) { const char *infile, *outfile; FILE *out, *in; int opt; poptContext pc; char buffer[4096]; long data_offset, data_length; long data_bytes_read; int in_packet = 0; struct poptOption long_options[] = { POPT_AUTOHELP { "quiet", 'q', POPT_ARG_NONE, &quiet, 0, "Be quiet, don't output warnings" }, { "hex", 'h', POPT_ARG_NONE, &hexformat, 0, "Output format readable by text2pcap" }, POPT_TABLEEND }; pc = poptGetContext(NULL, argc, (const char **) argv, long_options, POPT_CONTEXT_KEEP_FIRST); poptSetOtherOptionHelp(pc, "[<infile> [<outfile>]]"); while((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { } } poptGetArg(pc); /* Drop argv[0], the program name */ infile = poptGetArg(pc); if(infile) { in = fopen(infile, "r"); if(!in) { perror("fopen"); return 1; } } else in = stdin; outfile = poptGetArg(pc); if(outfile) { out = fopen(outfile, "w+"); if(!out) { perror("fopen"); fprintf(stderr, "Can't find %s, using stdout...\n", outfile); } } if(!outfile) out = stdout; if(!hexformat)print_pcap_header(out); while(!feof(in)) { fgets(buffer, sizeof(buffer), in); if(buffer[0] == '[') { /* Header */ if(strstr(buffer, "show_msg")) { in_packet++; if(in_packet == 1)continue; read_log_msg(in, &curpacket, &curpacket_len, &data_offset, &data_length); } else if(in_packet && strstr(buffer, "dump_data")) { data_bytes_read = read_log_data(in, curpacket+data_offset, data_length); } else { if(in_packet){ if(hexformat) print_hex_packet(out, curpacket, curpacket_len); else print_netbios_packet(out, curpacket, curpacket_len, data_bytes_read+data_offset); free(curpacket); } in_packet = 0; } } } return 0; }