代码拉取完成,页面将自动刷新
package ipmi
import (
"fmt"
"strings"
)
type CommandRawRequest struct {
NetFn NetFn
Cmd uint8
Data []byte
Name string
}
type CommandRawResponse struct {
Response []byte
}
func (req *CommandRawRequest) Command() Command {
return Command{ID: req.Cmd, NetFn: req.NetFn, Name: req.Name}
}
func (req *CommandRawRequest) Pack() []byte {
out := make([]byte, len(req.Data))
packBytes(req.Data, out, 0)
return out
}
func (res *CommandRawResponse) Unpack(msg []byte) error {
res.Response = msg
return nil
}
func (res *CommandRawResponse) CompletionCodes() map[uint8]string {
return map[uint8]string{}
}
func (res *CommandRawResponse) Format() string {
// convert the byte array to a slice of hex strings
hexStrings := make([]string, len(res.Response))
for i, b := range res.Response {
hexStrings[i] = fmt.Sprintf("0x%02X", b)
}
// join the hex strings with commas
hexString := strings.Join(hexStrings, ", ")
return fmt.Sprintf(`raw.Response = %s`, hexString)
}
func (c *Client) RawCommand(netFn NetFn, cmd uint8, data []byte, name string) (response *CommandRawResponse, err error) {
request := &CommandRawRequest{
NetFn: netFn,
Cmd: cmd,
Data: data,
Name: name,
}
response = &CommandRawResponse{}
err = c.Exchange(request, response)
return
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。