QMP port channel helper: Spice-GTK Reference Manual

## QMP port channel helper QMP port channel helper — QMP port helper |

## Stability Level

Stable, unless otherwise indicated

## Functions

SpiceQmpPort * | spice_qmp_port_get ()
void | spice_qmp_port_vm_action_async ()
gboolean | spice_qmp_port_vm_action_finish ()
void | spice_qmp_port_query_status_async ()
SpiceQmpStatus * | spice_qmp_port_query_status_finish ()
SpiceQmpStatus * | spice_qmp_status_ref ()
void | spice_qmp_status_unref ()

## Properties

SpicePortChannel * | channel | Read / Write / Construct Only
gboolean | ready | Read

## Signals

void | event | Run First

## Types and Values

| SpiceQmpPort
enum | SpiceQmpPortVmAction
| SpiceQmpStatus

## Object Hierarchy

        GBoxed
        ╰── SpiceQmpStatus
        GObject
        ╰── SpiceQmpPort

## Includes

    #include <spice-client.h>

## Description

A helper to handle QMP messages over a `SpicePortChannel`.

## Functions

### spice_qmp_port_get ()

    SpiceQmpPort *
    spice_qmp_port_get (SpicePortChannel *channel);

Associate a QMP port helper to the given port channel. If there is already a helper associated with the channel, it is simply returned.

#### Parameters

channel | the QMP port channel |

#### Returns

a weak reference to the associated SpiceQmpPort.

[transfer none]

Since: 0.36

### spice_qmp_port_vm_action_async ()

    void
    spice_qmp_port_vm_action_async (SpiceQmpPort *self,
                                    SpiceQmpPortVmAction action,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Request the VM to perform an action.

#### Parameters

self | a qmp port helper |
action | a VM action |
cancellable | a GCancellable, or `NULL` |
callback | callback to call when the action is complete |
user_data | the data to pass to the callback function |

Since: 0.36

### spice_qmp_port_vm_action_finish ()

    gboolean
    spice_qmp_port_vm_action_finish (SpiceQmpPort *self,
                                     GAsyncResult *result,
                                     GError **error);

Finishes asynchronous VM action and returns the result.

#### Parameters

self | a qmp port helper |
result | The async GAsyncResult result |
error | a GError pointer, or `NULL` |

Since: 0.36

### spice_qmp_port_query_status_async ()

    void
    spice_qmp_port_query_status_async (SpiceQmpPort *self,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);

Query the run status of all VCPUs.

#### Parameters

self | A SpiceQmpPort |
cancellable | A GCancellable |
callback | The async callback. |
user_data | The async callback user data. |

Since: 0.36

### spice_qmp_port_query_status_finish ()

    SpiceQmpStatus *
    spice_qmp_port_query_status_finish (SpiceQmpPort *self,
                                        GAsyncResult *result,
                                        GError **error);

Finish the asynchronous status query.

#### Parameters

self | A SpiceQmpPort |
result | The async GAsyncResult result |
error | a GError pointer, or `NULL` |

#### Returns

The SpiceQmpStatus result or `NULL`, in which case `error` will be set.

Since: 0.36

### spice_qmp_status_ref ()

    SpiceQmpStatus *
    spice_qmp_status_ref (SpiceQmpStatus *status);

References a `status` .

#### Parameters

status | a SpiceQmpStatus |

#### Returns

The same `status`

Since: 0.36

### spice_qmp_status_unref ()

    void
    spice_qmp_status_unref (SpiceQmpStatus *status);

Removes a reference from the given `status` .

#### Parameters

status | a SpiceQmpStatus |

Since: 0.36

## Types and Values

### SpiceQmpPort

    typedef struct _SpiceQmpPort SpiceQmpPort;

Opaque data structure.

Since: 0.36

### enum SpiceQmpPortVmAction

An action to perform on the VM.

#### Members

SPICE_QMP_PORT_VM_ACTION_QUIT | This command will cause the VM process to exit gracefully. |
SPICE_QMP_PORT_VM_ACTION_RESET | Performs a hard reset of the VM. |
SPICE_QMP_PORT_VM_ACTION_POWER_DOWN | Performs a power down operation. |
SPICE_QMP_PORT_VM_ACTION_PAUSE | Stop all VCPU execution. |
SPICE_QMP_PORT_VM_ACTION_CONTINUE | Resume all VCPU execution. |
SPICE_QMP_PORT_VM_ACTION_LAST | the last enum value. |

Since: 0.36

### SpiceQmpStatus

    typedef struct {
        gint version;

        gboolean running;
        gboolean singlestep;
        gchar *status;
    } SpiceQmpStatus;

Information about VCPU run state.

#### Members

gint `version`; | the structure version |
gboolean `running`; | true if all VCPUs are runnable, false if not runnable |
gboolean `singlestep`; | true if VCPUs are in single-step mode |
gchar *`status`; | the virtual machine run state |

Since: 0.36

## Property Details

### The `“channel”` property

      “channel”                  SpicePortChannel *

Associated port channel.

Owner: SpiceQmpPort

Flags: Read / Write / Construct Only

### The `“ready”` property

      “ready”                    gboolean

Whether the QMP port is ready.

Owner: SpiceQmpPort

Flags: Read

Default value: FALSE

## Signal Details

### The `“event”` signal

    void
    user_function (SpiceQmpPort *self,
                   char         *name,
                   gpointer      node,
                   gpointer      user_data)

Event emitted whenever a QMP event is received.

#### Parameters

self | the SpiceQmpPort that emitted the signal |
name | the QMP event name |
node | the event data json-node, or NULL |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 0.36

## See Also

SpicePortChannel