summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/red_channel.c16
-rw-r--r--server/red_channel.h22
-rw-r--r--server/red_client_cache.h4
-rw-r--r--server/red_client_shared_cache.h8
-rw-r--r--server/red_dispatcher.c4
-rw-r--r--server/red_tunnel_worker.c224
-rw-r--r--server/red_worker.c792
-rw-r--r--server/red_yuv.h4
-rw-r--r--server/reds.c472
-rw-r--r--server/snd_worker.c138
-rw-r--r--server/vd_interface.h2
11 files changed, 843 insertions, 843 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 48ace448..d8ea49dc 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -72,17 +72,17 @@ static void red_peer_handle_incoming(RedsStreamContext *peer, IncomingHandler *h
for (;;) {
int ret_handle;
- if (handler->header_pos < sizeof(RedDataHeader)) {
+ if (handler->header_pos < sizeof(SpiceDataHeader)) {
bytes_read = red_peer_receive(peer,
((uint8_t *)&handler->header) + handler->header_pos,
- sizeof(RedDataHeader) - handler->header_pos);
+ sizeof(SpiceDataHeader) - handler->header_pos);
if (bytes_read == -1) {
handler->on_error(handler->opaque);
return;
}
handler->header_pos += bytes_read;
- if (handler->header_pos != sizeof(RedDataHeader)) {
+ if (handler->header_pos != sizeof(SpiceDataHeader)) {
return;
}
}
@@ -328,17 +328,17 @@ void red_channel_init_outgoing_messages_window(RedChannel *channel)
red_channel_push(channel);
}
-int red_channel_handle_message(RedChannel *channel, RedDataHeader *header, uint8_t *msg)
+int red_channel_handle_message(RedChannel *channel, SpiceDataHeader *header, uint8_t *msg)
{
switch (header->type) {
- case REDC_ACK_SYNC:
+ case SPICE_MSGC_ACK_SYNC:
if (header->size != sizeof(uint32_t)) {
red_printf("bad message size");
return FALSE;
}
channel->ack_data.client_generation = *(uint32_t *)(msg);
break;
- case REDC_ACK:
+ case SPICE_MSGC_ACK:
if (channel->ack_data.client_generation == channel->ack_data.generation) {
channel->ack_data.messages_window -= CLIENT_ACK_WINDOW;
red_channel_push(channel);
@@ -377,7 +377,7 @@ void red_channel_reset_send_data(RedChannel *channel)
channel->send_data.header.size = 0;
channel->send_data.header.sub_list = 0;
++channel->send_data.header.serial;
- __red_channel_add_buf(channel, (void *)&channel->send_data.header, sizeof(RedDataHeader));
+ __red_channel_add_buf(channel, (void *)&channel->send_data.header, sizeof(SpiceDataHeader));
}
void red_channel_init_send_data(RedChannel *channel, uint16_t msg_type, PipeItem *item)
@@ -408,7 +408,7 @@ static void red_channel_send(RedChannel *channel)
void red_channel_begin_send_massage(RedChannel *channel)
{
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
channel->ack_data.messages_window++;
red_channel_send(channel);
}
diff --git a/server/red_channel.h b/server/red_channel.h
index 1096ba70..8c8518c4 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -36,15 +36,15 @@
At the final stage, this interface shouldn't be exposed. Only RedChannel will use it. */
typedef int (*handle_message_proc)(void *opaque,
- RedDataHeader *header, uint8_t *msg);
-typedef uint8_t *(*alloc_msg_recv_buf_proc)(void *opaque, RedDataHeader *msg_header);
+ SpiceDataHeader *header, uint8_t *msg);
+typedef uint8_t *(*alloc_msg_recv_buf_proc)(void *opaque, SpiceDataHeader *msg_header);
typedef void (*release_msg_recv_buf_proc)(void *opaque,
- RedDataHeader *msg_header, uint8_t *msg);
+ SpiceDataHeader *msg_header, uint8_t *msg);
typedef void (*on_incoming_error_proc)(void *opaque);
typedef struct IncomingHandler {
void *opaque;
- RedDataHeader header;
+ SpiceDataHeader header;
uint32_t header_pos;
uint8_t *msg; // data of the msg following the header. allocated by alloc_msg_buf.
uint32_t msg_pos;
@@ -88,11 +88,11 @@ typedef struct PipeItem {
typedef struct RedChannel RedChannel;
typedef uint8_t *(*channel_alloc_msg_recv_buf_proc)(RedChannel *channel,
- RedDataHeader *msg_header);
+ SpiceDataHeader *msg_header);
typedef int (*channel_handle_message_proc)(RedChannel *channel,
- RedDataHeader *header, uint8_t *msg);
+ SpiceDataHeader *header, uint8_t *msg);
typedef void (*channel_release_msg_recv_buf_proc)(RedChannel *channel,
- RedDataHeader *msg_header, uint8_t *msg);
+ SpiceDataHeader *msg_header, uint8_t *msg);
typedef void (*channel_disconnect_proc)(RedChannel *channel);
typedef int (*channel_configure_socket_proc)(RedChannel *channel);
typedef void (*channel_send_pipe_item_proc)(RedChannel *channel, PipeItem *item);
@@ -115,10 +115,10 @@ struct RedChannel {
uint32_t pipe_size;
struct {
- RedDataHeader header;
+ SpiceDataHeader header;
union {
- RedSetAck ack;
- RedMigrate migrate;
+ SpiceMsgSetAck ack;
+ SpiceMsgMigrate migrate;
} u;
uint32_t n_bufs;
BufDescriptor bufs[MAX_SEND_BUFS];
@@ -158,7 +158,7 @@ void red_channel_shutdown(RedChannel *channel);
void red_channel_init_outgoing_messages_window(RedChannel *channel);
/* handles general channel msgs from the client */
-int red_channel_handle_message(RedChannel *channel, RedDataHeader *header, uint8_t *msg);
+int red_channel_handle_message(RedChannel *channel, SpiceDataHeader *header, uint8_t *msg);
/* when preparing send_data: should call reset, then init and then add_buf per buffer that is
being sent */
diff --git a/server/red_client_cache.h b/server/red_client_cache.h
index c7b40e2f..3db0ce9c 100644
--- a/server/red_client_cache.h
+++ b/server/red_client_cache.h
@@ -20,7 +20,7 @@
#define CACHE_NAME cursor_cache
#define CACHE_HASH_KEY CURSOR_CACHE_HASH_KEY
#define CACHE_HASH_SIZE CURSOR_CACHE_HASH_SIZE
-#define CACHE_INVAL_TYPE RED_CURSOR_INVAL_ONE
+#define CACHE_INVAL_TYPE SPICE_MSG_CURSOR_INVAL_ONE
#define FUNC_NAME(name) red_cursor_cache_##name
#define VAR_NAME(name) cursor_cache_##name
#define CHANNEL CursorChannel
@@ -30,7 +30,7 @@
#define CACHE_NAME palette_cache
#define CACHE_HASH_KEY PALETTE_CACHE_HASH_KEY
#define CACHE_HASH_SIZE PALETTE_CACHE_HASH_SIZE
-#define CACHE_INVAL_TYPE RED_DISPLAY_INVAL_PALETTE
+#define CACHE_INVAL_TYPE SPICE_MSG_DISPLAY_INVAL_PALETTE
#define FUNC_NAME(name) red_palette_cache_##name
#define VAR_NAME(name) palette_cache_##name
#define CHANNEL DisplayChannel
diff --git a/server/red_client_shared_cache.h b/server/red_client_shared_cache.h
index 1d3c4528..141f1b11 100644
--- a/server/red_client_shared_cache.h
+++ b/server/red_client_shared_cache.h
@@ -27,7 +27,7 @@
#define PRIVATE_FUNC_NAME(name) __pixmap_cache_##name
#define CHANNEL DisplayChannel
#define CACH_GENERATION pixmap_cache_generation
-#define INVAL_ALL_VERB RED_DISPLAY_INVAL_ALL_PIXMAPS
+#define INVAL_ALL_VERB SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS
#else
#error "no cache type."
@@ -112,7 +112,7 @@ static int FUNC_NAME(add)(CACHE *cache, uint64_t id, uint32_t size, CHANNEL *cha
cache->items--;
cache->available += tail->size;
cache->sync[channel->base.id] = serial;
- display_channel_push_release(channel, RED_RES_TYPE_PIXMAP, tail->id, tail->sync);
+ display_channel_push_release(channel, SPICE_RES_TYPE_PIXMAP, tail->id, tail->sync);
free(tail);
}
++cache->items;
@@ -149,7 +149,7 @@ static void PRIVATE_FUNC_NAME(clear)(CACHE *cache)
cache->items = 0;
}
-static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, RedWaitForChannels* sync_data)
+static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, SpiceMsgWaitForChannels* sync_data)
{
uint8_t wait_count;
uint64_t serial;
@@ -167,7 +167,7 @@ static void FUNC_NAME(reset)(CACHE *cache, CHANNEL *channel, RedWaitForChannels*
wait_count = 0;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
if (cache->sync[i] && i != channel->base.id) {
- sync_data->wait_list[wait_count].channel_type = RED_CHANNEL_DISPLAY;
+ sync_data->wait_list[wait_count].channel_type = SPICE_CHANNEL_DISPLAY;
sync_data->wait_list[wait_count].channel_id = i;
sync_data->wait_list[wait_count++].message_serial = cache->sync[i];
}
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index e35aba35..d829805e 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -543,7 +543,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
red_error("reds channel malloc failed");
}
memset(reds_channel, 0, sizeof(Channel));
- reds_channel->type = RED_CHANNEL_DISPLAY;
+ reds_channel->type = SPICE_CHANNEL_DISPLAY;
reds_channel->id = qxl_interface->base.id;
reds_channel->link = red_dispatcher_set_peer;
reds_channel->shutdown = red_dispatcher_shutdown_peer;
@@ -555,7 +555,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
red_error("reds channel malloc failed");
}
memset(cursor_channel, 0, sizeof(Channel));
- cursor_channel->type = RED_CHANNEL_CURSOR;
+ cursor_channel->type = SPICE_CHANNEL_CURSOR;
cursor_channel->id = qxl_interface->base.id;
cursor_channel->link = red_dispatcher_set_cursor_peer;
cursor_channel->shutdown = red_dispatcher_shutdown_cursor_peer;
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index e4cb2172..a2a4eca2 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -115,8 +115,8 @@ typedef struct RedSocketRawSndBuf {
/* data received from the client */
typedef struct RedSocketRawRcvBuf {
RawTunneledBuffer base;
- uint8_t buf[MAX_SOCKET_DATA_SIZE + sizeof(RedcTunnelSocketData)];
- RedcTunnelSocketData *msg_info;
+ uint8_t buf[MAX_SOCKET_DATA_SIZE + sizeof(SpiceMsgcTunnelSocketData)];
+ SpiceMsgcTunnelSocketData *msg_info;
} RedSocketRawRcvBuf;
typedef struct ReadyTunneledChunk ReadyTunneledChunk;
@@ -276,7 +276,7 @@ struct RedSocket {
uint32_t mig_client_status_msg; // the last status change msg that was received from
//the client during migration, and thus was unhandled.
// It is 0 if the status didn't change during migration
- uint32_t mig_open_ack_tokens; // if REDC_TUNNEL_SOCKET_OPEN_ACK was received during
+ uint32_t mig_open_ack_tokens; // if SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK was received during
// migration, we store the tokens we received in the
// msg.
};
@@ -492,14 +492,14 @@ struct TunnelChannel {
struct {
union {
- RedTunnelInit init;
- RedTunnelServiceIpMap service_ip;
- RedTunnelSocketOpen socket_open;
- RedTunnelSocketFin socket_fin;
- RedTunnelSocketClose socket_close;
- RedTunnelSocketClosedAck socket_close_ack;
- RedTunnelSocketData socket_data;
- RedTunnelSocketTokens socket_token;
+ SpiceMsgTunnelInit init;
+ SpiceMsgTunnelServiceIpMap service_ip;
+ SpiceMsgTunnelSocketOpen socket_open;
+ SpiceMsgTunnelSocketFin socket_fin;
+ SpiceMsgTunnelSocketClose socket_close;
+ SpiceMsgTunnelSocketClosedAck socket_close_ack;
+ SpiceMsgTunnelSocketData socket_data;
+ SpiceMsgTunnelSocketTokens socket_token;
TunnelMigrateData migrate_data;
} u;
} send_data;
@@ -712,7 +712,7 @@ static inline RedSocketRawRcvBuf *__tunnel_worker_alloc_socket_rcv_buf(TunnelWor
red_error("malloc of send buf failed");
}
}
- ret->msg_info = (RedcTunnelSocketData *)ret->buf;
+ ret->msg_info = (SpiceMsgcTunnelSocketData *)ret->buf;
ret->base.usr_opaque = NULL;
ret->base.data = ret->msg_info->data;
ret->base.size = 0;
@@ -953,7 +953,7 @@ static TunneledBufferProcessQueue *tunnel_socket_alloc_simple_print_request_proc
RedSocket *sckt)
{
return __tunnel_socket_alloc_simple_process_queue(sckt,
- RED_TUNNEL_SERVICE_TYPE_IPP,
+ SPICE_TUNNEL_SERVICE_TYPE_IPP,
PROCESS_DIRECTION_TYPE_REQUEST);
}
@@ -961,7 +961,7 @@ static TunneledBufferProcessQueue *tunnel_socket_alloc_simple_print_reply_proces
RedSocket *sckt)
{
return __tunnel_socket_alloc_simple_process_queue(sckt,
- RED_TUNNEL_SERVICE_TYPE_IPP,
+ SPICE_TUNNEL_SERVICE_TYPE_IPP,
PROCESS_DIRECTION_TYPE_REPLY);
}
@@ -1015,7 +1015,7 @@ void *red_tunnel_attach(CoreInterface *core_interface, NetWireInterface *vlan_in
worker->null_interface.worker = worker;
- worker->channel_interface.type = RED_CHANNEL_TUNNEL;
+ worker->channel_interface.type = SPICE_CHANNEL_TUNNEL;
worker->channel_interface.id = 0;
worker->channel_interface.link = handle_tunnel_channel_link;
worker->channel_interface.shutdown = handle_tunnel_channel_shutdown;
@@ -1110,7 +1110,7 @@ static inline TunnelService *__tunnel_worker_add_service(TunnelWorker *worker, u
}
static TunnelService *tunnel_worker_add_service(TunnelWorker *worker, uint32_t size,
- RedcTunnelAddGenericService *redc_service)
+ SpiceMsgcTunnelAddGenericService *redc_service)
{
return __tunnel_worker_add_service(worker, size, redc_service->type,
redc_service->id, redc_service->group,
@@ -1136,7 +1136,7 @@ static void tunnel_worker_free_print_service(TunnelWorker *worker, TunnelPrintSe
}
static TunnelPrintService *tunnel_worker_add_print_service(TunnelWorker *worker,
- RedcTunnelAddPrintService *redc_service)
+ SpiceMsgcTunnelAddPrintService *redc_service)
{
TunnelPrintService *service;
@@ -1147,8 +1147,8 @@ static TunnelPrintService *tunnel_worker_add_print_service(TunnelWorker *worker,
return NULL;
}
- if (redc_service->ip.type == RED_TUNNEL_IP_TYPE_IPv4) {
- memcpy(service->ip, redc_service->ip.data, sizeof(RedTunnelIPv4));
+ if (redc_service->ip.type == SPICE_TUNNEL_IP_TYPE_IPv4) {
+ memcpy(service->ip, redc_service->ip.data, sizeof(SpiceTunnelIPv4));
} else {
red_printf("unexpected ip type=%d", redc_service->ip.type);
tunnel_worker_free_print_service(worker, service);
@@ -1162,14 +1162,14 @@ static TunnelPrintService *tunnel_worker_add_print_service(TunnelWorker *worker,
}
static int tunnel_channel_handle_service_add(TunnelChannel *channel,
- RedcTunnelAddGenericService *service_msg)
+ SpiceMsgcTunnelAddGenericService *service_msg)
{
TunnelService *out_service = NULL;
- if (service_msg->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ if (service_msg->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
out_service = &tunnel_worker_add_print_service(channel->worker,
- (RedcTunnelAddPrintService *)
+ (SpiceMsgcTunnelAddPrintService *)
service_msg)->base;
- } else if (service_msg->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ } else if (service_msg->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
out_service = tunnel_worker_add_service(channel->worker, sizeof(TunnelService),
service_msg);
} else {
@@ -1214,9 +1214,9 @@ static inline void tunnel_worker_clear_routed_network(TunnelWorker *worker)
{
while (!ring_is_empty(&worker->services)) {
TunnelService *service = (TunnelService *)ring_get_head(&worker->services);
- if (service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
tunnel_worker_free_service(worker, service);
- } else if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
tunnel_worker_free_print_service(worker, (TunnelPrintService *)service);
} else {
red_error("unexpected service type");
@@ -1429,13 +1429,13 @@ static int tunnel_channel_handle_socket_connect_ack(TunnelChannel *channel, RedS
red_printf("TUNNEL_DBG");
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_OPEN_ACK;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK;
sckt->mig_open_ack_tokens = tokens;
return TRUE;
}
if (sckt->client_status != CLIENT_SCKT_STATUS_WAIT_OPEN) {
- red_printf("unexpected REDC_TUNNEL_SOCKET_OPEN_ACK status=%d", sckt->client_status);
+ red_printf("unexpected SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK status=%d", sckt->client_status);
return FALSE;
}
sckt->client_status = CLIENT_SCKT_STATUS_OPEN;
@@ -1462,12 +1462,12 @@ static int tunnel_channel_handle_socket_connect_nack(TunnelChannel *channel, Red
PRINT_SCKT(sckt);
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_OPEN_NACK;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK;
return TRUE;
}
if (sckt->client_status != CLIENT_SCKT_STATUS_WAIT_OPEN) {
- red_printf("unexpected REDC_TUNNEL_SOCKET_OPEN_NACK status=%d", sckt->client_status);
+ red_printf("unexpected SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK status=%d", sckt->client_status);
return FALSE;
}
sckt->client_status = CLIENT_SCKT_STATUS_CLOSED;
@@ -1487,12 +1487,12 @@ static int tunnel_channel_handle_socket_fin(TunnelChannel *channel, RedSocket *s
PRINT_SCKT(sckt);
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_FIN;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_FIN;
return TRUE;
}
if (sckt->client_status != CLIENT_SCKT_STATUS_OPEN) {
- red_printf("unexpected REDC_TUNNEL_SOCKET_FIN status=%d", sckt->client_status);
+ red_printf("unexpected SPICE_MSGC_TUNNEL_SOCKET_FIN status=%d", sckt->client_status);
return FALSE;
}
sckt->client_status = CLIENT_SCKT_STATUS_SHUTDOWN_SEND;
@@ -1525,7 +1525,7 @@ static int tunnel_channel_handle_socket_closed(TunnelChannel *channel, RedSocket
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_CLOSED;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_CLOSED;
return TRUE;
}
@@ -1571,7 +1571,7 @@ static int tunnel_channel_handle_socket_closed_ack(TunnelChannel *channel, RedSo
PRINT_SCKT(sckt);
#endif
if (channel->mig_inprogress || channel->base.migrate) {
- sckt->mig_client_status_msg = REDC_TUNNEL_SOCKET_CLOSED_ACK;
+ sckt->mig_client_status_msg = SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK;
return TRUE;
}
@@ -1583,7 +1583,7 @@ static int tunnel_channel_handle_socket_closed_ack(TunnelChannel *channel, RedSo
}
if (sckt->slirp_status != SLIRP_SCKT_STATUS_CLOSED) {
- red_printf("unexcpected REDC_TUNNEL_SOCKET_CLOSED_ACK slirp_status=%d",
+ red_printf("unexcpected SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK slirp_status=%d",
sckt->slirp_status);
return FALSE;
}
@@ -1597,7 +1597,7 @@ static int tunnel_channel_handle_socket_receive_data(TunnelChannel *channel, Red
{
if ((sckt->client_status == CLIENT_SCKT_STATUS_SHUTDOWN_SEND) ||
(sckt->client_status == CLIENT_SCKT_STATUS_CLOSED)) {
- red_printf("unexcpected REDC_TUNNEL_SOCKET_DATA clinet_status=%d",
+ red_printf("unexcpected SPICE_MSGC_TUNNEL_SOCKET_DATA clinet_status=%d",
sckt->client_status);
return FALSE;
}
@@ -1641,7 +1641,7 @@ static inline int __client_socket_can_receive(RedSocket *sckt)
}
static int tunnel_channel_handle_socket_token(TunnelChannel *channel, RedSocket *sckt,
- RedcTunnelSocketTokens *message)
+ SpiceMsgcTunnelSocketTokens *message)
{
sckt->out_data.num_tokens += message->num_tokens;
@@ -1655,13 +1655,13 @@ static int tunnel_channel_handle_socket_token(TunnelChannel *channel, RedSocket
return TRUE;
}
-static uint8_t *tunnel_channel_alloc_msg_rcv_buf(RedChannel *channel, RedDataHeader *msg_header)
+static uint8_t *tunnel_channel_alloc_msg_rcv_buf(RedChannel *channel, SpiceDataHeader *msg_header)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
- if (msg_header->type == REDC_TUNNEL_SOCKET_DATA) {
+ if (msg_header->type == SPICE_MSGC_TUNNEL_SOCKET_DATA) {
return (__tunnel_worker_alloc_socket_rcv_buf(tunnel_channel->worker)->buf);
- } else if ((msg_header->type == REDC_MIGRATE_DATA) ||
- (msg_header->type == REDC_TUNNEL_SERVICE_ADD)) {
+ } else if ((msg_header->type == SPICE_MSGC_MIGRATE_DATA) ||
+ (msg_header->type == SPICE_MSGC_TUNNEL_SERVICE_ADD)) {
uint8_t *ret = malloc(msg_header->size);
if (!ret) {
red_error("failed allocating");
@@ -1673,11 +1673,11 @@ static uint8_t *tunnel_channel_alloc_msg_rcv_buf(RedChannel *channel, RedDataHea
}
// called by the receive routine of the channel, before the buffer was assigned to a socket
-static void tunnel_channel_release_msg_rcv_buf(RedChannel *channel, RedDataHeader *msg_header,
+static void tunnel_channel_release_msg_rcv_buf(RedChannel *channel, SpiceDataHeader *msg_header,
uint8_t *msg)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
- if (msg_header->type == REDC_TUNNEL_SOCKET_DATA) {
+ if (msg_header->type == SPICE_MSGC_TUNNEL_SOCKET_DATA) {
ASSERT(!(CONTAINEROF(msg, RedSocketRawRcvBuf, buf)->base.usr_opaque));
__tunnel_worker_free_socket_rcv_buf(tunnel_channel->worker,
CONTAINEROF(msg, RedSocketRawRcvBuf, buf));
@@ -1690,9 +1690,9 @@ static void __tunnel_channel_fill_service_migrate_item(TunnelChannel *channel,
{
migrate_item->service = service;
TunnelMigrateService *general_data;
- if (service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
general_data = &migrate_item->u.generic_service;
- } else if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
general_data = &migrate_item->u.print_service.base;
memcpy(migrate_item->u.print_service.ip, ((TunnelPrintService *)service)->ip, 4);
} else {
@@ -1728,8 +1728,8 @@ static void __tunnel_channel_fill_socket_migrate_item(TunnelChannel *channel, Re
// checking if there is a need to save the queues
if ((sckt->client_status != CLIENT_SCKT_STATUS_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED_ACK)) {
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED) &&
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK)) {
mig_sckt->out_data.process_queue_size =
sckt->out_data.process_queue->get_migrate_data_proc(sckt->out_data.process_queue,
&migrate_item->out_process_queue);
@@ -1976,9 +1976,9 @@ static void tunnel_channel_restore_migrated_service(TunnelChannel *channel,
int service_size;
TunnelService *service;
struct in_addr virt_ip;
- if (mig_service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (mig_service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
service_size = sizeof(TunnelService);
- } else if (mig_service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (mig_service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
service_size = sizeof(TunnelPrintService);
} else {
SET_TUNNEL_ERROR(channel, "unexpected service type");
@@ -1996,7 +1996,7 @@ static void tunnel_channel_restore_migrated_service(TunnelChannel *channel,
return;
}
- if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
TunnelMigratePrintService *mig_print_service = (TunnelMigratePrintService *)mig_service;
TunnelPrintService *print_service = (TunnelPrintService *)service;
@@ -2098,14 +2098,14 @@ static void tunnel_channel_restore_socket_state(TunnelChannel *channel, RedSocke
switch (sckt->mig_client_status_msg) {
case 0:
break;
- case REDC_TUNNEL_SOCKET_OPEN_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:
ret = tunnel_channel_handle_socket_connect_ack(channel, sckt,
sckt->mig_open_ack_tokens);
break;
- case REDC_TUNNEL_SOCKET_OPEN_NACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:
ret = tunnel_channel_handle_socket_connect_nack(channel, sckt);
break;
- case REDC_TUNNEL_SOCKET_FIN:
+ case SPICE_MSGC_TUNNEL_SOCKET_FIN:
if (sckt->client_status == CLIENT_SCKT_STATUS_WAIT_OPEN) {
ret = tunnel_channel_handle_socket_connect_ack(channel, sckt,
sckt->mig_open_ack_tokens);
@@ -2114,7 +2114,7 @@ static void tunnel_channel_restore_socket_state(TunnelChannel *channel, RedSocke
ret = tunnel_channel_handle_socket_fin(channel, sckt);
}
break;
- case REDC_TUNNEL_SOCKET_CLOSED:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED:
// can't just send nack since we need to send close ack to client
if (sckt->client_status == CLIENT_SCKT_STATUS_WAIT_OPEN) {
ret = tunnel_channel_handle_socket_connect_ack(channel, sckt,
@@ -2123,7 +2123,7 @@ static void tunnel_channel_restore_socket_state(TunnelChannel *channel, RedSocke
ret = ret & tunnel_channel_handle_socket_closed(channel, sckt);
break;
- case REDC_TUNNEL_SOCKET_CLOSED_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:
ret = tunnel_channel_handle_socket_closed_ack(channel, sckt);
break;
default:
@@ -2259,24 +2259,24 @@ error:
}
// msg was allocated by tunnel_channel_alloc_msg_rcv_buf
-static int tunnel_channel_handle_message(RedChannel *channel, RedDataHeader *header, uint8_t *msg)
+static int tunnel_channel_handle_message(RedChannel *channel, SpiceDataHeader *header, uint8_t *msg)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
RedSocket *sckt = NULL;
// retrieve the sckt
switch (header->type) {
- case REDC_MIGRATE_FLUSH_MARK:
- case REDC_MIGRATE_DATA:
- case REDC_TUNNEL_SERVICE_ADD:
- case REDC_TUNNEL_SERVICE_REMOVE:
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
+ case SPICE_MSGC_MIGRATE_DATA:
+ case SPICE_MSGC_TUNNEL_SERVICE_ADD:
+ case SPICE_MSGC_TUNNEL_SERVICE_REMOVE:
break;
- case REDC_TUNNEL_SOCKET_OPEN_ACK:
- case REDC_TUNNEL_SOCKET_OPEN_NACK:
- case REDC_TUNNEL_SOCKET_DATA:
- case REDC_TUNNEL_SOCKET_FIN:
- case REDC_TUNNEL_SOCKET_CLOSED:
- case REDC_TUNNEL_SOCKET_CLOSED_ACK:
- case REDC_TUNNEL_SOCKET_TOKEN:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_DATA:
+ case SPICE_MSGC_TUNNEL_SOCKET_FIN:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED:
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:
+ case SPICE_MSGC_TUNNEL_SOCKET_TOKEN:
// the first field in these messages is connection id
sckt = tunnel_channel->worker->sockets + (*((uint16_t *)msg));
if (!sckt->allocated) {
@@ -2289,73 +2289,73 @@ static int tunnel_channel_handle_message(RedChannel *channel, RedDataHeader *hea
}
switch (header->type) {
- case REDC_TUNNEL_SERVICE_ADD:
- if (header->size < sizeof(RedcTunnelAddGenericService)) {
+ case SPICE_MSGC_TUNNEL_SERVICE_ADD:
+ if (header->size < sizeof(SpiceMsgcTunnelAddGenericService)) {
red_printf("bad message size");
free(msg);
return FALSE;
}
return tunnel_channel_handle_service_add(tunnel_channel,
- (RedcTunnelAddGenericService *)msg);
- case REDC_TUNNEL_SERVICE_REMOVE:
+ (SpiceMsgcTunnelAddGenericService *)msg);
+ case SPICE_MSGC_TUNNEL_SERVICE_REMOVE:
red_printf("REDC_TUNNEL_REMOVE_SERVICE not supported yet");
return FALSE;
- case REDC_TUNNEL_SOCKET_OPEN_ACK:
- if (header->size != sizeof(RedcTunnelSocketOpenAck)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_ACK:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketOpenAck)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_connect_ack(tunnel_channel, sckt,
- ((RedcTunnelSocketOpenAck *)msg)->tokens);
+ ((SpiceMsgcTunnelSocketOpenAck *)msg)->tokens);
- case REDC_TUNNEL_SOCKET_OPEN_NACK:
- if (header->size != sizeof(RedcTunnelSocketOpenNack)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_OPEN_NACK:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketOpenNack)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_connect_nack(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_DATA:
+ case SPICE_MSGC_TUNNEL_SOCKET_DATA:
{
- if (header->size < sizeof(RedcTunnelSocketData)) {
+ if (header->size < sizeof(SpiceMsgcTunnelSocketData)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_receive_data(tunnel_channel, sckt,
CONTAINEROF(msg, RedSocketRawRcvBuf, buf),
- header->size - sizeof(RedcTunnelSocketData));
+ header->size - sizeof(SpiceMsgcTunnelSocketData));
}
- case REDC_TUNNEL_SOCKET_FIN:
- if (header->size != sizeof(RedcTunnelSocketFin)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_FIN:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketFin)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_fin(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_CLOSED:
- if (header->size != sizeof(RedcTunnelSocketClosed)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketClosed)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_closed(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_CLOSED_ACK:
- if (header->size != sizeof(RedcTunnelSocketClosedAck)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketClosedAck)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_closed_ack(tunnel_channel, sckt);
- case REDC_TUNNEL_SOCKET_TOKEN:
- if (header->size != sizeof(RedcTunnelSocketTokens)) {
+ case SPICE_MSGC_TUNNEL_SOCKET_TOKEN:
+ if (header->size != sizeof(SpiceMsgcTunnelSocketTokens)) {
red_printf("bad message size");
return FALSE;
}
return tunnel_channel_handle_socket_token(tunnel_channel, sckt,
- (RedcTunnelSocketTokens *)msg);
- case REDC_MIGRATE_FLUSH_MARK:
+ (SpiceMsgcTunnelSocketTokens *)msg);
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
return tunnel_channel_handle_migrate_mark(tunnel_channel);
- case REDC_MIGRATE_DATA:
+ case SPICE_MSGC_MIGRATE_DATA:
if (header->size < sizeof(TunnelMigrateData)) {
red_printf("bad message size");
free(msg);
@@ -2379,8 +2379,8 @@ static void tunnel_channel_send_set_ack(TunnelChannel *channel, PipeItem *item)
channel->base.send_data.u.ack.generation = ++channel->base.ack_data.generation;
channel->base.send_data.u.ack.window = CLIENT_ACK_WINDOW;
- red_channel_init_send_data(&channel->base, RED_SET_ACK, item);
- red_channel_add_buf(&channel->base, &channel->base.send_data.u.ack, sizeof(RedSetAck));
+ red_channel_init_send_data(&channel->base, SPICE_MSG_SET_ACK, item);
+ red_channel_add_buf(&channel->base, &channel->base.send_data.u.ack, sizeof(SpiceMsgSetAck));
red_channel_begin_send_massage(&channel->base);
}
@@ -2388,11 +2388,11 @@ static void tunnel_channel_send_set_ack(TunnelChannel *channel, PipeItem *item)
static void tunnel_channel_send_migrate(TunnelChannel *channel, PipeItem *item)
{
ASSERT(channel);
- channel->base.send_data.u.migrate.flags = RED_MIGRATE_NEED_FLUSH |
- RED_MIGRATE_NEED_DATA_TRANSFER;
+ channel->base.send_data.u.migrate.flags = SPICE_MIGRATE_NEED_FLUSH |
+ SPICE_MIGRATE_NEED_DATA_TRANSFER;
channel->expect_migrate_mark = TRUE;
- red_channel_init_send_data(&channel->base, RED_MIGRATE, item);
- red_channel_add_buf(&channel->base, &channel->base.send_data.u.migrate, sizeof(RedMigrate));
+ red_channel_init_send_data(&channel->base, SPICE_MSG_MIGRATE, item);
+ red_channel_add_buf(&channel->base, &channel->base.send_data.u.migrate, sizeof(SpiceMsgMigrate));
red_channel_begin_send_massage(&channel->base);
}
@@ -2438,12 +2438,12 @@ static int __tunnel_channel_send_service_migrate_data(TunnelChannel *channel,
int cur_offset = offset;
TunnelMigrateService *generic_data;
- if (service->type == RED_TUNNEL_SERVICE_TYPE_GENERIC) {
+ if (service->type == SPICE_TUNNEL_SERVICE_TYPE_GENERIC) {
generic_data = &item->u.generic_service;
red_channel_add_buf(&channel->base, &item->u.generic_service,
sizeof(item->u.generic_service));
cur_offset += sizeof(item->u.generic_service);
- } else if (service->type == RED_TUNNEL_SERVICE_TYPE_IPP) {
+ } else if (service->type == SPICE_TUNNEL_SERVICE_TYPE_IPP) {
generic_data = &item->u.print_service.base;
red_channel_add_buf(&channel->base, &item->u.print_service,
sizeof(item->u.print_service));
@@ -2474,8 +2474,8 @@ static int __tunnel_channel_send_socket_migrate_data(TunnelChannel *channel,
cur_offset += sizeof(*mig_sckt);
if ((sckt->client_status != CLIENT_SCKT_STATUS_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED) &&
- (sckt->mig_client_status_msg != REDC_TUNNEL_SOCKET_CLOSED_ACK)) {
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED) &&
+ (sckt->mig_client_status_msg != SPICE_MSGC_TUNNEL_SOCKET_CLOSED_ACK)) {
mig_sckt->out_data.process_buf = cur_offset;
mig_sckt->out_data.process_buf_size =
__tunnel_channel_send_process_bufs_migrate_data(channel,
@@ -2541,7 +2541,7 @@ static void tunnel_channel_send_migrate_data(TunnelChannel *channel, PipeItem *i
migrate_data->magic = TUNNEL_MIGRATE_DATA_MAGIC;
migrate_data->version = TUNNEL_MIGRATE_DATA_VERSION;
migrate_data->message_serial = red_channel_get_message_serial(&channel->base);
- red_channel_init_send_data(&channel->base, RED_MIGRATE_DATA, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_MIGRATE_DATA, item);
red_channel_add_buf(&channel->base, migrate_data, sizeof(*migrate_data));
migrate_data->slirp_state = data_buf_offset;
@@ -2583,8 +2583,8 @@ static void tunnel_channel_send_init(TunnelChannel *channel, PipeItem *item)
channel->send_data.u.init.max_socket_data_size = MAX_SOCKET_DATA_SIZE;
channel->send_data.u.init.max_num_of_sockets = MAX_SOCKETS_NUM;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_INIT, item);
- red_channel_add_buf(&channel->base, &channel->send_data.u.init, sizeof(RedTunnelInit));
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_INIT, item);
+ red_channel_add_buf(&channel->base, &channel->send_data.u.init, sizeof(SpiceMsgTunnelInit));
red_channel_begin_send_massage(&channel->base);
}
@@ -2594,12 +2594,12 @@ static void tunnel_channel_send_service_ip_map(TunnelChannel *channel, PipeItem
TunnelService *service = CONTAINEROF(item, TunnelService, pipe_item);
channel->send_data.u.service_ip.service_id = service->id;
- channel->send_data.u.service_ip.virtual_ip.type = RED_TUNNEL_IP_TYPE_IPv4;
+ channel->send_data.u.service_ip.virtual_ip.type = SPICE_TUNNEL_IP_TYPE_IPv4;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SERVICE_IP_MAP, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SERVICE_IP_MAP, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.service_ip,
- sizeof(RedTunnelServiceIpMap));
- red_channel_add_buf(&channel->base, &service->virt_ip.s_addr, sizeof(RedTunnelIPv4));
+ sizeof(SpiceMsgTunnelServiceIpMap));
+ red_channel_add_buf(&channel->base, &service->virt_ip.s_addr, sizeof(SpiceTunnelIPv4));
red_channel_begin_send_massage(&channel->base);
}
@@ -2614,7 +2614,7 @@ static void tunnel_channel_send_socket_open(TunnelChannel *channel, PipeItem *it
sckt->in_data.client_total_num_tokens = SOCKET_WINDOW_SIZE;
sckt->in_data.num_tokens = 0;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_OPEN, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_OPEN, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_open,
sizeof(channel->send_data.u.socket_open));
@@ -2639,7 +2639,7 @@ static void tunnel_channel_send_socket_fin(TunnelChannel *channel, PipeItem *ite
channel->send_data.u.socket_fin.connection_id = sckt->connection_id;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_FIN, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_FIN, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_fin,
sizeof(channel->send_data.u.socket_fin));
@@ -2671,7 +2671,7 @@ static void tunnel_channel_send_socket_close(TunnelChannel *channel, PipeItem *i
channel->send_data.u.socket_close.connection_id = sckt->connection_id;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_CLOSE, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_CLOSE, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_close,
sizeof(channel->send_data.u.socket_close));
@@ -2690,7 +2690,7 @@ static void tunnel_channel_send_socket_closed_ack(TunnelChannel *channel, PipeIt
channel->send_data.u.socket_close_ack.connection_id = sckt->connection_id;
// pipe item is null because we free the sckt.
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_CLOSED_ACK, NULL);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_CLOSED_ACK, NULL);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_close_ack,
sizeof(channel->send_data.u.socket_close_ack));
@@ -2727,7 +2727,7 @@ static void tunnel_channel_send_socket_token(TunnelChannel *channel, PipeItem *i
sckt->in_data.client_total_num_tokens += channel->send_data.u.socket_token.num_tokens;
ASSERT(sckt->in_data.client_total_num_tokens <= SOCKET_WINDOW_SIZE);
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_TOKEN, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_TOKEN, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_token,
sizeof(channel->send_data.u.socket_token));
@@ -2757,7 +2757,7 @@ static void tunnel_channel_send_socket_out_data(TunnelChannel *channel, PipeItem
channel->send_data.u.socket_data.connection_id = sckt->connection_id;
- red_channel_init_send_data(&channel->base, RED_TUNNEL_SOCKET_DATA, item);
+ red_channel_init_send_data(&channel->base, SPICE_MSG_TUNNEL_SOCKET_DATA, item);
red_channel_add_buf(&channel->base, &channel->send_data.u.socket_data,
sizeof(channel->send_data.u.socket_data));
pushed_bufs_num++;
diff --git a/server/red_worker.c b/server/red_worker.c
index 572b3224..9d6c08e5 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -295,9 +295,9 @@ typedef struct CursorItem {
typedef struct LocalCursor {
CursorItem base;
- Point16 position;
+ SpicePoint16 position;
uint32_t data_size;
- RedCursor red_cursor;
+ SpiceCursor red_cursor;
} LocalCursor;
#define MAX_SEND_BUFS 20
@@ -331,7 +331,7 @@ typedef struct RedChannel RedChannel;
typedef void (*disconnect_channel_proc)(RedChannel *channel);
typedef void (*hold_item_proc)(void *item);
typedef void (*release_item_proc)(RedChannel *channel, void *item);
-typedef int (*handle_message_proc)(RedChannel *channel, RedDataHeader *message);
+typedef int (*handle_message_proc)(RedChannel *channel, SpiceDataHeader *message);
struct RedChannel {
EventListener listener;
@@ -350,9 +350,9 @@ struct RedChannel {
struct {
int blocked;
- RedDataHeader header;
+ SpiceDataHeader header;
union {
- RedSetAck ack;
+ SpiceMsgSetAck ack;
} u;
uint32_t n_bufs;
BufDescriptor bufs[MAX_SEND_BUFS];
@@ -363,7 +363,7 @@ struct RedChannel {
struct {
uint8_t buf[RECIVE_BUF_SIZE];
- RedDataHeader *message;
+ SpiceDataHeader *message;
uint8_t *now;
uint8_t *end;
} recive_data;
@@ -380,7 +380,7 @@ struct RedChannel {
typedef struct ImageItem {
PipeItem link;
int refs;
- Point pos;
+ SpicePoint pos;
int width;
int height;
int stride;
@@ -398,7 +398,7 @@ struct Stream {
red_time_t last_time;
int width;
int height;
- Rect dest_area;
+ SpiceRect dest_area;
#endif
int top_down;
Stream *next;
@@ -442,12 +442,12 @@ static const int BITMAP_FMT_IS_RGB[] = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1};
static const int BITMAP_FMP_BYTES_PER_PIXEL[] = {0, 0, 0, 0, 0, 1, 2, 3, 4, 4};
typedef struct __attribute__ ((__packed__)) RedImage {
- ImageDescriptor descriptor;
+ SpiceImageDescriptor descriptor;
union { // variable length
- Bitmap bitmap;
- QUICData quic;
- LZ_RGBData lz_rgb;
- LZ_PLTData lz_plt;
+ SpiceBitmap bitmap;
+ SpiceQUICData quic;
+ SpiceLZRGBData lz_rgb;
+ SpiceLZPLTData lz_plt;
};
} RedImage;
@@ -499,13 +499,13 @@ typedef struct __attribute__ ((__packed__)) DisplayChannelMigrateData {
} DisplayChannelMigrateData;
typedef struct WaitForChannels {
- RedWaitForChannels header;
- RedWaitForChannel buf[MAX_CACHE_CLIENTS];
+ SpiceMsgWaitForChannels header;
+ SpiceWaitForChannel buf[MAX_CACHE_CLIENTS];
} WaitForChannels;
typedef struct FreeList {
int res_size;
- RedResorceList *res;
+ SpiceResorceList *res;
uint64_t sync[MAX_CACHE_CLIENTS];
WaitForChannels wait;
} FreeList;
@@ -524,7 +524,7 @@ typedef struct {
jmp_buf jmp_env;
union {
struct {
- ADDRESS next;
+ SPICE_ADDRESS next;
uint32_t stride;
uint32_t group_id;
@@ -629,30 +629,30 @@ struct DisplayChannel {
struct {
union {
- RedFill fill;
- RedOpaque opaque;
- RedCopy copy;
- RedTransparent transparent;
- RedAlphaBlend alpha_blend;
- RedCopyBits copy_bits;
- RedBlend blend;
- RedRop3 rop3;
- RedBlackness blackness;
- RedWhiteness whiteness;
- RedInvers invers;
- RedStroke stroke;
- RedText text;
- RedMode mode;
- RedInvalOne inval_one;
+ SpiceMsgDisplayDrawFill fill;
+ SpiceMsgDisplayDrawOpaque opaque;
+ SpiceMsgDisplayDrawCopy copy;
+ SpiceMsgDisplayDrawTransparent transparent;
+ SpiceMsgDisplayDrawAlphaBlend alpha_blend;
+ SpiceMsgDisplayCopyBits copy_bits;
+ SpiceMsgDisplayDrawBlend blend;
+ SpiceMsgDisplayDrawRop3 rop3;
+ SpiceMsgDisplayDrawBlackness blackness;
+ SpiceMsgDisplayDrawWhiteness whiteness;
+ SpiceMsgDisplayDrawInvers invers;
+ SpiceMsgDisplayDrawStroke stroke;
+ SpiceMsgDisplayDrawText text;
+ SpiceMsgDisplayMode mode;
+ SpiceMsgDisplayInvalOne inval_one;
WaitForChannels wait;
struct {
- RedStreamCreate message;
+ SpiceMsgDisplayStreamCreate message;
uint32_t num_rects;
} stream_create;
- RedStreamClip stream_clip;
- RedStreamData stream_data;
- RedStreamDestroy stream_destroy;
- RedMigrate migrate;
+ SpiceMsgDisplayStreamClip stream_clip;
+ SpiceMsgDisplayStreamData stream_data;
+ SpiceMsgDisplayStreamDestroy stream_destroy;
+ SpiceMsgMigrate migrate;
DisplayChannelMigrateData migrate_data;
} u;
@@ -666,10 +666,10 @@ struct DisplayChannel {
RedCompressBuf *used_compress_bufs;
struct {
- RedSubMessageList sub_list;
+ SpiceSubMessageList sub_list;
uint32_t sub_messages[DISPLAY_MAX_SUB_MESSAGES];
} sub_list;
- RedSubMessage sub_header[DISPLAY_MAX_SUB_MESSAGES];
+ SpicedSubMessage sub_header[DISPLAY_MAX_SUB_MESSAGES];
FreeList free_list;
} send_data;
@@ -697,12 +697,12 @@ typedef struct CursorChannel {
struct {
union {
- RedCursorInit cursor_init;
- RedCursorSet cursor_set;
- RedCursorMove cursor_move;
- RedCursorTrail cursor_trail;
- RedInvalOne inval_one;
- RedMigrate migrate;
+ SpiceMsgCursorInit cursor_init;
+ SpiceMsgCursorSet cursor_set;
+ SpiceMsgCursorMove cursor_move;
+ SpiceMsgCursorTrail cursor_trail;
+ SpiceMsgDisplayInvalOne inval_one;
+ SpiceMsgMigrate migrate;
} u;
} send_data;
#ifdef RED_STATISTICS
@@ -828,23 +828,23 @@ typedef struct UpgradeItem {
QRegion region;
} UpgradeItem;
-typedef void (*draw_fill_t)(void *canvas, Rect *bbox, Clip *clip, Fill *fill);
-typedef void (*draw_copy_t)(void *canvas, Rect *bbox, Clip *clip, Copy *copy);
-typedef void (*draw_opaque_t)(void *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-typedef void (*copy_bits_t)(void *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-typedef void (*draw_text_t)(void *canvas, Rect *bbox, Clip *clip, Text *text);
-typedef void (*draw_stroke_t)(void *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-typedef void (*draw_rop3_t)(void *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-typedef void (*draw_blend_t)(void *canvas, Rect *bbox, Clip *clip, Blend *blend);
-typedef void (*draw_blackness_t)(void *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-typedef void (*draw_whiteness_t)(void *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-typedef void (*draw_invers_t)(void *canvas, Rect *bbox, Clip *clip, Invers *invers);
-typedef void (*draw_transparent_t)(void *canvas, Rect *bbox, Clip *clip, Transparent* transparent);
-typedef void (*draw_alpha_blend_t)(void *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend);
-typedef void (*read_pixels_t)(void *canvas, uint8_t *dest, int dest_stride, const Rect *area);
-typedef void (*set_top_mask_t)(void *canvas, int num_rect, const Rect *rects);
+typedef void (*draw_fill_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+typedef void (*draw_copy_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+typedef void (*draw_opaque_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+typedef void (*copy_bits_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+typedef void (*draw_text_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
+typedef void (*draw_stroke_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+typedef void (*draw_rop3_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+typedef void (*draw_blend_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+typedef void (*draw_blackness_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+typedef void (*draw_whiteness_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+typedef void (*draw_invers_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+typedef void (*draw_transparent_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent);
+typedef void (*draw_alpha_blend_t)(void *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend);
+typedef void (*read_pixels_t)(void *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area);
+typedef void (*set_top_mask_t)(void *canvas, int num_rect, const SpiceRect *rects);
typedef void (*clear_top_mask_t)(void *canvas);
-typedef void (*validate_area_t)(void *canvas, int32_t stride, uint8_t *line_0, const Rect *area);
+typedef void (*validate_area_t)(void *canvas, int32_t stride, uint8_t *line_0, const SpiceRect *area);
typedef void (*destroy_t)(void *canvas);
typedef struct DrawFuncs {
@@ -891,7 +891,7 @@ typedef struct ItemTrace {
int last_gradual_frame;
int width;
int height;
- Rect dest_area;
+ SpiceRect dest_area;
} ItemTrace;
#define TRACE_ITEMS_SHIFT 3
@@ -943,7 +943,7 @@ typedef struct RedWorker {
CursorItem *cursor;
int cursor_visible;
- Point16 cursor_position;
+ SpicePoint16 cursor_position;
uint16_t cursor_trail_length;
uint16_t cursor_trail_frequency;
@@ -1017,7 +1017,7 @@ static void display_channel_push(RedWorker *worker);
#define red_draw_drawable(worker, item)
#else
static void red_draw_drawable(RedWorker *worker, Drawable *item);
-static void red_update_area(RedWorker *worker, const Rect *area);
+static void red_update_area(RedWorker *worker, const SpiceRect *area);
#endif
static void red_release_cursor(RedWorker *worker, CursorItem *cursor);
static inline void release_drawable(RedWorker *worker, Drawable *item);
@@ -1039,11 +1039,11 @@ static void red_display_release_stream_clip(DisplayChannel* channel, StreamClipI
static int red_display_free_some_independent_glz_drawables(DisplayChannel *channel);
static void red_display_free_glz_drawable(DisplayChannel *channel, RedGlzDrawable *drawable);
static void reset_rate(StreamAgent *stream_agent);
-static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_id);
-static inline int _stride_is_extra(Bitmap *bitmap);
+static int _bitmap_is_gradual(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id);
+static inline int _stride_is_extra(SpiceBitmap *bitmap);
#ifdef DUMP_BITMAP
-static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id);
+static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id);
#endif
#ifdef COMPRESS_STAT
@@ -1644,7 +1644,7 @@ static inline void red_add_item_trace(RedWorker *worker, Drawable *item)
trace->frames_count = item->frames_count;
trace->gradual_frames_count = item->gradual_frames_count;
trace->last_gradual_frame = item->last_gradual_frame;
- Rect* src_area = &item->qxl_drawable->u.copy.src_area;
+ SpiceRect* src_area = &item->qxl_drawable->u.copy.src_area;
trace->width = src_area->right - src_area->left;
trace->height = src_area->bottom - src_area->top;
trace->dest_area = item->qxl_drawable->bbox;
@@ -2118,7 +2118,7 @@ static inline void __current_add_drawable(RedWorker *worker, Drawable *drawable,
#ifdef USE_EXCLUDE_RGN
-static int is_equal_path(RedWorker *worker, ADDRESS p1, ADDRESS p2, uint32_t group_id1,
+static int is_equal_path(RedWorker *worker, SPICE_ADDRESS p1, SPICE_ADDRESS p2, uint32_t group_id1,
uint32_t group_id2)
{
QXLPath *path1;
@@ -2181,13 +2181,13 @@ static int is_equal_path(RedWorker *worker, ADDRESS p1, ADDRESS p2, uint32_t gro
}
// partial imp
-static int is_equal_brush(Brush *b1, Brush *b2)
+static int is_equal_brush(SpiceBrush *b1, SpiceBrush *b2)
{
- return b1->type == b2->type && b1->type == BRUSH_TYPE_SOLID && b1->u.color == b1->u.color;
+ return b1->type == b2->type && b1->type == SPICE_BRUSH_TYPE_SOLID && b1->u.color == b1->u.color;
}
// partial imp
-static int is_equal_line_attr(LineAttr *a1, LineAttr *a2)
+static int is_equal_line_attr(SpiceLineAttr *a1, SpiceLineAttr *a2)
{
return a1->flags == a2->flags && a1->join_style == a2->join_style &&
a1->end_style == a2->end_style && a1->style_nseg == a2->style_nseg &&
@@ -2195,7 +2195,7 @@ static int is_equal_line_attr(LineAttr *a1, LineAttr *a2)
a1->style_nseg == 0;
}
-static inline int rect_is_equal(const Rect *r1, const Rect *r2)
+static inline int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2)
{
return r1->top == r2->top && r1->left == r2->left &&
r1->bottom == r2->bottom && r1->right == r2->right;
@@ -2293,11 +2293,11 @@ static void push_stream_clip_by_drawable(DisplayChannel* channel, StreamAgent *a
PANIC("alloc failed");
}
- if (drawable->qxl_drawable->clip.type == CLIP_TYPE_NONE) {
+ if (drawable->qxl_drawable->clip.type == SPICE_CLIP_TYPE_NONE) {
region_init(&item->region);
- item->clip_type = CLIP_TYPE_NONE;
+ item->clip_type = SPICE_CLIP_TYPE_NONE;
} else {
- item->clip_type = CLIP_TYPE_RECTS;
+ item->clip_type = SPICE_CLIP_TYPE_RECTS;
region_clone(&item->region, &drawable->tree_item.base.rgn);
}
red_pipe_add((RedChannel*)channel, (PipeItem *)item);
@@ -2309,7 +2309,7 @@ static void push_stream_clip(DisplayChannel* channel, StreamAgent *agent)
if (!item) {
PANIC("alloc failed");
}
- item->clip_type = CLIP_TYPE_RECTS;
+ item->clip_type = SPICE_CLIP_TYPE_RECTS;
region_clone(&item->region, &agent->vis_region);
red_pipe_add((RedChannel*)channel, (PipeItem *)item);
}
@@ -2641,7 +2641,7 @@ static void red_create_stream(RedWorker *worker, Drawable *drawable)
Stream *stream;
AVFrame *frame;
uint8_t* frame_buf;
- Rect* src_rect;
+ SpiceRect* src_rect;
int stream_width;
int stream_height;
int pict_size;
@@ -2694,7 +2694,7 @@ static void red_create_stream(RedWorker *worker, Drawable *drawable)
stream->frame_buf_end = frame_buf + pict_size;
QXLImage *qxl_image = (QXLImage *)get_virt(worker, drawable->qxl_drawable->u.copy.src_bitmap,
sizeof(QXLImage), drawable->group_id);
- stream->top_down = !!(qxl_image->bitmap.flags & BITMAP_TOP_DOWN);
+ stream->top_down = !!(qxl_image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN);
drawable->stream = stream;
if (worker->display_channel) {
@@ -2770,7 +2770,7 @@ static inline int __red_is_next_stream_frame(RedWorker *worker,
const Drawable *candidate,
const int other_src_width,
const int other_src_height,
- const Rect *other_dest,
+ const SpiceRect *other_dest,
const red_time_t other_time,
const Stream *stream)
{
@@ -2787,7 +2787,7 @@ static inline int __red_is_next_stream_frame(RedWorker *worker,
return FALSE;
}
- Rect* candidate_src = &qxl_drawable->u.copy.src_area;
+ SpiceRect* candidate_src = &qxl_drawable->u.copy.src_area;
if (candidate_src->right - candidate_src->left != other_src_width ||
candidate_src->bottom - candidate_src->top != other_src_height) {
return FALSE;
@@ -2796,7 +2796,7 @@ static inline int __red_is_next_stream_frame(RedWorker *worker,
if (stream) {
QXLImage *qxl_image = (QXLImage *)get_virt(worker, qxl_drawable->u.copy.src_bitmap,
sizeof(QXLImage), candidate->group_id);
- if (stream->top_down != !!(qxl_image->bitmap.flags & BITMAP_TOP_DOWN)) {
+ if (stream->top_down != !!(qxl_image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
return FALSE;
}
}
@@ -2810,7 +2810,7 @@ static inline int red_is_next_stream_frame(RedWorker *worker, const Drawable *ca
return FALSE;
}
- Rect* prev_src = &prev->qxl_drawable->u.copy.src_area;
+ SpiceRect* prev_src = &prev->qxl_drawable->u.copy.src_area;
return __red_is_next_stream_frame(worker, candidate, prev_src->right - prev_src->left,
prev_src->bottom - prev_src->top,
&prev->qxl_drawable->bbox, prev->creation_time,
@@ -2844,19 +2844,19 @@ static inline int red_is_next_stream_frame(RedWorker *worker, Drawable *candidat
return FALSE;
}
- if (qxl_drawable->u.copy.rop_decriptor != ROPD_OP_PUT ||
- prev_qxl_drawable->u.copy.rop_decriptor != ROPD_OP_PUT) {
+ if (qxl_drawable->u.copy.rop_decriptor != SPICE_ROPD_OP_PUT ||
+ prev_qxl_drawable->u.copy.rop_decriptor != SPICE_ROPD_OP_PUT) {
return FALSE;
}
qxl_image = (QXLImage *)get_virt(worker, qxl_drawable->u.copy.src_bitmap, sizeof(QXLImage),
candidate->group_id);
- if (qxl_image->descriptor.type != IMAGE_TYPE_BITMAP) {
+ if (qxl_image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP) {
return FALSE;
}
- if (prev->stream && prev->stream->top_down != !!(qxl_image->bitmap.flags & BITMAP_TOP_DOWN)) {
+ if (prev->stream && prev->stream->top_down != !!(qxl_image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
return FALSE;
}
@@ -3382,22 +3382,22 @@ static inline int red_current_add(RedWorker *worker, Drawable *drawable)
#endif
-static void add_clip_rects(RedWorker *worker, QRegion *rgn, PHYSICAL data, uint32_t group_id)
+static void add_clip_rects(RedWorker *worker, QRegion *rgn, QXLPHYSICAL data, uint32_t group_id)
{
while (data) {
QXLDataChunk *chunk;
- Rect *now;
- Rect *end;
+ SpiceRect *now;
+ SpiceRect *end;
uint32_t data_size;
chunk = (QXLDataChunk *)get_virt(worker, data, sizeof(QXLDataChunk), group_id);
data_size = chunk->data_size;
validate_virt(worker, (unsigned long)chunk->data, get_memslot_id(worker, data), data_size,
group_id);
- now = (Rect *)chunk->data;
- end = now + data_size / sizeof(Rect);
+ now = (SpiceRect *)chunk->data;
+ end = now + data_size / sizeof(SpiceRect);
for (; now < end; now++) {
- Rect* r = (Rect *)now;
+ SpiceRect* r = (SpiceRect *)now;
ASSERT(now->top == r->top && now->left == r->left &&
now->bottom == r->bottom && now->right == r->right);
@@ -3410,7 +3410,7 @@ static void add_clip_rects(RedWorker *worker, QRegion *rgn, PHYSICAL data, uint3
}
}
-static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, Point *delta)
+static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, SpicePoint *delta)
{
if (!delta->x && !delta->y) {
return NULL;
@@ -3435,7 +3435,7 @@ static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, Point *del
return shadow;
}
-static inline int red_current_add_with_shadow(RedWorker *worker, Drawable *item, Point *delta)
+static inline int red_current_add_with_shadow(RedWorker *worker, Drawable *item, SpicePoint *delta)
{
#ifdef RED_WORKER_STAT
stat_time_t start_time = stat_now();
@@ -3497,13 +3497,13 @@ static inline void red_update_streamable(RedWorker *worker, Drawable *drawable,
if (drawable->tree_item.effect != QXL_EFFECT_OPAQUE ||
qxl_drawable->type != QXL_DRAW_COPY ||
- qxl_drawable->u.copy.rop_decriptor != ROPD_OP_PUT) {
+ qxl_drawable->u.copy.rop_decriptor != SPICE_ROPD_OP_PUT) {
return;
}
qxl_image = (QXLImage *)get_virt(worker, qxl_drawable->u.copy.src_bitmap, sizeof(QXLImage),
drawable->group_id);
- if (qxl_image->descriptor.type != IMAGE_TYPE_BITMAP) {
+ if (qxl_image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP) {
return;
}
@@ -3518,7 +3518,7 @@ static inline int red_current_add_qxl(RedWorker *worker, Drawable *drawable,
int ret;
if (has_shadow(qxl_drawable)) {
- Point delta;
+ SpicePoint delta;
#ifdef RED_WORKER_STAT
++worker->add_with_shadow_count;
@@ -3559,7 +3559,7 @@ static inline int red_current_add_qxl(RedWorker *worker, Drawable *drawable,
return ret;
}
-static void red_get_area(RedWorker *worker, const Rect *area, uint8_t *dest, int dest_stride,
+static void red_get_area(RedWorker *worker, const SpiceRect *area, uint8_t *dest, int dest_stride,
int update)
{
if (update) {
@@ -3591,17 +3591,17 @@ static inline int red_handle_self_bitmap(RedWorker *worker, Drawable *drawable)
}
dest = (uint8_t *)(image + 1);
- image->descriptor.type = IMAGE_TYPE_BITMAP;
+ image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
image->descriptor.flags = 0;
QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_RED, ++worker->bits_unique);
image->bitmap.flags = QXL_BITMAP_DIRECT | (worker->surface.context.top_down ?
QXL_BITMAP_TOP_DOWN : 0);
- image->bitmap.format = BITMAP_FMT_32BIT;
+ image->bitmap.format = SPICE_BITMAP_FMT_32BIT;
image->bitmap.stride = dest_stride;
image->descriptor.width = image->bitmap.x = width;
image->descriptor.height = image->bitmap.y = height;
- image->bitmap.data = (PHYSICAL)dest;
+ image->bitmap.data = (QXLPHYSICAL)dest;
image->bitmap.palette = 0;
red_get_area(worker, &drawable->qxl_drawable->self_bitmap_area, dest, dest_stride, TRUE);
@@ -3677,14 +3677,14 @@ static inline void red_process_drawable(RedWorker *worker, QXLDrawable *drawable
drawable->bbox.top, drawable->bbox.left, drawable->bbox.bottom, drawable->bbox.right);
#endif
- if (drawable->clip.type == CLIP_TYPE_RECTS) {
+ if (drawable->clip.type == SPICE_CLIP_TYPE_RECTS) {
QRegion rgn;
region_init(&rgn);
add_clip_rects(worker, &rgn, drawable->clip.data + OFFSETOF(QXLClipRects, chunk), group_id);
region_and(&item->tree_item.base.rgn, &rgn);
region_destroy(&rgn);
- } else if (drawable->clip.type == CLIP_TYPE_PATH) {
+ } else if (drawable->clip.type == SPICE_CLIP_TYPE_PATH) {
item->tree_item.effect = QXL_EFFECT_BLEND;
#ifdef PIPE_DEBUG
printf("TEST: DRAWABLE: QXL_CLIP_TYPE_PATH\n");
@@ -3714,7 +3714,7 @@ static inline void red_process_drawable(RedWorker *worker, QXLDrawable *drawable
release_drawable(worker, item);
}
-static void localize_path(RedWorker *worker, PHYSICAL *in_path, uint32_t group_id)
+static void localize_path(RedWorker *worker, QXLPHYSICAL *in_path, uint32_t group_id)
{
QXLPath *path;
uint8_t *data;
@@ -3726,7 +3726,7 @@ static void localize_path(RedWorker *worker, PHYSICAL *in_path, uint32_t group_i
path = (QXLPath *)get_virt(worker, *in_path, sizeof(QXLPath), group_id);
data = malloc(sizeof(UINT32) + path->data_size);
ASSERT(data);
- *in_path = (PHYSICAL)data;
+ *in_path = (QXLPHYSICAL)data;
*(UINT32 *)data = path->data_size;
data += sizeof(UINT32);
chunk = &path->chunk;
@@ -3740,18 +3740,18 @@ static void localize_path(RedWorker *worker, PHYSICAL *in_path, uint32_t group_i
} while (chunk);
}
-static void unlocalize_path(PHYSICAL *path)
+static void unlocalize_path(QXLPHYSICAL *path)
{
ASSERT(path && *path);
free((void *)*path);
*path = 0;
}
-static void localize_str(RedWorker *worker, PHYSICAL *in_str, uint32_t group_id)
+static void localize_str(RedWorker *worker, QXLPHYSICAL *in_str, uint32_t group_id)
{
QXLString *qxl_str = (QXLString *)get_virt(worker, *in_str, sizeof(QXLString), group_id);
QXLDataChunk *chunk;
- String *str;
+ SpiceString *str;
uint8_t *dest;
uint32_t data_size;
int memslot_id = get_memslot_id(worker, *in_str);
@@ -3759,13 +3759,13 @@ static void localize_str(RedWorker *worker, PHYSICAL *in_str, uint32_t group_id)
ASSERT(in_str);
str = malloc(sizeof(UINT32) + qxl_str->data_size);
ASSERT(str);
- *in_str = (PHYSICAL)str;
+ *in_str = (QXLPHYSICAL)str;
str->length = qxl_str->length;
str->flags = qxl_str->flags;
dest = str->data;
chunk = &qxl_str->chunk;
for (;;) {
- PHYSICAL next_chunk;
+ QXLPHYSICAL next_chunk;
data_size = chunk->data_size;
validate_virt(worker, (unsigned long)chunk->data, memslot_id, data_size, group_id);
@@ -3780,19 +3780,19 @@ static void localize_str(RedWorker *worker, PHYSICAL *in_str, uint32_t group_id)
}
}
-static void unlocalize_str(PHYSICAL *str)
+static void unlocalize_str(QXLPHYSICAL *str)
{
ASSERT(str && *str);
free((void *)*str);
*str = 0;
}
-static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
+static void localize_clip(RedWorker *worker, SpiceClip *clip, uint32_t group_id)
{
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
return;
- case CLIP_TYPE_RECTS: {
+ case SPICE_CLIP_TYPE_RECTS: {
QXLClipRects *clip_rects;
QXLDataChunk *chunk;
int memslot_id = get_memslot_id(worker, clip->data);
@@ -3801,9 +3801,9 @@ static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
clip_rects = (QXLClipRects *)get_virt(worker, clip->data, sizeof(QXLClipRects), group_id);
chunk = &clip_rects->chunk;
ASSERT(clip->data);
- data = malloc(sizeof(UINT32) + clip_rects->num_rects * sizeof(Rect));
+ data = malloc(sizeof(UINT32) + clip_rects->num_rects * sizeof(SpiceRect));
ASSERT(data);
- clip->data = (PHYSICAL)data;
+ clip->data = (QXLPHYSICAL)data;
*(UINT32 *)(data) = clip_rects->num_rects;
data += sizeof(UINT32);
do {
@@ -3817,7 +3817,7 @@ static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
} while (chunk);
break;
}
- case CLIP_TYPE_PATH:
+ case SPICE_CLIP_TYPE_PATH:
localize_path(worker, &clip->data, group_id);
break;
default:
@@ -3825,16 +3825,16 @@ static void localize_clip(RedWorker *worker, Clip *clip, uint32_t group_id)
}
}
-static void unlocalize_clip(Clip *clip)
+static void unlocalize_clip(SpiceClip *clip)
{
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
return;
- case CLIP_TYPE_RECTS:
+ case SPICE_CLIP_TYPE_RECTS:
free((void *)clip->data);
clip->data = 0;
break;
- case CLIP_TYPE_PATH:
+ case SPICE_CLIP_TYPE_PATH:
unlocalize_path(&clip->data);
break;
default:
@@ -3978,7 +3978,7 @@ static void image_cache_eaging(ImageCache *cache)
#endif
}
-static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t group_id)
+static void localize_bitmap(RedWorker *worker, QXLPHYSICAL *in_bitmap, uint32_t group_id)
{
QXLImage *image;
QXLImage *local_image;
@@ -3987,39 +3987,39 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
image = (QXLImage *)get_virt(worker, *in_bitmap, sizeof(QXLImage), group_id);
local_image = (QXLImage *)alloc_local_image(worker);
*local_image = *image;
- *in_bitmap = (PHYSICAL)local_image;
+ *in_bitmap = (QXLPHYSICAL)local_image;
local_image->descriptor.flags = 0;
if (image_cache_hit(&worker->image_cache, local_image->descriptor.id)) {
- local_image->descriptor.type = IMAGE_TYPE_FROM_CACHE;
+ local_image->descriptor.type = SPICE_IMAGE_TYPE_FROM_CACHE;
return;
}
switch (local_image->descriptor.type) {
- case IMAGE_TYPE_QUIC: {
+ case SPICE_IMAGE_TYPE_QUIC: {
QXLDataChunk **chanks_head;
#ifdef IMAGE_CACHE_AGE
- local_image->descriptor.flags |= IMAGE_CACHE_ME;
+ local_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
#else
if (local_image->descriptor.width * local_image->descriptor.height >= 640 * 480) {
- local_image->descriptor.flags |= IMAGE_CACHE_ME;
+ local_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
}
#endif
chanks_head = (QXLDataChunk **)local_image->quic.data;
*chanks_head = (QXLDataChunk *)image->quic.data;
break;
}
- case IMAGE_TYPE_BITMAP:
+ case SPICE_IMAGE_TYPE_BITMAP:
if (image->bitmap.flags & QXL_BITMAP_DIRECT) {
- local_image->bitmap.data = (PHYSICAL)get_virt(worker, image->bitmap.data,
+ local_image->bitmap.data = (QXLPHYSICAL)get_virt(worker, image->bitmap.data,
image->bitmap.stride * image->bitmap.y,
group_id);
} else {
- PHYSICAL src_data;
+ QXLPHYSICAL src_data;
int size = image->bitmap.y * image->bitmap.stride;
uint8_t *data = malloc(size);
ASSERT(data);
- local_image->bitmap.data = (PHYSICAL)data;
+ local_image->bitmap.data = (QXLPHYSICAL)data;
src_data = image->bitmap.data;
while (size) {
@@ -4043,12 +4043,12 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
if (local_image->bitmap.palette) {
uint16_t num_ents;
uint32_t *ents;
- Palette *tmp_palette;
- Palette *shadow_palette;
+ SpicePalette *tmp_palette;
+ SpicePalette *shadow_palette;
int slot_id = get_memslot_id(worker, local_image->bitmap.palette);
- tmp_palette = (Palette *)get_virt(worker, local_image->bitmap.palette,
- sizeof(Palette), group_id);
+ tmp_palette = (SpicePalette *)get_virt(worker, local_image->bitmap.palette,
+ sizeof(SpicePalette), group_id);
num_ents = tmp_palette->num_ents;
ents = tmp_palette->ents;
@@ -4056,17 +4056,17 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
validate_virt(worker, (unsigned long)ents, slot_id, (num_ents * sizeof(uint32_t)),
group_id);
- shadow_palette = (Palette *)malloc(sizeof(Palette) + num_ents * sizeof(uint32_t) +
- sizeof(PHYSICAL));
+ shadow_palette = (SpicePalette *)malloc(sizeof(SpicePalette) + num_ents * sizeof(uint32_t) +
+ sizeof(QXLPHYSICAL));
if (!shadow_palette) {
- PANIC("Palette malloc failed");
+ PANIC("SpicePalette malloc failed");
}
memcpy(shadow_palette->ents, ents, num_ents * sizeof(uint32_t));
shadow_palette->num_ents = num_ents;
shadow_palette->unique = tmp_palette->unique;
- local_image->bitmap.palette = (ADDRESS)shadow_palette;
+ local_image->bitmap.palette = (SPICE_ADDRESS)shadow_palette;
}
break;
default:
@@ -4074,7 +4074,7 @@ static void localize_bitmap(RedWorker *worker, PHYSICAL *in_bitmap, uint32_t gro
}
}
-static void unlocalize_bitmap(PHYSICAL *bitmap)
+static void unlocalize_bitmap(QXLPHYSICAL *bitmap)
{
QXLImage *image;
@@ -4083,7 +4083,7 @@ static void unlocalize_bitmap(PHYSICAL *bitmap)
*bitmap = 0;
switch (image->descriptor.type) {
- case IMAGE_TYPE_BITMAP:
+ case SPICE_IMAGE_TYPE_BITMAP:
if (!(image->bitmap.flags & QXL_BITMAP_DIRECT)) {
free((void *)image->bitmap.data);
}
@@ -4091,8 +4091,8 @@ static void unlocalize_bitmap(PHYSICAL *bitmap)
free((void *)image->bitmap.palette);
}
break;
- case IMAGE_TYPE_QUIC:
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_QUIC:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
*bitmap = 0;
break;
default:
@@ -4100,35 +4100,35 @@ static void unlocalize_bitmap(PHYSICAL *bitmap)
}
}
-static void localize_brush(RedWorker *worker, Brush *brush, uint32_t group_id)
+static void localize_brush(RedWorker *worker, SpiceBrush *brush, uint32_t group_id)
{
- if (brush->type == BRUSH_TYPE_PATTERN) {
+ if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
localize_bitmap(worker, &brush->u.pattern.pat, group_id);
}
}
-static void unlocalize_brush(Brush *brush)
+static void unlocalize_brush(SpiceBrush *brush)
{
- if (brush->type == BRUSH_TYPE_PATTERN) {
+ if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
unlocalize_bitmap(&brush->u.pattern.pat);
}
}
-static void localize_mask(RedWorker *worker, QMask *mask, uint32_t group_id)
+static void localize_mask(RedWorker *worker, SpiceQMask *mask, uint32_t group_id)
{
if (mask->bitmap) {
localize_bitmap(worker, &mask->bitmap, group_id);
}
}
-static void unlocalize_mask(QMask *mask)
+static void unlocalize_mask(SpiceQMask *mask)
{
if (mask->bitmap) {
unlocalize_bitmap(&mask->bitmap);
}
}
-static void localize_attr(RedWorker *worker, LineAttr *attr, uint32_t group_id)
+static void localize_attr(RedWorker *worker, SpiceLineAttr *attr, uint32_t group_id)
{
if (attr->style_nseg) {
uint8_t *buf;
@@ -4140,11 +4140,11 @@ static void localize_attr(RedWorker *worker, LineAttr *attr, uint32_t group_id)
data = malloc(attr->style_nseg * sizeof(uint32_t));
ASSERT(data);
memcpy(data, buf, attr->style_nseg * sizeof(uint32_t));
- attr->style = (PHYSICAL)data;
+ attr->style = (QXLPHYSICAL)data;
}
}
-static void unlocalize_attr(LineAttr *attr)
+static void unlocalize_attr(SpiceLineAttr *attr)
{
if (attr->style_nseg) {
free((void *)attr->style);
@@ -4154,7 +4154,7 @@ static void unlocalize_attr(LineAttr *attr)
static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
{
- Clip clip = drawable->qxl_drawable->clip;
+ SpiceClip clip = drawable->qxl_drawable->clip;
worker->local_images_pos = 0;
image_cache_eaging(&worker->image_cache);
@@ -4164,7 +4164,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
localize_clip(worker, &clip, drawable->group_id);
switch (drawable->qxl_drawable->type) {
case QXL_DRAW_FILL: {
- Fill fill = drawable->qxl_drawable->u.fill;
+ SpiceFill fill = drawable->qxl_drawable->u.fill;
localize_brush(worker, &fill.brush, drawable->group_id);
localize_mask(worker, &fill.mask, drawable->group_id);
worker->draw_funcs.draw_fill(worker->surface.context.canvas, &drawable->qxl_drawable->bbox,
@@ -4173,7 +4173,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_OPAQUE: {
- Opaque opaque = drawable->qxl_drawable->u.opaque;
+ SpiceOpaque opaque = drawable->qxl_drawable->u.opaque;
localize_brush(worker, &opaque.brush, drawable->group_id);
localize_bitmap(worker, &opaque.src_bitmap, drawable->group_id);
localize_mask(worker, &opaque.mask, drawable->group_id);
@@ -4185,7 +4185,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_COPY: {
- Copy copy = drawable->qxl_drawable->u.copy;
+ SpiceCopy copy = drawable->qxl_drawable->u.copy;
localize_bitmap(worker, &copy.src_bitmap, drawable->group_id);
localize_mask(worker, &copy.mask, drawable->group_id);
worker->draw_funcs.draw_copy(worker->surface.context.canvas, &drawable->qxl_drawable->bbox,
@@ -4195,7 +4195,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_TRANSPARENT: {
- Transparent transparent = drawable->qxl_drawable->u.transparent;
+ SpiceTransparent transparent = drawable->qxl_drawable->u.transparent;
localize_bitmap(worker, &transparent.src_bitmap, drawable->group_id);
worker->draw_funcs.draw_transparent(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &transparent);
@@ -4203,7 +4203,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_ALPHA_BLEND: {
- AlphaBlnd alpha_blend = drawable->qxl_drawable->u.alpha_blend;
+ SpiceAlphaBlnd alpha_blend = drawable->qxl_drawable->u.alpha_blend;
localize_bitmap(worker, &alpha_blend.src_bitmap, drawable->group_id);
worker->draw_funcs.draw_alpha_blend(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &alpha_blend);
@@ -4216,7 +4216,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_BLEND: {
- Blend blend = drawable->qxl_drawable->u.blend;
+ SpiceBlend blend = drawable->qxl_drawable->u.blend;
localize_bitmap(worker, &blend.src_bitmap, drawable->group_id);
localize_mask(worker, &blend.mask, drawable->group_id);
worker->draw_funcs.draw_blend(worker->surface.context.canvas, &drawable->qxl_drawable->bbox,
@@ -4226,7 +4226,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_BLACKNESS: {
- Blackness blackness = drawable->qxl_drawable->u.blackness;
+ SpiceBlackness blackness = drawable->qxl_drawable->u.blackness;
localize_mask(worker, &blackness.mask, drawable->group_id);
worker->draw_funcs.draw_blackness(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &blackness);
@@ -4234,7 +4234,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_WHITENESS: {
- Whiteness whiteness = drawable->qxl_drawable->u.whiteness;
+ SpiceWhiteness whiteness = drawable->qxl_drawable->u.whiteness;
localize_mask(worker, &whiteness.mask, drawable->group_id);
worker->draw_funcs.draw_whiteness(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &whiteness);
@@ -4242,7 +4242,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_INVERS: {
- Invers invers = drawable->qxl_drawable->u.invers;
+ SpiceInvers invers = drawable->qxl_drawable->u.invers;
localize_mask(worker, &invers.mask, drawable->group_id);
worker->draw_funcs.draw_invers(worker->surface.context.canvas,
&drawable->qxl_drawable->bbox, &clip, &invers);
@@ -4250,7 +4250,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_ROP3: {
- Rop3 rop3 = drawable->qxl_drawable->u.rop3;
+ SpiceRop3 rop3 = drawable->qxl_drawable->u.rop3;
localize_brush(worker, &rop3.brush, drawable->group_id);
localize_bitmap(worker, &rop3.src_bitmap, drawable->group_id);
localize_mask(worker, &rop3.mask, drawable->group_id);
@@ -4261,7 +4261,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_STROKE: {
- Stroke stroke = drawable->qxl_drawable->u.stroke;
+ SpiceStroke stroke = drawable->qxl_drawable->u.stroke;
localize_brush(worker, &stroke.brush, drawable->group_id);
localize_path(worker, &stroke.path, drawable->group_id);
localize_attr(worker, &stroke.attr, drawable->group_id);
@@ -4273,7 +4273,7 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
break;
}
case QXL_DRAW_TEXT: {
- Text text = drawable->qxl_drawable->u.text;
+ SpiceText text = drawable->qxl_drawable->u.text;
localize_brush(worker, &text.fore_brush, drawable->group_id);
localize_brush(worker, &text.back_brush, drawable->group_id);
localize_str(worker, &text.str, drawable->group_id);
@@ -4355,7 +4355,7 @@ static inline void __red_collect_for_update(RedWorker *worker, Ring *ring, RingI
}
}
-static void red_update_area(RedWorker *worker, const Rect *area)
+static void red_update_area(RedWorker *worker, const SpiceRect *area)
{
Ring *ring = &worker->current;
RingItem *ring_item;
@@ -4390,7 +4390,7 @@ static void red_update_area(RedWorker *worker, const Rect *area)
#else
-static void red_update_area(RedWorker *worker, const Rect *area)
+static void red_update_area(RedWorker *worker, const SpiceRect *area)
{
Ring *ring = &worker->current_list;
RingItem *ring_item = ring;
@@ -4533,7 +4533,7 @@ void qxl_process_cursor(RedWorker *worker, QXLCursorCmd *cursor_cmd, uint32_t gr
red_error("invalid cursor command %u", cursor_cmd->type);
}
- if (worker->cursor_channel && (worker->mouse_mode == RED_MOUSE_MODE_SERVER ||
+ if (worker->cursor_channel && (worker->mouse_mode == SPICE_MOUSE_MODE_SERVER ||
cursor_cmd->type != QXL_CURSOR_MOVE || cursor_show)) {
red_pipe_add(&worker->cursor_channel->base, &item->pipe_data);
} else {
@@ -4684,7 +4684,7 @@ static void red_add_screen_image(RedWorker *worker)
{
ImageItem *item;
int stride;
- Rect area;
+ SpiceRect area;
if (!worker->display_channel || !worker->surface.context.canvas) {
return;
@@ -4734,7 +4734,7 @@ static void add_buf(RedChannel *channel, uint32_t type, void *data, uint32_t siz
channel->send_data.header.size += size;
}
-static void fill_path(DisplayChannel *display_channel, PHYSICAL *in_path, uint32_t group_id)
+static void fill_path(DisplayChannel *display_channel, QXLPHYSICAL *in_path, uint32_t group_id)
{
RedWorker *worker;
RedChannel *channel = &display_channel->base;
@@ -4748,7 +4748,7 @@ static void fill_path(DisplayChannel *display_channel, PHYSICAL *in_path, uint32
add_buf(channel, BUF_TYPE_CHUNK, &path->chunk, path->data_size, memslot_id, group_id);
}
-static void fill_str(DisplayChannel *display_channel, PHYSICAL *in_str, uint32_t group_id)
+static void fill_str(DisplayChannel *display_channel, QXLPHYSICAL *in_str, uint32_t group_id)
{
RedWorker *worker;
RedChannel *channel = &display_channel->base;
@@ -4762,7 +4762,7 @@ static void fill_str(DisplayChannel *display_channel, PHYSICAL *in_str, uint32_t
add_buf(channel, BUF_TYPE_CHUNK, &str->chunk, str->data_size, memslot_id, group_id);
}
-static inline void fill_rects_clip(RedChannel *channel, PHYSICAL *in_clip, uint32_t group_id)
+static inline void fill_rects_clip(RedChannel *channel, QXLPHYSICAL *in_clip, uint32_t group_id)
{
RedWorker *worker = channel->worker;
QXLClipRects *clip;
@@ -4772,11 +4772,11 @@ static inline void fill_rects_clip(RedChannel *channel, PHYSICAL *in_clip, uint3
clip = (QXLClipRects *)get_virt(worker, *in_clip, sizeof(QXLClipRects), group_id);
*in_clip = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, &clip->num_rects, sizeof(UINT32), 0, 0);
- add_buf(channel, BUF_TYPE_CHUNK, &clip->chunk, clip->num_rects * sizeof(Rect), memslot_id,
+ add_buf(channel, BUF_TYPE_CHUNK, &clip->chunk, clip->num_rects * sizeof(SpiceRect), memslot_id,
group_id);
}
-static void fill_base(DisplayChannel *display_channel, RedDrawBase *base, Drawable *drawable,
+static void fill_base(DisplayChannel *display_channel, SpiceMsgDisplayBase *base, Drawable *drawable,
uint32_t size)
{
RedChannel *channel = &display_channel->base;
@@ -4784,9 +4784,9 @@ static void fill_base(DisplayChannel *display_channel, RedDrawBase *base, Drawab
base->box = drawable->qxl_drawable->bbox;
base->clip = drawable->qxl_drawable->clip;
- if (base->clip.type == CLIP_TYPE_RECTS) {
+ if (base->clip.type == SPICE_CLIP_TYPE_RECTS) {
fill_rects_clip(channel, &base->clip.data, drawable->group_id);
- } else if (base->clip.type == CLIP_TYPE_PATH) {
+ } else if (base->clip.type == SPICE_CLIP_TYPE_PATH) {
fill_path(display_channel, &base->clip.data, drawable->group_id);
}
}
@@ -4798,30 +4798,30 @@ static inline RedImage *alloc_image(DisplayChannel *display_channel)
}
/* io_palette is relative address of the palette*/
-static inline void fill_palette(DisplayChannel *display_channel, ADDRESS *io_palette, UINT8 *flags,
+static inline void fill_palette(DisplayChannel *display_channel, SPICE_ADDRESS *io_palette, UINT8 *flags,
uint32_t group_id)
{
RedChannel *channel = &display_channel->base;
RedWorker *worker = channel->worker;
- Palette *palette;
+ SpicePalette *palette;
if (!(*io_palette)) {
return;
}
- palette = (Palette *)get_virt(worker, *io_palette, sizeof(Palette), group_id);
+ palette = (SpicePalette *)get_virt(worker, *io_palette, sizeof(SpicePalette), group_id);
if (palette->unique) {
if (red_palette_cache_find(display_channel, palette->unique)) {
- *flags |= BITMAP_PAL_FROM_CACHE;
+ *flags |= SPICE_BITMAP_FLAGS_PAL_FROM_CACHE;
*io_palette = palette->unique;
return;
}
if (red_palette_cache_add(display_channel, palette->unique, 1)) {
- *flags |= BITMAP_PAL_CACHE_ME;
+ *flags |= SPICE_BITMAP_FLAGS_PAL_CACHE_ME;
}
}
*io_palette = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, palette,
- sizeof(Palette) + palette->num_ents * sizeof(UINT32), 0, 0);
+ sizeof(SpicePalette) + palette->num_ents * sizeof(UINT32), 0, 0);
}
static inline RedCompressBuf *red_display_alloc_compress_buf(DisplayChannel *display_channel)
@@ -5425,7 +5425,7 @@ typedef uint16_t rgb16_pixel_t;
#define GRADUAL_SCORE_RGB16_TH 0
// assumes that stride doesn't overflow
-static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
+static int _bitmap_is_gradual(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id)
{
double score = 0.0;
int num_samples = 0;
@@ -5437,20 +5437,20 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
x = bitmap->x;
y = bitmap->y;
switch (bitmap->format) {
- case BITMAP_FMT_16BIT: {
+ case SPICE_BITMAP_FMT_16BIT: {
uint8_t *lines = (uint8_t*)get_virt(worker, bitmap->data, x * y *
sizeof(rgb16_pixel_t), group_id);
compute_lines_gradual_score_rgb16((rgb16_pixel_t*)lines, x, y, &score, &num_samples);
break;
}
- case BITMAP_FMT_24BIT: {
+ case SPICE_BITMAP_FMT_24BIT: {
uint8_t *lines = (uint8_t*)get_virt(worker, bitmap->data, x * y *
sizeof(rgb24_pixel_t), group_id);
compute_lines_gradual_score_rgb24((rgb24_pixel_t*)lines, x, y, &score, &num_samples);
break;
}
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA: {
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA: {
uint8_t *lines = (uint8_t*)get_virt(worker, bitmap->data, x * y *
sizeof(rgb32_pixel_t), group_id);
compute_lines_gradual_score_rgb32((rgb32_pixel_t*)lines, x, y, &score, &num_samples);
@@ -5465,7 +5465,7 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
double chunk_score = 0.0;
int chunk_num_samples = 0;
uint32_t x;
- ADDRESS relative_address = bitmap->data;
+ SPICE_ADDRESS relative_address = bitmap->data;
while (relative_address) {
chunk = (QXLDataChunk *)get_virt(worker, relative_address, sizeof(QXLDataChunk),
@@ -5473,22 +5473,22 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
num_lines = chunk->data_size / bitmap->stride;
x = bitmap->x;
switch (bitmap->format) {
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
validate_virt(worker, (unsigned long)chunk->data,
get_memslot_id(worker, relative_address),
sizeof(rgb16_pixel_t) * x * num_lines, group_id);
compute_lines_gradual_score_rgb16((rgb16_pixel_t*)chunk->data, x, num_lines,
&chunk_score, &chunk_num_samples);
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
validate_virt(worker, (unsigned long)chunk->data,
get_memslot_id(worker, relative_address),
sizeof(rgb24_pixel_t) * x * num_lines, group_id);
compute_lines_gradual_score_rgb24((rgb24_pixel_t*)chunk->data, x, num_lines,
&chunk_score, &chunk_num_samples);
break;
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA:
validate_virt(worker, (unsigned long)chunk->data,
get_memslot_id(worker, relative_address),
sizeof(rgb32_pixel_t) * x * num_lines, group_id);
@@ -5509,29 +5509,29 @@ static int _bitmap_is_gradual(RedWorker *worker, Bitmap *bitmap, uint32_t group_
ASSERT(num_samples);
score /= num_samples;
- if (bitmap->format == BITMAP_FMT_16BIT) {
+ if (bitmap->format == SPICE_BITMAP_FMT_16BIT) {
return (score < GRADUAL_SCORE_RGB16_TH);
} else {
return (score < GRADUAL_SCORE_RGB24_TH);
}
}
-static inline int _stride_is_extra(Bitmap *bitmap)
+static inline int _stride_is_extra(SpiceBitmap *bitmap)
{
ASSERT(bitmap);
if (BITMAP_FMT_IS_RGB[bitmap->format]) {
return ((bitmap->x * BITMAP_FMP_BYTES_PER_PIXEL[bitmap->format]) < bitmap->stride);
} else {
switch (bitmap->format) {
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
return (bitmap->x < bitmap->stride);
- case BITMAP_FMT_4BIT_BE:
- case BITMAP_FMT_4BIT_LE: {
+ case SPICE_BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_LE: {
int bytes_width = ALIGN(bitmap->x, 2) >> 1;
return bytes_width < bitmap->stride;
}
- case BITMAP_FMT_1BIT_BE:
- case BITMAP_FMT_1BIT_LE: {
+ case SPICE_BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_LE: {
int bytes_width = ALIGN(bitmap->x, 8) >> 3;
return bytes_width < bitmap->stride;
}
@@ -5558,13 +5558,13 @@ typedef struct compress_send_data_t {
uint32_t raw_size;
void* comp_buf;
uint32_t comp_buf_size;
- ADDRESS *plt_ptr;
+ SPICE_ADDRESS *plt_ptr;
UINT8 *flags_ptr;
} compress_send_data_t;
static inline int red_glz_compress_image(DisplayChannel *display_channel,
- RedImage *dest, Bitmap *src, Drawable *drawable,
+ RedImage *dest, SpiceBitmap *src, Drawable *drawable,
compress_send_data_t* o_comp_data)
{
RedWorker *worker = (RedWorker *)display_channel->base.worker;
@@ -5617,10 +5617,10 @@ static inline int red_glz_compress_image(DisplayChannel *display_channel,
glz_drawable_instance,
&glz_drawable_instance->glz_instance);
- dest->descriptor.type = IMAGE_TYPE_GLZ_RGB;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_GLZ_RGB;
dest->lz_rgb.data_size = size;
- o_comp_data->raw_size = sizeof(LZ_RGBImage);
+ o_comp_data->raw_size = sizeof(SpiceLZRGBImage);
o_comp_data->comp_buf = glz_data->data.bufs_head;
o_comp_data->comp_buf_size = size;
o_comp_data->plt_ptr = NULL;
@@ -5632,7 +5632,7 @@ static inline int red_glz_compress_image(DisplayChannel *display_channel,
}
static inline int red_lz_compress_image(DisplayChannel *display_channel,
- RedImage *dest, Bitmap *src,
+ RedImage *dest, SpiceBitmap *src,
compress_send_data_t* o_comp_data, uint32_t group_id)
{
RedWorker *worker = display_channel->base.worker;
@@ -5692,21 +5692,21 @@ static inline int red_lz_compress_image(DisplayChannel *display_channel,
}
if (BITMAP_FMT_IS_RGB[src->format]) {
- dest->descriptor.type = IMAGE_TYPE_LZ_RGB;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_LZ_RGB;
dest->lz_rgb.data_size = size;
- o_comp_data->raw_size = sizeof(LZ_RGBImage);
+ o_comp_data->raw_size = sizeof(SpiceLZRGBImage);
o_comp_data->comp_buf = lz_data->data.bufs_head;
o_comp_data->comp_buf_size = size;
o_comp_data->plt_ptr = NULL;
o_comp_data->flags_ptr = NULL;
} else {
- dest->descriptor.type = IMAGE_TYPE_LZ_PLT;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_LZ_PLT;
dest->lz_plt.data_size = size;
- dest->lz_plt.flags = src->flags & BITMAP_TOP_DOWN;
+ dest->lz_plt.flags = src->flags & SPICE_BITMAP_FLAGS_TOP_DOWN;
dest->lz_plt.palette = src->palette;
- o_comp_data->raw_size = sizeof(LZ_PLTImage);
+ o_comp_data->raw_size = sizeof(SpiceLZPLTImage);
o_comp_data->comp_buf = lz_data->data.bufs_head;
o_comp_data->comp_buf_size = size;
o_comp_data->plt_ptr = &(dest->lz_plt.palette);
@@ -5718,7 +5718,7 @@ static inline int red_lz_compress_image(DisplayChannel *display_channel,
}
static inline int red_quic_compress_image(DisplayChannel *display_channel, RedImage *dest,
- Bitmap *src, compress_send_data_t* o_comp_data,
+ SpiceBitmap *src, compress_send_data_t* o_comp_data,
uint32_t group_id)
{
RedWorker *worker = display_channel->base.worker;
@@ -5732,16 +5732,16 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
#endif
switch (src->format) {
- case BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_32BIT:
type = QUIC_IMAGE_TYPE_RGB32;
break;
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_RGBA:
type = QUIC_IMAGE_TYPE_RGBA;
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
type = QUIC_IMAGE_TYPE_RGB16;
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
type = QUIC_IMAGE_TYPE_RGB24;
break;
default:
@@ -5824,7 +5824,7 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
quic_data->usr.more_lines = quic_usr_more_lines;
stride = src->stride;
} else {
- ADDRESS prev_addr = src->data;
+ SPICE_ADDRESS prev_addr = src->data;
QXLDataChunk *chunk = (QXLDataChunk *)get_virt(worker, src->data,
sizeof(QXLDataChunk), group_id);
while (chunk->next_chunk) {
@@ -5833,7 +5833,7 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
group_id);
ASSERT(chunk->prev_chunk);
}
- quic_data->data.u.lines_data.next = (ADDRESS)prev_addr -
+ quic_data->data.u.lines_data.next = (SPICE_ADDRESS)prev_addr -
get_virt_delta(worker,
get_memslot_id(worker, src->data),
group_id);
@@ -5850,10 +5850,10 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
longjmp(quic_data->data.jmp_env, 1);
}
- dest->descriptor.type = IMAGE_TYPE_QUIC;
+ dest->descriptor.type = SPICE_IMAGE_TYPE_QUIC;
dest->quic.data_size = size << 2;
- o_comp_data->raw_size = sizeof(QUICImage);
+ o_comp_data->raw_size = sizeof(SpiceQUICImage);
o_comp_data->comp_buf = quic_data->data.bufs_head;
o_comp_data->comp_buf_size = size << 2;
o_comp_data->plt_ptr = NULL;
@@ -5867,7 +5867,7 @@ static inline int red_quic_compress_image(DisplayChannel *display_channel, RedIm
#define MIN_SIZE_TO_COMPRESS 54
#define MIN_DIMENSION_TO_QUIC 3
static inline int red_compress_image(DisplayChannel *display_channel,
- RedImage *dest, Bitmap *src, Drawable *drawable,
+ RedImage *dest, SpiceBitmap *src, Drawable *drawable,
compress_send_data_t* o_comp_data)
{
image_compression_t image_compression = display_channel->base.worker->image_compression;
@@ -5971,19 +5971,19 @@ static inline void red_display_add_image_to_pixmap_cache(DisplayChannel *display
if (pixmap_cache_add(display_channel->pixmap_cache, qxl_image->descriptor.id,
qxl_image->descriptor.width * qxl_image->descriptor.height,
display_channel)) {
- io_image->descriptor.flags |= IMAGE_CACHE_ME;
+ io_image->descriptor.flags |= SPICE_IMAGE_FLAGS_CACHE_ME;
stat_inc_counter(display_channel->add_to_cache_counter, 1);
}
}
- if (!(io_image->descriptor.flags & IMAGE_CACHE_ME)) {
+ if (!(io_image->descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME)) {
stat_inc_counter(display_channel->non_cache_counter, 1);
}
}
/* if the number of times fill_bits can be called per one qxl_drawable increases -
MAX_LZ_DRAWABLE_INSTANCES must be increased as well */
-static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Drawable *drawable)
+static void fill_bits(DisplayChannel *display_channel, QXLPHYSICAL *in_bitmap, Drawable *drawable)
{
RedChannel *channel = &display_channel->base;
RedWorker *worker = channel->worker;
@@ -6009,15 +6009,15 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
if ((qxl_image->descriptor.flags & QXL_IMAGE_CACHE)) {
if (pixmap_cache_hit(display_channel->pixmap_cache, image->descriptor.id,
display_channel)) {
- image->descriptor.type = IMAGE_TYPE_FROM_CACHE;
- add_buf(channel, BUF_TYPE_RAW, image, sizeof(ImageDescriptor), 0, 0);
+ image->descriptor.type = SPICE_IMAGE_TYPE_FROM_CACHE;
+ add_buf(channel, BUF_TYPE_RAW, image, sizeof(SpiceImageDescriptor), 0, 0);
stat_inc_counter(display_channel->cache_hits_counter, 1);
return;
}
}
switch (qxl_image->descriptor.type) {
- case IMAGE_TYPE_BITMAP:
+ case SPICE_IMAGE_TYPE_BITMAP:
#ifdef DUMP_BITMAP
dump_bitmap(display_channel->base.worker, &qxl_image->bitmap, drawable->group_id);
#endif
@@ -6028,7 +6028,7 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
drawable, &comp_send_data)) {
uint32_t y;
uint32_t stride;
- ADDRESS image_data;
+ SPICE_ADDRESS image_data;
red_display_add_image_to_pixmap_cache(display_channel, qxl_image, image);
@@ -6036,9 +6036,9 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
y = image->bitmap.y;
stride = image->bitmap.stride;
image_data = image->bitmap.data;
- image->bitmap.flags = image->bitmap.flags & BITMAP_TOP_DOWN;
+ image->bitmap.flags = image->bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN;
- add_buf(channel, BUF_TYPE_RAW, image, sizeof(BitmapImage), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, image, sizeof(SpiceBitmapImage), 0, 0);
fill_palette(display_channel, &(image->bitmap.palette), &(image->bitmap.flags),
drawable->group_id);
image->bitmap.data = channel->send_data.header.size;
@@ -6064,10 +6064,10 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
}
}
break;
- case IMAGE_TYPE_QUIC:
+ case SPICE_IMAGE_TYPE_QUIC:
red_display_add_image_to_pixmap_cache(display_channel, qxl_image, image);
image->quic = qxl_image->quic;
- add_buf(channel, BUF_TYPE_RAW, image, sizeof(QUICImage), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, image, sizeof(SpiceQUICImage), 0, 0);
add_buf(channel, BUF_TYPE_CHUNK, qxl_image->quic.data, qxl_image->quic.data_size,
memslot_id, drawable->group_id);
break;
@@ -6076,14 +6076,14 @@ static void fill_bits(DisplayChannel *display_channel, PHYSICAL *in_bitmap, Draw
}
}
-static void fill_brush(DisplayChannel *display_channel, Brush *brush, Drawable *drawable)
+static void fill_brush(DisplayChannel *display_channel, SpiceBrush *brush, Drawable *drawable)
{
- if (brush->type == BRUSH_TYPE_PATTERN) {
+ if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
fill_bits(display_channel, &brush->u.pattern.pat, drawable);
}
}
-static void fill_mask(DisplayChannel *display_channel, QMask *mask, Drawable *drawable)
+static void fill_mask(DisplayChannel *display_channel, SpiceQMask *mask, Drawable *drawable)
{
if (mask->bitmap) {
if (display_channel->base.worker->image_compression != IMAGE_COMPRESS_OFF) {
@@ -6097,7 +6097,7 @@ static void fill_mask(DisplayChannel *display_channel, QMask *mask, Drawable *dr
}
}
-static void fill_attr(DisplayChannel *display_channel, LineAttr *attr, uint32_t group_id)
+static void fill_attr(DisplayChannel *display_channel, SpiceLineAttr *attr, uint32_t group_id)
{
if (attr->style_nseg) {
RedChannel *channel = &display_channel->base;
@@ -6109,12 +6109,12 @@ static void fill_attr(DisplayChannel *display_channel, LineAttr *attr, uint32_t
}
}
-static void fill_cursor(CursorChannel *cursor_channel, RedCursor *red_cursor, CursorItem *cursor)
+static void fill_cursor(CursorChannel *cursor_channel, SpiceCursor *red_cursor, CursorItem *cursor)
{
RedChannel *channel = &cursor_channel->base;
if (!cursor) {
- red_cursor->flags = RED_CURSOR_NONE;
+ red_cursor->flags = SPICE_CURSOR_FLAGS_NONE;
return;
}
@@ -6130,11 +6130,11 @@ static void fill_cursor(CursorChannel *cursor_channel, RedCursor *red_cursor, Cu
if (red_cursor->header.unique) {
if (red_cursor_cache_find(cursor_channel, red_cursor->header.unique)) {
- red_cursor->flags |= RED_CURSOR_FROM_CACHE;
+ red_cursor->flags |= SPICE_CURSOR_FLAGS_FROM_CACHE;
return;
}
if (red_cursor_cache_add(cursor_channel, red_cursor->header.unique, 1)) {
- red_cursor->flags |= RED_CURSOR_CACHE_ME;
+ red_cursor->flags |= SPICE_CURSOR_FLAGS_CACHE_ME;
}
}
@@ -6160,7 +6160,7 @@ static inline void red_channel_reset_send_data(RedChannel *channel)
channel->send_data.header.sub_list = 0;
++channel->send_data.header.serial;
channel->send_data.bufs[0].type = BUF_TYPE_RAW;
- channel->send_data.bufs[0].size = sizeof(RedDataHeader);
+ channel->send_data.bufs[0].size = sizeof(SpiceDataHeader);
channel->send_data.bufs[0].data = (void *)&channel->send_data.header;
}
@@ -6181,99 +6181,99 @@ static inline void red_send_qxl_drawable(RedWorker *worker, DisplayChannel *disp
RedChannel *channel = &display_channel->base;
switch (drawable->type) {
case QXL_DRAW_FILL:
- channel->send_data.header.type = RED_DISPLAY_DRAW_FILL;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_FILL;
fill_base(display_channel, &display_channel->send_data.u.fill.base, item,
- sizeof(RedFill));
+ sizeof(SpiceMsgDisplayDrawFill));
display_channel->send_data.u.fill.data = drawable->u.fill;
fill_brush(display_channel, &display_channel->send_data.u.fill.data.brush, item);
fill_mask(display_channel, &display_channel->send_data.u.fill.data.mask, item);
break;
case QXL_DRAW_OPAQUE:
- channel->send_data.header.type = RED_DISPLAY_DRAW_OPAQUE;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_OPAQUE;
fill_base(display_channel, &display_channel->send_data.u.opaque.base, item,
- sizeof(RedOpaque));
+ sizeof(SpiceMsgDisplayDrawOpaque));
display_channel->send_data.u.opaque.data = drawable->u.opaque;
fill_bits(display_channel, &display_channel->send_data.u.opaque.data.src_bitmap, item);
fill_brush(display_channel, &display_channel->send_data.u.opaque.data.brush, item);
fill_mask(display_channel, &display_channel->send_data.u.opaque.data.mask, item);
break;
case QXL_DRAW_COPY:
- channel->send_data.header.type = RED_DISPLAY_DRAW_COPY;
- fill_base(display_channel, &display_channel->send_data.u.copy.base, item, sizeof(RedCopy));
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_COPY;
+ fill_base(display_channel, &display_channel->send_data.u.copy.base, item, sizeof(SpiceMsgDisplayDrawCopy));
display_channel->send_data.u.copy.data = drawable->u.copy;
fill_bits(display_channel, &display_channel->send_data.u.copy.data.src_bitmap, item);
fill_mask(display_channel, &display_channel->send_data.u.copy.data.mask, item);
break;
case QXL_DRAW_TRANSPARENT:
- channel->send_data.header.type = RED_DISPLAY_DRAW_TRANSPARENT;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_TRANSPARENT;
fill_base(display_channel, &display_channel->send_data.u.transparent.base, item,
- sizeof(RedTransparent));
+ sizeof(SpiceMsgDisplayDrawTransparent));
display_channel->send_data.u.transparent.data = drawable->u.transparent;
fill_bits(display_channel, &display_channel->send_data.u.transparent.data.src_bitmap, item);
break;
case QXL_DRAW_ALPHA_BLEND:
- channel->send_data.header.type = RED_DISPLAY_DRAW_ALPHA_BLEND;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_ALPHA_BLEND;
fill_base(display_channel, &display_channel->send_data.u.alpha_blend.base, item,
- sizeof(RedAlphaBlend));
+ sizeof(SpiceMsgDisplayDrawAlphaBlend));
display_channel->send_data.u.alpha_blend.data = drawable->u.alpha_blend;
fill_bits(display_channel, &display_channel->send_data.u.alpha_blend.data.src_bitmap, item);
break;
case QXL_COPY_BITS:
- channel->send_data.header.type = RED_DISPLAY_COPY_BITS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_COPY_BITS;
fill_base(display_channel, &display_channel->send_data.u.copy_bits.base, item,
- sizeof(RedCopyBits));
+ sizeof(SpiceMsgDisplayCopyBits));
display_channel->send_data.u.copy_bits.src_pos = drawable->u.copy_bits.src_pos;
break;
case QXL_DRAW_BLEND:
- channel->send_data.header.type = RED_DISPLAY_DRAW_BLEND;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_BLEND;
fill_base(display_channel, &display_channel->send_data.u.blend.base, item,
- sizeof(RedBlend));
+ sizeof(SpiceMsgDisplayDrawBlend));
display_channel->send_data.u.blend.data = drawable->u.blend;
fill_bits(display_channel, &display_channel->send_data.u.blend.data.src_bitmap, item);
fill_mask(display_channel, &display_channel->send_data.u.blend.data.mask, item);
break;
case QXL_DRAW_BLACKNESS:
- channel->send_data.header.type = RED_DISPLAY_DRAW_BLACKNESS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_BLACKNESS;
fill_base(display_channel, &display_channel->send_data.u.blackness.base, item,
- sizeof(RedBlackness));
+ sizeof(SpiceMsgDisplayDrawBlackness));
display_channel->send_data.u.blackness.data = drawable->u.blackness;
fill_mask(display_channel, &display_channel->send_data.u.blackness.data.mask, item);
break;
case QXL_DRAW_WHITENESS:
- channel->send_data.header.type = RED_DISPLAY_DRAW_WHITENESS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_WHITENESS;
fill_base(display_channel, &display_channel->send_data.u.whiteness.base, item,
- sizeof(RedWhiteness));
+ sizeof(SpiceMsgDisplayDrawWhiteness));
display_channel->send_data.u.whiteness.data = drawable->u.whiteness;
fill_mask(display_channel, &display_channel->send_data.u.whiteness.data.mask, item);
break;
case QXL_DRAW_INVERS:
- channel->send_data.header.type = RED_DISPLAY_DRAW_INVERS;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_INVERS;
fill_base(display_channel, &display_channel->send_data.u.invers.base, item,
- sizeof(RedInvers));
+ sizeof(SpiceMsgDisplayDrawInvers));
display_channel->send_data.u.invers.data = drawable->u.invers;
fill_mask(display_channel, &display_channel->send_data.u.invers.data.mask, item);
break;
case QXL_DRAW_ROP3:
- channel->send_data.header.type = RED_DISPLAY_DRAW_ROP3;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_ROP3;
fill_base(display_channel, &display_channel->send_data.u.rop3.base, item,
- sizeof(RedRop3));
+ sizeof(SpiceMsgDisplayDrawRop3));
display_channel->send_data.u.rop3.data = drawable->u.rop3;
fill_bits(display_channel, &display_channel->send_data.u.rop3.data.src_bitmap, item);
fill_brush(display_channel, &display_channel->send_data.u.rop3.data.brush, item);
fill_mask(display_channel, &display_channel->send_data.u.rop3.data.mask, item);
break;
case QXL_DRAW_STROKE:
- channel->send_data.header.type = RED_DISPLAY_DRAW_STROKE;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_STROKE;
fill_base(display_channel, &display_channel->send_data.u.stroke.base, item,
- sizeof(RedStroke));
+ sizeof(SpiceMsgDisplayDrawStroke));
display_channel->send_data.u.stroke.data = drawable->u.stroke;
fill_path(display_channel, &display_channel->send_data.u.stroke.data.path, item->group_id);
fill_attr(display_channel, &display_channel->send_data.u.stroke.data.attr, item->group_id);
fill_brush(display_channel, &display_channel->send_data.u.stroke.data.brush, item);
break;
case QXL_DRAW_TEXT:
- channel->send_data.header.type = RED_DISPLAY_DRAW_TEXT;
- fill_base(display_channel, &display_channel->send_data.u.text.base, item, sizeof(RedText));
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_TEXT;
+ fill_base(display_channel, &display_channel->send_data.u.text.base, item, sizeof(SpiceMsgDisplayDrawText));
display_channel->send_data.u.text.data = drawable->u.text;
fill_brush(display_channel, &display_channel->send_data.u.text.data.fore_brush, item);
fill_brush(display_channel, &display_channel->send_data.u.text.data.back_brush, item);
@@ -6443,14 +6443,14 @@ static void display_channel_push_release(DisplayChannel *channel, uint8_t type,
}
if (free_list->res->count == free_list->res_size) {
- RedResorceList *new_list;
- new_list = malloc(sizeof(*new_list) + free_list->res_size * sizeof(RedResorceID) * 2);
+ SpiceResorceList *new_list;
+ new_list = malloc(sizeof(*new_list) + free_list->res_size * sizeof(SpiceResorceID) * 2);
if (!new_list) {
PANIC("malloc failed");
}
new_list->count = free_list->res->count;
memcpy(new_list->resorces, free_list->res->resorces,
- new_list->count * sizeof(RedResorceID));
+ new_list->count * sizeof(SpiceResorceID));
free(free_list->res);
free_list->res = new_list;
free_list->res_size *= 2;
@@ -6461,7 +6461,7 @@ static void display_channel_push_release(DisplayChannel *channel, uint8_t type,
static inline void red_begin_send_massage(RedChannel *channel, void *item)
{
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
channel->messages_window++;
red_send_data(channel, item);
}
@@ -6478,19 +6478,19 @@ static inline void display_begin_send_massage(DisplayChannel *channel, void *ite
channel->base.send_data.header.sub_list = channel->base.send_data.header.size;
for (i = 0; i < MAX_CACHE_CLIENTS; i++) {
if (i != channel->base.id && free_list->sync[i] != 0) {
- free_list->wait.header.wait_list[sync_count].channel_type = RED_CHANNEL_DISPLAY;
+ free_list->wait.header.wait_list[sync_count].channel_type = SPICE_CHANNEL_DISPLAY;
free_list->wait.header.wait_list[sync_count].channel_id = i;
free_list->wait.header.wait_list[sync_count++].message_serial = free_list->sync[i];
}
}
- RedSubMessageList *sub_list = &channel->send_data.sub_list.sub_list;
- RedSubMessage *sub_header = channel->send_data.sub_header;
+ SpiceSubMessageList *sub_list = &channel->send_data.sub_list.sub_list;
+ SpicedSubMessage *sub_header = channel->send_data.sub_header;
if (sync_count) {
sub_list->size = 2;
add_buf((RedChannel*)channel, BUF_TYPE_RAW, sub_list,
sizeof(*sub_list) + 2 * sizeof(sub_list->sub_messages[0]), 0, 0);
sub_list->sub_messages[0] = channel->base.send_data.header.size;
- sub_header[0].type = RED_WAIT_FOR_CHANNELS;
+ sub_header[0].type = SPICE_MSG_WAIT_FOR_CHANNELS;
sub_header[0].size = sizeof(free_list->wait.header) +
sync_count * sizeof(free_list->wait.buf[0]);
add_buf((RedChannel*)channel, BUF_TYPE_RAW, sub_header, sizeof(*sub_header), 0, 0);
@@ -6506,7 +6506,7 @@ static inline void display_begin_send_massage(DisplayChannel *channel, void *ite
sub_list->sub_messages[0] = channel->base.send_data.header.size;
sub_index = 0;
}
- sub_header[sub_index].type = RED_DISPLAY_INVAL_LIST;
+ sub_header[sub_index].type = SPICE_MSG_DISPLAY_INVAL_LIST;
sub_header[sub_index].size = sizeof(*free_list->res) + free_list->res->count *
sizeof(free_list->res->resorces[0]);
add_buf((RedChannel*)channel, BUF_TYPE_RAW, &sub_header[sub_index], sizeof(*sub_header), 0,
@@ -6600,7 +6600,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
qxl_image = (QXLImage *)get_virt(worker, drawable->qxl_drawable->u.copy.src_bitmap,
sizeof(QXLImage), drawable->group_id);
- if (qxl_image->descriptor.type != IMAGE_TYPE_BITMAP ||
+ if (qxl_image->descriptor.type != SPICE_IMAGE_TYPE_BITMAP ||
(qxl_image->bitmap.flags & QXL_BITMAP_DIRECT)) {
return FALSE;
}
@@ -6615,7 +6615,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
data = qxl_image->bitmap.data;
switch (qxl_image->bitmap.format) {
- case BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_32BIT:
if (!red_rgb_to_yuv420_32bpp(worker, &drawable->qxl_drawable->u.copy.src_area,
&qxl_image->bitmap, stream->av_frame,
get_virt_delta(worker, data, drawable->group_id),
@@ -6624,7 +6624,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
return FALSE;
}
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
if (!red_rgb_to_yuv420_16bpp(worker, &drawable->qxl_drawable->u.copy.src_area,
&qxl_image->bitmap, stream->av_frame,
get_virt_delta(worker, data, drawable->group_id),
@@ -6633,7 +6633,7 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
return FALSE;
}
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
if (!red_rgb_to_yuv420_24bpp(worker, &drawable->qxl_drawable->u.copy.src_area,
&qxl_image->bitmap, stream->av_frame,
get_virt_delta(worker, data, drawable->group_id),
@@ -6709,9 +6709,9 @@ static inline int red_send_stream_data(DisplayChannel *display_channel, Drawable
break;
}
#endif
- channel->send_data.header.type = RED_DISPLAY_STREAM_DATA;
- RedStreamData* stream_data = &display_channel->send_data.u.stream_data;
- add_buf(channel, BUF_TYPE_RAW, stream_data, sizeof(RedStreamData), 0, 0);
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_DATA;
+ SpiceMsgDisplayStreamData* stream_data = &display_channel->send_data.u.stream_data;
+ add_buf(channel, BUF_TYPE_RAW, stream_data, sizeof(SpiceMsgDisplayStreamData), 0, 0);
add_buf(channel, BUF_TYPE_RAW, display_channel->send_data.stream_outbuf,
n + FF_INPUT_BUFFER_PADDING_SIZE, 0, 0);
@@ -6750,12 +6750,12 @@ static void red_send_mode(DisplayChannel *display_channel)
}
channel = &display_channel->base;
- channel->send_data.header.type = RED_DISPLAY_MODE;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_MODE;
display_channel->send_data.u.mode.x_res = worker->surface.context.width;
display_channel->send_data.u.mode.y_res = worker->surface.context.height;
display_channel->send_data.u.mode.bits = worker->surface.context.depth;
- add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.mode, sizeof(RedMode), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.mode, sizeof(SpiceMsgDisplayMode), 0, 0);
display_begin_send_massage(display_channel, NULL);
}
@@ -6763,12 +6763,12 @@ static void red_send_mode(DisplayChannel *display_channel)
static void red_send_set_ack(RedChannel *channel)
{
ASSERT(channel);
- channel->send_data.header.type = RED_SET_ACK;
+ channel->send_data.header.type = SPICE_MSG_SET_ACK;
channel->send_data.u.ack.generation = ++channel->ack_generation;
channel->send_data.u.ack.window = channel->client_ack_window;
channel->messages_window = 0;
- add_buf(channel, BUF_TYPE_RAW, &channel->send_data.u.ack, sizeof(RedSetAck), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, &channel->send_data.u.ack, sizeof(SpiceMsgSetAck), 0, 0);
red_begin_send_massage(channel, NULL);
}
@@ -6787,14 +6787,14 @@ static inline void display_send_verb(DisplayChannel *channel, uint16_t verb)
}
static inline void __red_send_inval(RedChannel *channel, CacheItem *cach_item,
- RedInvalOne *inval_one)
+ SpiceMsgDisplayInvalOne *inval_one)
{
channel->send_data.header.type = cach_item->inval_type;
inval_one->id = *(uint64_t *)&cach_item->id;
add_buf(channel, BUF_TYPE_RAW, inval_one, sizeof(*inval_one), 0, 0);
}
-static void red_send_inval(RedChannel *channel, CacheItem *cach_item, RedInvalOne *inval_one)
+static void red_send_inval(RedChannel *channel, CacheItem *cach_item, SpiceMsgDisplayInvalOne *inval_one)
{
__red_send_inval(channel, cach_item, inval_one);
red_begin_send_massage(channel, NULL);
@@ -6809,9 +6809,9 @@ static void red_display_send_inval(DisplayChannel *display_channel, CacheItem *c
static void display_channel_send_migrate(DisplayChannel *display_channel)
{
- display_channel->base.send_data.header.type = RED_MIGRATE;
- display_channel->send_data.u.migrate.flags = RED_MIGRATE_NEED_FLUSH |
- RED_MIGRATE_NEED_DATA_TRANSFER;
+ display_channel->base.send_data.header.type = SPICE_MSG_MIGRATE;
+ display_channel->send_data.u.migrate.flags = SPICE_MIGRATE_NEED_FLUSH |
+ SPICE_MIGRATE_NEED_DATA_TRANSFER;
add_buf((RedChannel*)display_channel, BUF_TYPE_RAW, &display_channel->send_data.u.migrate,
sizeof(display_channel->send_data.u.migrate), 0, 0);
display_channel->expect_migrate_mark = TRUE;
@@ -6822,7 +6822,7 @@ static void display_channel_send_migrate_data(DisplayChannel *display_channel)
{
DisplayChannelMigrateData* display_data;
- display_channel->base.send_data.header.type = RED_MIGRATE_DATA;
+ display_channel->base.send_data.header.type = SPICE_MSG_MIGRATE_DATA;
ASSERT(display_channel->pixmap_cache);
display_data = &display_channel->send_data.u.migrate_data;
display_data->magic = DISPLAY_MIGRATE_DATA_MAGIC;
@@ -6851,11 +6851,11 @@ static void display_channel_send_migrate_data(DisplayChannel *display_channel)
static void display_channel_pixmap_sync(DisplayChannel *display_channel)
{
- RedWaitForChannels *wait;
+ SpiceMsgWaitForChannels *wait;
PixmapCache *pixmap_cache;
- display_channel->base.send_data.header.type = RED_WAIT_FOR_CHANNELS;
+ display_channel->base.send_data.header.type = SPICE_MSG_WAIT_FOR_CHANNELS;
wait = &display_channel->send_data.u.wait.header;
pixmap_cache = display_channel->pixmap_cache;
@@ -6863,7 +6863,7 @@ static void display_channel_pixmap_sync(DisplayChannel *display_channel)
pthread_mutex_lock(&pixmap_cache->lock);
wait->wait_count = 1;
- wait->wait_list[0].channel_type = RED_CHANNEL_DISPLAY;
+ wait->wait_list[0].channel_type = SPICE_CHANNEL_DISPLAY;
wait->wait_list[0].channel_id = pixmap_cache->generation_initiator.client;
wait->wait_list[0].message_serial = pixmap_cache->generation_initiator.message;
display_channel->pixmap_cache_generation = pixmap_cache->generation;
@@ -6878,9 +6878,9 @@ static void display_channel_pixmap_sync(DisplayChannel *display_channel)
static void display_channel_reset_cache(DisplayChannel *display_channel)
{
- RedWaitForChannels *wait = &display_channel->send_data.u.wait.header;
+ SpiceMsgWaitForChannels *wait = &display_channel->send_data.u.wait.header;
- display_channel->base.send_data.header.type = RED_DISPLAY_INVAL_ALL_PIXMAPS;
+ display_channel->base.send_data.header.type = SPICE_MSG_DISPLAY_INVAL_ALL_PIXMAPS;
pixmap_cache_reset(display_channel->pixmap_cache, display_channel, wait);
add_buf((RedChannel *)display_channel, BUF_TYPE_RAW, wait,
@@ -6893,7 +6893,7 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
RedChannel *channel;
RedImage *red_image;
RedWorker *worker;
- Bitmap bitmap;
+ SpiceBitmap bitmap;
ASSERT(display_channel && item);
channel = &display_channel->base;
@@ -6903,30 +6903,30 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
ASSERT(red_image);
QXL_SET_IMAGE_ID(red_image, QXL_IMAGE_GROUP_RED, ++worker->bits_unique);
- red_image->descriptor.type = IMAGE_TYPE_BITMAP;
+ red_image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
red_image->descriptor.flags = 0;
red_image->descriptor.width = item->width;
red_image->descriptor.height = item->height;
- bitmap.format = BITMAP_FMT_32BIT;
+ bitmap.format = SPICE_BITMAP_FMT_32BIT;
bitmap.flags = QXL_BITMAP_DIRECT;
bitmap.flags |= item->top_down ? QXL_BITMAP_TOP_DOWN : 0;
bitmap.x = item->width;
bitmap.y = item->height;
bitmap.stride = item->stride;
bitmap.palette = 0;
- bitmap.data = (ADDRESS)item->data;
+ bitmap.data = (SPICE_ADDRESS)item->data;
- channel->send_data.header.type = RED_DISPLAY_DRAW_COPY;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_COPY;
- add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.copy, sizeof(RedCopy), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.copy, sizeof(SpiceMsgDisplayDrawCopy), 0, 0);
display_channel->send_data.u.copy.base.box.left = item->pos.x;
display_channel->send_data.u.copy.base.box.top = item->pos.y;
display_channel->send_data.u.copy.base.box.right = item->pos.x + bitmap.x;
display_channel->send_data.u.copy.base.box.bottom = item->pos.y + bitmap.y;
- display_channel->send_data.u.copy.base.clip.type = CLIP_TYPE_NONE;
+ display_channel->send_data.u.copy.base.clip.type = SPICE_CLIP_TYPE_NONE;
display_channel->send_data.u.copy.base.clip.data = 0;
- display_channel->send_data.u.copy.data.rop_decriptor = ROPD_OP_PUT;
+ display_channel->send_data.u.copy.data.rop_decriptor = SPICE_ROPD_OP_PUT;
display_channel->send_data.u.copy.data.src_area.left = 0;
display_channel->send_data.u.copy.data.src_area.top = 0;
display_channel->send_data.u.copy.data.src_area.right = bitmap.x;
@@ -6943,10 +6943,10 @@ static void red_send_image(DisplayChannel *display_channel, ImageItem *item)
add_buf(channel, BUF_TYPE_COMPRESS_BUF, comp_send_data.comp_buf,
comp_send_data.comp_buf_size, 0, 0);
} else {
- red_image->descriptor.type = IMAGE_TYPE_BITMAP;
+ red_image->descriptor.type = SPICE_IMAGE_TYPE_BITMAP;
red_image->bitmap = bitmap;
red_image->bitmap.flags &= ~QXL_BITMAP_DIRECT;
- add_buf(channel, BUF_TYPE_RAW, red_image, sizeof(BitmapImage), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, red_image, sizeof(SpiceBitmapImage), 0, 0);
red_image->bitmap.data = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, item->data, bitmap.y * bitmap.stride, 0, 0);
}
@@ -6957,24 +6957,24 @@ static void red_display_send_upgrade(DisplayChannel *display_channel, UpgradeIte
{
RedChannel *channel;
QXLDrawable *qxl_drawable;
- RedCopy *copy = &display_channel->send_data.u.copy;
+ SpiceMsgDisplayDrawCopy *copy = &display_channel->send_data.u.copy;
ASSERT(display_channel && item && item->drawable);
channel = &display_channel->base;
- channel->send_data.header.type = RED_DISPLAY_DRAW_COPY;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_DRAW_COPY;
qxl_drawable = item->drawable->qxl_drawable;
ASSERT(qxl_drawable->type == QXL_DRAW_COPY);
- ASSERT(qxl_drawable->u.copy.rop_decriptor == ROPD_OP_PUT);
+ ASSERT(qxl_drawable->u.copy.rop_decriptor == SPICE_ROPD_OP_PUT);
ASSERT(qxl_drawable->u.copy.mask.bitmap == 0);
- add_buf(channel, BUF_TYPE_RAW, copy, sizeof(RedCopy), 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, copy, sizeof(SpiceMsgDisplayDrawCopy), 0, 0);
copy->base.box = qxl_drawable->bbox;
- copy->base.clip.type = CLIP_TYPE_RECTS;
+ copy->base.clip.type = SPICE_CLIP_TYPE_RECTS;
copy->base.clip.data = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, &item->region.num_rects, sizeof(uint32_t), 0, 0);
- add_buf(channel, BUF_TYPE_RAW, item->region.rects, sizeof(Rect) * item->region.num_rects, 0, 0);
+ add_buf(channel, BUF_TYPE_RAW, item->region.rects, sizeof(SpiceRect) * item->region.num_rects, 0, 0);
copy->data = qxl_drawable->u.copy;
fill_bits(display_channel, &copy->data.src_bitmap, item->drawable);
@@ -6988,11 +6988,11 @@ static void red_display_send_stream_start(DisplayChannel *display_channel, Strea
agent->lats_send_time = 0;
ASSERT(stream);
- channel->send_data.header.type = RED_DISPLAY_STREAM_CREATE;
- RedStreamCreate *stream_create = &display_channel->send_data.u.stream_create.message;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_CREATE;
+ SpiceMsgDisplayStreamCreate *stream_create = &display_channel->send_data.u.stream_create.message;
stream_create->id = agent - display_channel->stream_agents;
- stream_create->flags = stream->top_down ? STREAM_TOP_DOWN : 0;
- stream_create->codec_type = RED_VIDEO_CODEC_TYPE_MJPEG;
+ stream_create->flags = stream->top_down ? SPICE_STREAM_FLAGS_TOP_DOWN : 0;
+ stream_create->codec_type = SPICE_VIDEO_CODEC_TYPE_MJPEG;
stream_create->src_width = stream->width;
stream_create->src_height = stream->height;
@@ -7004,14 +7004,14 @@ static void red_display_send_stream_start(DisplayChannel *display_channel, Strea
if (stream->current) {
QXLDrawable *qxl_drawable = stream->current->qxl_drawable;
stream_create->clip = qxl_drawable->clip;
- if (qxl_drawable->clip.type == CLIP_TYPE_RECTS) {
+ if (qxl_drawable->clip.type == SPICE_CLIP_TYPE_RECTS) {
fill_rects_clip(channel, &stream_create->clip.data, stream->current->group_id);
} else {
- ASSERT(qxl_drawable->clip.type == CLIP_TYPE_NONE);
+ ASSERT(qxl_drawable->clip.type == SPICE_CLIP_TYPE_NONE);
}
display_begin_send_massage(display_channel, &stream->current->pipe_item);
} else {
- stream_create->clip.type = CLIP_TYPE_RECTS;
+ stream_create->clip.type = SPICE_CLIP_TYPE_RECTS;
stream_create->clip.data = channel->send_data.header.size;
display_channel->send_data.u.stream_create.num_rects = 0;
add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.stream_create.num_rects,
@@ -7030,18 +7030,18 @@ static void red_display_send_stream_clip(DisplayChannel *display_channel,
ASSERT(stream);
- channel->send_data.header.type = RED_DISPLAY_STREAM_CLIP;
- RedStreamClip *stream_clip = &display_channel->send_data.u.stream_clip;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_CLIP;
+ SpiceMsgDisplayStreamClip *stream_clip = &display_channel->send_data.u.stream_clip;
add_buf(channel, BUF_TYPE_RAW, stream_clip, sizeof(*stream_clip), 0, 0);
stream_clip->id = agent - display_channel->stream_agents;
- if ((stream_clip->clip.type = item->clip_type) == CLIP_TYPE_NONE) {
+ if ((stream_clip->clip.type = item->clip_type) == SPICE_CLIP_TYPE_NONE) {
stream_clip->clip.data = 0;
} else {
- ASSERT(stream_clip->clip.type == CLIP_TYPE_RECTS);
+ ASSERT(stream_clip->clip.type == SPICE_CLIP_TYPE_RECTS);
stream_clip->clip.data = channel->send_data.header.size;
add_buf(channel, BUF_TYPE_RAW, &item->region.num_rects, sizeof(uint32_t), 0, 0);
add_buf(channel, BUF_TYPE_RAW, item->region.rects,
- item->region.num_rects * sizeof(Rect), 0, 0);
+ item->region.num_rects * sizeof(SpiceRect), 0, 0);
}
display_begin_send_massage(display_channel, item);
}
@@ -7049,10 +7049,10 @@ static void red_display_send_stream_clip(DisplayChannel *display_channel,
static void red_display_send_stream_end(DisplayChannel *display_channel, StreamAgent* agent)
{
RedChannel *channel = &display_channel->base;
- channel->send_data.header.type = RED_DISPLAY_STREAM_DESTROY;
+ channel->send_data.header.type = SPICE_MSG_DISPLAY_STREAM_DESTROY;
display_channel->send_data.u.stream_destroy.id = agent - display_channel->stream_agents;
add_buf(channel, BUF_TYPE_RAW, &display_channel->send_data.u.stream_destroy,
- sizeof(RedStreamDestroy), 0, 0);
+ sizeof(SpiceMsgDisplayStreamDestroy), 0, 0);
display_begin_send_massage(display_channel, NULL);
}
@@ -7069,12 +7069,12 @@ static void red_send_cursor_init(CursorChannel *channel)
worker = channel->base.worker;
- channel->base.send_data.header.type = RED_CURSOR_INIT;
+ channel->base.send_data.header.type = SPICE_MSG_CURSOR_INIT;
channel->send_data.u.cursor_init.visible = worker->cursor_visible;
channel->send_data.u.cursor_init.position = worker->cursor_position;
channel->send_data.u.cursor_init.trail_length = worker->cursor_trail_length;
channel->send_data.u.cursor_init.trail_frequency = worker->cursor_trail_frequency;
- add_buf(&channel->base, BUF_TYPE_RAW, &channel->send_data.u.cursor_init, sizeof(RedCursorInit),
+ add_buf(&channel->base, BUF_TYPE_RAW, &channel->send_data.u.cursor_init, sizeof(SpiceMsgCursorInit),
0, 0);
fill_cursor(channel, &channel->send_data.u.cursor_init.cursor, worker->cursor);
@@ -7089,11 +7089,11 @@ static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cu
ASSERT(cursor_channel);
channel = &cursor_channel->base;
- channel->send_data.header.type = RED_CURSOR_SET;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_SET;
cursor_channel->send_data.u.cursor_set.postition = cursor->position;
cursor_channel->send_data.u.cursor_set.visible = channel->worker->cursor_visible;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_set,
- sizeof(RedCursorSet), 0, 0);
+ sizeof(SpiceMsgCursorSet), 0, 0);
fill_cursor(cursor_channel, &cursor_channel->send_data.u.cursor_set.cursor, &cursor->base);
red_begin_send_massage(channel, cursor);
@@ -7103,7 +7103,7 @@ static void red_send_local_cursor(CursorChannel *cursor_channel, LocalCursor *cu
static void cursor_channel_send_migrate(CursorChannel *cursor_channel)
{
- cursor_channel->base.send_data.header.type = RED_MIGRATE;
+ cursor_channel->base.send_data.header.type = SPICE_MSG_MIGRATE;
cursor_channel->send_data.u.migrate.flags = 0;
add_buf((RedChannel*)cursor_channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.migrate,
sizeof(cursor_channel->send_data.u.migrate), 0, 0);
@@ -7122,28 +7122,28 @@ static void red_send_cursor(CursorChannel *cursor_channel, CursorItem *cursor)
cmd = cursor->qxl_cursor;
switch (cmd->type) {
case QXL_CURSOR_MOVE:
- channel->send_data.header.type = RED_CURSOR_MOVE;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_MOVE;
cursor_channel->send_data.u.cursor_move.postition = cmd->u.position;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_move,
- sizeof(RedCursorMove), 0, 0);
+ sizeof(SpiceMsgCursorMove), 0, 0);
break;
case QXL_CURSOR_SET:
- channel->send_data.header.type = RED_CURSOR_SET;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_SET;
cursor_channel->send_data.u.cursor_set.postition = cmd->u.set.position;
cursor_channel->send_data.u.cursor_set.visible = channel->worker->cursor_visible;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_set,
- sizeof(RedCursorSet), 0, 0);
+ sizeof(SpiceMsgCursorSet), 0, 0);
fill_cursor(cursor_channel, &cursor_channel->send_data.u.cursor_set.cursor, cursor);
break;
case QXL_CURSOR_HIDE:
- channel->send_data.header.type = RED_CURSOR_HIDE;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_HIDE;
break;
case QXL_CURSOR_TRAIL:
- channel->send_data.header.type = RED_CURSOR_TRAIL;
+ channel->send_data.header.type = SPICE_MSG_CURSOR_TRAIL;
cursor_channel->send_data.u.cursor_trail.length = cmd->u.trail.length;
cursor_channel->send_data.u.cursor_trail.frequency = cmd->u.trail.frequency;
add_buf(channel, BUF_TYPE_RAW, &cursor_channel->send_data.u.cursor_trail,
- sizeof(RedCursorTrail), 0, 0);
+ sizeof(SpiceMsgCursorTrail), 0, 0);
break;
default:
red_error("bad cursor command %d", cmd->type);
@@ -7248,7 +7248,7 @@ static void display_channel_push(RedWorker *worker)
break;
case PIPE_ITEM_TYPE_INVAL_PALLET_CACHE:
red_reset_palette_cache(display_channel);
- red_send_verb((RedChannel *)display_channel, RED_DISPLAY_INVAL_ALL_PALETTES);
+ red_send_verb((RedChannel *)display_channel, SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
free(pipe_item);
break;
default:
@@ -7297,7 +7297,7 @@ static void cursor_channel_push(RedWorker *worker)
break;
case PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
red_reset_cursor_cache(cursor_channel);
- red_send_verb((RedChannel *)cursor_channel, RED_CURSOR_INVAL_ALL);
+ red_send_verb((RedChannel *)cursor_channel, SPICE_MSG_CURSOR_INVAL_ALL);
free(pipe_item);
break;
default:
@@ -7424,7 +7424,7 @@ static void red_disconnect_display(RedChannel *channel)
static void red_migrate_display(RedWorker *worker)
{
if (worker->display_channel) {
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_STREAM_DESTROY_ALL);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_MIGRATE);
}
}
@@ -7442,7 +7442,7 @@ static void destroy_cairo_canvas(CairoCanvas *canvas)
cairo_destroy(cairo);
}
-static void validate_area_nop(void *canvas, int32_t stride, uint8_t *line_0, const Rect *area)
+static void validate_area_nop(void *canvas, int32_t stride, uint8_t *line_0, const SpiceRect *area)
{
}
@@ -7507,7 +7507,7 @@ static void destroy_gl_canvas(GLCanvas *canvas)
oglctx_destroy(ctx);
}
-static void gl_validate_area(GLCanvas *canvas, int32_t stride, uint8_t *line_0, const Rect *area)
+static void gl_validate_area(GLCanvas *canvas, int32_t stride, uint8_t *line_0, const SpiceRect *area)
{
int h;
@@ -7791,28 +7791,28 @@ static void on_new_display_channel(RedWorker *worker)
push_new_mode(worker);
red_add_screen_image(worker);
if (channel_is_connected(&display_channel->base)) {
- red_pipe_add_verb(&display_channel->base, RED_DISPLAY_MARK);
+ red_pipe_add_verb(&display_channel->base, SPICE_MSG_DISPLAY_MARK);
red_disply_start_streams(display_channel);
}
}
}
-static int channel_handle_message(RedChannel *channel, RedDataHeader *message)
+static int channel_handle_message(RedChannel *channel, SpiceDataHeader *message)
{
switch (message->type) {
- case REDC_ACK_SYNC:
+ case SPICE_MSGC_ACK_SYNC:
if (message->size != sizeof(uint32_t)) {
red_printf("bad message size");
return FALSE;
}
channel->client_ack_generation = *(uint32_t *)(message + 1);
break;
- case REDC_ACK:
+ case SPICE_MSGC_ACK:
if (channel->client_ack_generation == channel->ack_generation) {
channel->messages_window -= channel->client_ack_window;
}
break;
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("invalid message type %u", message->type);
@@ -8017,14 +8017,14 @@ static void red_release_pixmap_cache(DisplayChannel *channel)
free(cache);
}
-static int display_channel_init_cache(DisplayChannel *channel, RedcDisplayInit *init_info)
+static int display_channel_init_cache(DisplayChannel *channel, SpiceMsgcDisplayInit *init_info)
{
ASSERT(!channel->pixmap_cache);
return !!(channel->pixmap_cache = red_get_pixmap_cache(init_info->pixmap_cache_id,
init_info->pixmap_cache_size));
}
-static int display_channel_init_glz_dictionary(DisplayChannel *channel, RedcDisplayInit *init_info)
+static int display_channel_init_glz_dictionary(DisplayChannel *channel, SpiceMsgcDisplayInit *init_info)
{
ASSERT(!channel->glz_dict);
ring_init(&channel->glz_drawables);
@@ -8035,7 +8035,7 @@ static int display_channel_init_glz_dictionary(DisplayChannel *channel, RedcDisp
init_info->glz_dictionary_window_size));
}
-static int display_channel_init(DisplayChannel *channel, RedcDisplayInit *init_info)
+static int display_channel_init(DisplayChannel *channel, SpiceMsgcDisplayInit *init_info)
{
return (display_channel_init_cache(channel, init_info) &&
display_channel_init_glz_dictionary(channel, init_info));
@@ -8064,7 +8064,7 @@ static int display_channel_handle_migrate_mark(DisplayChannel *channel)
return TRUE;
}
-static int display_channel_handle_migrate_data(DisplayChannel *channel, RedDataHeader *message)
+static int display_channel_handle_migrate_data(DisplayChannel *channel, SpiceDataHeader *message)
{
DisplayChannelMigrateData *migrate_data;
int i;
@@ -8115,23 +8115,23 @@ static int display_channel_handle_migrate_data(DisplayChannel *channel, RedDataH
return TRUE;
}
-static int display_channel_handle_message(RedChannel *channel, RedDataHeader *message)
+static int display_channel_handle_message(RedChannel *channel, SpiceDataHeader *message)
{
switch (message->type) {
- case REDC_DISPLAY_INIT:
- if (message->size != sizeof(RedcDisplayInit)) {
+ case SPICE_MSGC_DISPLAY_INIT:
+ if (message->size != sizeof(SpiceMsgcDisplayInit)) {
red_printf("bad message size");
return FALSE;
}
if (!((DisplayChannel *)channel)->expect_init) {
- red_printf("unexpected REDC_DISPLAY_INIT");
+ red_printf("unexpected SPICE_MSGC_DISPLAY_INIT");
return FALSE;
}
((DisplayChannel *)channel)->expect_init = FALSE;
- return display_channel_init((DisplayChannel *)channel, (RedcDisplayInit *)(message + 1));
- case REDC_MIGRATE_FLUSH_MARK:
+ return display_channel_init((DisplayChannel *)channel, (SpiceMsgcDisplayInit *)(message + 1));
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
return display_channel_handle_migrate_mark((DisplayChannel *)channel);
- case REDC_MIGRATE_DATA:
+ case SPICE_MSGC_MIGRATE_DATA:
return display_channel_handle_migrate_data((DisplayChannel *)channel, message);
default:
return channel_handle_message(channel, message);
@@ -8167,28 +8167,28 @@ static void red_receive(RedChannel *channel)
} else {
channel->recive_data.now += n;
for (;;) {
- RedDataHeader *message = channel->recive_data.message;
+ SpiceDataHeader *message = channel->recive_data.message;
n = channel->recive_data.now - (uint8_t *)message;
- if (n < sizeof(RedDataHeader) ||
- n < sizeof(RedDataHeader) + message->size) {
+ if (n < sizeof(SpiceDataHeader) ||
+ n < sizeof(SpiceDataHeader) + message->size) {
break;
}
if (!channel->handle_message(channel, message)) {
channel->disconnect(channel);
return;
}
- channel->recive_data.message = (RedDataHeader *)((uint8_t *)message +
- sizeof(RedDataHeader) +
+ channel->recive_data.message = (SpiceDataHeader *)((uint8_t *)message +
+ sizeof(SpiceDataHeader) +
message->size);
}
if (channel->recive_data.now == (uint8_t *)channel->recive_data.message) {
channel->recive_data.now = channel->recive_data.buf;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
} else if (channel->recive_data.now == channel->recive_data.end) {
memcpy(channel->recive_data.buf, channel->recive_data.message, n);
channel->recive_data.now = channel->recive_data.buf + n;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
}
}
}
@@ -8241,7 +8241,7 @@ static RedChannel *__new_channel(RedWorker *worker, int size, RedsStreamContext
channel->client_ack_window = IS_LOW_BANDWIDTH() ? WIDE_CLIENT_ACK_WINDOW :
NARROW_CLIENT_ACK_WINDOW;
channel->client_ack_generation = ~0;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
channel->recive_data.now = channel->recive_data.buf;
channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf);
ring_init(&channel->pipe);
@@ -8361,9 +8361,9 @@ static void handle_new_display_channel(RedWorker *worker, RedsStreamContext *pee
worker->display_channel = display_channel;
- if (!(display_channel->send_data.free_list.res = malloc(sizeof(RedResorceList) +
+ if (!(display_channel->send_data.free_list.res = malloc(sizeof(SpiceResorceList) +
DISPLAY_FREE_LIST_DEFAULT_SIZE *
- sizeof(RedResorceID)))) {
+ sizeof(SpiceResorceID)))) {
PANIC("free list alloc failed");
}
display_channel->send_data.free_list.res_size = DISPLAY_FREE_LIST_DEFAULT_SIZE;
@@ -8447,11 +8447,11 @@ static void red_connect_cursor(RedWorker *worker, RedsStreamContext *peer, int m
typedef struct __attribute__ ((__packed__)) CursorData {
uint32_t visible;
- Point16 position;
+ SpicePoint16 position;
uint16_t trail_length;
uint16_t trail_frequency;
uint32_t data_size;
- RedCursor _cursor;
+ SpiceCursor _cursor;
} CursorData;
static void red_save_cursor(RedWorker *worker)
@@ -8464,7 +8464,7 @@ static void red_save_cursor(RedWorker *worker)
ASSERT(worker->cursor->type == CURSOR_TYPE_LOCAL);
local = (LocalCursor *)worker->cursor;
- size = sizeof(CursorData) + sizeof(RedCursor) + local->data_size;
+ size = sizeof(CursorData) + sizeof(SpiceCursor) + local->data_size;
cursor_data = malloc(size);
ASSERT(cursor_data);
@@ -8478,7 +8478,7 @@ static void red_save_cursor(RedWorker *worker)
worker->qxl->set_save_data(worker->qxl, cursor_data, size);
}
-static LocalCursor *_new_local_cursor(CursorHeader *header, int data_size, Point16 position)
+static LocalCursor *_new_local_cursor(SpiceCursorHeader *header, int data_size, SpicePoint16 position)
{
LocalCursor *local;
@@ -8686,16 +8686,16 @@ static inline void handle_dev_destroy_surfaces(RedWorker *worker)
if (worker->cursor_channel) {
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!worker->cursor_channel->base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->base, RED_CURSOR_RESET);
+ red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
}
ASSERT(!worker->cursor_channel->base.send_data.item);
}
if (worker->display_channel) {
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_INVAL_PALLET_CACHE);
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_STREAM_DESTROY_ALL);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_STREAM_DESTROY_ALL);
if (!worker->display_channel->base.migrate) {
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_RESET);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_RESET);
}
}
@@ -8735,7 +8735,7 @@ static inline void handle_dev_create_primary_surface(RedWorker *worker)
if (worker->display_channel) {
red_pipe_add_type(&worker->display_channel->base, PIPE_ITEM_TYPE_MODE);
- red_pipe_add_verb(&worker->display_channel->base, RED_DISPLAY_MARK);
+ red_pipe_add_verb(&worker->display_channel->base, SPICE_MSG_DISPLAY_MARK);
display_channel_push(worker);
}
@@ -8765,7 +8765,7 @@ static inline void handle_dev_destroy_primary_surface(RedWorker *worker)
if (worker->cursor_channel) {
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!worker->cursor_channel->base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->base, RED_CURSOR_RESET);
+ red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
}
ASSERT(!worker->cursor_channel->base.send_data.item);
}
@@ -8844,7 +8844,7 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
if (worker->cursor_channel) {
red_pipe_add_type(&worker->cursor_channel->base, PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
if (!worker->cursor_channel->base.migrate) {
- red_pipe_add_verb(&worker->cursor_channel->base, RED_CURSOR_RESET);
+ red_pipe_add_verb(&worker->cursor_channel->base, SPICE_MSG_CURSOR_RESET);
}
ASSERT(!worker->cursor_channel->base.send_data.item);
@@ -9040,7 +9040,7 @@ static void red_init(RedWorker *worker, WorkerInitData *init_data)
worker->num_renderers = init_data->num_renderers;
memcpy(worker->renderers, init_data->renderers, sizeof(worker->renderers));
worker->renderer = RED_RENDERER_INVALID;
- worker->mouse_mode = RED_MOUSE_MODE_SERVER;
+ worker->mouse_mode = SPICE_MOUSE_MODE_SERVER;
worker->image_compression = init_data->image_compression;
worker->streaming_video = init_data->streaming_video;
ring_init(&worker->current_list);
@@ -9089,7 +9089,7 @@ void *red_worker_main(void *arg)
red_printf("begin");
ASSERT(MAX_PIPE_SIZE > WIDE_CLIENT_ACK_WINDOW &&
MAX_PIPE_SIZE > NARROW_CLIENT_ACK_WINDOW); //ensure wakeup by ack message
- ASSERT(QXL_BITMAP_TOP_DOWN == BITMAP_TOP_DOWN);
+ ASSERT(QXL_BITMAP_TOP_DOWN == SPICE_BITMAP_FLAGS_TOP_DOWN);
#if defined(RED_WORKER_STAT) || defined(COMPRESS_STAT)
if (pthread_getcpuclockid(pthread_self(), &clock_id)) {
@@ -9157,7 +9157,7 @@ void *red_worker_main(void *arg)
#ifdef DUMP_BITMAP
#include <stdio.h>
-static void dump_palette(FILE *f, Palette* plt)
+static void dump_palette(FILE *f, SpicePalette* plt)
{
int i;
for (i = 0; i < plt->num_ents; i++) {
@@ -9181,14 +9181,14 @@ static void dump_line(FILE *f, uint8_t* line, uint16_t n_pixel_bits, int width,
#define RAM_PATH "/tmp/tmpfs"
-static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
+static void dump_bitmap(RedWorker *worker, SpiceBitmap *bitmap, uint32_t group_id)
{
static uint32_t file_id = 0;
char file_str[200];
int rgb = TRUE;
uint16_t n_pixel_bits;
- Palette *plt = NULL;
+ SpicePalette *plt = NULL;
uint32_t id;
int row_size;
uint32_t file_size;
@@ -9201,30 +9201,30 @@ static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
FILE *f;
switch (bitmap->format) {
- case BITMAP_FMT_1BIT_BE:
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
rgb = FALSE;
n_pixel_bits = 1;
break;
- case BITMAP_FMT_4BIT_BE:
- case BITMAP_FMT_4BIT_LE:
+ case SPICE_BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_LE:
rgb = FALSE;
n_pixel_bits = 4;
break;
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
rgb = FALSE;
n_pixel_bits = 8;
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
n_pixel_bits = 16;
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
n_pixel_bits = 24;
break;
- case BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_32BIT:
n_pixel_bits = 32;
break;
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_RGBA:
n_pixel_bits = 32;
alpha = 1;
break;
@@ -9236,7 +9236,7 @@ static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
if (!bitmap->palette) {
return; // dont dump masks.
}
- plt = (Palette *)get_virt(worker, bitmap->palette, sizeof(Palette), group_id);
+ plt = (SpicePalette *)get_virt(worker, bitmap->palette, sizeof(SpicePalette), group_id);
}
row_size = (((bitmap->x * n_pixel_bits) + 31) / 32) * 4;
bitmap_data_offset = header_size;
@@ -9301,7 +9301,7 @@ static void dump_bitmap(RedWorker *worker, Bitmap *bitmap, uint32_t group_id)
} else {
QXLDataChunk *chunk = NULL;
int num_lines;
- ADDRESS relative_address = bitmap->data;
+ SPICE_ADDRESS relative_address = bitmap->data;
while (relative_address) {
int i;
diff --git a/server/red_yuv.h b/server/red_yuv.h
index 85597475..756717d5 100644
--- a/server/red_yuv.h
+++ b/server/red_yuv.h
@@ -83,8 +83,8 @@ static inline void FUNC_NAME(red_rgb_to_yuv420_line)(const uint8_t* line0, const
}
}
-static inline int FUNC_NAME(red_rgb_to_yuv420)(RedWorker *worker, const Rect *src,
- const Bitmap *image, AVFrame *frame,
+static inline int FUNC_NAME(red_rgb_to_yuv420)(RedWorker *worker, const SpiceRect *src,
+ const SpiceBitmap *image, AVFrame *frame,
long phys_delta, int memslot_id, int id,
Stream *stream, uint32_t group_id)
{
diff --git a/server/reds.c b/server/reds.c
index fb26901a..bb71ae74 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -97,7 +97,7 @@ static void openssl_init();
// approximate max recive message size
#define RECIVE_BUF_SIZE \
- (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * RED_AGENT_MAX_DATA_SIZE)
+ (4096 + (REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES) * SPICE_AGENT_MAX_DATA_SIZE)
#define SEND_BUF_SIZE 4096
@@ -110,7 +110,7 @@ typedef struct IncomingHandler {
int shut;
uint8_t buf[RECIVE_BUF_SIZE];
uint32_t end_pos;
- void (*handle_message)(void *opaque, RedDataHeader *message);
+ void (*handle_message)(void *opaque, SpiceDataHeader *message);
} IncomingHandler;
typedef struct OutgoingHandler {
@@ -123,7 +123,7 @@ typedef struct OutgoingHandler {
} OutgoingHandler;
typedef struct TicketAuthentication {
- char password[RED_MAX_PASSWORD_LENGTH];
+ char password[SPICE_MAX_PASSWORD_LENGTH];
time_t expiration_time;
} TicketAuthentication;
@@ -133,7 +133,7 @@ typedef struct TicketInfo {
RSA *rsa;
int rsa_size;
BIGNUM *bn;
- RedLinkEncryptedTicket encrypted_ticket;
+ SpiceLinkEncryptedTicket encrypted_ticket;
} TicketInfo;
typedef struct MonitorMode {
@@ -151,8 +151,8 @@ struct RedsOutItem {
typedef struct VDIReadBuf {
RedsOutItem out_item;
int len;
- RedDataHeader header;
- uint8_t data[RED_AGENT_MAX_DATA_SIZE];
+ SpiceDataHeader header;
+ uint8_t data[SPICE_AGENT_MAX_DATA_SIZE];
} VDIReadBuf;
enum {
@@ -226,7 +226,7 @@ enum NetTestStage {
#ifdef RED_STATISTICS
#define REDS_MAX_STAT_NODES 100
-#define REDS_STAT_SHM_SIZE (sizeof(RedsStat) + REDS_MAX_STAT_NODES * sizeof(StatNode))
+#define REDS_STAT_SHM_SIZE (sizeof(SpiceStat) + REDS_MAX_STAT_NODES * sizeof(SpiceStatNode))
typedef struct RedsStatValue {
uint32_t value;
@@ -270,7 +270,7 @@ typedef struct RedsState {
#ifdef RED_STATISTICS
char *stat_shm_name;
- RedsStat *stat;
+ SpiceStat *stat;
pthread_mutex_t stat_lock;
RedsStatValue roundtrip_stat;
VDObjectRef ping_timer;
@@ -300,8 +300,8 @@ typedef struct AsyncRead {
typedef struct RedLinkInfo {
RedsStreamContext *peer;
AsyncRead asyc_read;
- RedLinkHeader link_header;
- RedLinkMess *link_mess;
+ SpiceLinkHeader link_header;
+ SpiceLinkMess *link_mess;
int mess_pos;
TicketInfo tiTicketing;
} RedLinkInfo;
@@ -317,7 +317,7 @@ struct __attribute__ ((__packed__)) VDIPortBuf {
typedef struct __attribute__ ((__packed__)) VDAgentExtBuf {
VDIPortBuf base;
- uint8_t buf[RED_AGENT_MAX_DATA_SIZE];
+ uint8_t buf[SPICE_AGENT_MAX_DATA_SIZE];
VDIChunkHeader migrate_overflow;
} VDAgentExtBuf;
@@ -352,8 +352,8 @@ struct ChannelSecurityOptions {
typedef struct PingItem {
RedsOutItem base;
- RedDataHeader header;
- RedPing ping;
+ SpiceDataHeader header;
+ SpiceMsgPing ping;
int size;
} PingItem;
@@ -617,11 +617,11 @@ static struct iovec *reds_iovec_skip(struct iovec vec[], int skip, int *vec_size
static void print_stat_tree(uint32_t node_index, int depth)
{
- StatNode *node = &reds->stat->nodes[node_index];
+ SpiceStatNode *node = &reds->stat->nodes[node_index];
- if ((node->flags & STAT_NODE_MASK_SHOW) == STAT_NODE_MASK_SHOW) {
+ if ((node->flags & SPICE_STAT_NODE_MASK_SHOW) == SPICE_STAT_NODE_MASK_SHOW) {
core->term_printf(core, "%*s%s", depth * STAT_TAB_LEN, "", node->name);
- if (node->flags & STAT_NODE_FLAG_VALUE) {
+ if (node->flags & SPICE_STAT_NODE_FLAG_VALUE) {
core->term_printf(core, ":%*s%llu\n",
(STAT_VALUE_TABS - depth) * STAT_TAB_LEN - strlen(node->name) - 1, "",
node->value);
@@ -645,12 +645,12 @@ static void do_info_statistics()
static void do_reset_statistics()
{
- StatNode *node;
+ SpiceStatNode *node;
int i;
for (i = 0; i <= REDS_MAX_STAT_NODES; i++) {
node = &reds->stat->nodes[i];
- if (node->flags & STAT_NODE_FLAG_VALUE) {
+ if (node->flags & SPICE_STAT_NODE_FLAG_VALUE) {
node->value = 0;
}
}
@@ -668,11 +668,11 @@ static void do_reset_statistics_2(const VDICmdArg* args)
void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
{
- StatNode *node = &reds->stat->nodes[ref];
+ SpiceStatNode *node = &reds->stat->nodes[ref];
uint32_t pos = INVALID_STAT_REF;
uint32_t node_index;
uint32_t *head;
- StatNode *n;
+ SpiceStatNode *n;
node->first_child_index = INVALID_STAT_REF;
head = (parent == INVALID_STAT_REF ? &reds->stat->root_index :
@@ -696,7 +696,7 @@ void insert_stat_node(StatNodeRef parent, StatNodeRef ref)
StatNodeRef stat_add_node(StatNodeRef parent, const char *name, int visible)
{
StatNodeRef ref;
- StatNode *node;
+ SpiceStatNode *node;
ASSERT(name && strlen(name) > 0);
if (strlen(name) >= sizeof(node->name)) {
@@ -722,23 +722,23 @@ StatNodeRef stat_add_node(StatNodeRef parent, const char *name, int visible)
reds->stat->num_of_nodes++;
for (ref = 0; ref <= REDS_MAX_STAT_NODES; ref++) {
node = &reds->stat->nodes[ref];
- if (!(node->flags & STAT_NODE_FLAG_ENABLED)) {
+ if (!(node->flags & SPICE_STAT_NODE_FLAG_ENABLED)) {
break;
}
}
- ASSERT(!(node->flags & STAT_NODE_FLAG_ENABLED));
+ ASSERT(!(node->flags & SPICE_STAT_NODE_FLAG_ENABLED));
node->value = 0;
- node->flags = STAT_NODE_FLAG_ENABLED | (visible ? STAT_NODE_FLAG_VISIBLE : 0);
+ node->flags = SPICE_STAT_NODE_FLAG_ENABLED | (visible ? SPICE_STAT_NODE_FLAG_VISIBLE : 0);
strncpy(node->name, name, sizeof(node->name));
insert_stat_node(parent, ref);
pthread_mutex_unlock(&reds->stat_lock);
return ref;
}
-void stat_remove(StatNode *node)
+void stat_remove(SpiceStatNode *node)
{
pthread_mutex_lock(&reds->stat_lock);
- node->flags &= ~STAT_NODE_FLAG_ENABLED;
+ node->flags &= ~SPICE_STAT_NODE_FLAG_ENABLED;
reds->stat->generation++;
reds->stat->num_of_nodes--;
pthread_mutex_unlock(&reds->stat_lock);
@@ -752,19 +752,19 @@ void stat_remove_node(StatNodeRef ref)
uint64_t *stat_add_counter(StatNodeRef parent, const char *name, int visible)
{
StatNodeRef ref = stat_add_node(parent, name, visible);
- StatNode *node;
+ SpiceStatNode *node;
if (ref == INVALID_STAT_REF) {
return NULL;
}
node = &reds->stat->nodes[ref];
- node->flags |= STAT_NODE_FLAG_VALUE;
+ node->flags |= SPICE_STAT_NODE_FLAG_VALUE;
return &node->value;
}
void stat_remove_counter(uint64_t *counter)
{
- stat_remove((StatNode *)(counter - offsetof(StatNode, value)));
+ stat_remove((SpiceStatNode *)(counter - offsetof(SpiceStatNode, value)));
}
static void reds_update_stat_value(RedsStatValue* stat_value, uint32_t value)
@@ -926,7 +926,7 @@ static int handle_incoming(RedsStreamContext *peer, IncomingHandler *handler)
uint8_t *buf = handler->buf;
uint32_t pos = handler->end_pos;
uint8_t *end = buf + pos;
- RedDataHeader *header;
+ SpiceDataHeader *header;
int n;
n = peer->cb_read(peer->ctx, buf + pos, RECIVE_BUF_SIZE - pos);
if (n <= 0) {
@@ -947,9 +947,9 @@ static int handle_incoming(RedsStreamContext *peer, IncomingHandler *handler)
} else {
pos += n;
end = buf + pos;
- while (buf + sizeof(RedDataHeader) <= end &&
- buf + sizeof(RedDataHeader) + (header = (RedDataHeader *)buf)->size <= end) {
- buf += sizeof(RedDataHeader) + header->size;
+ while (buf + sizeof(SpiceDataHeader) <= end &&
+ buf + sizeof(SpiceDataHeader) + (header = (SpiceDataHeader *)buf)->size <= end) {
+ buf += sizeof(SpiceDataHeader) + header->size;
handler->handle_message(handler->opaque, header);
if (handler->shut) {
@@ -1036,7 +1036,7 @@ static int outgoing_write(RedsStreamContext *peer, OutgoingHandler *handler, voi
typedef struct SimpleOutItem {
RedsOutItem base;
- RedDataHeader header;
+ SpiceDataHeader header;
uint8_t data[0];
} SimpleOutItem;
@@ -1087,19 +1087,19 @@ static void reds_push_pipe_item(RedsOutItem *item)
static void reds_send_channels()
{
- RedChannels* channels_info;
+ SpiceMsgChannels* channels_info;
SimpleOutItem *item;
int message_size;
Channel *channel;
int i;
- message_size = sizeof(RedChannels) + reds->num_of_channels * sizeof(RedChannelInit);
- if (!(item = new_simple_out_item(RED_CHANNELS_LIST, message_size))) {
+ message_size = sizeof(SpiceMsgChannels) + reds->num_of_channels * sizeof(SpiceChannelId);
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_CHANNELS_LIST, message_size))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- channels_info = (RedChannels *)item->data;
+ channels_info = (SpiceMsgChannels *)item->data;
channels_info->num_of_channels = reds->num_of_channels;
channel = reds->channels;
@@ -1151,7 +1151,7 @@ static int send_ping(int size)
item->base.release = reds_free_ping_item;
item->header.serial = ++reds->serial;
- item->header.type = RED_PING;
+ item->header.type = SPICE_MSG_PING;
item->header.size = sizeof(item->ping) + size;
item->header.sub_list = 0;
@@ -1237,22 +1237,22 @@ static void do_info_rtt_client()
static void reds_send_mouse_mode()
{
- RedMouseMode *mouse_mode;
+ SpiceMsgMainMouseMode *mouse_mode;
SimpleOutItem *item;
if (!reds->peer) {
return;
}
- if (!(item = new_simple_out_item(RED_MOUSE_MODE, sizeof(RedMouseMode)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_MOUSE_MODE, sizeof(SpiceMsgMainMouseMode)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- mouse_mode = (RedMouseMode *)item->data;
- mouse_mode->supported_modes = RED_MOUSE_MODE_SERVER;
+ mouse_mode = (SpiceMsgMainMouseMode *)item->data;
+ mouse_mode->supported_modes = SPICE_MOUSE_MODE_SERVER;
if (reds->is_client_mouse_allowed) {
- mouse_mode->supported_modes |= RED_MOUSE_MODE_CLIENT;
+ mouse_mode->supported_modes |= SPICE_MOUSE_MODE_CLIENT;
}
mouse_mode->current_mode = reds->mouse_mode;
reds_push_pipe_item(&item->base);
@@ -1280,8 +1280,8 @@ static void reds_update_mouse_mode()
return;
}
reds->is_client_mouse_allowed = allowed;
- if (reds->mouse_mode == RED_MOUSE_MODE_CLIENT && !allowed) {
- reds_set_mouse_mode(RED_MOUSE_MODE_SERVER);
+ if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT && !allowed) {
+ reds_set_mouse_mode(SPICE_MOUSE_MODE_SERVER);
return;
}
reds_send_mouse_mode();
@@ -1290,7 +1290,7 @@ static void reds_update_mouse_mode()
static void reds_send_agent_connected()
{
SimpleOutItem *item;
- if (!(item = new_simple_out_item(RED_AGENT_CONNECTED, 0))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_AGENT_CONNECTED, 0))) {
PANIC("alloc item failed");
}
reds_push_pipe_item(&item->base);
@@ -1298,14 +1298,14 @@ static void reds_send_agent_connected()
static void reds_send_agent_disconnected()
{
- RedAgentDisconnect *disconnect;
+ SpiceMsgMainAgentDisconnect *disconnect;
SimpleOutItem *item;
- if (!(item = new_simple_out_item(RED_AGENT_DISCONNECTED, sizeof(RedAgentDisconnect)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_AGENT_DISCONNECTED, sizeof(SpiceMsgMainAgentDisconnect)))) {
PANIC("alloc item failed");
}
- disconnect = (RedAgentDisconnect *)item->data;
- disconnect->error_code = RED_ERR_OK;
+ disconnect = (SpiceMsgMainAgentDisconnect *)item->data;
+ disconnect->error_code = SPICE_LINK_ERR_OK;
reds_push_pipe_item(&item->base);
}
@@ -1334,19 +1334,19 @@ static void reds_agent_remove()
static void reds_send_tokens()
{
- RedAgentTokens *tokens;
+ SpiceMsgMainAgentTokens *tokens;
SimpleOutItem *item;
if (!reds->peer) {
return;
}
- if (!(item = new_simple_out_item(RED_AGENT_TOKEN, sizeof(RedAgentTokens)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_AGENT_TOKEN, sizeof(SpiceMsgMainAgentTokens)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- tokens = (RedAgentTokens *)item->data;
+ tokens = (SpiceMsgMainAgentTokens *)item->data;
tokens->num_tokens = reds->agent_state.num_tokens;
reds->agent_state.num_client_tokens += tokens->num_tokens;
ASSERT(reds->agent_state.num_client_tokens <= REDS_AGENT_WINDOW_SIZE);
@@ -1545,7 +1545,7 @@ typedef struct WriteQueueInfo {
typedef struct SendMainMigrateItem {
RedsOutItem base;
- RedDataHeader header;
+ SpiceDataHeader header;
MainMigrateData data;
WriteQueueInfo queue_info[REDS_AGENT_WINDOW_SIZE + REDS_NUM_INTERNAL_AGENT_MESSAGES];
} SendMainMigrateItem;
@@ -1562,7 +1562,7 @@ static void main_channel_send_migrate_data_item(RedsOutItem *in_item, struct iov
vec = vec_start;
item->header.serial = ++reds->serial;
- item->header.type = RED_MIGRATE_DATA;
+ item->header.type = SPICE_MSG_MIGRATE_DATA;
item->header.size = sizeof(item->data);
item->header.sub_list = 0;
@@ -1713,7 +1713,7 @@ static int main_channel_restore_vdi_read_state(MainMigrateData *data, uint8_t **
buff = state->current_read_buf = (VDIReadBuf *)ring_item;
buff->len = data->read_buf_len;
n = buff->len - state->recive_len;
- if (buff->len > RED_AGENT_MAX_DATA_SIZE || n > RED_AGENT_MAX_DATA_SIZE) {
+ if (buff->len > SPICE_AGENT_MAX_DATA_SIZE || n > SPICE_AGENT_MAX_DATA_SIZE) {
red_printf("bad read position");
reds_disconnect();
return FALSE;
@@ -1863,23 +1863,23 @@ static void main_channel_recive_migrate_data(MainMigrateData *data, uint8_t *end
ASSERT(state->num_client_tokens + state->num_tokens == REDS_AGENT_WINDOW_SIZE);
}
-static void reds_main_handle_message(void *opaque, RedDataHeader *message)
+static void reds_main_handle_message(void *opaque, SpiceDataHeader *message)
{
switch (message->type) {
- case REDC_AGENT_START: {
- RedcAgentTokens *agent_start;
+ case SPICE_MSGC_MAIN_AGENT_START: {
+ SpiceMsgcMainAgentTokens *agent_start;
red_printf("agent start");
if (!reds->peer) {
return;
}
- agent_start = (RedcAgentTokens *)(message + 1);
+ agent_start = (SpiceMsgcMainAgentTokens *)(message + 1);
reds->agent_state.client_agent_started = TRUE;
reds->agent_state.send_tokens = agent_start->num_tokens;
read_from_vdi_port();
break;
}
- case REDC_AGENT_DATA: {
+ case SPICE_MSGC_MAIN_AGENT_DATA: {
RingItem *ring_item;
VDAgentExtBuf *buf;
@@ -1896,12 +1896,12 @@ static void reds_main_handle_message(void *opaque, RedDataHeader *message)
}
if (!reds->agent_state.client_agent_started) {
- red_printf("REDC_AGENT_DATA race");
+ red_printf("SPICE_MSGC_MAIN_AGENT_DATA race");
add_token();
break;
}
- if (message->size > RED_AGENT_MAX_DATA_SIZE) {
+ if (message->size > SPICE_AGENT_MAX_DATA_SIZE) {
red_printf("invalid agent message");
reds_disconnect();
break;
@@ -1922,53 +1922,53 @@ static void reds_main_handle_message(void *opaque, RedDataHeader *message)
write_to_vdi_port();
break;
}
- case REDC_AGENT_TOKEN: {
- RedcAgentTokens *token;
+ case SPICE_MSGC_MAIN_AGENT_TOKEN: {
+ SpiceMsgcMainAgentTokens *token;
if (!reds->agent_state.client_agent_started) {
- red_printf("REDC_AGENT_TOKEN race");
+ red_printf("SPICE_MSGC_MAIN_AGENT_TOKEN race");
break;
}
- token = (RedcAgentTokens *)(message + 1);
+ token = (SpiceMsgcMainAgentTokens *)(message + 1);
reds->agent_state.send_tokens += token->num_tokens;
read_from_vdi_port();
break;
}
- case REDC_ATTACH_CHANNELS:
+ case SPICE_MSGC_MAIN_ATTACH_CHANNELS:
reds_send_channels();
break;
- case REDC_MIGRATE_CONNECTED:
+ case SPICE_MSGC_MAIN_MIGRATE_CONNECTED:
red_printf("connected");
if (reds->mig_wait_connect) {
reds_mig_cleanup();
}
break;
- case REDC_MIGRATE_CONNECT_ERROR:
+ case SPICE_MSGC_MAIN_MIGRATE_CONNECT_ERROR:
red_printf("mig connect error");
if (reds->mig_wait_connect) {
reds_mig_cleanup();
}
break;
- case REDC_MOUSE_MODE_REQUEST: {
- switch (((RedcMouseModeRequest *)(message + 1))->mode) {
- case RED_MOUSE_MODE_CLIENT:
+ case SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST: {
+ switch (((SpiceMsgcMainMouseModeRequest *)(message + 1))->mode) {
+ case SPICE_MOUSE_MODE_CLIENT:
if (reds->is_client_mouse_allowed) {
- reds_set_mouse_mode(RED_MOUSE_MODE_CLIENT);
+ reds_set_mouse_mode(SPICE_MOUSE_MODE_CLIENT);
} else {
red_printf("client mouse is disabled");
}
break;
- case RED_MOUSE_MODE_SERVER:
- reds_set_mouse_mode(RED_MOUSE_MODE_SERVER);
+ case SPICE_MOUSE_MODE_SERVER:
+ reds_set_mouse_mode(SPICE_MOUSE_MODE_SERVER);
break;
default:
red_printf("unsupported mouse mode");
}
break;
}
- case REDC_PONG: {
- RedPing *ping = (RedPing *)(message + 1);
+ case SPICE_MSGC_PONG: {
+ SpiceMsgPing *ping = (SpiceMsgPing *)(message + 1);
uint64_t roundtrip;
struct timespec ts;
@@ -2017,16 +2017,16 @@ static void reds_main_handle_message(void *opaque, RedDataHeader *message)
#endif
break;
}
- case REDC_MIGRATE_FLUSH_MARK:
+ case SPICE_MSGC_MIGRATE_FLUSH_MARK:
main_channel_push_migrate_data_item();
break;
- case REDC_MIGRATE_DATA:
+ case SPICE_MSGC_MIGRATE_DATA:
main_channel_recive_migrate_data((MainMigrateData *)(message + 1),
(uint8_t *)(message + 1) + message->size);
reds->mig_target = FALSE;
while (write_to_vdi_port() || read_from_vdi_port());
break;
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("unexpected type %d", message->type);
@@ -2126,19 +2126,19 @@ static int sync_write(RedsStreamContext *peer, void *in_buf, size_t n)
static int reds_send_link_ack(RedLinkInfo *link)
{
- RedLinkHeader header;
- RedLinkReply ack;
+ SpiceLinkHeader header;
+ SpiceLinkReply ack;
Channel *channel;
BUF_MEM *bmBuf;
BIO *bio;
int ret;
- header.magic = RED_MAGIC;
+ header.magic = SPICE_MAGIC;
header.size = sizeof(ack);
- header.major_version = RED_VERSION_MAJOR;
- header.minor_version = RED_VERSION_MINOR;
+ header.major_version = SPICE_VERSION_MAJOR;
+ header.minor_version = SPICE_VERSION_MINOR;
- ack.error = RED_ERR_OK;
+ ack.error = SPICE_LINK_ERR_OK;
if ((channel = reds_find_channel(link->link_mess->channel_type, 0))) {
ack.num_common_caps = channel->num_common_caps;
@@ -2148,7 +2148,7 @@ static int reds_send_link_ack(RedLinkInfo *link)
ack.num_common_caps = 0;
ack.num_channel_caps = 0;
}
- ack.caps_offset = sizeof(RedLinkReply);
+ ack.caps_offset = sizeof(SpiceLinkReply);
if (!(link->tiTicketing.rsa = RSA_new())) {
red_printf("RSA nes failed");
@@ -2160,7 +2160,7 @@ static int reds_send_link_ack(RedLinkInfo *link)
return FALSE;
}
- RSA_generate_key_ex(link->tiTicketing.rsa, RED_TICKET_KEY_PAIR_LENGTH, link->tiTicketing.bn,
+ RSA_generate_key_ex(link->tiTicketing.rsa, SPICE_TICKET_KEY_PAIR_LENGTH, link->tiTicketing.bn,
NULL);
link->tiTicketing.rsa_size = RSA_size(link->tiTicketing.rsa);
@@ -2181,13 +2181,13 @@ static int reds_send_link_ack(RedLinkInfo *link)
static int reds_send_link_error(RedLinkInfo *link, uint32_t error)
{
- RedLinkHeader header;
- RedLinkReply reply;
+ SpiceLinkHeader header;
+ SpiceLinkReply reply;
- header.magic = RED_MAGIC;
+ header.magic = SPICE_MAGIC;
header.size = sizeof(reply);
- header.major_version = RED_VERSION_MAJOR;
- header.minor_version = RED_VERSION_MINOR;
+ header.major_version = SPICE_VERSION_MAJOR;
+ header.minor_version = SPICE_VERSION_MINOR;
memset(&reply, 0, sizeof(reply));
reply.error = error;
return sync_write(link->peer, &header, sizeof(header)) && sync_write(link->peer, &reply,
@@ -2228,7 +2228,7 @@ static void reds_handle_main_link(RedLinkInfo *link)
reds_disconnect();
if (!link->link_mess->connection_id) {
- reds_send_link_result(link, RED_ERR_OK);
+ reds_send_link_result(link, SPICE_LINK_ERR_OK);
while((connection_id = rand()) == 0);
reds->agent_state.num_tokens = 0;
reds->agent_state.send_tokens = 0;
@@ -2236,11 +2236,11 @@ static void reds_handle_main_link(RedLinkInfo *link)
reds->mig_target = FALSE;
} else {
if (link->link_mess->connection_id != reds->link_id) {
- reds_send_link_result(link, RED_ERR_BAD_CONNECTION_ID);
+ reds_send_link_result(link, SPICE_LINK_ERR_BAD_CONNECTION_ID);
reds_release_link(link);
return;
}
- reds_send_link_result(link, RED_ERR_OK);
+ reds_send_link_result(link, SPICE_LINK_ERR_OK);
connection_id = link->link_mess->connection_id;
reds->mig_target = TRUE;
}
@@ -2270,20 +2270,20 @@ static void reds_handle_main_link(RedLinkInfo *link)
if (!reds->mig_target) {
SimpleOutItem *item;
- RedInit *init;
+ SpiceMsgMainInit *init;
- if (!(item = new_simple_out_item(RED_INIT, sizeof(RedInit)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_INIT, sizeof(SpiceMsgMainInit)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- init = (RedInit *)item->data;
+ init = (SpiceMsgMainInit *)item->data;
init->session_id = connection_id;
init->display_channels_hint = red_dispatcher_count();
init->current_mouse_mode = reds->mouse_mode;
- init->supported_mouse_modes = RED_MOUSE_MODE_SERVER;
+ init->supported_mouse_modes = SPICE_MOUSE_MODE_SERVER;
if (reds->is_client_mouse_allowed) {
- init->supported_mouse_modes |= RED_MOUSE_MODE_CLIENT;
+ init->supported_mouse_modes |= SPICE_MOUSE_MODE_CLIENT;
}
init->agent_connected = !!vdagent;
init->agent_tokens = REDS_AGENT_WINDOW_SIZE;
@@ -2296,14 +2296,14 @@ static void reds_handle_main_link(RedLinkInfo *link)
}
#define RED_MOUSE_STATE_TO_LOCAL(state) \
- ((state & REDC_LBUTTON_MASK) | \
- ((state & REDC_MBUTTON_MASK) << 1) | \
- ((state & REDC_RBUTTON_MASK) >> 1))
+ ((state & SPICE_MOUSE_BUTTON_MASK_LEFT) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) << 1) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) >> 1))
#define RED_MOUSE_BUTTON_STATE_TO_AGENT(state) \
- (((state & REDC_LBUTTON_MASK) ? VD_AGENT_LBUTTON_MASK : 0) | \
- ((state & REDC_MBUTTON_MASK) ? VD_AGENT_MBUTTON_MASK : 0) | \
- ((state & REDC_RBUTTON_MASK) ? VD_AGENT_RBUTTON_MASK : 0))
+ (((state & SPICE_MOUSE_BUTTON_MASK_LEFT) ? VD_AGENT_LBUTTON_MASK : 0) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_MIDDLE) ? VD_AGENT_MBUTTON_MASK : 0) | \
+ ((state & SPICE_MOUSE_BUTTON_MASK_RIGHT) ? VD_AGENT_RBUTTON_MASK : 0))
static void activate_modifiers_watch()
{
@@ -2318,21 +2318,21 @@ static void push_key_scan(uint8_t scan)
keyboard->push_scan_freg(keyboard, scan);
}
-static void inputs_handle_input(void *opaque, RedDataHeader *header)
+static void inputs_handle_input(void *opaque, SpiceDataHeader *header)
{
InputsState *state = (InputsState *)opaque;
uint8_t *buf = (uint8_t *)(header + 1);
switch (header->type) {
- case REDC_INPUTS_KEY_DOWN: {
- RedcKeyDown *key_up = (RedcKeyDown *)buf;
+ case SPICE_MSGC_INPUTS_KEY_DOWN: {
+ SpiceMsgcKeyDown *key_up = (SpiceMsgcKeyDown *)buf;
if (key_up->code == CAPS_LOCK_SCAN_CODE || key_up->code == NUM_LOCK_SCAN_CODE ||
key_up->code == SCROLL_LOCK_SCAN_CODE) {
activate_modifiers_watch();
}
}
- case REDC_INPUTS_KEY_UP: {
- RedcKeyDown *key_down = (RedcKeyDown *)buf;
+ case SPICE_MSGC_INPUTS_KEY_UP: {
+ SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
uint8_t *now = (uint8_t *)&key_down->code;
uint8_t *end = now + sizeof(key_down->code);
for (; now < end && *now; now++) {
@@ -2340,45 +2340,45 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
}
break;
}
- case REDC_INPUTS_MOUSE_MOTION: {
- RedcMouseMotion *mouse_motion = (RedcMouseMotion *)buf;
+ case SPICE_MSGC_INPUTS_MOUSE_MOTION: {
+ SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *)buf;
- if (++state->motion_count % RED_MOTION_ACK_BUNCH == 0) {
- RedDataHeader header;
+ if (++state->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0) {
+ SpiceDataHeader header;
header.serial = ++state->serial;
- header.type = RED_INPUTS_MOUSE_MOTION_ACK;
+ header.type = SPICE_MSG_INPUTS_MOUSE_MOTION_ACK;
header.size = 0;
header.sub_list = 0;
- if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(RedDataHeader))
+ if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(SpiceDataHeader))
!= OUTGOING_OK) {
red_printf("motion ack failed");
reds_disconnect();
}
}
- if (mouse && reds->mouse_mode == RED_MOUSE_MODE_SERVER) {
+ if (mouse && reds->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
mouse->moution(mouse, mouse_motion->dx, mouse_motion->dy, 0,
RED_MOUSE_STATE_TO_LOCAL(mouse_motion->buttons_state));
}
break;
}
- case REDC_INPUTS_MOUSE_POSITION: {
- RedcMousePosition *pos = (RedcMousePosition *)buf;
+ case SPICE_MSGC_INPUTS_MOUSE_POSITION: {
+ SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *)buf;
- if (++state->motion_count % RED_MOTION_ACK_BUNCH == 0) {
- RedDataHeader header;
+ if (++state->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0) {
+ SpiceDataHeader header;
header.serial = ++state->serial;
- header.type = RED_INPUTS_MOUSE_MOTION_ACK;
+ header.type = SPICE_MSG_INPUTS_MOUSE_MOTION_ACK;
header.size = 0;
header.sub_list = 0;
- if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(RedDataHeader))
+ if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(SpiceDataHeader))
!= OUTGOING_OK) {
red_printf("position ack failed");
reds_disconnect();
}
}
- if (reds->mouse_mode != RED_MOUSE_MODE_CLIENT) {
+ if (reds->mouse_mode != SPICE_MOUSE_MODE_CLIENT) {
break;
}
ASSERT((agent_mouse && vdagent) || tablet);
@@ -2394,15 +2394,15 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
reds_handle_agent_mouse_event();
break;
}
- case REDC_INPUTS_MOUSE_PRESS: {
- RedcMousePress *mouse_press = (RedcMousePress *)buf;
+ case SPICE_MSGC_INPUTS_MOUSE_PRESS: {
+ SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *)buf;
int dz = 0;
- if (mouse_press->button == REDC_MOUSE_UBUTTON) {
+ if (mouse_press->button == SPICE_MOUSE_BUTTON_UP) {
dz = -1;
- } else if (mouse_press->button == REDC_MOUSE_DBUTTON) {
+ } else if (mouse_press->button == SPICE_MOUSE_BUTTON_DOWN) {
dz = 1;
}
- if (reds->mouse_mode == RED_MOUSE_MODE_CLIENT) {
+ if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT) {
if (agent_mouse && vdagent) {
reds->inputs_state->mouse_state.buttons =
RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_press->buttons_state) |
@@ -2417,9 +2417,9 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
}
break;
}
- case REDC_INPUTS_MOUSE_RELEASE: {
- RedcMouseRelease *mouse_release = (RedcMouseRelease *)buf;
- if (reds->mouse_mode == RED_MOUSE_MODE_CLIENT) {
+ case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
+ SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *)buf;
+ if (reds->mouse_mode == SPICE_MOUSE_MODE_CLIENT) {
if (agent_mouse && vdagent) {
reds->inputs_state->mouse_state.buttons =
RED_MOUSE_BUTTON_STATE_TO_AGENT(mouse_release->buttons_state);
@@ -2432,29 +2432,29 @@ static void inputs_handle_input(void *opaque, RedDataHeader *header)
}
break;
}
- case REDC_INPUTS_KEY_MODIFAIERS: {
- RedcKeyModifiers *modifiers = (RedcKeyModifiers *)buf;
+ case SPICE_MSGC_INPUTS_KEY_MODIFIERS: {
+ SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *)buf;
if (!keyboard) {
break;
}
uint8_t leds = keyboard->get_leds(keyboard);
- if ((modifiers->modifiers & RED_SCROLL_LOCK_MODIFIER) !=
- (leds & RED_SCROLL_LOCK_MODIFIER)) {
+ if ((modifiers->modifiers & SPICE_SCROLL_LOCK_MODIFIER) !=
+ (leds & SPICE_SCROLL_LOCK_MODIFIER)) {
push_key_scan(SCROLL_LOCK_SCAN_CODE);
push_key_scan(SCROLL_LOCK_SCAN_CODE | 0x80);
}
- if ((modifiers->modifiers & RED_NUM_LOCK_MODIFIER) != (leds & RED_NUM_LOCK_MODIFIER)) {
+ if ((modifiers->modifiers & SPICE_NUM_LOCK_MODIFIER) != (leds & SPICE_NUM_LOCK_MODIFIER)) {
push_key_scan(NUM_LOCK_SCAN_CODE);
push_key_scan(NUM_LOCK_SCAN_CODE | 0x80);
}
- if ((modifiers->modifiers & RED_CAPS_LOCK_MODIFIER) != (leds & RED_CAPS_LOCK_MODIFIER)) {
+ if ((modifiers->modifiers & SPICE_CAPS_LOCK_MODIFIER) != (leds & SPICE_CAPS_LOCK_MODIFIER)) {
push_key_scan(CAPS_LOCK_SCAN_CODE);
push_key_scan(CAPS_LOCK_SCAN_CODE | 0x80);
}
activate_modifiers_watch();
break;
}
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("unexpected type %d", header->type);
@@ -2522,12 +2522,12 @@ static void inputs_shutdown(Channel *channel)
static void inputs_migrate(Channel *channel)
{
InputsState *state = (InputsState *)channel->data;
- RedDataHeader header;
- RedMigrate migrate;
+ SpiceDataHeader header;
+ SpiceMsgMigrate migrate;
red_printf("");
header.serial = ++state->serial;
- header.type = RED_MIGRATE;
+ header.type = SPICE_MSG_MIGRATE;
header.size = sizeof(migrate);
header.sub_list = 0;
migrate.flags = 0;
@@ -2600,17 +2600,17 @@ static void inputs_link(Channel *channel, RedsStreamContext *peer, int migration
reds->inputs_state = inputs_state;
core->set_file_handlers(core, peer->socket, inputs_read, NULL, inputs_state);
- RedDataHeader header;
- RedInputsInit inputs_init;
+ SpiceDataHeader header;
+ SpiceMsgInputsInit inputs_init;
header.serial = ++inputs_state->serial;
- header.type = RED_INPUTS_INIT;
- header.size = sizeof(RedInputsInit);
+ header.type = SPICE_MSG_INPUTS_INIT;
+ header.size = sizeof(SpiceMsgInputsInit);
header.sub_list = 0;
inputs_init.keyboard_modifiers = keyboard ? keyboard->get_leds(keyboard) : 0;
if (outgoing_write(inputs_state->peer, &inputs_state->out_handler, &header,
- sizeof(RedDataHeader)) != OUTGOING_OK ||
+ sizeof(SpiceDataHeader)) != OUTGOING_OK ||
outgoing_write(inputs_state->peer, &inputs_state->out_handler, &inputs_init,
- sizeof(RedInputsInit)) != OUTGOING_OK) {
+ sizeof(SpiceMsgInputsInit)) != OUTGOING_OK) {
red_printf("failed to send modifiers state");
reds_disconnect();
}
@@ -2618,24 +2618,24 @@ static void inputs_link(Channel *channel, RedsStreamContext *peer, int migration
static void reds_send_keyborad_modifiers(uint8_t modifiers)
{
- Channel *channel = reds_find_channel(RED_CHANNEL_INPUTS, 0);
+ Channel *channel = reds_find_channel(SPICE_CHANNEL_INPUTS, 0);
InputsState *state;
if (!channel || !(state = (InputsState *)channel->data)) {
return;
}
ASSERT(state->peer);
- RedDataHeader header;
- RedKeyModifiers key_modifiers;
+ SpiceDataHeader header;
+ SpiceMsgInputsKeyModifiers key_modifiers;
header.serial = ++state->serial;
- header.type = RED_INPUTS_KEY_MODIFAIERS;
- header.size = sizeof(RedKeyModifiers);
+ header.type = SPICE_MSG_INPUTS_KEY_MODIFIERS;
+ header.size = sizeof(SpiceMsgInputsKeyModifiers);
header.sub_list = 0;
key_modifiers.modifiers = modifiers;
- if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(RedDataHeader))
+ if (outgoing_write(state->peer, &state->out_handler, &header, sizeof(SpiceDataHeader))
!= OUTGOING_OK ||
- outgoing_write(state->peer, &state->out_handler, &key_modifiers, sizeof(RedKeyModifiers))
+ outgoing_write(state->peer, &state->out_handler, &key_modifiers, sizeof(SpiceMsgInputsKeyModifiers))
!= OUTGOING_OK) {
red_printf("failed to send modifiers state");
reds_disconnect();
@@ -2666,7 +2666,7 @@ static void inputs_init()
red_error("alloc inputs chanel failed");
}
memset(channel, 0, sizeof(Channel));
- channel->type = RED_CHANNEL_INPUTS;
+ channel->type = SPICE_CHANNEL_INPUTS;
channel->link = inputs_link;
channel->shutdown = inputs_shutdown;
channel->migrate = inputs_migrate;
@@ -2677,45 +2677,45 @@ static void reds_handle_other_links(RedLinkInfo *link)
{
Channel *channel;
RedsStreamContext *peer;
- RedLinkMess *link_mess;
+ SpiceLinkMess *link_mess;
uint32_t *caps;
link_mess = link->link_mess;
if (!reds->link_id || reds->link_id != link_mess->connection_id) {
- reds_send_link_result(link, RED_ERR_BAD_CONNECTION_ID);
+ reds_send_link_result(link, SPICE_LINK_ERR_BAD_CONNECTION_ID);
reds_release_link(link);
return;
}
if (!(channel = reds_find_channel(link_mess->channel_type,
link_mess->channel_id))) {
- reds_send_link_result(link, RED_ERR_CHANNEL_NOT_AVAILABLE);
+ reds_send_link_result(link, SPICE_LINK_ERR_CHANNEL_NOT_AVAILABLE);
reds_release_link(link);
return;
}
- reds_send_link_result(link, RED_ERR_OK);
+ reds_send_link_result(link, SPICE_LINK_ERR_OK);
reds_show_new_channel(link);
- if (link_mess->channel_type == RED_CHANNEL_INPUTS && !link->peer->ssl) {
+ if (link_mess->channel_type == SPICE_CHANNEL_INPUTS && !link->peer->ssl) {
SimpleOutItem *item;
- RedNotify *notify;
+ SpiceMsgNotify *notify;
char *mess = "keybord channel is unsecure";
const int mess_len = strlen(mess);
LOG_MESSAGE(VD_LOG_WARN, "%s", mess);
- if (!(item = new_simple_out_item(RED_NOTIFY, sizeof(RedNotify) + mess_len + 1))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_NOTIFY, sizeof(SpiceMsgNotify) + mess_len + 1))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- notify = (RedNotify *)item->data;
+ notify = (SpiceMsgNotify *)item->data;
notify->time_stamp = get_time_stamp();
- notify->severty = RED_NOTIFY_SEVERITY_WARN;
- notify->visibilty = RED_NOTIFY_VISIBILITY_HIGH;
- notify->what = RED_WARN_GENERAL;
+ notify->severty = SPICE_NOTIFY_SEVERITY_WARN;
+ notify->visibilty = SPICE_NOTIFY_VISIBILITY_HIGH;
+ notify->what = SPICE_WARN_GENERAL;
notify->message_len = mess_len;
memcpy(notify->message, mess, mess_len + 1);
reds_push_pipe_item(&item->base);
@@ -2733,7 +2733,7 @@ static void reds_handle_other_links(RedLinkInfo *link)
static void reds_handle_ticket(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
- char password[RED_MAX_PASSWORD_LENGTH];
+ char password[SPICE_MAX_PASSWORD_LENGTH];
time_t ltime;
//todo: use monotonic time
@@ -2747,21 +2747,21 @@ static void reds_handle_ticket(void *opaque)
char *actual_sever_pass = link->link_mess->connection_id ? reds->taTicket.password :
taTicket.password;
if (strlen(actual_sever_pass) == 0) {
- reds_send_link_result(link, RED_ERR_PERMISSION_DENIED);
+ reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
red_printf("Ticketing is enabled, but no password is set. "
"please set a ticket first");
reds_release_link(link);
return;
}
- if (expired || strncmp(password, actual_sever_pass, RED_MAX_PASSWORD_LENGTH) != 0) {
- reds_send_link_result(link, RED_ERR_PERMISSION_DENIED);
+ if (expired || strncmp(password, actual_sever_pass, SPICE_MAX_PASSWORD_LENGTH) != 0) {
+ reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
LOG_MESSAGE(VD_LOG_WARN, "bad connection password or time expired");
reds_release_link(link);
return;
}
}
- if (link->link_mess->channel_type == RED_CHANNEL_MAIN) {
+ if (link->link_mess->channel_type == SPICE_CHANNEL_MAIN) {
reds_handle_main_link(link);
} else {
reds_handle_other_links(link);
@@ -2829,14 +2829,14 @@ static int reds_security_check(RedLinkInfo *link)
static void reds_handle_read_link_done(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
- RedLinkMess *link_mess = link->link_mess;
+ SpiceLinkMess *link_mess = link->link_mess;
AsyncRead *obj = &link->asyc_read;
uint32_t num_caps = link_mess->num_common_caps + link_mess->num_channel_caps;
if (num_caps && (num_caps * sizeof(uint32_t) + link_mess->caps_offset >
link->link_header.size ||
link_mess->caps_offset < sizeof(*link_mess))) {
- reds_send_link_error(link, RED_ERR_INVALID_DATA);
+ reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
reds_release_link(link);
return;
}
@@ -2846,12 +2846,12 @@ static void reds_handle_read_link_done(void *opaque)
LOG_MESSAGE(VD_LOG_INFO, "channels of type %d should connect only over "
"a non secure link", link_mess->channel_type);
red_printf("spice channels %d should not be encrypted", link_mess->channel_type);
- reds_send_link_error(link, RED_ERR_NEED_UNSECURED);
+ reds_send_link_error(link, SPICE_LINK_ERR_NEED_UNSECURED);
} else {
LOG_MESSAGE(VD_LOG_INFO, "channels of type %d should connect only over "
"a secure link", link_mess->channel_type);
red_printf("spice channels %d should be encrypted", link_mess->channel_type);
- reds_send_link_error(link, RED_ERR_NEED_SECURED);
+ reds_send_link_error(link, SPICE_LINK_ERR_NEED_SECURED);
}
reds_release_link(link);
return;
@@ -2885,25 +2885,25 @@ static void reds_handle_link_error(void *opaque, int err)
static void reds_handle_read_header_done(void *opaque)
{
RedLinkInfo *link = (RedLinkInfo *)opaque;
- RedLinkHeader *header = &link->link_header;
+ SpiceLinkHeader *header = &link->link_header;
AsyncRead *obj = &link->asyc_read;
- if (header->magic != RED_MAGIC) {
- reds_send_link_error(link, RED_ERR_INVALID_MAGIC);
+ if (header->magic != SPICE_MAGIC) {
+ reds_send_link_error(link, SPICE_LINK_ERR_INVALID_MAGIC);
LOG_MESSAGE(VD_LOG_ERROR, "bad magic %u", header->magic);
reds_release_link(link);
return;
}
- if (header->major_version != RED_VERSION_MAJOR) {
+ if (header->major_version != SPICE_VERSION_MAJOR) {
if (header->major_version > 0) {
- reds_send_link_error(link, RED_ERR_VERSION_MISMATCH);
+ reds_send_link_error(link, SPICE_LINK_ERR_VERSION_MISMATCH);
}
LOG_MESSAGE(VD_LOG_INFO, "version mismatch client %u.%u server %u.%u",
header->major_version,
header->minor_version,
- RED_VERSION_MAJOR,
- RED_VERSION_MINOR);
+ SPICE_VERSION_MAJOR,
+ SPICE_VERSION_MINOR);
red_printf("version mismatch");
reds_release_link(link);
@@ -2912,8 +2912,8 @@ static void reds_handle_read_header_done(void *opaque)
reds->peer_minor_version = header->minor_version;
- if (header->size < sizeof(RedLinkMess)) {
- reds_send_link_error(link, RED_ERR_INVALID_DATA);
+ if (header->size < sizeof(SpiceLinkMess)) {
+ reds_send_link_error(link, SPICE_LINK_ERR_INVALID_DATA);
red_printf("bad size %u", header->size);
reds_release_link(link);
return;
@@ -2937,7 +2937,7 @@ static void reds_handle_new_link(RedLinkInfo *link)
obj->opaque = link;
obj->peer = link->peer;
obj->now = (uint8_t *)&link->link_header;
- obj->end = (uint8_t *)((RedLinkHeader *)&link->link_header + 1);
+ obj->end = (uint8_t *)((SpiceLinkHeader *)&link->link_header + 1);
obj->active_file_handlers = FALSE;
obj->done = reds_handle_read_header_done;
obj->error = reds_handle_link_error;
@@ -3853,27 +3853,27 @@ static int set_channels_security(const char *channels, uint32_t security)
break;
case CHANNEL_NAME_MAIN:
specific++;
- set_one_channel_security(RED_CHANNEL_MAIN, security);
+ set_one_channel_security(SPICE_CHANNEL_MAIN, security);
break;
case CHANNEL_NAME_DISPLAY:
specific++;
- set_one_channel_security(RED_CHANNEL_DISPLAY, security);
+ set_one_channel_security(SPICE_CHANNEL_DISPLAY, security);
break;
case CHANNEL_NAME_INPUTS:
specific++;
- set_one_channel_security(RED_CHANNEL_INPUTS, security);
+ set_one_channel_security(SPICE_CHANNEL_INPUTS, security);
break;
case CHANNEL_NAME_CURSOR:
specific++;
- set_one_channel_security(RED_CHANNEL_CURSOR, security);
+ set_one_channel_security(SPICE_CHANNEL_CURSOR, security);
break;
case CHANNEL_NAME_PLAYBACK:
specific++;
- set_one_channel_security(RED_CHANNEL_PLAYBACK, security);
+ set_one_channel_security(SPICE_CHANNEL_PLAYBACK, security);
break;
case CHANNEL_NAME_RECORD:
specific++;
- set_one_channel_security(RED_CHANNEL_RECORD, security);
+ set_one_channel_security(SPICE_CHANNEL_RECORD, security);
break;
default:
goto error;
@@ -4172,7 +4172,7 @@ typedef struct RedsMigSpice {
RedsMigWrite write;
RedsMigRead read;
- char pub_key[RED_TICKET_PUBKEY_BYTES];
+ char pub_key[SPICE_TICKET_PUBKEY_BYTES];
uint32_t mig_key;
char *local_args;
@@ -4294,27 +4294,27 @@ static void reds_mig_read(void *data)
static void reds_mig_continue(RedsMigSpice *s)
{
- RedMigrationBegin *migrate;
+ SpiceMsgMainMigrationBegin *migrate;
SimpleOutItem *item;
int host_len;
red_printf("");
core->set_file_handlers(core, s->fd, NULL, NULL, NULL);
host_len = strlen(s->host) + 1;
- item = new_simple_out_item(RED_MIGRATE_BEGIN,
- sizeof(RedMigrationBegin) + host_len + s->cert_pub_key_len);
+ item = new_simple_out_item(SPICE_MSG_MAIN_MIGRATE_BEGIN,
+ sizeof(SpiceMsgMainMigrationBegin) + host_len + s->cert_pub_key_len);
if (!(item)) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- migrate = (RedMigrationBegin *)item->data;
+ migrate = (SpiceMsgMainMigrationBegin *)item->data;
migrate->port = s->port;
migrate->sport = s->sport;
- migrate->host_offset = sizeof(RedMigrationBegin);
+ migrate->host_offset = sizeof(SpiceMsgMainMigrationBegin);
migrate->host_size = host_len;
migrate->pub_key_type = s->cert_pub_key_type;
- migrate->pub_key_offset = sizeof(RedMigrationBegin) + host_len;
+ migrate->pub_key_offset = sizeof(SpiceMsgMainMigrationBegin) + host_len;
migrate->pub_key_size = s->cert_pub_key_len;
memcpy((uint8_t*)(migrate) + migrate->host_offset , s->host, host_len);
memcpy((uint8_t*)(migrate) + migrate->pub_key_offset, s->cert_pub_key, s->cert_pub_key_len);
@@ -4359,7 +4359,7 @@ static void reds_mig_send_ticket(RedsMigSpice *s)
bio_key = BIO_new(BIO_s_mem());
if (bio_key != NULL) {
- BIO_write(bio_key, s->read.buf, RED_TICKET_PUBKEY_BYTES);
+ BIO_write(bio_key, s->read.buf, SPICE_TICKET_PUBKEY_BYTES);
pubkey = d2i_PUBKEY_bio(bio_key, NULL);
rsa = pubkey->pkey.rsa;
rsa_size = RSA_size(rsa);
@@ -4393,7 +4393,7 @@ static void reds_mig_receive_cert_public_key(RedsMigSpice *s)
memcpy(s->cert_pub_key, s->read.buf, s->cert_pub_key_len);
- s->read.size = RED_TICKET_PUBKEY_BYTES;
+ s->read.size = SPICE_TICKET_PUBKEY_BYTES;
s->read.end_pos = 0;
s->read.handle_data = reds_mig_send_ticket;
@@ -4418,7 +4418,7 @@ static void reds_mig_receive_cert_public_key_info(RedsMigSpice *s)
s->read.handle_data = reds_mig_receive_cert_public_key;
} else {
s->cert_pub_key = NULL;
- s->read.size = RED_TICKET_PUBKEY_BYTES;
+ s->read.size = SPICE_TICKET_PUBKEY_BYTES;
s->read.end_pos = 0;
s->read.handle_data = reds_mig_send_ticket;
}
@@ -4514,9 +4514,9 @@ static void reds_mig_started(void *opaque, const char *in_args)
goto error;
}
- if ((RED_VERSION_MAJOR == 1) && (reds->peer_minor_version < 2)) {
+ if ((SPICE_VERSION_MAJOR == 1) && (reds->peer_minor_version < 2)) {
red_printf("minor version mismatch client %u server %u",
- reds->peer_minor_version, RED_VERSION_MINOR);
+ reds->peer_minor_version, SPICE_VERSION_MINOR);
goto error;
}
@@ -4633,18 +4633,18 @@ static void reds_mig_finished(void *opaque, int completed)
if (completed) {
Channel *channel;
- RedMigrate *migrate;
+ SpiceMsgMigrate *migrate;
reds->mig_wait_disconnect = TRUE;
core->arm_timer(core, reds->mig_timer, MIGRATE_TIMEOUT);
- if (!(item = new_simple_out_item(RED_MIGRATE, sizeof(RedMigrate)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MIGRATE, sizeof(SpiceMsgMigrate)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- migrate = (RedMigrate *)item->data;
- migrate->flags = RED_MIGRATE_NEED_FLUSH | RED_MIGRATE_NEED_DATA_TRANSFER;
+ migrate = (SpiceMsgMigrate *)item->data;
+ migrate->flags = SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER;
reds_push_pipe_item(&item->base);
channel = reds->channels;
while (channel) {
@@ -4652,7 +4652,7 @@ static void reds_mig_finished(void *opaque, int completed)
channel = channel->next;
}
} else {
- if (!(item = new_simple_out_item(RED_MIGRATE_CANCEL, 0))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_MIGRATE_CANCEL, 0))) {
red_printf("alloc item failed");
reds_disconnect();
return;
@@ -4733,7 +4733,7 @@ static void reds_mig_send_cert_public_key(int fd)
RedsMigCertPubKeyInfo pub_key_info_msg;
if (spice_secure_port == -1) {
- pub_key_info_msg.type = RED_PUBKEY_TYPE_INVALID;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_INVALID;
pub_key_info_msg.len = 0;
reds_mig_write_all(fd, &pub_key_info_msg, sizeof(pub_key_info_msg), "cert public key info");
return;
@@ -4762,31 +4762,31 @@ static void reds_mig_send_cert_public_key(int fd)
switch(pub_key->type) {
case EVP_PKEY_RSA:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_RSA;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_RSA;
break;
case EVP_PKEY_RSA2:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_RSA2;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_RSA2;
break;
case EVP_PKEY_DSA:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA;
break;
case EVP_PKEY_DSA1:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA1;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA1;
break;
case EVP_PKEY_DSA2:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA2;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA2;
break;
case EVP_PKEY_DSA3:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA3;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA3;
break;
case EVP_PKEY_DSA4:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA4;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DSA4;
break;
case EVP_PKEY_DH:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_DH;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_DH;
break;
case EVP_PKEY_EC:
- pub_key_info_msg.type = RED_PUBKEY_TYPE_EC;
+ pub_key_info_msg.type = SPICE_PUBKEY_TYPE_EC;
break;
default:
red_error("invalid public key type");
@@ -4804,7 +4804,7 @@ static void reds_mig_send_cert_public_key(int fd)
static void reds_mig_recv(void *opaque, int fd)
{
uint32_t ack_message = *(uint32_t *)"ack_";
- char password[RED_MAX_PASSWORD_LENGTH];
+ char password[SPICE_MAX_PASSWORD_LENGTH];
RedsMigSpiceMessage mig_message;
unsigned long f4 = RSA_F4;
TicketInfo ticketing_info;
@@ -4856,7 +4856,7 @@ static void reds_mig_recv(void *opaque, int fd)
red_error("OpenSSL RSA alloc failed");
}
- RSA_generate_key_ex(ticketing_info.rsa, RED_TICKET_KEY_PAIR_LENGTH, ticketing_info.bn, NULL);
+ RSA_generate_key_ex(ticketing_info.rsa, SPICE_TICKET_KEY_PAIR_LENGTH, ticketing_info.bn, NULL);
ticketing_info.rsa_size = RSA_size(ticketing_info.rsa);
if (!(bio = BIO_new(BIO_s_mem()))) {
@@ -4866,7 +4866,7 @@ static void reds_mig_recv(void *opaque, int fd)
i2d_RSA_PUBKEY_bio(bio, ticketing_info.rsa);
BIO_get_mem_ptr(bio, &buff);
- reds_mig_write_all(fd, buff->data, RED_TICKET_PUBKEY_BYTES, "publick key");
+ reds_mig_write_all(fd, buff->data, SPICE_TICKET_PUBKEY_BYTES, "publick key");
reds_mig_read_all(fd, ticketing_info.encrypted_ticket.encrypted_data, ticketing_info.rsa_size,
"ticket");
@@ -4910,7 +4910,7 @@ void reds_update_mm_timer(uint32_t mm_time)
void reds_enable_mm_timer()
{
- RedMultiMediaTime *time_mes;
+ SpiceMsgMainMultiMediaTime *time_mes;
SimpleOutItem *item;
core->arm_timer(core, reds->mm_timer, MM_TIMER_GRANULARITY_MS);
@@ -4918,12 +4918,12 @@ void reds_enable_mm_timer()
return;
}
- if (!(item = new_simple_out_item(RED_MULTI_MEDIA_TIME, sizeof(RedMultiMediaTime)))) {
+ if (!(item = new_simple_out_item(SPICE_MSG_MAIN_MULTI_MEDIA_TIME, sizeof(SpiceMsgMainMultiMediaTime)))) {
red_printf("alloc item failed");
reds_disconnect();
return;
}
- time_mes = (RedMultiMediaTime *)item->data;
+ time_mes = (SpiceMsgMainMultiMediaTime *)item->data;
time_mes->time = reds_get_mm_time() - MM_TIME_DELTA;
reds_push_pipe_item(&item->base);
}
@@ -5375,7 +5375,7 @@ static void init_vd_agent_resources()
memset(buf, 0, sizeof(*buf));
buf->out_item.prepare = reds_prepare_read_buf;
buf->out_item.release = reds_release_read_buf;
- buf->header.type = RED_AGENT_DATA;
+ buf->header.type = SPICE_MSG_MAIN_AGENT_DATA;
buf->header.sub_list = 0;
ring_item_init(&buf->out_item.link);
ring_add(&reds->agent_state.read_bufs, &buf->out_item.link);
@@ -5431,13 +5431,13 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
core->register_change_notifiers(core, &reds, interface_change_notifier);
#ifdef RED_STATISTICS
- int shm_name_len = strlen(REDS_STAT_SHM_NAME) + 20;
+ int shm_name_len = strlen(SPICE_STAT_SHM_NAME) + 20;
int fd;
if (!(reds->stat_shm_name = (char *)malloc(shm_name_len))) {
red_error("stat_shm_name alloc failed");
}
- snprintf(reds->stat_shm_name, shm_name_len, REDS_STAT_SHM_NAME, getpid());
+ snprintf(reds->stat_shm_name, shm_name_len, SPICE_STAT_SHM_NAME, getpid());
if ((fd = shm_open(reds->stat_shm_name, O_CREAT | O_RDWR, 0444)) == -1) {
red_error("statistics shm_open failed, %s", strerror(errno));
}
@@ -5445,12 +5445,12 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
red_error("statistics ftruncate failed, %s", strerror(errno));
}
reds->stat = mmap(NULL, REDS_STAT_SHM_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (reds->stat == (RedsStat *)MAP_FAILED) {
+ if (reds->stat == (SpiceStat *)MAP_FAILED) {
red_error("statistics mmap failed, %s", strerror(errno));
}
memset(reds->stat, 0, REDS_STAT_SHM_SIZE);
- reds->stat->magic = REDS_STAT_MAGIC;
- reds->stat->version = REDS_STAT_VERSION;
+ reds->stat->magic = SPICE_STAT_MAGIC;
+ reds->stat->version = SPICE_STAT_VERSION;
reds->stat->root_index = INVALID_STAT_REF;
if (pthread_mutex_init(&reds->stat_lock, NULL)) {
red_error("mutex init failed");
@@ -5472,7 +5472,7 @@ void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_int
}
inputs_init();
- reds->mouse_mode = RED_MOUSE_MODE_SERVER;
+ reds->mouse_mode = SPICE_MOUSE_MODE_SERVER;
atexit(reds_exit);
}
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 8cfabaef..3046bd1b 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -68,7 +68,7 @@ typedef struct BufDescriptor {
typedef struct SndChannel SndChannel;
typedef void (*send_messages_proc)(void *in_channel);
-typedef int (*handle_message_proc)(SndChannel *channel, RedDataHeader *message);
+typedef int (*handle_message_proc)(SndChannel *channel, SpiceDataHeader *message);
typedef void (*on_message_done_proc)(SndChannel *channel);
typedef void (*cleanup_channel_proc)(SndChannel *channel);
@@ -90,7 +90,7 @@ struct SndChannel {
uint32_t ack_messages;
struct {
- RedDataHeader header;
+ SpiceDataHeader header;
uint32_t n_bufs;
BufDescriptor bufs[MAX_SEND_BUFS];
@@ -100,7 +100,7 @@ struct SndChannel {
struct {
uint8_t buf[RECIVE_BUF_SIZE];
- RedDataHeader *message;
+ SpiceDataHeader *message;
uint8_t *now;
uint8_t *end;
} recive_data;
@@ -132,9 +132,9 @@ typedef struct PlaybackChannel {
uint32_t mode;
struct {
union {
- RedPlaybackMode mode;
- RedPlaybackStart start;
- RedMigrate migrate;
+ SpiceMsgPlaybackMode mode;
+ SpiceMsgPlaybackStart start;
+ SpiceMsgMigrate migrate;
uint8_t celt_buf[CELT_COMPRESSED_FRAME_BYTES];
} u;
} send_data;
@@ -158,8 +158,8 @@ typedef struct __attribute__ ((__packed__)) RecordMigrateData {
} RecordMigrateData;
typedef struct __attribute__ ((__packed__)) RecordMigrateMessage {
- RedMigrate migrate;
- RedDataHeader header;
+ SpiceMsgMigrate migrate;
+ SpiceDataHeader header;
RecordMigrateData data;
} RecordMigrateMessage;
@@ -178,14 +178,14 @@ typedef struct RecordChannel {
uint32_t celt_buf[FRAME_SIZE];
struct {
union {
- RedRecordStart start;
+ SpiceMsgRecordStart start;
RecordMigrateMessage migrate;
} u;
} send_data;
} RecordChannel;
static SndWorker *workers = NULL;
-static uint32_t playback_compression = RED_AUDIO_DATA_MODE_CELT_0_5_1;
+static uint32_t playback_compression = SPICE_AUDIO_DATA_MODE_CELT_0_5_1;
static void snd_receive(void* data);
@@ -323,9 +323,9 @@ static int snd_send_data(SndChannel *channel)
return TRUE;
}
-static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader *message)
+static int snd_record_handle_write(RecordChannel *record_channel, SpiceDataHeader *message)
{
- RedcRecordPacket *packet;
+ SpiceMsgcRecordPacket *packet;
uint32_t write_pos;
uint32_t* data;
uint32_t size;
@@ -336,10 +336,10 @@ static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader
return FALSE;
}
- packet = (RedcRecordPacket *)(message + 1);
+ packet = (SpiceMsgcRecordPacket *)(message + 1);
size = message->size - sizeof(*packet);
- if (record_channel->mode == RED_AUDIO_DATA_MODE_CELT_0_5_1) {
+ if (record_channel->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
int celt_err = celt051_decode(record_channel->celt_decoder, packet->data, size,
(celt_int16_t *)record_channel->celt_buf);
if (celt_err != CELT_OK) {
@@ -348,7 +348,7 @@ static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader
}
data = record_channel->celt_buf;
size = FRAME_SIZE;
- } else if (record_channel->mode == RED_AUDIO_DATA_MODE_RAW) {
+ } else if (record_channel->mode == SPICE_AUDIO_DATA_MODE_RAW) {
data = (uint32_t *)packet->data;
size = size >> 2;
size = MIN(size, RECORD_SAMPLES_SIZE);
@@ -373,14 +373,14 @@ static int snd_record_handle_write(RecordChannel *record_channel, RedDataHeader
return TRUE;
}
-static int snd_playback_handle_message(SndChannel *channel, RedDataHeader *message)
+static int snd_playback_handle_message(SndChannel *channel, SpiceDataHeader *message)
{
if (!channel) {
return FALSE;
}
switch (message->type) {
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
default:
red_printf("invalid message type %u", message->type);
@@ -389,7 +389,7 @@ static int snd_playback_handle_message(SndChannel *channel, RedDataHeader *messa
return TRUE;
}
-static int snd_record_handle_message(SndChannel *channel, RedDataHeader *message)
+static int snd_record_handle_message(SndChannel *channel, SpiceDataHeader *message)
{
RecordChannel *record_channel = (RecordChannel *)channel;
@@ -397,26 +397,26 @@ static int snd_record_handle_message(SndChannel *channel, RedDataHeader *message
return FALSE;
}
switch (message->type) {
- case REDC_RECORD_DATA:
+ case SPICE_MSGC_RECORD_DATA:
return snd_record_handle_write((RecordChannel *)channel, message);
- case REDC_RECORD_MODE: {
- RedcRecordMode *mode = (RedcRecordMode *)(message + 1);
+ case SPICE_MSGC_RECORD_MODE: {
+ SpiceMsgcRecordMode *mode = (SpiceMsgcRecordMode *)(message + 1);
record_channel->mode = mode->mode;
record_channel->mode_time = mode->time;
- if (record_channel->mode != RED_AUDIO_DATA_MODE_CELT_0_5_1 &&
- record_channel->mode != RED_AUDIO_DATA_MODE_RAW) {
+ if (record_channel->mode != SPICE_AUDIO_DATA_MODE_CELT_0_5_1 &&
+ record_channel->mode != SPICE_AUDIO_DATA_MODE_RAW) {
red_printf("unsupported mode");
}
break;
}
- case REDC_RECORD_START_MARK: {
- RedcRecordStartMark *mark = (RedcRecordStartMark *)(message + 1);
+ case SPICE_MSGC_RECORD_START_MARK: {
+ SpiceMsgcRecordStartMark *mark = (SpiceMsgcRecordStartMark *)(message + 1);
record_channel->start_time = mark->time;
break;
}
- case REDC_DISCONNECTING:
+ case SPICE_MSGC_DISCONNECTING:
break;
- case REDC_MIGRATE_DATA: {
+ case SPICE_MSGC_MIGRATE_DATA: {
RecordMigrateData* mig_data = (RecordMigrateData *)(message + 1);
if (mig_data->version != RECORD_MIG_VERSION) {
red_printf("invalid mig version");
@@ -467,26 +467,26 @@ static void snd_receive(void* data)
} else {
channel->recive_data.now += n;
for (;;) {
- RedDataHeader *message = channel->recive_data.message;
+ SpiceDataHeader *message = channel->recive_data.message;
n = channel->recive_data.now - (uint8_t *)message;
- if (n < sizeof(RedDataHeader) || n < sizeof(RedDataHeader) + message->size) {
+ if (n < sizeof(SpiceDataHeader) || n < sizeof(SpiceDataHeader) + message->size) {
break;
}
if (!channel->handle_message(channel, message)) {
snd_disconnect_channel(channel);
return;
}
- channel->recive_data.message = (RedDataHeader *)((uint8_t *)message +
- sizeof(RedDataHeader) +
+ channel->recive_data.message = (SpiceDataHeader *)((uint8_t *)message +
+ sizeof(SpiceDataHeader) +
message->size);
}
if (channel->recive_data.now == (uint8_t *)channel->recive_data.message) {
channel->recive_data.now = channel->recive_data.buf;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
} else if (channel->recive_data.now == channel->recive_data.end) {
memcpy(channel->recive_data.buf, channel->recive_data.message, n);
channel->recive_data.now = channel->recive_data.buf + n;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
}
}
}
@@ -518,27 +518,27 @@ static inline int snd_reset_send_data(SndChannel *channel, uint16_t verb)
channel->send_data.header.size = 0;
channel->send_data.header.type = verb;
++channel->send_data.header.serial;
- __snd_add_buf(channel, &channel->send_data.header, sizeof(RedDataHeader));
+ __snd_add_buf(channel, &channel->send_data.header, sizeof(SpiceDataHeader));
return TRUE;
}
static int snd_playback_send_migrate(PlaybackChannel *channel)
{
- if (!snd_reset_send_data((SndChannel *)channel, RED_MIGRATE)) {
+ if (!snd_reset_send_data((SndChannel *)channel, SPICE_MSG_MIGRATE)) {
return FALSE;
}
channel->send_data.u.migrate.flags = 0;
snd_add_buf((SndChannel *)channel, &channel->send_data.u.migrate,
sizeof(channel->send_data.u.migrate));
- channel->base.send_data.size = channel->base.send_data.header.size + sizeof(RedDataHeader);
+ channel->base.send_data.size = channel->base.send_data.header.size + sizeof(SpiceDataHeader);
return snd_send_data((SndChannel *)channel);
}
static int snd_playback_send_start(PlaybackChannel *playback_channel)
{
SndChannel *channel = (SndChannel *)playback_channel;
- RedPlaybackStart *start;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_START)) {
+ SpiceMsgPlaybackStart *start;
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_START)) {
return FALSE;
}
@@ -546,21 +546,21 @@ static int snd_playback_send_start(PlaybackChannel *playback_channel)
start->channels = VD_INTERFACE_PLAYBACK_CHAN;
start->frequency = VD_INTERFACE_PLAYBACK_FREQ;
ASSERT(VD_INTERFACE_PLAYBACK_FMT == VD_INTERFACE_AUDIO_FMT_S16);
- start->format = RED_AUDIO_FMT_S16;
+ start->format = SPICE_AUDIO_FMT_S16;
start->time = reds_get_mm_time();
snd_add_buf(channel, start, sizeof(*start));
- channel->send_data.size = sizeof(RedDataHeader) + sizeof(*start);
+ channel->send_data.size = sizeof(SpiceDataHeader) + sizeof(*start);
return snd_send_data(channel);
}
static int snd_playback_send_stop(PlaybackChannel *playback_channel)
{
SndChannel *channel = (SndChannel *)playback_channel;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_STOP)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_STOP)) {
return FALSE;
}
- channel->send_data.size = sizeof(RedDataHeader);
+ channel->send_data.size = sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -578,8 +578,8 @@ static int snd_playback_send_ctl(PlaybackChannel *playback_channel)
static int snd_record_send_start(RecordChannel *record_channel)
{
SndChannel *channel = (SndChannel *)record_channel;
- RedRecordStart *start;
- if (!snd_reset_send_data(channel, RED_RECORD_START)) {
+ SpiceMsgRecordStart *start;
+ if (!snd_reset_send_data(channel, SPICE_MSG_RECORD_START)) {
return FALSE;
}
@@ -587,20 +587,20 @@ static int snd_record_send_start(RecordChannel *record_channel)
start->channels = VD_INTERFACE_RECORD_CHAN;
start->frequency = VD_INTERFACE_RECORD_FREQ;
ASSERT(VD_INTERFACE_RECORD_FMT == VD_INTERFACE_AUDIO_FMT_S16);
- start->format = RED_AUDIO_FMT_S16;
+ start->format = SPICE_AUDIO_FMT_S16;
snd_add_buf(channel, start, sizeof(*start));
- channel->send_data.size = sizeof(RedDataHeader) + sizeof(*start);
+ channel->send_data.size = sizeof(SpiceDataHeader) + sizeof(*start);
return snd_send_data(channel);
}
static int snd_record_send_stop(RecordChannel *record_channel)
{
SndChannel *channel = (SndChannel *)record_channel;
- if (!snd_reset_send_data(channel, RED_RECORD_STOP)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_RECORD_STOP)) {
return FALSE;
}
- channel->send_data.size = sizeof(RedDataHeader);
+ channel->send_data.size = sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -620,13 +620,13 @@ static int snd_record_send_migrate(RecordChannel *record_channel)
SndChannel *channel = (SndChannel *)record_channel;
RecordMigrateMessage* migrate;
- if (!snd_reset_send_data(channel, RED_MIGRATE)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_MIGRATE)) {
return FALSE;
}
migrate = &record_channel->send_data.u.migrate;
- migrate->migrate.flags = RED_MIGRATE_NEED_DATA_TRANSFER;
- migrate->header.type = RED_MIGRATE_DATA;
+ migrate->migrate.flags = SPICE_MIGRATE_NEED_DATA_TRANSFER;
+ migrate->header.type = SPICE_MSG_MIGRATE_DATA;
migrate->header.size = sizeof(RecordMigrateData);
migrate->header.serial = ++channel->send_data.header.serial;
migrate->header.sub_list = 0;
@@ -638,7 +638,7 @@ static int snd_record_send_migrate(RecordChannel *record_channel)
migrate->data.mode_time = record_channel->mode_time;
snd_add_buf(channel, migrate, sizeof(*migrate));
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
channel->send_data.header.size -= sizeof(migrate->header);
channel->send_data.header.size -= sizeof(migrate->data);
return snd_send_data(channel);
@@ -649,13 +649,13 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
SndChannel *channel = (SndChannel *)playback_channel;
AudioFrame *frame;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_DATA)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_DATA)) {
return FALSE;
}
frame = playback_channel->in_progress;
snd_add_buf(channel, &frame->time, sizeof(frame->time));
- if (playback_channel->mode == RED_AUDIO_DATA_MODE_CELT_0_5_1) {
+ if (playback_channel->mode == SPICE_AUDIO_DATA_MODE_CELT_0_5_1) {
int n = celt051_encode(playback_channel->celt_encoder, (celt_int16_t *)frame->samples, NULL,
playback_channel->send_data.u.celt_buf, CELT_COMPRESSED_FRAME_BYTES);
if (n < 0) {
@@ -668,7 +668,7 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
snd_add_buf(channel, frame->samples, sizeof(frame->samples));
}
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -676,9 +676,9 @@ static int snd_playback_send_write(PlaybackChannel *playback_channel)
static int playback_send_mode(PlaybackChannel *playback_channel)
{
SndChannel *channel = (SndChannel *)playback_channel;
- RedPlaybackMode *mode;
+ SpiceMsgPlaybackMode *mode;
- if (!snd_reset_send_data(channel, RED_PLAYBACK_MODE)) {
+ if (!snd_reset_send_data(channel, SPICE_MSG_PLAYBACK_MODE)) {
return FALSE;
}
mode = &playback_channel->send_data.u.mode;
@@ -686,7 +686,7 @@ static int playback_send_mode(PlaybackChannel *playback_channel)
mode->mode = playback_channel->mode;
snd_add_buf(channel, mode, sizeof(*mode));
- channel->send_data.size = channel->send_data.header.size + sizeof(RedDataHeader);
+ channel->send_data.size = channel->send_data.header.size + sizeof(SpiceDataHeader);
return snd_send_data(channel);
}
@@ -802,7 +802,7 @@ static SndChannel *__new_channel(SndWorker *worker, int size, RedsStreamContext
memset(channel, 0, size);
channel->peer = peer;
channel->worker = worker;
- channel->recive_data.message = (RedDataHeader *)channel->recive_data.buf;
+ channel->recive_data.message = (SpiceDataHeader *)channel->recive_data.buf;
channel->recive_data.now = channel->recive_data.buf;
channel->recive_data.end = channel->recive_data.buf + sizeof(channel->recive_data.buf);
@@ -989,9 +989,9 @@ static void snd_set_playback_peer(Channel *channel, RedsStreamContext *peer, int
playback_channel->plug.put_frame = snd_playback_put_frame;
playback_channel->celt_mode = celt_mode;
playback_channel->celt_encoder = celt_encoder;
- playback_channel->celt_allowed = num_caps > 0 && (caps[0] & (1 << RED_PLAYBACK_CAP_CELT_0_5_1));
+ playback_channel->celt_allowed = num_caps > 0 && (caps[0] & (1 << SPICE_PLAYBACK_CAP_CELT_0_5_1));
playback_channel->mode = playback_channel->celt_allowed ? playback_compression :
- RED_AUDIO_DATA_MODE_RAW;
+ SPICE_AUDIO_DATA_MODE_RAW;
on_new_playback_channel(worker);
snd_playback_send(worker->connection);
@@ -1205,7 +1205,7 @@ void snd_attach_playback(PlaybackInterface *interface)
red_error("playback channel malloc failed");
}
memset(playback_worker, 0, sizeof(*playback_worker));
- playback_worker->base.type = RED_CHANNEL_PLAYBACK;
+ playback_worker->base.type = SPICE_CHANNEL_PLAYBACK;
playback_worker->base.link = snd_set_playback_peer;
playback_worker->base.shutdown = snd_shutdown;
playback_worker->base.migrate = snd_playback_migrate;
@@ -1216,7 +1216,7 @@ void snd_attach_playback(PlaybackInterface *interface)
if (!(playback_worker->base.caps = malloc(sizeof(uint32_t)))) {
PANIC("malloc failed");
}
- playback_worker->base.caps[0] = (1 << RED_PLAYBACK_CAP_CELT_0_5_1);
+ playback_worker->base.caps[0] = (1 << SPICE_PLAYBACK_CAP_CELT_0_5_1);
add_worker(playback_worker);
reds_register_channel(&playback_worker->base);
@@ -1230,7 +1230,7 @@ void snd_attach_record(RecordInterface *interface)
}
memset(record_worker, 0, sizeof(*record_worker));
- record_worker->base.type = RED_CHANNEL_RECORD;
+ record_worker->base.type = SPICE_CHANNEL_RECORD;
record_worker->base.link = snd_set_record_peer;
record_worker->base.shutdown = snd_shutdown;
record_worker->base.migrate = snd_record_migrate;
@@ -1242,7 +1242,7 @@ void snd_attach_record(RecordInterface *interface)
if (!(record_worker->base.caps = malloc(sizeof(uint32_t)))) {
PANIC("malloc failed");
}
- record_worker->base.caps[0] = (1 << RED_RECORD_CAP_CELT_0_5_1);
+ record_worker->base.caps[0] = (1 << SPICE_RECORD_CAP_CELT_0_5_1);
add_worker(record_worker);
reds_register_channel(&record_worker->base);
}
@@ -1277,12 +1277,12 @@ void snd_set_playback_compression(int on)
{
SndWorker *now = workers;
- playback_compression = on ? RED_AUDIO_DATA_MODE_CELT_0_5_1 : RED_AUDIO_DATA_MODE_RAW;
+ playback_compression = on ? SPICE_AUDIO_DATA_MODE_CELT_0_5_1 : SPICE_AUDIO_DATA_MODE_RAW;
for (; now; now = now->next) {
- if (now->base.type == RED_CHANNEL_PLAYBACK && now->connection) {
+ if (now->base.type == SPICE_CHANNEL_PLAYBACK && now->connection) {
PlaybackChannel* playback = (PlaybackChannel*)now->connection;
if (!playback->celt_allowed) {
- ASSERT(playback->mode == RED_AUDIO_DATA_MODE_RAW);
+ ASSERT(playback->mode == SPICE_AUDIO_DATA_MODE_RAW);
continue;
}
if (playback->mode != playback_compression) {
@@ -1295,6 +1295,6 @@ void snd_set_playback_compression(int on)
int snd_get_playback_compression()
{
- return (playback_compression == RED_AUDIO_DATA_MODE_RAW) ? FALSE : TRUE;
+ return (playback_compression == SPICE_AUDIO_DATA_MODE_RAW) ? FALSE : TRUE;
}
diff --git a/server/vd_interface.h b/server/vd_interface.h
index 3adbf7e6..674fae00 100644
--- a/server/vd_interface.h
+++ b/server/vd_interface.h
@@ -196,7 +196,7 @@ struct QXLInterface {
void (*release_resource)(QXLInterface *qxl, struct QXLReleaseInfoExt release_info);
int (*get_cursor_command)(QXLInterface *qxl, struct QXLCommandExt *cmd);
int (*req_cursor_notification)(QXLInterface *qxl);
- const struct Rect *(*get_update_area)(QXLInterface *qxl);
+ const struct SpiceRect *(*get_update_area)(QXLInterface *qxl);
void (*notify_update)(QXLInterface *qxl, uint32_t update_id);
void (*set_save_data)(QXLInterface *qxl, void *data, int size);
void *(*get_save_data)(QXLInterface *qxl);