-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Filebeat] NetFlow: Add Cisco ASA fields #11201
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ package fields | |
|
||
import ( | ||
"encoding/binary" | ||
"encoding/hex" | ||
"errors" | ||
"fmt" | ||
"io" | ||
|
@@ -322,6 +323,34 @@ func (u UnsupportedDecoder) Decode(data []byte) (interface{}, error) { | |
|
||
var _ Decoder = (*UnsupportedDecoder)(nil) | ||
|
||
type ACLIDDecoder struct{} | ||
|
||
const aclIDLength = 12 | ||
|
||
func (u ACLIDDecoder) MinLength() uint16 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported method ACLIDDecoder.MinLength should have comment or be unexported |
||
return aclIDLength | ||
} | ||
|
||
func (u ACLIDDecoder) MaxLength() uint16 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported method ACLIDDecoder.MaxLength should have comment or be unexported |
||
return aclIDLength | ||
} | ||
|
||
func (u ACLIDDecoder) Decode(data []byte) (interface{}, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported method ACLIDDecoder.Decode should have comment or be unexported |
||
if len(data) != aclIDLength { | ||
return nil, ErrOutOfBounds | ||
} | ||
// Encode a [12]byte to a hex string in the form: | ||
// "11223344-55667788-99aabbcc" | ||
var result [aclIDLength*2 + 2]byte | ||
hex.Encode(result[:8], data[:4]) | ||
hex.Encode(result[9:17], data[4:8]) | ||
hex.Encode(result[18:], data[8:]) | ||
result[8], result[17] = '-', '-' | ||
return string(result[:]), nil | ||
} | ||
|
||
var _ Decoder = (*OctetArrayDecoder)(nil) | ||
|
||
// RFC5610 fields | ||
var ( | ||
OctetArray = OctetArrayDecoder{} | ||
|
@@ -348,3 +377,6 @@ var ( | |
SubTemplateList = UnsupportedDecoder{} | ||
SubTemplateMultiList = UnsupportedDecoder{} | ||
) | ||
|
||
// ACLID field added for Cisco ASA devices | ||
var ACLID = ACLIDDecoder{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type ACLIDDecoder should have comment or be unexported