summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-21 14:42:35 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-25 18:59:10 +0200
commit359fc1cb5dbbcf32132c3e8ee6f881a23deff684 (patch)
tree3ae7cc1c8b4d0449d50a13cb9640a6ef75f51f11 /server
parent4df135c858d7dfb1aa0ae5d3cb17d786410d1544 (diff)
downloadspice-359fc1cb5dbbcf32132c3e8ee6f881a23deff684.tar.gz
spice-359fc1cb5dbbcf32132c3e8ee6f881a23deff684.tar.xz
spice-359fc1cb5dbbcf32132c3e8ee6f881a23deff684.zip
Use the spice-common submodule
This patch will replace the common/ directory with the spice-common project. It is for now a simple project subdirectory shared with spice-gtk, but the goal is to make it a proper library later on. With this change, the spice-server build is broken. The following commits fix the build, and have been seperated to ease the review. v2 - moves all the generated marshallers to spice-common library - don't attempt to fix windows VS build, which should somehow be splitted with spice-common (or built from tarball only to avoid generation tools/libs deps) v3 - uses libspice-common-client - fix a mutex.h inclusion reported by Alon
Diffstat (limited to 'server')
-rw-r--r--server/Makefile.am47
-rw-r--r--server/dispatcher.c25
-rw-r--r--server/glz_encoder.h2
-rw-r--r--server/glz_encoder_config.h2
-rw-r--r--server/inputs_channel.c6
-rw-r--r--server/main_channel.c11
-rw-r--r--server/red_channel.c6
-rw-r--r--server/red_channel.h9
-rw-r--r--server/red_common.h9
-rw-r--r--server/red_dispatcher.c3
-rw-r--r--server/red_worker.c26
-rw-r--r--server/reds.c16
-rw-r--r--server/reds_gl_canvas.c4
-rw-r--r--server/reds_gl_canvas.h2
-rw-r--r--server/reds_sw_canvas.c4
-rw-r--r--server/reds_sw_canvas.h2
-rw-r--r--server/smartcard.c10
-rw-r--r--server/smartcard.h2
-rw-r--r--server/snd_worker.c5
-rw-r--r--server/spicevmc.c6
-rw-r--r--server/tests/Makefile.am21
21 files changed, 117 insertions, 101 deletions
diff --git a/server/Makefile.am b/server/Makefile.am
index a88e464a..97e7dfed 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -1,14 +1,11 @@
-SUBDIRS = . tests
-
NULL =
+SUBDIRS = . tests
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/common \
+AM_CPPFLAGS = \
-DRED_STATISTICS \
$(CELT051_CFLAGS) \
+ $(COMMON_CFLAGS) \
$(PIXMAN_CFLAGS) \
- $(PROTOCOL_CFLAGS) \
$(SASL_CFLAGS) \
$(SLIRP_CFLAGS) \
$(SMARTCARD_CFLAGS) \
@@ -17,18 +14,6 @@ INCLUDES = \
$(WARN_CFLAGS) \
$(NULL)
-spice_built_sources = generated_marshallers.c generated_marshallers.h generated_demarshallers.c
-
-generated_demarshallers.c: $(top_srcdir)/spice.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --server --include red_common.h $(top_srcdir)/spice.proto generated_demarshallers.c
-
-STRUCTS=-M String -M Rect -M Point -M DisplayBase -M Fill -M Opaque -M Copy -M Blend -M Blackness -M Whiteness -M Invers -M Rop3 -M Stroke -M Text -M Transparent -M AlphaBlend
-generated_marshallers.c: $(top_srcdir)/spice.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --include red_common.h --generate-marshallers $(STRUCTS) --server $(top_srcdir)/spice.proto generated_marshallers.c
-
-generated_marshallers.h: $(top_srcdir)/spice.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server -H $(top_srcdir)/spice.proto generated_marshallers.h
-
lib_LTLIBRARIES = libspice-server.la
libspice_server_la_LDFLAGS = \
@@ -41,17 +26,18 @@ libspice_server_la_LDFLAGS += \
-Wl,--version-script=$(top_srcdir)/server/spice-server.syms
endif
-libspice_server_la_LIBADD = \
- $(top_builddir)/common/libspice-common.la \
- $(CELT051_LIBS) \
- $(GL_LIBS) \
- $(JPEG_LIBS) \
- $(LIBRT) \
- $(PIXMAN_LIBS) \
- $(SASL_LIBS) \
- $(SLIRP_LIBS) \
- $(SSL_LIBS) \
- $(Z_LIBS) \
+libspice_server_la_LIBADD = \
+ $(top_builddir)/spice-common/common/libspice-common.la \
+ $(top_builddir)/spice-common/common/libspice-common-server.la \
+ $(CELT051_LIBS) \
+ $(GL_LIBS) \
+ $(JPEG_LIBS) \
+ $(LIBRT) \
+ $(PIXMAN_LIBS) \
+ $(SASL_LIBS) \
+ $(SLIRP_LIBS) \
+ $(SSL_LIBS) \
+ $(Z_LIBS) \
$(NULL)
libspice_server_la_SOURCES = \
@@ -59,9 +45,6 @@ libspice_server_la_SOURCES = \
agent-msg-filter.h \
char_device.h \
demarshallers.h \
- generated_demarshallers.c \
- generated_marshallers.c \
- generated_marshallers.h \
glz_encoder.c \
glz_encoder.h \
glz_encoder_config.h \
diff --git a/server/dispatcher.c b/server/dispatcher.c
index 94ae5569..c15a7a18 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -1,4 +1,24 @@
+/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ Copyright (C) 2009-2012 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/>.
+*/
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+
#include <unistd.h>
#include <errno.h>
#include <assert.h>
@@ -7,8 +27,9 @@
#include <fcntl.h>
#include <poll.h>
-#include "mem.h"
-#include "spice_common.h"
+#include "common/mem.h"
+#include "common/spice_common.h"
+
#include "dispatcher.h"
#define DISPATCHER_DEBUG_PRINTF(level, ...) \
diff --git a/server/glz_encoder.h b/server/glz_encoder.h
index 9b4f9108..34c363a3 100644
--- a/server/glz_encoder.h
+++ b/server/glz_encoder.h
@@ -21,7 +21,7 @@
/* Manging the lz encoding using a dictionary that is shared among encoders */
#include <stdint.h>
-#include "lz_common.h"
+#include "common/lz_common.h"
#include "glz_encoder_dictionary.h"
#include "glz_encoder_config.h"
diff --git a/server/glz_encoder_config.h b/server/glz_encoder_config.h
index 2d1626a7..157e3a21 100644
--- a/server/glz_encoder_config.h
+++ b/server/glz_encoder_config.h
@@ -19,7 +19,7 @@
#define _H_GLZ_ENCODER_CONFIG
#include <spice/macros.h>
-#include "lz_common.h"
+#include "common/lz_common.h"
typedef void GlzUsrImageContext;
typedef struct GlzEncoderUsrContext GlzEncoderUsrContext;
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 42247613..da4c53c4 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -26,10 +26,12 @@
#include <errno.h>
#include <spice/macros.h>
#include <spice/vd_agent.h>
+
#include "common/marshaller.h"
#include "common/messages.h"
-#include "server/demarshallers.h"
-#include "server/generated_marshallers.h"
+#include "common/generated_server_marshallers.h"
+
+#include "demarshallers.h"
#include "spice.h"
#include "red_common.h"
#include "reds.h"
diff --git a/server/main_channel.c b/server/main_channel.c
index dbac010a..7a2938c6 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -36,14 +36,15 @@
#include <errno.h>
#include <ctype.h>
-#include "server/red_common.h"
-#include "server/demarshallers.h"
-#include "common/ring.h"
+#include "common/generated_server_marshallers.h"
#include "common/messages.h"
+#include "common/ring.h"
+
+#include "demarshallers.h"
#include "main_channel.h"
-#include "reds.h"
#include "red_channel.h"
-#include "generated_marshallers.h"
+#include "red_common.h"
+#include "reds.h"
#define ZERO_BUF_SIZE 4096
diff --git a/server/red_channel.c b/server/red_channel.c
index ecb512d3..f27abeda 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -29,11 +29,13 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
-#include "ring.h"
+
+#include "common/generated_server_marshallers.h"
+#include "common/ring.h"
+
#include "stat.h"
#include "red_channel.h"
#include "reds.h"
-#include "generated_marshallers.h"
static void red_channel_client_event(int fd, int event, void *data);
static void red_client_add_channel(RedClient *client, RedChannelClient *rcc);
diff --git a/server/red_channel.h b/server/red_channel.h
index 5dfd187b..54182106 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -25,11 +25,12 @@
#include <pthread.h>
#include <limits.h>
-#include "red_common.h"
-#include "spice.h"
-#include "ring.h"
+#include "common/ring.h"
#include "common/marshaller.h"
-#include "server/demarshallers.h"
+
+#include "spice.h"
+#include "red_common.h"
+#include "demarshallers.h"
#define MAX_SEND_BUFS 1000
#define CLIENT_ACK_WINDOW 20
diff --git a/server/red_common.h b/server/red_common.h
index 86be95dd..cb7bf716 100644
--- a/server/red_common.h
+++ b/server/red_common.h
@@ -20,12 +20,13 @@
#include <sys/uio.h>
#include <openssl/ssl.h>
+#include <spice/macros.h>
+
+#include "common/mem.h"
+#include "common/spice_common.h"
+#include "common/messages.h"
#include "spice.h"
-#include "mem.h"
-#include "spice_common.h"
-#include <messages.h>
-#include <spice/macros.h>
enum {
STREAM_VIDEO_INVALID,
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 1aa619c1..9a049488 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -29,9 +29,10 @@
#include <inttypes.h>
#include <spice/qxl_dev.h>
+#include "common/quic.h"
+
#include "spice.h"
#include "red_worker.h"
-#include "quic.h"
#include "reds_sw_canvas.h"
#ifdef USE_OPENGL
#include "reds_gl_canvas.h"
diff --git a/server/red_worker.c b/server/red_worker.c
index 45260ee7..172a5716 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -44,31 +44,33 @@
#include <setjmp.h>
#include <openssl/ssl.h>
-#include <spice/qxl_dev.h>
-#include "spice.h"
-#include "region.h"
#include <spice/protocol.h>
-#include "red_worker.h"
-#include "reds_sw_canvas.h"
+#include <spice/qxl_dev.h>
+#include "common/lz.h"
+#include "common/marshaller.h"
+#include "common/quic.h"
+#include "common/rect.h"
+#include "common/region.h"
+#include "common/ring.h"
+#include "common/generated_server_marshallers.h"
+
#ifdef USE_OPENGL
+#include "common/ogl_ctx.h"
#include "reds_gl_canvas.h"
-#include "ogl_ctx.h"
#endif /* USE_OPENGL */
-#include "quic.h"
-#include "lz.h"
+
+#include "spice.h"
+#include "red_worker.h"
+#include "reds_sw_canvas.h"
#include "glz_encoder_dictionary.h"
#include "glz_encoder.h"
#include "stat.h"
#include "reds.h"
-#include "ring.h"
#include "mjpeg_encoder.h"
#include "red_memslots.h"
#include "red_parse_qxl.h"
#include "jpeg_encoder.h"
-#include "rect.h"
-#include "marshaller.h"
#include "demarshallers.h"
-#include "generated_marshallers.h"
#include "zlib_encoder.h"
#include "red_channel.h"
#include "red_dispatcher.h"
diff --git a/server/reds.c b/server/reds.c
index 30e3ac04..cf493dde 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -47,26 +47,26 @@
#include <sasl/sasl.h>
#endif
+#include <spice/protocol.h>
+#include <spice/vd_agent.h>
+#include <spice/stats.h>
+
+#include "common/generated_server_marshallers.h"
+#include "common/ring.h"
+
#include "spice.h"
#include "spice-experimental.h"
#include "reds.h"
-#include <spice/protocol.h>
-#include <spice/vd_agent.h>
#include "agent-msg-filter.h"
-
#include "inputs_channel.h"
#include "main_channel.h"
#include "red_common.h"
#include "red_dispatcher.h"
#include "main_dispatcher.h"
#include "snd_worker.h"
-#include <spice/stats.h>
#include "stat.h"
-#include "ring.h"
#include "demarshallers.h"
-#include "marshaller.h"
-#include "generated_marshallers.h"
-#include "server/char_device.h"
+#include "char_device.h"
#ifdef USE_TUNNEL
#include "red_tunnel_worker.h"
#endif
diff --git a/server/reds_gl_canvas.c b/server/reds_gl_canvas.c
index deec4403..da03ee53 100644
--- a/server/reds_gl_canvas.c
+++ b/server/reds_gl_canvas.c
@@ -18,11 +18,11 @@
#include <config.h>
#endif
-#include "spice_common.h"
+#include "common/spice_common.h"
#include "reds_gl_canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_IMAGE_CACHE
-#include "gl_canvas.c"
+#include "common/gl_canvas.c"
#undef SW_CANVAS_IMAGE_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/server/reds_gl_canvas.h b/server/reds_gl_canvas.h
index c20cca50..c9da25c8 100644
--- a/server/reds_gl_canvas.h
+++ b/server/reds_gl_canvas.h
@@ -20,7 +20,7 @@
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_IMAGE_CACHE
-#include "gl_canvas.h"
+#include "common/gl_canvas.h"
#undef SW_CANVAS_IMAGE_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/server/reds_sw_canvas.c b/server/reds_sw_canvas.c
index 43e086d6..e7ace3b4 100644
--- a/server/reds_sw_canvas.c
+++ b/server/reds_sw_canvas.c
@@ -18,11 +18,11 @@
#include <config.h>
#endif
-#include "spice_common.h"
+#include "common/spice_common.h"
#include "reds_sw_canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_IMAGE_CACHE
-#include "sw_canvas.c"
+#include "common/sw_canvas.c"
#undef SW_CANVAS_IMAGE_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/server/reds_sw_canvas.h b/server/reds_sw_canvas.h
index 00e61562..f065be53 100644
--- a/server/reds_sw_canvas.h
+++ b/server/reds_sw_canvas.h
@@ -19,7 +19,7 @@
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_IMAGE_CACHE
-#include "sw_canvas.h"
+#include "common/sw_canvas.h"
#undef SW_CANVAS_IMAGE_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/server/smartcard.c b/server/smartcard.c
index 84aa18b3..d023331f 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -20,12 +20,12 @@
#endif
#include <arpa/inet.h>
-
#include <vscard_common.h>
-#include "server/reds.h"
-#include "server/char_device.h"
-#include "server/red_channel.h"
-#include "server/smartcard.h"
+
+#include "reds.h"
+#include "char_device.h"
+#include "red_channel.h"
+#include "smartcard.h"
#define SMARTCARD_MAX_READERS 10
diff --git a/server/smartcard.h b/server/smartcard.h
index 60cc2c6c..7881e1fd 100644
--- a/server/smartcard.h
+++ b/server/smartcard.h
@@ -18,7 +18,7 @@
#ifndef __SMART_CARD_H__
#define __SMART_CARD_H__
-#include "server/spice-experimental.h"
+#include "spice-experimental.h"
// Maximal length of APDU
#define APDUBufSize 270
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 4c511905..be980947 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -27,14 +27,15 @@
#include <netinet/tcp.h>
#include <celt051/celt.h>
+#include "common/marshaller.h"
+#include "common/generated_server_marshallers.h"
+
#include "spice.h"
#include "red_common.h"
#include "main_channel.h"
#include "reds.h"
#include "red_dispatcher.h"
#include "snd_worker.h"
-#include "marshaller.h"
-#include "generated_marshallers.h"
#include "demarshallers.h"
#ifndef IOV_MAX
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 2f1b8f77..18ae6279 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -28,9 +28,9 @@
#include <netinet/in.h> // IPPROTO_TCP
#include <netinet/tcp.h> // TCP_NODELAY
-#include "server/char_device.h"
-#include "server/red_channel.h"
-#include "server/reds.h"
+#include "char_device.h"
+#include "red_channel.h"
+#include "reds.h"
/* 64K should be enough for all but the largest writes + 32 bytes hdr */
#define BUF_SIZE (64 * 1024 + 32)
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
index 52e55a88..e77865c7 100644
--- a/server/tests/Makefile.am
+++ b/server/tests/Makefile.am
@@ -1,21 +1,22 @@
NULL =
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_srcdir)/common \
- -I$(top_srcdir)/server \
- -I$(top_srcdir)/server/tests \
- $(PROTOCOL_CFLAGS) \
- $(SPICE_NONPKGCONFIG_CFLAGS) \
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/server \
+ -I$(top_srcdir)/server/tests \
+ $(COMMON_CFLAGS) \
+ $(SMARTCARD_CFLAGS) \
+ $(SPICE_NONPKGCONFIG_CFLAGS) \
$(NULL)
if SUPPORT_AUTOMATED_TESTS
INCLUDES += -DAUTOMATED_TESTS
endif
-LDADD = \
- $(top_builddir)/common/libspice-common.la \
- $(top_builddir)/server/libspice-server.la \
+LDADD = \
+ $(top_builddir)/spice-common/common/libspice-common.la \
+ $(top_builddir)/server/libspice-server.la \
$(NULL)
COMMON_BASE = \