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
|
package ipmi
import "context"
// 21.7 Set Command Enables Command
type SetCommandEnablesRequest struct {
ChannelNumber uint8
CommandRangeMask CommandRangeMask
NetFn NetFn
LUN uint8
// if CommandRangeMask == CommandRangeMask007F
CommandsMaskBytes [16]byte
CodeForNetFn2C uint8
OEMIANA uint32 // 3 bytes only
}
type SetCommandEnablesResponse struct {
}
func (req *SetCommandEnablesRequest) Command() Command {
return CommandSetCommandEnables
}
func (req *SetCommandEnablesRequest) Pack() []byte {
out := make([]byte, 22)
out[0] = req.ChannelNumber
out[1] = uint8(req.NetFn) & (uint8(req.CommandRangeMask) << 6)
out[2] = req.LUN & 0x03
packBytes(req.CommandsMaskBytes[:], out, 3)
if uint8(req.NetFn) == 0x2c {
packUint8(req.CodeForNetFn2C, out, 19)
return out[0:20]
}
if uint8(req.NetFn) == 0x2e {
packUint24L(req.OEMIANA, out, 19)
return out[0:22]
}
return out[0:20]
}
func (res *SetCommandEnablesResponse) Unpack(msg []byte) error {
return nil
}
func (*SetCommandEnablesResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{
0x80: "attempt to enable an unsupported or un-configurable command",
}
}
func (res *SetCommandEnablesResponse) Format() string {
return ""
}
func (c *Client) SetCommandEnables(ctx context.Context, request *SetCommandEnablesRequest) (response *SetCommandEnablesResponse, err error) {
response = &SetCommandEnablesResponse{}
err = c.Exchange(ctx, request, response)
return
}
|