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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
package ipmi
import (
"context"
"fmt"
)
// RmcpPingRequest
// 13.2.3 RMCP/ASF Presence Ping Message
type RmcpPingRequest struct {
// empty
}
type RmcpPingResponse struct {
// If no OEM-specific capabilities exist, this field contains the ASF IANA (4542) and the OEM-defined field is set to all zeroes (00000000h). Otherwise, this field contains the OEM's IANA Enterprise Number and the OEM-defined field contains the OEM-specific capabilities.
OEMIANA uint32
// Not used for IPMI.
// This field can contain OEM-defined values; the definition of these values is left to the manufacturer identified by the preceding IANA Enterprise number.
OEMDefined uint32
IPMISupported bool
ASFVersion uint8
RMCPSecurityExtensionsSupported bool
DMTFDashSupported bool
// Reserved for future definition by ASF specification,
// set to 00 00 00 00 00 00h, six bytes
Reserved []byte
}
func (req *RmcpPingRequest) Pack() []byte {
return nil
}
func (req *RmcpPingRequest) Command() Command {
return CommandNone
}
func (res *RmcpPingResponse) Unpack(msg []byte) error {
if len(msg) < 16 {
return ErrUnpackedDataTooShortWith(len(msg), 16)
}
res.OEMIANA, _, _ = unpackUint32L(msg, 0)
res.OEMDefined, _, _ = unpackUint32L(msg, 4)
b, _, _ := unpackUint8(msg, 8)
res.IPMISupported = isBit7Set(b)
res.ASFVersion = b & 0x0f
c, _, _ := unpackUint8(msg, 9)
res.RMCPSecurityExtensionsSupported = isBit7Set(c)
res.DMTFDashSupported = isBit5Set(c)
res.Reserved, _, _ = unpackBytes(msg, 10, 6)
return nil
}
func (r *RmcpPingResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{}
}
func (res *RmcpPingResponse) Format() string {
return fmt.Sprintf("%v", res)
}
func (c *Client) RmcpPing(ctx context.Context) (response *RmcpPingResponse, err error) {
request := &RmcpPingRequest{}
response = &RmcpPingResponse{}
err = c.Exchange(ctx, request, response)
return
}
|