mirror of
https://github.com/soypat/lneto.git
synced 2026-08-20 14:39:02 +00:00
add FieldClassOperation to pcap and associated formatting changes
This commit is contained in:
@@ -670,6 +670,7 @@ const (
|
||||
FieldClassAddress // address
|
||||
// FieldClassBinaryText represents long stretches of binary data such as BOOTP DHCPv4 field.
|
||||
FieldClassBinaryText // binary-text
|
||||
FieldClassOperation // op
|
||||
)
|
||||
|
||||
const octet = 8
|
||||
@@ -718,8 +719,7 @@ var baseARPFields = [...]FrameField{
|
||||
BitLength: 1 * octet,
|
||||
},
|
||||
{
|
||||
Name: "Opcode",
|
||||
Class: FieldClassType,
|
||||
Class: FieldClassOperation,
|
||||
FrameBitOffset: 6 * octet,
|
||||
BitLength: 2 * octet,
|
||||
},
|
||||
@@ -924,8 +924,7 @@ var baseUDPFields = [...]FrameField{
|
||||
|
||||
var baseDHCPv4Fields = [...]FrameField{
|
||||
{
|
||||
Name: "Opcode",
|
||||
Class: FieldClassType,
|
||||
Class: FieldClassOperation,
|
||||
FrameBitOffset: 0,
|
||||
BitLength: 1 * octet,
|
||||
},
|
||||
|
||||
@@ -112,7 +112,7 @@ func (f *Formatter) formatField(dst []byte, pktStartOff int, field FrameField, p
|
||||
dst = hex.AppendEncode(dst, f.buf)
|
||||
case FieldClassText:
|
||||
dst = strconv.AppendQuote(dst, string(f.buf))
|
||||
case FieldClassDst, FieldClassSrc, FieldClassSize, FieldClassAddress:
|
||||
case FieldClassDst, FieldClassSrc, FieldClassSize, FieldClassAddress, FieldClassOperation:
|
||||
// IP, MAC addresses and ports.
|
||||
if field.BitLength <= 16 {
|
||||
v, err := fieldAsUint(pkt, fieldBitStart, field.BitLength, field.RightAligned)
|
||||
|
||||
@@ -23,11 +23,12 @@ func _() {
|
||||
_ = x[FieldClassText-12]
|
||||
_ = x[FieldClassAddress-13]
|
||||
_ = x[FieldClassBinaryText-14]
|
||||
_ = x[FieldClassOperation-15]
|
||||
}
|
||||
|
||||
const _FieldClass_name = "undefinedsourcedestinationprotocolversiontypesizeflagsidentificationchecksumoptionspayloadtextaddressbinary-text"
|
||||
const _FieldClass_name = "undefinedsourcedestinationprotocolversiontypesizeflagsidentificationchecksumoptionspayloadtextaddressbinary-textop"
|
||||
|
||||
var _FieldClass_index = [...]uint8{0, 9, 15, 26, 34, 41, 45, 49, 54, 68, 76, 83, 90, 94, 101, 112}
|
||||
var _FieldClass_index = [...]uint8{0, 9, 15, 26, 34, 41, 45, 49, 54, 68, 76, 83, 90, 94, 101, 112, 114}
|
||||
|
||||
func (i FieldClass) String() string {
|
||||
if i >= FieldClass(len(_FieldClass_index)-1) {
|
||||
|
||||
Reference in New Issue
Block a user