Decode decodes a TypedParam. These are part of the libvirt spec, and not xdr proper. TypedParams contain a name, which is called Field for some reason, and a Value, which itself has a "discriminant" - an integer enum encoding the actual type, and a value, the length of which varies based on the actu
(d *xdr.Decoder, v reflect.Value)
| 416 | // actual type, and a value, the length of which varies based on the actual |
| 417 | // type. |
| 418 | func (tpd typedParamDecoder) Decode(d *xdr.Decoder, v reflect.Value) (int, error) { |
| 419 | // Get the name of the typed param first |
| 420 | name, n, err := d.DecodeString() |
| 421 | if err != nil { |
| 422 | return n, err |
| 423 | } |
| 424 | val, n2, err := tpd.decodeTypedParamValue(d) |
| 425 | n += n2 |
| 426 | if err != nil { |
| 427 | return n, err |
| 428 | } |
| 429 | tp := &TypedParam{Field: name, Value: *val} |
| 430 | v.Set(reflect.ValueOf(*tp)) |
| 431 | |
| 432 | return n, nil |
| 433 | } |
| 434 | |
| 435 | // decodeTypedParamValue decodes the Value part of a TypedParam. |
| 436 | func (typedParamDecoder) decodeTypedParamValue(d *xdr.Decoder) (*TypedParamValue, int, error) { |
nothing calls this directly
no test coverage detected