1 Star 0 Fork 0

叶海丰/ipmi-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cmd_set_user_access.go 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
叶海丰 提交于 12个月前 . init
package ipmi
// 22.26 Set User Access Command
type SetUserAccessRequest struct {
EnableChanging bool
RestrictedToCallback bool
EnableLinkAuth bool
EnableIPMIMessaging bool
ChannelNumber uint8
UserID uint8
MaxPrivLevel uint8
SessionLimit uint8
}
type SetUserAccessResponse struct {
}
func (req *SetUserAccessRequest) Command() Command {
return CommandSetUserAccess
}
func (req *SetUserAccessRequest) Pack() []byte {
out := make([]byte, 4)
b := req.ChannelNumber & 0x0f
if req.EnableChanging {
b = setBit7(b)
}
if req.RestrictedToCallback {
b = setBit6(b)
}
if req.EnableLinkAuth {
b = setBit5(b)
}
if req.EnableIPMIMessaging {
b = setBit4(b)
}
packUint8(b, out, 0)
packUint8(req.UserID&0x3f, out, 1)
packUint8(req.MaxPrivLevel&0x3f, out, 1)
packUint8(req.SessionLimit&0x0f, out, 3)
return out
}
func (res *SetUserAccessResponse) CompletionCodes() map[uint8]string {
// Note: an implementation will not return an error completion code if the user
// access level is set higher than the privilege limit for a given channel. If it is
// desired to bring attention to this condition, it is up to software to check the
// channel privilege limits set using the Set Channel Access command and
// provide notification of any mismatch.
return map[uint8]string{}
}
func (res *SetUserAccessResponse) Unpack(msg []byte) error {
return nil
}
func (res *SetUserAccessResponse) Format() string {
return ""
}
func (c *Client) SetUserAccess(request *SetUserAccessRequest) (response *SetUserAccessResponse, err error) {
response = &SetUserAccessResponse{}
err = c.Exchange(request, response)
return
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/rogax/ipmi-go.git
git@gitee.com:rogax/ipmi-go.git
rogax
ipmi-go
ipmi-go
86ae46cfb58e

搜索帮助