Documentation ¶
Index ¶
- func AsDosTimeDate(v uint32) time.Time
- func AsFileTime(b []byte) time.Time
- func AsInt64(kind string, b []byte) int64
- func AsUint64(kind string, b []byte) uint64
- func AsUint64Raw(b []byte) (v uint64)
- func AsciiPrintableString(b []byte, maxLength int) (string, uint64)
- func AsciiZString(b []byte, maxLength int) (string, uint64)
- func ParseHexString(in string) ([]byte, error)
- func ParseHexStringToUint64(in string) (uint64, error)
- func ReverseBytes(b []byte, unitLength int) []byte
- func ShiftJISString(b []byte) string
- func SingleUnitSize(kind string) int64
- func U64toBytesBigEndian(val uint64, unitSize uint64) []byte
- func Utf16String(b []byte) string
- func Utf16zString(b []byte) string
- func Utf8zString(b []byte) string
- type DataField
- type DataPattern
- type DosDate
- type DosTime
- type MatchedPattern
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsDosTimeDate ¶
func AsFileTime ¶
func AsUint64Raw ¶
decodes value in network byte order (big) to unsigned integer
func AsciiPrintableString ¶
ascii text encoding (non-printable is replaced by "·") returns decoded string and length in bytes
func AsciiZString ¶
ascii text encoding (00-terminated) returns decoded string and length in bytes
func ParseHexString ¶
parses a textual representation of data into a byte array
func ParseHexStringToUint64 ¶
func ReverseBytes ¶
reverse byte order in groups of `unitLength` to handle u16/u32 ordering
func SingleUnitSize ¶
func U64toBytesBigEndian ¶
func Utf16zString ¶
text encoding used by Windows (00 00-terminated)
func Utf8zString ¶
text encoding used by Windows (00 00-terminated)
Types ¶
type DataField ¶
type DataField struct { // data type: u8, ascii etc Kind string // ranged value if set. data field is type Kind[Length] or Kind[Start:Length] Range string // XXX make this unexported RangeVal int64 // a slice type if true. data field is type Kind[] Slice bool // field label Label string // tracks the index of this DataField in it's parent array Index int // if set, endianness override for this field Endian string }
a parsed data field
func ParseDataField ¶
func (*DataField) IsPatternableUnit ¶
returns true if unit is a single u8, u16, u32 or u64 that can have eq/bit field as child
func (*DataField) IsSimpleUnit ¶
returns true if unit is a single u8, u16, u32 or u64 that can be used in IF statements
func (*DataField) SingleUnitSize ¶
type DataPattern ¶
type DataPattern struct { // if false, data value was described as "??" Known bool // if true, holds the expected pattern Pattern []byte // holds the value (for custom values like in "endian: big") Value string }
func ParseDataPattern ¶
func ParseDataPattern(in string) (DataPattern, error)
parses a "structs" data value (used by structs parser)
type DosDate ¶
type DosDate struct {
// contains filtered or unexported fields
}
MS-DOS 16-bit "dos date" value. Identical to the Date-part of a 32-Bit Windows Time+Date field
type DosTime ¶
type DosTime struct {
// contains filtered or unexported fields
}
MS-DOS 16-bit "dos time" value Identical to the Time-part of a 32-Bit Windows Time+Date field
type MatchedPattern ¶
type MatchedPattern struct { Label string // for debugging Operation string // parsed value of bit field Value []byte // parsed value for display Parsed string // size of bitfield, in bits Size int8 // index bit Index int8 }
A match for values of a fileField. Based on template.MatchPattern data from file template.