mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-21 04:52:54 +00:00
Add Wireshark packet dissector plugin and associated tools
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
Record of pcap data
|
||||
"""
|
||||
struct PcapRecord
|
||||
header::RecordHeader
|
||||
timestamp::UnixTime
|
||||
underlying_data::Vector{UInt8}
|
||||
record_offset::Int
|
||||
end
|
||||
|
||||
@inline function record_field_(x::PcapRecord, ::Val{:data})
|
||||
offset = getfield(x, :record_offset) + sizeof(RecordHeader)
|
||||
len = Int(getfield(x, :header).incl_len)
|
||||
UnsafeArray{UInt8, 1}(pointer(getfield(x, :underlying_data)) + offset, (len,))
|
||||
end
|
||||
|
||||
@inline function record_field_(x::PcapRecord, ::Val{:raw})
|
||||
offset = getfield(x, :record_offset)
|
||||
len = sizeof(RecordHeader) + getfield(x, :header).incl_len
|
||||
UnsafeArray{UInt8, 1}(pointer(getfield(x, :underlying_data)) + offset, (len,))
|
||||
end
|
||||
|
||||
@inline record_field_(x::PcapRecord, ::Val{f}) where {f} = getfield(x, f)
|
||||
|
||||
@inline Base.getproperty(x::PcapRecord, f::Symbol) = record_field_(x, Val(f))
|
||||
Reference in New Issue
Block a user