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

Function NewNgWriterInterface

pcapgo/ngwrite.go:66–79  ·  view source on GitHub ↗

NewNgWriterInterface initializes and returns a new writer. Additionally, one section and one interface (without statistics) is written to the file. Flush must be called before the file is closed, or if eventual unwritten information should be written out to the storage device. Written files are in

(w io.Writer, intf NgInterface, options NgWriterOptions)

Source from the content-addressed store, hash-verified

64//
65// Written files are in little endian format. Interface timestamp resolution is fixed to 9 (to match time.Time).
66func NewNgWriterInterface(w io.Writer, intf NgInterface, options NgWriterOptions) (*NgWriter, error) {
67 ret := &NgWriter{
68 w: bufio.NewWriter(w),
69 options: options,
70 }
71 if err := ret.writeSectionHeader(); err != nil {
72 return nil, err
73 }
74
75 if _, err := ret.AddInterface(intf); err != nil {
76 return nil, err
77 }
78 return ret, nil
79}
80
81// ngOptionLength returns the needed length for one option value (without padding)
82func ngOptionLength(option ngOption) int {

Callers 2

NewNgWriterFunction · 0.85
TestNgWriteComplexFunction · 0.85

Calls 2

writeSectionHeaderMethod · 0.95
AddInterfaceMethod · 0.95

Tested by 1

TestNgWriteComplexFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…