Documentation ¶
Overview ¶
Package qmp implments part of the QEMU Machine Protocol Specification. It provides serializable types and functions for communicating with a running QEMU instance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrClientClosed = errors.New("the qmp client does not have an open connection") ErrClientAlreadyConnected = errors.New("the qmp client is already connected") )
Possible client errors.
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability string
Capability identifies a capability supported by the server.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client establishes and maintains a QMP communications channel with a QEMU instance.
func NewClient ¶
NewClient returns a new QMP client that will communicate with a QEMU instance.
The id should be a randomly generated number. It is used to ensure the QMP request identifiers generated by the client are unique.
func (*Client) Connect ¶
Connect attempts to esablish the client's connection to a QMP service provided over conn.
Only one client can be connected to a unix socket at a time. The Connect call will block when connecting to a unix socket that is already occupied, until the given timeout expires. See this email thread for background: https://lists.gnu.org/archive/html/qemu-devel/2016-10/msg02208.html
func (*Client) ServerInfo ¶
func (c *Client) ServerInfo() (VersionInfo, Capabilities)
ServerInfo returns information about the QMP server that the client is connected to.
type Command ¶
type Command interface { // Command returns the name of the command to be issued. Command() string // CommandArgs returns the arguments of the command, marshaeled as JSON. // If no arguments are provided, a nil byte slice will be returned. CommandArgs() ([]byte, error) // CommandResponse unmarshals the response to the command, if present. CommandResponse([]byte) error }
Command is a QMP command that can be sent by a client.
type Greeting ¶
type Greeting struct {
QMP GreetingPayload `json:"QMP"`
}
Greeting is sent by the server when a connection is first established.
func (*Greeting) UnmarshalQMP ¶
UnmarshalQMP unmarshals the given QMP greeting, encoded in JSON.
type GreetingPayload ¶
type GreetingPayload struct { Version VersionInfo `json:"version"` Capabilities Capabilities `json:"capabilities"` }
GreetingPayload is the payload of a greeting message.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener receives QMP messages from a client.
type MessageHandler ¶
Message holds a QMP message.
func (*MessageHandler) UnmarshalJSON ¶
func (m *MessageHandler) UnmarshalJSON(b []byte) error
UnmarshalJSON copies the given JSON data to the respones.
type VersionInfo ¶
type VersionInfo struct { Qemu VersionTriple `json:"qemu"` Package string `json:"package"` }
VersionInfo identifies the version of the server that's running.
func (VersionInfo) String ¶
func (v VersionInfo) String() string
String returns a string representation of the version.
type VersionTriple ¶
type VersionTriple struct { Major int `json:"major"` Minor int `json:"minor"` Micro int `json:"micro"` }
VersionTriple specifies the major, minor and macro parts of a version identifier.
func (VersionTriple) String ¶
func (v VersionTriple) String() string
String returns a string representation of the version triple.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package qmpcmd defines a subset of possible QMP commands that are used by machina.
|
Package qmpcmd defines a subset of possible QMP commands that are used by machina. |
Package qmpmsg defines types used to marshal and umarshal QMP messages.
|
Package qmpmsg defines types used to marshal and umarshal QMP messages. |