MCPcopy Create free account
hub / github.com/Edgio/vflow / decodeFlows

Method decodeFlows

netflow/v5/decoder.go:315–338  ·  view source on GitHub ↗
(flowCount int, msg *Message)

Source from the content-addressed store, hash-verified

313}
314
315func (d *Decoder) decodeFlows(flowCount int, msg *Message) error {
316 remainingLen := d.reader.Len()
317 expectedLen := flowCount * 48
318 flowIndex := 0
319
320 var err error
321
322 if expectedLen > remainingLen {
323 err = fmt.Errorf("Expect %v bytes to read, %v remaining bytes encountered", expectedLen, remainingLen)
324 }
325
326 // there should be *flowCount* number of flows in the message, each 48 bytes long
327 for err == nil && flowIndex < flowCount {
328
329 fr := FlowRecord{}
330 err = fr.unmarshal(d.reader)
331 if err == nil {
332 msg.Flows = append(msg.Flows, fr)
333 }
334 flowIndex++
335 }
336
337 return err
338}
339
340func combineErrors(errorSlice ...error) (err error) {
341 switch len(errorSlice) {

Callers 1

DecodeMethod · 0.95

Calls 2

unmarshalMethod · 0.95
LenMethod · 0.80

Tested by

no test coverage detected