summaryrefslogtreecommitdiffstats
path: root/client/demarshallers.h
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-05-25 16:01:18 +0200
committerAlexander Larsson <alexl@redhat.com>2010-06-18 16:32:11 +0200
commit4154d7028943ca4bf0f1ff2e0480d688fc081fcc (patch)
treefe166cb9d21905653aed68592166b58f14927ff5 /client/demarshallers.h
parent17bbef4df334bd8d98d3960143f229d753b4b0a3 (diff)
downloadspice-4154d7028943ca4bf0f1ff2e0480d688fc081fcc.tar.gz
spice-4154d7028943ca4bf0f1ff2e0480d688fc081fcc.tar.xz
spice-4154d7028943ca4bf0f1ff2e0480d688fc081fcc.zip
Client: Use the autogenerated demarshallers
When a message has been read from the network we now pass it into the generated demarshaller for the channel. The demarshaller converts the network data to in-memory structures that is passed on to the spice internals. Additionally it also: * Converts endianness * Validates sizes of message and any pointers in it * Localizes offsets (converts them to pointers) * Checks for zero offsets in messages where they are not supported Some of this was previously done using custom code in the client, this is now removed.
Diffstat (limited to 'client/demarshallers.h')
-rw-r--r--client/demarshallers.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/client/demarshallers.h b/client/demarshallers.h
new file mode 100644
index 00000000..81189735
--- /dev/null
+++ b/client/demarshallers.h
@@ -0,0 +1,25 @@
+/*
+ Copyright (C) 2010 Red Hat, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef _H_DEMARSHAL
+#define _H_DEMARSHAL
+
+typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor, size_t *size_out);
+
+spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t channel, unsigned int *max_message_type);
+
+#endif
+