vmproto

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: 7 Imported by: 0

Documentation

Overview

Package vmproto implements a BMC server frontend that speaks QEMU's OpenIPMI VM protocol (the ipmi-bmc-extern wire format), a sibling to the RMCP+ UDP server in pkg/server. It exists so an emulated machine's in-band system interface and an out-of-band LAN client can drive one shared bmc.BMC, which is what the library's simulation / end-to-end use targets: a guest kernel and a userland agent talk to the BMC over the VM protocol while tooling talks to the same BMC over LAN, and both observe the same state.

Unlike the RMCP+ frontend, the VM protocol is a byte stream, not datagrams, so it is built on a net.Listener rather than a transport.PacketConn. The system interface is unauthenticated by design (there is no session), so messages dispatch with a session-less handlers.HandlerContext whose channel is the system interface, which the handler privilege check treats as locally authorized.

Client is the console side of the same protocol, standing in for QEMU or the in-guest OpenIPMI driver in simulation and end-to-end testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client speaks the console side of the OpenIPMI VM protocol (QEMU's ipmi-bmc-extern wire format) over a byte stream, the counterpart to VMServer. QEMU and the in-guest OpenIPMI driver are the real consumers of the server; this client stands in for them in simulation and end-to-end testing.

func NewClient

func NewClient(conn net.Conn, timeout time.Duration) *Client

NewClient wraps conn, a stream connection to a VMServer listener, as a VM-protocol client. timeout bounds each response read; pass 0 for no deadline.

func (*Client) Command

func (c *Client) Command(netFn, cmd byte, data ...byte) (cc byte, resp []byte, err error)

Command sends one IPMI request over the VM protocol and returns the response completion code and data. The system interface carries one transaction at a time, so it writes the request and reads the matching response.

type VMServer

type VMServer struct {
	// contains filtered or unexported fields
}

VMServer serves QEMU's OpenIPMI VM protocol on a stream listener, dispatching each in-band IPMI message through the same handler registry as the RMCP+ [Server] against the same bmc.BMC.

Construct one with NewVMServer sharing the bmc.BMC you gave [NewServer], then call VMServer.Serve. It is a distinct frontend from [Server]: the VM protocol is a byte stream, so it takes a net.Listener, and the system interface is unauthenticated, so messages carry no session.

func NewVMServer

func NewVMServer(b *bmc.BMC, opts ...VMServerOption) *VMServer

NewVMServer creates a VM protocol frontend over the BMC state b.

Share b with the [Server] created by [NewServer] so in-band (VM protocol) and out-of-band (LAN) requests operate on the same BMC. By default it builds its own copy of the standard registry, identical to the RMCP+ server's; override it with WithVMHandlerRegistry, for example to share a single registry instance or to add OEM commands.

func (*VMServer) Serve

func (s *VMServer) Serve(ctx context.Context, ln net.Listener) error

Serve accepts connections on ln and serves each until ctx is canceled or ln is closed. Each accepted connection is one QEMU process; every guest power cycle is a fresh QEMU process reconnecting to the same listener, so the loop accepts forever. Connections are served one at a time, matching QEMU's single ipmi-bmc-extern link.

type VMServerOption

type VMServerOption func(*VMServer)

VMServerOption configures a VMServer.

func WithVMHandlerRegistry

func WithVMHandlerRegistry(r *handlers.Registry) VMServerOption

WithVMHandlerRegistry replaces the default handler registry. Pass the same registry the RMCP+ [Server] uses to guarantee the two frontends dispatch an identical command set. All registration must be complete before VMServer.Serve is called; the registry is read-only during dispatch.

Jump to

Keyboard shortcuts

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