Documentation ¶
Index ¶
- Constants
- func IsASCII(data string) bool
- func JSONValueToType(value any, typ CIMType) (any, bool)
- func LookupDictionary(ref uint32) string
- func Marshal(obj *Object) ([]byte, error)
- func QualifierSetSize(qs []*Qualifier) int
- func ReverseLookupDictionary(s string) uint32
- type CIMType
- type Class
- type Codec
- func (c *Codec) Begin(s any)
- func (c *Codec) Bytes() []byte
- func (c *Codec) DecodeHeap() error
- func (c *Codec) DecodeWithBytes(b []byte, data any) error
- func (c *Codec) DecodeWithLength32(data any) error
- func (c *Codec) DecodeWithSize32(sz uint32, data any) error
- func (c *Codec) Done() error
- func (c *Codec) EncodeBytesWithSize32(sz *uint32, data any) ([]byte, error)
- func (c *Codec) EncodeWithLength32(data any) error
- func (c *Codec) Err(err ...error) error
- func (c *Codec) Errf(frmt string, args ...interface{}) error
- func (c *Codec) Len() int
- func (c *Codec) Read(p []byte) error
- func (c *Codec) ReadData(data any) error
- func (c *Codec) ReadHeap() error
- func (c *Codec) ReadRef(data any, debug ...string) error
- func (c *Codec) Write(p []byte) error
- func (c *Codec) WriteData(data any) error
- func (c *Codec) WriteDataOnHeap(sz int, data any) error
- func (c *Codec) WriteHeap() error
- func (c *Codec) WriteRef(data any, debug ...string) error
- type Decoration
- type Flavor
- type Heap
- type HeapRef
- type Heaps
- type Instance
- type Method
- type Methods
- type Object
- func (o *Object) Decode(r *Codec) error
- func (o *Object) DecodeWithClass(r *Codec, cls Class) error
- func (o *Object) Encode(r *Codec) error
- func (o *Object) Method(n string) (*Object, *Object, error)
- func (o *Object) New(values Values, convert ...func(any, CIMType) (any, bool)) (*Object, error)
- func (o *Object) Properties() Values
- func (o *Object) Values() Values
- type ObjectClass
- type ObjectFlag
- type Property
- type Qualifier
- type Value
- type Values
Constants ¶
const Inherited uint32 = 0x4000
const NULLRef = uint32(0xFFFFFFFF)
The NULL reference.
Variables ¶
This section is empty.
Functions ¶
func LookupDictionary ¶
func QualifierSetSize ¶
func ReverseLookupDictionary ¶
Types ¶
type CIMType ¶
type CIMType uint32
const CIMArray CIMType = 0x2000
var ( Int8 CIMType = 16 Uint8 CIMType = 17 Int16 CIMType = 2 Uint16 CIMType = 18 Int32 CIMType = 3 Uint32 CIMType = 19 Int64 CIMType = 20 Uint64 CIMType = 21 Float32 CIMType = 4 Float64 CIMType = 5 Bool CIMType = 11 String CIMType = 8 DateTime CIMType = 101 Ref CIMType = 102 Rune CIMType = 103 CIMObject CIMType = 13 Int8Array CIMType = Int8 | CIMArray Uint8Array CIMType = Uint8 | CIMArray Int16Array CIMType = Int16 | CIMArray Uint16Array CIMType = Uint16 | CIMArray Int32Array CIMType = Int32 | CIMArray Uint32Array CIMType = Uint32 | CIMArray Int64Array CIMType = Int64 | CIMArray Uint64Array CIMType = Uint64 | CIMArray Float32Array CIMType = Float32 | CIMArray Float64Array CIMType = Float64 | CIMArray BoolArray CIMType = Bool | CIMArray StringArray CIMType = String | CIMArray DateTimeArray CIMType = DateTime | CIMArray RefArray CIMType = Ref | CIMArray RuneArray CIMType = Rune | CIMArray CIMObjectArray CIMType = CIMObject | CIMArray )
func (CIMType) MarshalJSON ¶
type Class ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
The WMIO encoder/decoder.
func (*Codec) DecodeHeap ¶
DecodeHeap function decodes the references on the current heap. If decoded data has more references, they will be decoded as well.
func (*Codec) DecodeWithBytes ¶
DecodeWithBytes function decodes the `data` within given byte chunk `b`.
func (*Codec) DecodeWithLength32 ¶
DecodeWithLength32 function reads the uint32 data length prefix (length is calculated as len + size_of(len)).
func (*Codec) DecodeWithSize32 ¶
DecodeWithSize32 function reads the sized chunk and decodes the data within it.
func (*Codec) EncodeBytesWithSize32 ¶
EncodeBytesWithSize32 function writes the data and saves the captured length into the value `sz`.
func (*Codec) EncodeWithLength32 ¶
EncodeWithLength32 function encodes the data and length prefix.
func (*Codec) ReadHeap ¶
ReadHeap function reads the heap data. (size of heap is calculated by inverting the left-most bit).
func (*Codec) ReadRef ¶
ReadRef function reads the reference for the data, and if reference is not NULL, appends the reference to the list of heap references.
func (*Codec) WriteDataOnHeap ¶
WriteDataOnHeap function is used to write reference and refered value to the heap. First, we allocate space for the reference (or data that includes a reference), and then we write the actual referred data right after the reference.
type Decoration ¶
type Decoration struct { ServerName string `json:"server_name,omitempty"` Namespace string `json:"namespace,omitempty"` }
func (*Decoration) Decode ¶
func (d *Decoration) Decode(r *Codec) error
func (*Decoration) Encode ¶
func (d *Decoration) Encode(r *Codec) error
type HeapRef ¶
type HeapRef struct { // The offset on the heap. Offset uint32 // The value to encode/decode. Value any // The debug information associated with the // reference. Debug []string }
The heap reference.
type Heaps ¶
type Heaps struct {
// contains filtered or unexported fields
}
Heaps represent the stack of heaps, top-level (last) element represents the current heap.
func (*Heaps) HeapBuffer ¶
HeapBuffer function returns the top-level (last) heap bytes.Buffer.
func (*Heaps) Pop ¶
func (r *Heaps) Pop()
Pop function removes the top-level (last) heap from the heap stack.
type Instance ¶
type Instance struct { CurrentClass Class `json:"current_class,omitempty"` Flags uint8 `json:"flags,omitempty"` ClassName string `json:"class_name,omitempty"` Properties []*Property `json:"properties,omitempty"` Qualifiers []*Qualifier `json:"qualifiers,omitempty"` }
func (*Instance) DecodeInstanceNoClass ¶ added in v1.0.1
type Method ¶
type Method struct { Name string `json:"name,omitempty"` Flags uint8 `json:"flags,omitempty"` Origin uint32 `json:"origin,omitempty"` Qualifiers []*Qualifier `json:"qualifiers,omitempty"` InputSignature Object `json:"input_signature,omitempty"` OutputSignature Object `json:"output_signature,omitempty"` }
type Object ¶
type Object struct { Decoration *Decoration `json:"decoration,omitempty"` Class *ObjectClass `json:"class,omitempty"` Instance *Instance `json:"instance,omitempty"` Partial bool `json:"partial,omitempty"` IsQuery bool `json:"is_query,omitempty"` }
func UnmarshalWithClass ¶ added in v1.0.1
func (*Object) DecodeWithClass ¶ added in v1.0.1
func (*Object) Properties ¶ added in v1.0.1
type ObjectClass ¶
type ObjectClass struct { ParentClass Class `json:"parent_class,omitempty"` ParentClassMethods Methods `json:"parent_class_methods,omitempty"` CurrentClass Class `json:"current_class,omitempty"` CurrentClassMethods Methods `json:"current_class_methods,omitempty"` }
func (*ObjectClass) Decode ¶
func (o *ObjectClass) Decode(r *Codec) error
func (*ObjectClass) Encode ¶
func (o *ObjectClass) Encode(r *Codec) error
type ObjectFlag ¶
type ObjectFlag uint8
const ( // The object is a CIM class. This flag is mutually exclusive with 0x02. ObjectFlagClass ObjectFlag = 0x01 // The object is a CIM instance. This flag is mutually exclusive with 0x01. ObjectFlagInstance ObjectFlag = 0x02 // If this flag is set, the object has a Decoration block. ObjectFlagDecoration ObjectFlag = 0x04 // If this flag is set, the object is a prototype of the result // object for the query ObjectFlagQuery ObjectFlag = 0x40 // If this flag is set, one or more key properties of the class are // not present in the Prototype Result Object. ObjectFlagPartial ObjectFlag = 0x10 // Mask. ObjectFlagMask = ObjectFlagClass | ObjectFlagInstance | ObjectFlagDecoration | ObjectFlagQuery | ObjectFlagPartial )
type Property ¶
type Property struct { Name string `json:"name,omitempty"` Order uint16 `json:"order"` Offset uint32 `json:"offset,omitempty"` ClassOfOrigin uint32 `json:"class_of_origin,omitempty"` Qualifiers []*Qualifier `json:"qualifiers,omitempty"` Nullable bool `json:"nullable,omitempty"` InheritDefault bool `json:"inherit_default,omitempty"` Inherited bool `json:"inherited,omitempty"` Value Value `json:"value,omitempty"` }