summaryrefslogtreecommitdiffstats
path: root/server/spice-experimental.h
blob: f1b7385c5785f6b8c39a58b6cb9ce7add25366e1 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef __SPICE_EXPERIMENTAL_H__
#define __SPICE_EXPERIMENTAL_H__

#include "spice.h"

/* char device interfaces */
#define SPICE_INTERFACE_CHAR_DEVICE "char_device"
#define SPICE_INTERFACE_CHAR_DEVICE_MAJOR 1
#define SPICE_INTERFACE_CHAR_DEVICE_MINOR 1
typedef struct SpiceCharDeviceInterface SpiceCharDeviceInterface;
typedef struct SpiceCharDeviceInstance SpiceCharDeviceInstance;
typedef struct SpiceCharDeviceState SpiceCharDeviceState;

struct SpiceCharDeviceInterface {
    SpiceBaseInterface base;

    void (*state)(SpiceCharDeviceInstance *sin, int connected);
    int (*write)(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len);
    int (*read)(SpiceCharDeviceInstance *sin, uint8_t *buf, int len);
};

struct SpiceCharDeviceInstance {
    SpiceBaseInstance base;
    const char* subtype;
    SpiceCharDeviceState *st;
};

void spice_server_char_device_wakeup(SpiceCharDeviceInstance *sin);
const char** spice_server_char_device_recognized_subtypes(void);

/* tunnel interface */

#define SPICE_INTERFACE_NET_WIRE "net_wire"
#define SPICE_INTERFACE_NET_WIRE_MAJOR 1
#define SPICE_INTERFACE_NET_WIRE_MINOR 1
typedef struct SpiceNetWireInterface SpiceNetWireInterface;
typedef struct SpiceNetWireInstance SpiceNetWireInstance;
typedef struct SpiceNetWireState SpiceNetWireState;

struct SpiceNetWireInterface {
    SpiceBaseInterface base;

    struct in_addr (*get_ip)(SpiceNetWireInstance *sin);
    int (*can_send_packet)(SpiceNetWireInstance *sin);
    void (*send_packet)(SpiceNetWireInstance *sin, const uint8_t *pkt, int len);
};

struct SpiceNetWireInstance {
    SpiceBaseInstance base;
    SpiceNetWireState *st;
};

void spice_server_net_wire_recv_packet(SpiceNetWireInstance *sin,
                                       const uint8_t *pkt, int len);

/* spice seamless client migration (broken) */

enum {
    SPICE_MIGRATE_CLIENT_NONE = 1,
    SPICE_MIGRATE_CLIENT_WAITING,
    SPICE_MIGRATE_CLIENT_READY,
};

int spice_server_migrate_start(SpiceServer *s);
int spice_server_migrate_client_state(SpiceServer *s);
int spice_server_migrate_end(SpiceServer *s, int completed);

#endif // __SPICE_EXPERIMENTAL_H__