MCPcopy Index your code
hub / github.com/google/gopacket / NextPacket

Method NextPacket

packet.go:800–810  ·  view source on GitHub ↗

NextPacket returns the next decoded packet from the PacketSource. On error, it returns a nil packet and a non-nil error.

()

Source from the content-addressed store, hash-verified

798// NextPacket returns the next decoded packet from the PacketSource. On error,
799// it returns a nil packet and a non-nil error.
800func (p *PacketSource) NextPacket() (Packet, error) {
801 data, ci, err := p.source.ReadPacketData()
802 if err != nil {
803 return nil, err
804 }
805 packet := NewPacket(data, p.decoder, p.DecodeOptions)
806 m := packet.Metadata()
807 m.CaptureInfo = ci
808 m.Truncated = m.Truncated || ci.CaptureLength < ci.Length
809 return packet, nil
810}
811
812// packetsToChannel reads in all packets from the packet source and sends them
813// to the given channel. This routine terminates when a non-temporary error

Callers 2

packetsToChannelMethod · 0.95
benchmarkPacketDecodeFunction · 0.80

Calls 3

MetadataMethod · 0.95
NewPacketFunction · 0.85
ReadPacketDataMethod · 0.65

Tested by

no test coverage detected