1 /* this is a file autogenerated by spice_codegen.py */
2 /*
3 Copyright (C) 2013 Red Hat, Inc.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include <config.h>
20 #include "test-marshallers.h"
21 #include <string.h>
22 #include <assert.h>
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <spice/protocol.h>
26 #include <spice/macros.h>
27 #include "common/marshaller.h"
28
29 #ifdef _MSC_VER
30 #pragma warning(disable:4101)
31 #pragma warning(disable:4018)
32 #endif
33
spice_marshall_array_uint64(SpiceMarshaller * m,uint64_t * ptr,unsigned count)34 SPICE_GNUC_UNUSED static void spice_marshall_array_uint64(SpiceMarshaller *m, uint64_t *ptr, unsigned count)
35 {
36 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
37 uint32_t i;
38
39 for (i = 0; i < count; i++) {
40 spice_marshaller_add_uint64(m, *ptr++);
41 }
42 }
43
spice_marshall_msg_main_ShortDataSubMarshall(SPICE_GNUC_UNUSED SpiceMarshaller * m,SPICE_GNUC_UNUSED SpiceMsgMainShortDataSubMarshall * msg)44 void spice_marshall_msg_main_ShortDataSubMarshall(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgMainShortDataSubMarshall *msg)
45 {
46 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
47 SpiceMsgMainShortDataSubMarshall *src;
48 src = (SpiceMsgMainShortDataSubMarshall *)msg;
49
50 spice_marshaller_add_uint8(m, src->dummy_byte);
51 spice_marshaller_add_uint32(m, src->data_size);
52 m2 = spice_marshaller_get_ptr_submarshaller(m);
53 if (src->data != NULL) {
54 spice_marshall_array_uint64(m2, src->data, src->data_size);
55 }
56 }
57
spice_marshall_msg_main_ArrayMessage(SPICE_GNUC_UNUSED SpiceMarshaller * m,SPICE_GNUC_UNUSED SpiceMsgMainArrayMessage * msg)58 void spice_marshall_msg_main_ArrayMessage(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgMainArrayMessage *msg)
59 {
60 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
61 }
62
spice_marshall_msg_main_Zeroes(SPICE_GNUC_UNUSED SpiceMarshaller * m,SPICE_GNUC_UNUSED SpiceMsgMainZeroes * msg)63 void spice_marshall_msg_main_Zeroes(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgMainZeroes *msg)
64 {
65 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
66 SpiceMsgMainZeroes *src;
67 src = (SpiceMsgMainZeroes *)msg;
68
69 spice_marshaller_add_uint8(m, 0);
70 spice_marshaller_add_uint16(m, src->n);
71 spice_marshaller_add_uint32(m, 0);
72 }
73
spice_marshall_msg_main_channels_list(SPICE_GNUC_UNUSED SpiceMarshaller * m,SPICE_GNUC_UNUSED SpiceMsgChannels * msg)74 void spice_marshall_msg_main_channels_list(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgChannels *msg)
75 {
76 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
77 SpiceMsgChannels *src;
78 uint16_t *channels__element;
79 uint32_t i;
80 src = (SpiceMsgChannels *)msg;
81
82 spice_marshaller_add_uint32(m, src->num_of_channels);
83 channels__element = src->channels;
84 for (i = 0; i < src->num_of_channels; i++) {
85 spice_marshaller_add_uint16(m, *channels__element);
86 channels__element++;
87 }
88 }
89
spice_marshall_msg_main_LenMessage(SPICE_GNUC_UNUSED SpiceMarshaller * m,SPICE_GNUC_UNUSED SpiceMsgMainLenMessage * msg)90 void spice_marshall_msg_main_LenMessage(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgMainLenMessage *msg)
91 {
92 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
93 SpiceMsgMainLenMessage *src;
94 uint32_t *dummy__element;
95 uint32_t i;
96 src = (SpiceMsgMainLenMessage *)msg;
97
98 dummy__element = src->dummy;
99 for (i = 0; i < 2; i++) {
100 spice_marshaller_add_uint32(m, *dummy__element);
101 dummy__element++;
102 }
103 /* Remaining data must be appended manually */
104 }
105
spice_marshall_array_uint8(SpiceMarshaller * m,uint8_t * ptr,unsigned count)106 SPICE_GNUC_UNUSED static void spice_marshall_array_uint8(SpiceMarshaller *m, uint8_t *ptr, unsigned count)
107 {
108 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
109 uint32_t i;
110
111 for (i = 0; i < count; i++) {
112 spice_marshaller_add_uint8(m, *ptr++);
113 }
114 }
115
spice_marshall_msg_main_ZeroLen1(SPICE_GNUC_UNUSED SpiceMarshaller * m,SPICE_GNUC_UNUSED SpiceMsgMainZeroLen1 * msg,SpiceMarshaller ** txt2_out)116 void spice_marshall_msg_main_ZeroLen1(SPICE_GNUC_UNUSED SpiceMarshaller *m, SPICE_GNUC_UNUSED SpiceMsgMainZeroLen1 *msg, SpiceMarshaller **txt2_out)
117 {
118 SPICE_GNUC_UNUSED SpiceMarshaller *m2;
119 SpiceMsgMainZeroLen1 *src;
120 uint8_t *txt1__element;
121 uint32_t i;
122 uint8_t *txt3__element;
123 uint8_t *txt4__element;
124 *txt2_out = NULL;
125 src = (SpiceMsgMainZeroLen1 *)msg;
126
127 txt1__element = src->txt1;
128 for (i = 0; i < 4; i++) {
129 spice_marshaller_add_uint8(m, *txt1__element);
130 txt1__element++;
131 }
132 spice_marshaller_add_uint8(m, src->sep1);
133 spice_marshaller_add_uint32(m, src->txt2_len);
134 *txt2_out = spice_marshaller_get_ptr_submarshaller(m);
135 txt3__element = src->txt3;
136 for (i = 0; i < src->txt2_len; i++) {
137 spice_marshaller_add_uint8(m, *txt3__element);
138 txt3__element++;
139 }
140 spice_marshaller_add_uint32(m, src->n);
141 spice_marshaller_add_uint16(m, src->txt4_len);
142 txt4__element = src->txt4;
143 for (i = 0; i < src->txt4_len; i++) {
144 spice_marshaller_add_uint8(m, *txt4__element);
145 txt4__element++;
146 }
147 }
148
149