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

Method getSampleInfo

sflow/decoder.go:184–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

182}
183
184func (d *SFDecoder) getSampleInfo() (uint32, uint32, error) {
185 var (
186 sfType uint32
187 sfTypeFormat uint32
188 sfTypeEnterprise uint32
189 sfDataLength uint32
190
191 err error
192 )
193
194 if err = read(d.reader, &sfType); err != nil {
195 return 0, 0, err
196 }
197
198 sfTypeEnterprise = sfType >> 12 // 20 bytes enterprise
199 sfTypeFormat = sfType & 0xfff // 12 bytes format
200
201 // supports standard sflow data
202 if sfTypeEnterprise != 0 {
203 d.reader.Seek(int64(sfDataLength), 1)
204 return 0, 0, errNoneEnterpriseStandard
205 }
206
207 if err = read(d.reader, &sfDataLength); err != nil {
208 return 0, 0, errDataLengthUnknown
209 }
210
211 return sfTypeFormat, sfDataLength, nil
212}
213
214func (d *SFDecoder) isFilterMatch(f uint32) bool {
215 for _, v := range d.filter {

Callers 2

SFDecodeMethod · 0.95
TestGetSampleInfoFunction · 0.95

Calls 1

readFunction · 0.85

Tested by 1

TestGetSampleInfoFunction · 0.76