Documentation ¶
Index ¶
- Constants
- type AllocateIndex
- type Close
- type DeallocateIndex
- type Error
- type Flags
- type Get
- type GetNext
- type Header
- type HeaderPacket
- type ObjectIdentifier
- func (o *ObjectIdentifier) ByteSize() int
- func (o *ObjectIdentifier) GetIdentifier() value.OID
- func (o *ObjectIdentifier) GetInclude() bool
- func (o *ObjectIdentifier) MarshalBinary() ([]byte, error)
- func (o *ObjectIdentifier) SetIdentifier(oid value.OID)
- func (o *ObjectIdentifier) SetInclude(value bool)
- func (o ObjectIdentifier) String() string
- func (o *ObjectIdentifier) UnmarshalBinary(data []byte) error
- type OctetString
- type Open
- type Packet
- type Range
- type Ranges
- type Reason
- type Register
- type Response
- type Timeout
- type Type
- type TypeOwner
- type Unregister
- type Variable
- type VariableType
- type Variables
Constants ¶
const (
// HeaderSize defines the total size of a header packet.
HeaderSize = 20
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocateIndex ¶
type AllocateIndex struct {
Variables Variables
}
AllocateIndex defiens the pdu allocate index packet.
func (*AllocateIndex) MarshalBinary ¶
func (ai *AllocateIndex) MarshalBinary() ([]byte, error)
MarshalBinary returns the pdu packet as a slice of bytes.
func (*AllocateIndex) UnmarshalBinary ¶
func (ai *AllocateIndex) UnmarshalBinary(data []byte) error
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Close ¶
type Close struct {
Reason Reason
}
Close defines the pdu close packet.
func (*Close) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Close) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type DeallocateIndex ¶
type DeallocateIndex struct {
Variables Variables
}
DeallocateIndex defiens the pdu deallocate index packet.
func (*DeallocateIndex) MarshalBinary ¶
func (di *DeallocateIndex) MarshalBinary() ([]byte, error)
MarshalBinary returns the pdu packet as a slice of bytes.
func (*DeallocateIndex) Type ¶
func (di *DeallocateIndex) Type() Type
Type returns the pdu packet type.
func (*DeallocateIndex) UnmarshalBinary ¶
func (di *DeallocateIndex) UnmarshalBinary(data []byte) error
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Error ¶
type Error uint16
Error defines a pdu packet error.
const ( ErrorNone Error = 0 ErrorOpenFailed Error = 256 ErrorNotOpen Error = 257 ErrorIndexWrongType Error = 258 ErrorIndexAlreadyAllocated Error = 259 ErrorIndexNoneAvailable Error = 260 ErrorIndexNotAllocated Error = 261 ErrorUnsupportedContext Error = 262 ErrorDuplicateRegistration Error = 263 ErrorUnknownRegistration Error = 264 ErrorUnknownAgentCaps Error = 265 ErrorParse Error = 266 ErrorRequestDenied Error = 267 ErrorProcessing Error = 268 )
The various pdu packet errors.
type Flags ¶
type Flags byte
Flags defines pdu packet flags.
type Get ¶
type Get struct {
SearchRange Range
}
Get defines the pdu get packet.
func (*Get) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Get) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type GetNext ¶
type GetNext struct {
SearchRanges Ranges
}
GetNext defines the pdu get next packet.
func (*GetNext) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*GetNext) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Header ¶
type Header struct { Version byte Type Type Flags Flags SessionID uint32 TransactionID uint32 PacketID uint32 PayloadLength uint32 }
Header defines a pdu packet header
func (*Header) MarshalBinary ¶
MarshalBinary returns the pdu header as a slice of bytes.
func (*Header) UnmarshalBinary ¶
UnmarshalBinary sets the header structure from the provided slice of bytes.
type HeaderPacket ¶
HeaderPacket defines a container structure for a header and a packet.
func (*HeaderPacket) MarshalBinary ¶
func (hp *HeaderPacket) MarshalBinary() ([]byte, error)
MarshalBinary returns the pdu packet as a slice of bytes.
func (*HeaderPacket) String ¶
func (hp *HeaderPacket) String() string
type ObjectIdentifier ¶
ObjectIdentifier defines the pdu object identifier packet.
func (*ObjectIdentifier) ByteSize ¶
func (o *ObjectIdentifier) ByteSize() int
ByteSize returns the number of bytes, the binding would need in the encoded version.
func (*ObjectIdentifier) GetIdentifier ¶
func (o *ObjectIdentifier) GetIdentifier() value.OID
GetIdentifier returns the identifier as an oid string.
func (*ObjectIdentifier) GetInclude ¶
func (o *ObjectIdentifier) GetInclude() bool
GetInclude returns true if the include field ist set, false otherwise.
func (*ObjectIdentifier) MarshalBinary ¶
func (o *ObjectIdentifier) MarshalBinary() ([]byte, error)
MarshalBinary returns the pdu packet as a slice of bytes.
func (*ObjectIdentifier) SetIdentifier ¶
func (o *ObjectIdentifier) SetIdentifier(oid value.OID)
SetIdentifier set the subidentifiers by the provided oid string.
func (*ObjectIdentifier) SetInclude ¶
func (o *ObjectIdentifier) SetInclude(value bool)
SetInclude sets the include field.
func (ObjectIdentifier) String ¶
func (o ObjectIdentifier) String() string
func (*ObjectIdentifier) UnmarshalBinary ¶
func (o *ObjectIdentifier) UnmarshalBinary(data []byte) error
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type OctetString ¶
type OctetString struct {
Text string
}
OctetString defines the pdu description packet.
func (*OctetString) MarshalBinary ¶
func (o *OctetString) MarshalBinary() ([]byte, error)
MarshalBinary returns the pdu packet as a slice of bytes.
func (*OctetString) UnmarshalBinary ¶
func (o *OctetString) UnmarshalBinary(data []byte) error
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Open ¶
type Open struct { Timeout Timeout ID ObjectIdentifier Description OctetString }
Open defines a pdu open packet.
func (*Open) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Open) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Packet ¶
type Packet interface { TypeOwner encoding.BinaryMarshaler encoding.BinaryUnmarshaler }
Packet defines a general interface for a pdu packet.
type Range ¶
type Range struct { From ObjectIdentifier To ObjectIdentifier }
Range defines the pdu search range packet.
func (*Range) ByteSize ¶
ByteSize returns the number of bytes, the binding would need in the encoded version.
func (*Range) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Range) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Ranges ¶
type Ranges []Range
Ranges defines the pdu search range list packet.
func (*Ranges) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Ranges) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Reason ¶
type Reason byte
Reason defines a reason.
type Register ¶
type Register struct { Timeout Timeout Subtree ObjectIdentifier }
Register defines the pdu register packet.
func (*Register) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Register) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Response ¶
Response defines the pdu response packet.
func (*Response) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Response) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Timeout ¶
Timeout defines the pdu timeout packet.
func (*Timeout) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Timeout) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Type ¶
type Type byte
Type defines the pdu packet type.
const ( TypeOpen Type = 1 TypeClose Type = 2 TypeRegister Type = 3 TypeUnregister Type = 4 TypeGet Type = 5 TypeGetNext Type = 6 TypeGetBulk Type = 7 TypeTestSet Type = 8 TypeCommitSet Type = 9 TypeUndoSet Type = 10 TypeCleanupSet Type = 11 TypeNotify Type = 12 TypePing Type = 13 TypeIndexAllocate Type = 14 TypeIndexDeallocate Type = 15 TypeAddAgentCaps Type = 16 TypeRemoveAgentCaps Type = 17 TypeResponse Type = 18 )
The various pdu packet types.
type TypeOwner ¶
type TypeOwner interface {
Type() Type
}
TypeOwner defines the interface for an object that provides a type.
type Unregister ¶
type Unregister struct { Timeout Timeout Subtree ObjectIdentifier }
Unregister defines the pdu unregister packet.
func (*Unregister) MarshalBinary ¶
func (u *Unregister) MarshalBinary() ([]byte, error)
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Unregister) UnmarshalBinary ¶
func (u *Unregister) UnmarshalBinary(data []byte) error
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type Variable ¶
type Variable struct { Type VariableType Name ObjectIdentifier Value interface{} }
Variable defines the pdu varbind packet.
func (*Variable) ByteSize ¶
ByteSize returns the number of bytes, the binding would need in the encoded version.
func (*Variable) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Variable) Set ¶
func (v *Variable) Set(oid value.OID, t VariableType, value interface{})
Set sets the variable.
func (*Variable) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.
type VariableType ¶
type VariableType uint16
VariableType defines the type of a variable.
const ( VariableTypeInteger VariableType = 2 VariableTypeOctetString VariableType = 4 VariableTypeNull VariableType = 5 VariableTypeObjectIdentifier VariableType = 6 VariableTypeIPAddress VariableType = 64 VariableTypeCounter32 VariableType = 65 VariableTypeGauge32 VariableType = 66 VariableTypeTimeTicks VariableType = 67 VariableTypeOpaque VariableType = 68 VariableTypeCounter64 VariableType = 70 VariableTypeNoSuchObject VariableType = 128 VariableTypeNoSuchInstance VariableType = 129 VariableTypeEndOfMIBView VariableType = 130 )
The various variable types.
func (VariableType) String ¶
func (v VariableType) String() string
type Variables ¶
type Variables []Variable
Variables defines a list of variable bindings.
func (*Variables) Add ¶
func (v *Variables) Add(oid value.OID, t VariableType, value interface{})
Add adds the provided variable.
func (*Variables) MarshalBinary ¶
MarshalBinary returns the pdu packet as a slice of bytes.
func (*Variables) UnmarshalBinary ¶
UnmarshalBinary sets the packet structure from the provided slice of bytes.