Files
agentx
config
go-agentx
marshaler
pdu
allocate_index.go
close.go
deallocate_index.go
error.go
flags.go
get.go
get_next.go
header.go
header_packet.go
object_identifier.go
octet_string.go
open.go
packet.go
range.go
ranges.go
reason.go
register.go
response.go
timeout.go
type.go
unregister.go
variable.go
variable_type.go
variables.go
value
.gitignore
AUTHORS
LICENSE
README.md
client.go
environment_test.go
go.mod
go.sum
handler.go
helper_test.go
list_handler.go
list_handler_test.go
list_item.go
request.go
session.go
session_test.go
shell.nix
snmpd.conf
ifmib
logger
vppstats
.gitignore
README.md
go.mod
go.sum
main.go
govpp-snmp-agentx/go-agentx/pdu/close.go

27 lines
651 B
Go

// Copyright 2018 The agentx authors
// Licensed under the LGPLv3 with static-linking exception.
// See LICENCE file for details.
package pdu
// Close defines the pdu close packet.
type Close struct {
Reason Reason
}
// Type returns the pdu packet type.
func (c *Close) Type() Type {
return TypeClose
}
// MarshalBinary returns the pdu packet as a slice of bytes.
func (c *Close) MarshalBinary() ([]byte, error) {
return []byte{byte(c.Reason), 0x00, 0x00, 0x00}, nil
}
// UnmarshalBinary sets the packet structure from the provided slice of bytes.
func (c *Close) UnmarshalBinary(data []byte) error {
c.Reason = Reason(data[0])
return nil
}