1 Star 0 Fork 0

叶海丰/ipmi-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cmd_get_system_interface_capabilities.go 2.10 KB
一键复制 编辑 原始数据 按行查看 历史
叶海丰 提交于 2024-08-02 08:43 . init
package ipmi
// 22.9 Get System Interface Capabilities Command
type GetSystemInterfaceCapabilitiesRequest struct {
SystemInterfaceType SystemInterfaceType
}
type GetSystemInterfaceCapabilitiesResponse struct {
// For System Interface Type = SSIF
TransactionSupportMask uint8
PECSupported bool
SSIFVersion uint8
InputMessageSizeBytes uint8
OutputMessageSizeBytes uint8
// For System Interface Type = KCS or SMIC
SystemInterfaceVersion uint8
InputMaximumMessageSizeBytes uint8
}
type SystemInterfaceType uint8
const (
SystemInterfaceTypeSSIF SystemInterfaceType = 0x00
SystemInterfaceTypeKCS SystemInterfaceType = 0x01
SystemInterfaceTypeSMIC SystemInterfaceType = 0x02
)
func (req *GetSystemInterfaceCapabilitiesRequest) Command() Command {
return CommandGetSystemInterfaceCapabilities
}
func (req *GetSystemInterfaceCapabilitiesRequest) Pack() []byte {
return []byte{uint8(req.SystemInterfaceType)}
}
func (res *GetSystemInterfaceCapabilitiesResponse) Unpack(msg []byte) error {
// at least 3 bytes
if len(msg) < 3 {
return ErrUnpackedDataTooShortWith(len(msg), 3)
}
// For System Interface Type = SSIF:
b, _, _ := unpackUint8(msg, 1)
res.TransactionSupportMask = b >> 6
res.PECSupported = isBit3Set(b)
res.SSIFVersion = b & 0x07
res.InputMessageSizeBytes, _, _ = unpackUint8(msg, 2)
// For System Interface Type = KCS or SMIC
res.SystemInterfaceVersion = b & 0x07
res.InputMaximumMessageSizeBytes, _, _ = unpackUint8(msg, 2)
if len(msg) >= 4 {
res.OutputMessageSizeBytes, _, _ = unpackUint8(msg, 3)
}
return nil
}
func (*GetSystemInterfaceCapabilitiesResponse) CompletionCodes() map[uint8]string {
// no command-specific cc
return map[uint8]string{}
}
func (res *GetSystemInterfaceCapabilitiesResponse) Format() string {
return ""
}
func (c *Client) GetSystemInterfaceCapabilities(interfaceType SystemInterfaceType) (response *GetSystemInterfaceCapabilitiesResponse, err error) {
request := &GetSystemInterfaceCapabilitiesRequest{
SystemInterfaceType: interfaceType,
}
response = &GetSystemInterfaceCapabilitiesResponse{}
err = c.Exchange(request, response)
return
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rogax/ipmi-go.git
git@gitee.com:rogax/ipmi-go.git
rogax
ipmi-go
ipmi-go
86ae46cfb58e

搜索帮助

0d507c66 1850385 C8b1a773 1850385