Versions in this module Expand all Collapse all v0 v0.0.10 Sep 19, 2023 v0.0.9 Feb 27, 2023 v0.0.8 Sep 6, 2022 v0.0.7 May 6, 2022 v0.0.6 Mar 28, 2022 Changes in this version + func FormatTagCanonical(v uint32, enumMap EnumMap) string type Enum + func (e *Enum) CanonicalName(v uint32) (string, bool) type EnumMap + CanonicalName func(v uint32) (string, bool) type Registry + func (r *Registry) FormatTagCanonical(t Tag) string type Tag + func (t Tag) CanonicalName() string type Value + func NewStruct(tag Tag, vals ...Value) Value + func NewValue(tag Tag, val interface{}) Value v0.0.5 Aug 7, 2020 Changes in this version + const TagNone + var ErrHeaderTruncated = errors.New("header truncated") + var ErrIntOverflow = fmt.Errorf("value exceeds max int value %d", math.MaxInt32) + var ErrInvalidHexString = kmiputil.ErrInvalidHexString + var ErrInvalidLen = errors.New("invalid length") + var ErrInvalidTag = errors.New("invalid tag") + var ErrInvalidType = errors.New("invalid KMIP type") + var ErrNoTag = errors.New("unable to determine tag for field") + var ErrTagConflict = errors.New("tag conflict") + var ErrUnexpectedValue = errors.New("no field was found to unmarshal value into") + var ErrUnregisteredEnumName = merry.New("unregistered enum name") + var ErrUnsupportedEnumTypeError = errors.New("unsupported type for enums, must be string, or int types") + var ErrUnsupportedTypeError = errors.New("marshaling/unmarshaling is not supported for this type") + var ErrValueTruncated = errors.New("value truncated") + func Details(err error) string + func FormatEnum(v uint32, enumMap EnumMap) string + func FormatInt(i int32, enumMap EnumMap) string + func FormatTag(v uint32, enumMap EnumMap) string + func FormatType(b byte, enumMap EnumMap) string + func Hex2bytes(s string) []byte + func NormalizeName(s string) string + func ParseEnum(s string, enumMap EnumMap) (uint32, error) + func ParseInt(s string, enumMap EnumMap) (int32, error) + func Print(w io.Writer, prefix, indent string, t TTLV) error + func PrintPrettyHex(w io.Writer, prefix, indent string, t TTLV) error + func RegisterTypes(r *Registry) + func Unmarshal(ttlv TTLV, v interface{}) error + type DateTimeExtended struct + func (t *DateTimeExtended) UnmarshalTTLV(d *Decoder, ttlv TTLV) error + func (t DateTimeExtended) MarshalTTLV(e *Encoder, tag Tag) error + type Decoder struct + DisallowExtraValues bool + func NewDecoder(r io.Reader) *Decoder + func (dec *Decoder) Decode(v interface{}) error + func (dec *Decoder) DecodeValue(v interface{}, ttlv TTLV) error + func (dec *Decoder) NextTTLV() (TTLV, error) + func (dec *Decoder) Reset(r io.Reader) + type Encoder struct + func NewEncoder(w io.Writer) *Encoder + func (e *Encoder) Encode(v interface{}) error + func (e *Encoder) EncodeBigInteger(tag Tag, v *big.Int) + func (e *Encoder) EncodeBoolean(tag Tag, v bool) + func (e *Encoder) EncodeByteString(tag Tag, v []byte) + func (e *Encoder) EncodeDateTime(tag Tag, v time.Time) + func (e *Encoder) EncodeDateTimeExtended(tag Tag, v time.Time) + func (e *Encoder) EncodeEnumeration(tag Tag, v uint32) + func (e *Encoder) EncodeInteger(tag Tag, v int32) + func (e *Encoder) EncodeInterval(tag Tag, v time.Duration) + func (e *Encoder) EncodeLongInteger(tag Tag, v int64) + func (e *Encoder) EncodeStructure(tag Tag, f func(e *Encoder) error) error + func (e *Encoder) EncodeTextString(tag Tag, v string) + func (e *Encoder) EncodeValue(tag Tag, v interface{}) error + func (e *Encoder) Flush() error + type Enum struct + func NewBitmask() Enum + func NewEnum() Enum + func (e *Enum) Bitmask() bool + func (e *Enum) Name(v uint32) (string, bool) + func (e *Enum) RegisterValue(v uint32, name string) + func (e *Enum) Value(name string) (uint32, bool) + func (e *Enum) Values() []uint32 + type EnumMap interface + Bitmask func() bool + Name func(v uint32) (string, bool) + Value func(name string) (uint32, bool) + Values func() []uint32 + type EnumValue uint32 + func (v EnumValue) MarshalTTLV(e *Encoder, tag Tag) error + type Marshaler interface + MarshalTTLV func(e *Encoder, tag Tag) error + type MarshalerError struct + Field string + Struct string + Tag Tag + Type reflect.Type + func (e *MarshalerError) Error() string + type Registry struct + var DefaultRegistry Registry + func (r *Registry) EnumForTag(t Tag) EnumMap + func (r *Registry) FormatEnum(t Tag, v uint32) string + func (r *Registry) FormatInt(t Tag, v int32) string + func (r *Registry) FormatTag(t Tag) string + func (r *Registry) FormatType(t Type) string + func (r *Registry) IsBitmask(t Tag) bool + func (r *Registry) IsEnum(t Tag) bool + func (r *Registry) ParseEnum(t Tag, s string) (uint32, error) + func (r *Registry) ParseInt(t Tag, s string) (int32, error) + func (r *Registry) ParseTag(s string) (Tag, error) + func (r *Registry) ParseType(s string) (Type, error) + func (r *Registry) RegisterEnum(t Tag, def EnumMap) + func (r *Registry) RegisterTag(t Tag, name string) + func (r *Registry) RegisterType(t Type, name string) + func (r *Registry) Tags() EnumMap + func (r *Registry) Types() EnumMap + type TTLV []byte + func Marshal(v interface{}) (TTLV, error) + func (t *TTLV) UnmarshalJSON(b []byte) error + func (t *TTLV) UnmarshalTTLV(_ *Decoder, ttlv TTLV) error + func (t *TTLV) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error + func (t TTLV) FullLen() int + func (t TTLV) Len() int + func (t TTLV) MarshalJSON() ([]byte, error) + func (t TTLV) MarshalXML(e *xml.Encoder, _ xml.StartElement) error + func (t TTLV) Next() TTLV + func (t TTLV) String() string + func (t TTLV) Tag() Tag + func (t TTLV) Type() Type + func (t TTLV) Valid() error + func (t TTLV) ValidHeader() error + func (t TTLV) Value() interface{} + func (t TTLV) ValueBigInteger() *big.Int + func (t TTLV) ValueBoolean() bool + func (t TTLV) ValueByteString() []byte + func (t TTLV) ValueDateTime() time.Time + func (t TTLV) ValueDateTimeExtended() DateTimeExtended + func (t TTLV) ValueEnumeration() uint32 + func (t TTLV) ValueInteger() int32 + func (t TTLV) ValueInterval() time.Duration + func (t TTLV) ValueLongInteger() int64 + func (t TTLV) ValueRaw() []byte + func (t TTLV) ValueStructure() TTLV + func (t TTLV) ValueTextString() string + type Tag uint32 + func ParseTag(s string, enumMap EnumMap) (Tag, error) + func (t *Tag) UnmarshalText(text []byte) (err error) + func (t Tag) MarshalText() (text []byte, err error) + func (t Tag) String() string + func (t Tag) Valid() bool + type Type byte + const TypeBigInteger + const TypeBoolean + const TypeByteString + const TypeDateTime + const TypeDateTimeExtended + const TypeEnumeration + const TypeInteger + const TypeInterval + const TypeLongInteger + const TypeStructure + const TypeTextString + func ParseType(s string, enumMap EnumMap) (Type, error) + func (t *Type) UnmarshalText(text []byte) (err error) + func (t Type) MarshalText() (text []byte, err error) + func (t Type) String() string + type Unmarshaler interface + UnmarshalTTLV func(d *Decoder, ttlv TTLV) error + type UnmarshalerError struct + Field string + Struct reflect.Type + Tag Tag + Type Type + Val reflect.Type + func (e *UnmarshalerError) Error() string + type Value struct + Tag Tag + Value interface{} + func (t *Value) UnmarshalTTLV(d *Decoder, ttlv TTLV) error + func (t Value) MarshalTTLV(e *Encoder, tag Tag) error + type Values []Value