File: cmd_chassis_control.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 (53 lines) | stat: -rw-r--r-- 1,298 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
package ipmi

import "context"

type ChassisControl uint8

const (
	ChassisControlPowerDown           ChassisControl = 0 // down, off
	ChassisControlPowerUp             ChassisControl = 1
	ChassisControlPowerCycle          ChassisControl = 2
	ChassisControlHardReset           ChassisControl = 3
	ChassisControlDiagnosticInterrupt ChassisControl = 4
	ChassisControlSoftShutdown        ChassisControl = 5
)

// 28.3 Chassis Control Command
type ChassisControlRequest struct {
	ChassisControl ChassisControl
}

type ChassisControlResponse struct {
}

func (req *ChassisControlRequest) Pack() []byte {
	out := make([]byte, 1)
	packUint8(uint8(req.ChassisControl), out, 0)
	return out
}

func (req *ChassisControlRequest) Command() Command {
	return CommandChassisControl
}

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

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

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

func (c *Client) ChassisControl(ctx context.Context, control ChassisControl) (response *ChassisControlResponse, err error) {
	request := &ChassisControlRequest{
		ChassisControl: control,
	}
	response = &ChassisControlResponse{}
	err = c.Exchange(ctx, request, response)
	return
}