forked from posteo/go-agentx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.go
37 lines (29 loc) · 844 Bytes
/
register.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2018 The agentx authors
// Licensed under the LGPLv3 with static-linking exception.
// See LICENCE file for details.
package pdu
import (
"github.com/Yamu-OSS/go-agentx/marshaler"
)
// Register defines the pdu register packet.
type Register struct {
Timeout Timeout
Subtree ObjectIdentifier
}
// Type returns the pdu packet type.
func (r *Register) Type() Type {
return TypeRegister
}
// MarshalBinary returns the pdu packet as a slice of bytes.
func (r *Register) MarshalBinary() ([]byte, error) {
combined := marshaler.NewMulti(&r.Timeout, &r.Subtree)
combinedBytes, err := combined.MarshalBinary()
if err != nil {
return nil, err
}
return combinedBytes, nil
}
// UnmarshalBinary sets the packet structure from the provided slice of bytes.
func (r *Register) UnmarshalBinary(data []byte) error {
return nil
}