protocol

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package protocol provides IPMI wire-format framing shared by both client and server: IPMB checksums, LAN message assembly/disassembly, and RMCP+ packet building. Neither the client nor the server needs to duplicate this logic; they each import this package and carry their session-specific state separately.

Index

Constants

View Source
const BMCAddr = uint8(0x20)

BMCAddr is the IPMI BMC slave address on the IPMB bus.

View Source
const RemoteConsoleAddr = uint8(0x20)

RemoteConsoleAddr is the conventional remote console requester address.

Variables

This section is empty.

Functions

func BuildASFPresencePong

func BuildASFPresencePong(tag byte) []byte

BuildASFPresencePong builds an RMCP/ASF Presence Pong response for the given tag byte. The Pong advertises IPMI support per the ASF 2.0 spec.

func BuildIPMIResponse

func BuildIPMIResponse(reqNetFn, cmd, seq, cc uint8, data []byte) []byte

BuildIPMIResponse constructs a raw IPMI LAN response message. reqNetFn is the *request* NetFn; the response uses reqNetFn|1.

func BuildRMCPPlusPacket

func BuildRMCPPlusPacket(payloadType, payloadFlags uint8, sessionID, seq uint32, payload []byte) []byte

BuildRMCPPlusPacket assembles a complete RMCP+ (IPMI 2.0) wire packet.

RMCP header  (4 bytes): version=0x06, reserved, seq=0xFF, class=0x07
Session20 header (12 bytes): authType=0x06, payloadType|flags,
  sessionID(LE), seqNum(LE), payloadLen(LE)
Payload (len bytes)

The payloadType and flags parameters are raw bytes; callers typically pass uint8(types.PayloadTypeIPMI) | types.PayloadFlagAuthenticated.

func Checksum

func Checksum(data []byte) uint8

Checksum computes the two's-complement checksum over data, as required by the IPMB and IPMI LAN message formats (section 13.8 of the IPMI 2.0 spec).

func ParseIPMIRequest

func ParseIPMIRequest(msg []byte) (netFn, cmd uint8, data []byte, seq uint8, ok bool)

ParseIPMIRequest parses a raw IPMI LAN request message (post-RMCP, post-session header) and returns its NetFn, command code, data body, and requester sequence number.

The IPMI LAN message format (Table 13-8) is:

[0]  rsSA  (BMC = 0x20)
[1]  netFn/rsLUN  (netFn in bits [7:2])
[2]  checksum1
[3]  rqSA
[4]  rqSeq/rqLUN  (seq in bits [7:2])
[5]  cmd
[6..n-1] data
[n]  checksum2

func ParseRMCPPlusHeader

func ParseRMCPPlusHeader(pkt []byte) (sessionID, seqNum uint32, payloadType, flags uint8, payload []byte, ok bool)

ParseRMCPPlusHeader extracts the session-layer fields from a raw RMCP+ packet starting at offset 4 (after the 4-byte RMCP header).

Returns sessionID, seqNum, payloadType (without flag bits), flags byte, payload slice, and ok=false if the buffer is too short.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL