File: cmd_set_chassis_capabilities.go

package info (click to toggle)
golang-github-bougou-go-ipmi 0.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,880 kB
  • sloc: makefile: 38
file content (62 lines) | stat: -rw-r--r-- 1,421 bytes parent folder | download | duplicates (2)
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
package ipmi

import "context"

// 28.7 Set Chassis Capabilities Command
type SetChassisCapabilitiesRequest struct {
	ProvideFrontPanelLockout bool
	ProvideIntrusionSensor   bool

	FRUDeviceAddress uint8

	SDRDeviceAddress uint8

	SELDeviceAddress uint8

	SystemManagementDeviceAddress uint8

	BridgeDeviceAddress uint8
}

type SetChassisCapabilitiesResponse struct {
}

func (req *SetChassisCapabilitiesRequest) Pack() []byte {
	out := make([]byte, 5)

	var b uint8 = 0
	if req.ProvideFrontPanelLockout {
		b = setBit1(b)
	}
	if req.ProvideIntrusionSensor {
		b = setBit0(b)
	}
	packUint8(b, out, 0)
	packUint8(req.FRUDeviceAddress, out, 1)
	packUint8(req.SDRDeviceAddress, out, 2)
	packUint8(req.SELDeviceAddress, out, 3)
	packUint8(req.SystemManagementDeviceAddress, out, 4)
	return out
}

func (req *SetChassisCapabilitiesRequest) Command() Command {
	return CommandSetChassisCapabilities
}

func (res *SetChassisCapabilitiesResponse) CompletionCodes() map[uint8]string {
	return map[uint8]string{}
}

func (res *SetChassisCapabilitiesResponse) Unpack(msg []byte) error {
	return nil
}

func (res *SetChassisCapabilitiesResponse) Format() string {
	return ""
}

func (c *Client) SetChassisCapabilities(ctx context.Context, request *SetChassisCapabilitiesRequest) (response *SetChassisCapabilitiesResponse, err error) {
	response = &SetChassisCapabilitiesResponse{}
	err = c.Exchange(ctx, request, response)
	return
}