Temporarily add go-agentx (w/ fixes to lexico ordering)
This commit is contained in:
go-agentx
.gitignoreAUTHORSLICENSEREADME.mdclient.goenvironment_test.gogo.modgo.sumhandler.gohelper_test.golist_handler.golist_handler_test.golist_item.go
marshaler
pdu
allocate_index.goclose.godeallocate_index.goerror.goflags.goget.goget_next.goheader.goheader_packet.goobject_identifier.gooctet_string.goopen.gopacket.gorange.goranges.goreason.goregister.goresponse.gotimeout.gotype.gounregister.govariable.govariable_type.govariables.go
request.gosession.gosession_test.goshell.nixsnmpd.confvalue
38
go-agentx/pdu/open.go
Normal file
38
go-agentx/pdu/open.go
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2018 The agentx authors
|
||||
// Licensed under the LGPLv3 with static-linking exception.
|
||||
// See LICENCE file for details.
|
||||
|
||||
package pdu
|
||||
|
||||
import (
|
||||
"github.com/posteo/go-agentx/marshaler"
|
||||
)
|
||||
|
||||
// Open defines a pdu open packet.
|
||||
type Open struct {
|
||||
Timeout Timeout
|
||||
ID ObjectIdentifier
|
||||
Description OctetString
|
||||
}
|
||||
|
||||
// Type returns the pdu packet type.
|
||||
func (o *Open) Type() Type {
|
||||
return TypeOpen
|
||||
}
|
||||
|
||||
// MarshalBinary returns the pdu packet as a slice of bytes.
|
||||
func (o *Open) MarshalBinary() ([]byte, error) {
|
||||
combined := marshaler.NewMulti(&o.Timeout, &o.ID, &o.Description)
|
||||
|
||||
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 (o *Open) UnmarshalBinary(data []byte) error {
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user