Ejemplo n.º 1
0
func (s *EfhSim) AnalyzeInput() (err error) {
	defer errs.PassE(&err)
	handle, err := pcap.OpenOffline(s.inputFileName)
	errs.CheckE(err)
	defer handle.Close()
	pp := processor.NewProcessor()
	pp.LimitPacketNumber(s.inputPacketLimit)
	pp.SetObtainer(handle)
	pp.SetHandler(s)
	errs.CheckE(pp.ProcessAll())
	return
}
Ejemplo n.º 2
0
func (c *cmdPcap2memh) ParsingFinished() (err error) {
	if !c.shouldExecute {
		return
	}
	handle, err := pcap.OpenOffline(c.InputFileName)
	errs.CheckE(err)
	defer handle.Close()

	printer, err := rec.NewMemhRecorder(c.DestDirName)
	errs.CheckE(err)
	defer func() { errs.CheckE(printer.Close()) }()
	printer.AddDummy()

	pp := processor.NewProcessor()
	pp.LimitPacketNumber(c.PacketNumLimit)
	pp.SetObtainer(handle)
	pp.SetHandler(printer)
	errs.CheckE(pp.ProcessAll())
	return
}