forked from posteo/go-agentx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.go
40 lines (32 loc) · 925 Bytes
/
get.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
38
39
40
// 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/value"
// Get defines the pdu get packet.
type Get struct {
SearchRange Range
}
// GetOID returns the oid.
func (g *Get) GetOID() value.OID {
return g.SearchRange.From.GetIdentifier()
}
// SetOID sets the provided oid.
func (g *Get) SetOID(oid value.OID) {
g.SearchRange.From.SetIdentifier(oid)
}
// Type returns the pdu packet type.
func (g *Get) Type() Type {
return TypeGet
}
// MarshalBinary returns the pdu packet as a slice of bytes.
func (g *Get) MarshalBinary() ([]byte, error) {
return []byte{}, nil
}
// UnmarshalBinary sets the packet structure from the provided slice of bytes.
func (g *Get) UnmarshalBinary(data []byte) error {
if err := g.SearchRange.UnmarshalBinary(data); err != nil {
return err
}
return nil
}