spice-space-commit Mailing List for Spice Space
Brought to you by:
ykamay
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(25) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
(81) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Yaniv K. <yk...@re...> - 2010-02-01 14:32:40
|
repository: /home/tlv/ykamay/open_spice_upload/vdesktop branch: master commit 6bab087da13997dafcba7cd0b3495618ae13eb61 Author: Yaniv Kamay <yk...@re...> Date: Mon Feb 1 14:13:07 2010 +0200 qxl device: fix regitser_interfac typo diff --git a/qemu/hw/qxl.c b/qemu/hw/qxl.c index d31dcfd..17cc3fa 100644 --- a/qemu/hw/qxl.c +++ b/qemu/hw/qxl.c @@ -12,7 +12,7 @@ #include "qxl_dev.h" -#ifdef CONFIG_SPICE +#ifdef CONFIG_SPICE #include "interface.h" #endif #include "qxl_interface.h" @@ -26,8 +26,8 @@ #define VDI_PORT_SAVE_VERSION 1 #define ASSERT(x) if (!(x)) { \ - printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \ - exit(-1); \ + printf("%s: ASSERT %s failed\n", __FUNCTION__, #x); \ + exit(-1); \ } #define PANIC_ON(x) if ((x)) { \ @@ -180,7 +180,7 @@ typedef struct PCIVDIPortDevice { static PCIQXLDevice *dev_list = NULL; static pthread_t main_thread; -#define PIXEL_SIZE 0.2936875 //1280x1024 is 14.8" x 11.9" +#define PIXEL_SIZE 0.2936875 //1280x1024 is 14.8" x 11.9" #define QXL_MODE(x_res, y_res, bits, orientation) \ {0, x_res, y_res, bits, (x_res) * (bits) / 8, \ @@ -197,8 +197,8 @@ static pthread_t main_thread; QXLMode qxl_modes[] = { QXL_MODE_EX(640, 480), - QXL_MODE_EX(800, 600), - QXL_MODE_EX(832, 624), + QXL_MODE_EX(800, 600), + QXL_MODE_EX(832, 624), QXL_MODE_EX(1024, 768), QXL_MODE_EX(1152, 864), QXL_MODE_EX(1152, 870), @@ -337,7 +337,7 @@ static void set_dreaw_area(PCIQXLDevice *d, QXLDevInfo *info) info->draw_area.buf = (uint8_t *)d->state.ram_start + d->state.rom->draw_area_offset; info->draw_area.size = stride * info->y_res; info->draw_area.line_0 = info->draw_area.buf + info->draw_area.size - stride; - info->draw_area.stride = -stride; + info->draw_area.stride = -stride; info->draw_area.width = info->x_res; info->draw_area.heigth = info->y_res; } @@ -353,8 +353,8 @@ static void _qxl_get_info(PCIQXLDevice *d, QXLDevInfo *info) { QXLState *state = &d->state; QXLMode *mode; - - info->ram_size = state->rom->num_io_pages << TARGET_PAGE_BITS; + + info->ram_size = state->rom->num_io_pages << TARGET_PAGE_BITS; if (state->mode == QXL_MODE_VGA) { info->x_res = qxl_vga.ds->width; @@ -492,8 +492,8 @@ static void _qxl_release_resource(PCIQXLDevice *d, QXLReleaseInfo *release_info) state->last_release->next = release_info->id; release_info->next = 0; state->last_release = release_info; - } - + } + state->num_free_res++; qxl_push_free_res(d); @@ -520,7 +520,7 @@ static int _qxl_flush_resources(PCIQXLDevice *d) if (d->state.mode == QXL_MODE_VGA) { return 0; } - ret = d->state.num_free_res; + ret = d->state.num_free_res; if (ret) { qxl_push_free_res(d); } @@ -550,14 +550,14 @@ static void qxl_detach(PCIQXLDevice *d) RING_INIT(&d->state.ram->cursor_ring); return; } - + ring = &d->state.vga_ring; - + while (!RING_IS_EMPTY(ring)) { QXLDrawable *drawable; QXLCommand *cmd; int notify; - + cmd = RING_CONS_ITEM(ring); RING_POP(ring, notify); ASSERT(cmd->type == QXL_CMD_DRAW); @@ -836,7 +836,7 @@ static int vdi_port_interface_write(VDIPortInterface *port, VDObjectRef plug, vdi_port_set_dirty(d, packet, sizeof(*packet) - (sizeof(packet->data) - packet->size)); RING_PUSH(ring, notify); - do_notify = do_notify || notify; + do_notify = do_notify || notify; len -= packet->size; buf += packet->size; actual_write += packet->size; @@ -914,7 +914,7 @@ static void vdi_port_register_interface(PCIVDIPortDevice *d) if (d->active_interface ) { return; } - + interface->base.base_version = VM_INTERFACE_VERSION; interface->base.type = VD_INTERFACE_VDI_PORT; interface->base.id = ++interface_id; @@ -1033,7 +1033,7 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id) uint64_t start; uint64_t end; uint64_t start_offset; - uint64_t end_offset; + uint64_t end_offset; unsigned long new_virt_start; unsigned long new_virt_end; unsigned long ram_phys_addr; @@ -1045,7 +1045,7 @@ static void qxl_add_memslot(PCIQXLDevice *d, uint32_t slot_id) end = slot->mem_end; printf("%s: slot %d start: 0x%lx end: 0x%lx\n", __FUNCTION__, slot_id, start, end); - + PANIC_ON(slot_id >= NUM_MEMSLOTS); PANIC_ON(d->state.mem_slots[slot_id].active); PANIC_ON(slot_id == 0); @@ -1178,7 +1178,7 @@ static uint32_t ioport_read(void *opaque, uint32_t addr) return 0xff; } -static void ioport_map(PCIDevice *pci_dev, int region_num, +static void ioport_map(PCIDevice *pci_dev, int region_num, uint32_t addr, uint32_t size, int type) { QXLState *s = &((PCIQXLDevice *)pci_dev)->state; @@ -1346,7 +1346,8 @@ static void init_qxl_ram(QXLState *s, uint8_t *buf, uint32_t actual_ram_size) s->rom->draw_area_offset = s->rom->ram_header_offset - draw_area_size; s->rom->pages_offset = 0; - s->rom->num_io_pages = (actual_ram_size - (draw_area_size + ram_header_size)) >> TARGET_PAGE_BITS; + s->rom->num_io_pages = (actual_ram_size - (draw_area_size + ram_header_size)) >> + TARGET_PAGE_BITS; printf("%s: npages %u\n", __FUNCTION__, s->rom->num_io_pages); } @@ -1492,7 +1493,7 @@ static void qxl_vga_update(void) static void qxl_display_resize(struct DisplayState *ds, int w, int h) { - PCIQXLDevice *client; + PCIQXLDevice *client; uint8_t *data = ds->data; size_t buf_size; @@ -1871,7 +1872,9 @@ static void unregister_mode_notifier(PCIQXLDevice *d, QXLModeNotifier *notifier) } } -static VDObjectRef interface_register_mode_change(QXLInterface *qxl, qxl_mode_change_notifier_t notifier, void *opaque) +static VDObjectRef interface_register_mode_change(QXLInterface *qxl, + qxl_mode_change_notifier_t notifier, + void *opaque) { PCIQXLDevice *d = ((Interface *)qxl)->d; @@ -1955,7 +1958,7 @@ static int interface_flush_resources(QXLInterface *qxl) return _qxl_flush_resources(((Interface *)qxl)->d); } -static void regitser_interface(PCIQXLDevice *d) +static void register_interface(PCIQXLDevice *d) { Interface *interface = (Interface *)qemu_mallocz(sizeof(*interface)); @@ -2148,7 +2151,7 @@ static void vdi_port_vm_change_state_handler(void *opaque, int running) } } -static void vdi_port_init(PCIBus *bus, uint8_t *ram, unsigned long ram_offset, +static void vdi_port_init(PCIBus *bus, uint8_t *ram, unsigned long ram_offset, uint32_t ram_size) { PCIVDIPortDevice *d; @@ -2176,7 +2179,6 @@ static void vdi_port_init(PCIBus *bus, uint8_t *ram, unsigned long ram_offset, d->ram_size = ram_size; d->new_gen_on_resume = FALSE; d->running = FALSE; - pci_register_io_region(&d->pci_dev, VDI_PORT_IO_RANGE_INDEX, msb_mask(VDI_PORT_IO_RANGE_SIZE * 2 - 1), @@ -2194,7 +2196,7 @@ static void vdi_port_init(PCIBus *bus, uint8_t *ram, unsigned long ram_offset, void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, uint32_t vram_size, uint32_t in_ram_size, QXLAddressRange *address_ranges, - uint8_t num_ranges) + uint8_t num_ranges) { PCIQXLDevice *d; PCIConf *pci_conf; @@ -2244,7 +2246,7 @@ void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, ASSERT(vram_size > qxl_ram_size); rom_size = init_qxl_rom(d, vram + qxl_ram_size , vram_size - qxl_ram_size, &max_fb); - rom_size = MAX(rom_size, TARGET_PAGE_SIZE); + rom_size = MAX(rom_size, TARGET_PAGE_SIZE); rom_size = msb_mask(rom_size * 2 - 1); d->state.rom_offset = vram_offset + qxl_ram_size; d->state.rom_size = rom_size; @@ -2277,7 +2279,7 @@ void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, d->state.vram, d->state.vram_offset, d->state.vram_size); - + pci_register_io_region(&d->pci_dev, QXL_IO_RANGE_INDEX, msb_mask(QXL_IO_RANGE_SIZE * 2 - 1), PCI_ADDRESS_SPACE_IO, ioport_map); @@ -2290,7 +2292,7 @@ void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, d->state.ram_size, PCI_ADDRESS_SPACE_MEM, ram_map); #ifdef QXL_IO_MEM - d->state.qxl_io_memory = cpu_register_io_memory(0, qxl_mem_read, + d->state.qxl_io_memory = cpu_register_io_memory(0, qxl_mem_read, qxl_mem_write, NULL); ASSERT(d->state.qxl_io_memory > 0); pci_register_io_region(&d->pci_dev, QXL_VRAM_RANGE_INDEX, d->state.vram_size, @@ -2298,7 +2300,7 @@ void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, #else pci_register_io_region(&d->pci_dev, QXL_VRAM_RANGE_INDEX, d->state.vram_size, PCI_ADDRESS_SPACE_MEM_PREFETCH, vram_map); -#endif +#endif d->dev_next = dev_list; dev_list = d; d->vga_next = qxl_vga.clients; @@ -2307,9 +2309,9 @@ void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, qxl_reset_state(d); qxl_init_memslots(d); init_pipe_signaling(d); - + #ifdef CONFIG_SPICE - regitser_interface(d); + register_interface(d); #endif if (!d->worker) { creat_native_worker(d, device_id); @@ -2318,7 +2320,7 @@ void qxl_init(PCIBus *bus, uint8_t *vram, unsigned long vram_offset, if (QXL_SHARED_VGA_MODE || !d->id) { qxl_enter_vga_mode(d); d->worker->attach(d->worker); - } + } qemu_register_reset(reset_handler, d); device_id++; } |
From: Yaniv K. <yk...@re...> - 2010-02-01 13:23:24
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit a85232b0b91146e4226f494675b3385ef42b5426 Author: Uri Lublin <ur...@re...> Date: Wed Jan 13 18:17:48 2010 +0200 spice: Adding README to all subdirs Also adding some information to toplevel (spice) README And do not touch README when running autogen.sh Signed-off-by: Uri Lublin <ur...@re...> diff --git a/README b/README index b55a222..9324b03 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Copyright 2009 Red Hat, Inc. and/or its affiliates. +Copyright 2009 Red Hat, Inc. and/or its affiliates. This program is licensed to you under the GNU General Public License, version 2 or (at your option) any later version published by the Free @@ -8,3 +8,6 @@ There is NO WARRANTY for this software, not even the implied warranties of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. +Implementation of the SPICE protocol. +Includes spice-server (library) and spice-client. +For more information look at spice-space.org diff --git a/autogen.sh.shared b/autogen.sh.shared index 453dac2..aa94ec6 100755 --- a/autogen.sh.shared +++ b/autogen.sh.shared @@ -148,7 +148,7 @@ if test -n "$p"; then printbold "Setting up $p toplevel" fi -touch NEWS README AUTHORS ChangeLog ### ToDo: define those. +touch NEWS AUTHORS ChangeLog ### ToDo: define those. mkdir -p m4 do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS do_cmd $ACLOCAL $ACLOCAL_FLAGS diff --git a/client/README b/client/README new file mode 100644 index 0000000..01d1cb9 --- /dev/null +++ b/client/README @@ -0,0 +1,12 @@ +Copyright 2009 Red Hat, Inc. and/or its affiliates. + +This program is licensed to you under the GNU General Public License, +version 2 or (at your option) any later version published by the Free +Software Foundation. See the file COPYING for details. + +There is NO WARRANTY for this software, not even the implied +warranties of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A +PARTICULAR PURPOSE. + +Implementation of the client side of the SPICE protocol. +For more information look at spice-space.org diff --git a/common/README b/common/README new file mode 100644 index 0000000..677015b --- /dev/null +++ b/common/README @@ -0,0 +1,12 @@ +Copyright 2009 Red Hat, Inc. and/or its affiliates. + +This program is licensed to you under the GNU General Public License, +version 2 or (at your option) any later version published by the Free +Software Foundation. See the file COPYING for details. + +There is NO WARRANTY for this software, not even the implied +warranties of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A +PARTICULAR PURPOSE. + +Common source file used to build both spice-server and spice-client. +For more information look at spice-space.org diff --git a/server/README b/server/README new file mode 100644 index 0000000..0c6eaa7 --- /dev/null +++ b/server/README @@ -0,0 +1,12 @@ +Copyright 2009 Red Hat, Inc. and/or its affiliates. + +This program is licensed to you under the GNU General Public License, +version 2 or (at your option) any later version published by the Free +Software Foundation. See the file COPYING for details. + +There is NO WARRANTY for this software, not even the implied +warranties of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A +PARTICULAR PURPOSE. + +Implementation of the server side of SPICE protocol (library). +For more information look at spice-space.org |
From: Yaniv K. <yk...@re...> - 2010-02-01 11:46:14
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit b903607ba4c792d31120be5bad883e38fe9957d9 Author: Yaniv Kamay <yk...@re...> Date: Mon Feb 1 13:46:03 2010 +0200 remove unused lookup3 diff --git a/common/Makefile.am b/common/Makefile.am index 7fcdfe9..f145ba8 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -13,8 +13,6 @@ COMMON_SRCS = \ glc.h \ glc.c \ gl_utils.h \ - lookup3.h \ - lookup3.c \ lz_common.h \ mutex.h \ ogl_ctx.h \ diff --git a/common/lookup3.c b/common/lookup3.c deleted file mode 100644 index f23461a..0000000 --- a/common/lookup3.c +++ /dev/null @@ -1,769 +0,0 @@ -/* -------------------------------------------------------------------------------- -lookup3.c, by Bob Jenkins, May 2006, Public Domain. - -These are functions for producing 32-bit hashes for hash table lookup. -hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() -are externally useful functions. Routines to test the hash are included -if SELF_TEST is defined. You can use this free for any purpose. It's in -the public domain. It has no warranty. - -You probably want to use hashlittle(). hashlittle() and hashbig() -hash byte arrays. hashlittle() is is faster than hashbig() on -little-endian machines. Intel and AMD are little-endian machines. -On second thought, you probably want hashlittle2(), which is identical to -hashlittle() except it returns two 32-bit hashes for the price of one. -You could implement hashbig2() if you wanted but I haven't bothered here. - -If you want to find a hash of, say, exactly 7 integers, do - a = i1; b = i2; c = i3; - mix(a,b,c); - a += i4; b += i5; c += i6; - mix(a,b,c); - a += i7; - final(a,b,c); -then use c as the hash value. If you have a variable length array of -4-byte integers to hash, use hashword(). If you have a byte array (like -a character string), use hashlittle(). If you have several byte arrays, or -a mix of things, see the comments above hashlittle(). - -Why is this so big? I read 12 bytes at a time into 3 4-byte integers, -then mix those integers. This is fast (you can do a lot more thorough -mixing with 12*3 instructions on 3 integers than you can with 3 instructions -on 1 byte), but shoehorning those bytes into integers efficiently is messy. -------------------------------------------------------------------------------- -*/ - -#include <stdio.h> /* defines printf for tests */ -#include <time.h> /* defines time_t for timings in the test */ -#include "lookup3.h" -#ifdef linux -# include <endian.h> /* attempt to define endianness */ -#endif - -/* - * My best guess at if you are big-endian or little-endian. This may - * need adjustment. - */ -#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ - __BYTE_ORDER == __LITTLE_ENDIAN) || \ - (defined(i386) || defined(__i386__) || defined(__i486__) || \ - defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL)) -# define HASH_LITTLE_ENDIAN 1 -# define HASH_BIG_ENDIAN 0 -#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ - __BYTE_ORDER == __BIG_ENDIAN) || \ - (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 1 -#else -# define HASH_LITTLE_ENDIAN 0 -# define HASH_BIG_ENDIAN 0 -#endif - -#define hashsize(n) ((uint32_t)1<<(n)) -#define hashmask(n) (hashsize(n)-1) -#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) - -/* -------------------------------------------------------------------------------- -mix -- mix 3 32-bit values reversibly. - -This is reversible, so any information in (a,b,c) before mix() is -still in (a,b,c) after mix(). - -If four pairs of (a,b,c) inputs are run through mix(), or through -mix() in reverse, there are at least 32 bits of the output that -are sometimes the same for one pair and different for another pair. -This was tested for: -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that -satisfy this are - 4 6 8 16 19 4 - 9 15 3 18 27 15 - 14 9 3 7 17 3 -Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing -for "differ" defined as + with a one-bit base and a two-bit delta. I -used http://burtleburtle.net/bob/hash/avalanche.html to choose -the operations, constants, and arrangements of the variables. - -This does not achieve avalanche. There are input bits of (a,b,c) -that fail to affect some output bits of (a,b,c), especially of a. The -most thoroughly mixed value is c, but it doesn't really even achieve -avalanche in c. - -This allows some parallelism. Read-after-writes are good at doubling -the number of bits affected, so the goal of mixing pulls in the opposite -direction as the goal of parallelism. I did what I could. Rotates -seem to cost as much as shifts on every machine I could lay my hands -on, and rotates are much kinder to the top and bottom bits, so I used -rotates. -------------------------------------------------------------------------------- -*/ -#define mix(a,b,c) \ -{ \ - a -= c; a ^= rot(c, 4); c += b; \ - b -= a; b ^= rot(a, 6); a += c; \ - c -= b; c ^= rot(b, 8); b += a; \ - a -= c; a ^= rot(c,16); c += b; \ - b -= a; b ^= rot(a,19); a += c; \ - c -= b; c ^= rot(b, 4); b += a; \ -} - -/* -------------------------------------------------------------------------------- -final -- final mixing of 3 32-bit values (a,b,c) into c - -Pairs of (a,b,c) values differing in only a few bits will usually -produce values of c that look totally different. This was tested for -* pairs that differed by one bit, by two bits, in any combination - of top bits of (a,b,c), or in any combination of bottom bits of - (a,b,c). -* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed - the output delta to a Gray code (a^(a>>1)) so a string of 1's (as - is commonly produced by subtraction) look like a single 1-bit - difference. -* the base values were pseudorandom, all zero but one bit set, or - all zero plus a counter that starts at zero. - -These constants passed: - 14 11 25 16 4 14 24 - 12 14 25 16 4 14 24 -and these came close: - 4 8 15 26 3 22 24 - 10 8 15 26 3 22 24 - 11 8 15 26 3 22 24 -------------------------------------------------------------------------------- -*/ -#define final(a,b,c) \ -{ \ - c ^= b; c -= rot(b,14); \ - a ^= c; a -= rot(c,11); \ - b ^= a; b -= rot(a,25); \ - c ^= b; c -= rot(b,16); \ - a ^= c; a -= rot(c,4); \ - b ^= a; b -= rot(a,14); \ - c ^= b; c -= rot(b,24); \ -} - -/* --------------------------------------------------------------------- - This works on all machines. To be useful, it requires - -- that the key be an array of uint32_t's, and - -- that the length be the number of uint32_t's in the key - - The function hashword() is identical to hashlittle() on little-endian - machines, and identical to hashbig() on big-endian machines, - except that the length has to be measured in uint32_ts rather than in - bytes. hashlittle() is more complicated than hashword() only because - hashlittle() has to dance around fitting the key bytes into registers. --------------------------------------------------------------------- -*/ -uint32_t hashword( -const uint32_t *k, /* the key, an array of uint32_t values */ -size_t length, /* the length of the key, in uint32_ts */ -uint32_t initval) /* the previous hash, or an arbitrary value */ -{ - uint32_t a,b,c; - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; - - /*------------------------------------------------- handle most of the key */ - while (length > 3) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 3; - k += 3; - } - - /*------------------------------------------- handle the last 3 uint32_t's */ - switch(length) /* all the case statements fall through */ - { - case 3 : c+=k[2]; - case 2 : b+=k[1]; - case 1 : a+=k[0]; - final(a,b,c); - case 0: /* case 0: nothing left to add */ - break; - } - /*------------------------------------------------------ report the result */ - return c; -} - - -/* --------------------------------------------------------------------- -hashword2() -- same as hashword(), but take two seeds and return two -32-bit values. pc and pb must both be nonnull, and *pc and *pb must -both be initialized with seeds. If you pass in (*pb)==0, the output -(*pc) will be the same as the return value from hashword(). --------------------------------------------------------------------- -*/ -void hashword2 ( -const uint32_t *k, /* the key, an array of uint32_t values */ -size_t length, /* the length of the key, in uint32_ts */ -uint32_t *pc, /* IN: seed OUT: primary hash value */ -uint32_t *pb) /* IN: more seed OUT: secondary hash value */ -{ - uint32_t a,b,c; - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32_t)(length<<2)) + *pc; - c += *pb; - - /*------------------------------------------------- handle most of the key */ - while (length > 3) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 3; - k += 3; - } - - /*------------------------------------------- handle the last 3 uint32_t's */ - switch(length) /* all the case statements fall through */ - { - case 3 : c+=k[2]; - case 2 : b+=k[1]; - case 1 : a+=k[0]; - final(a,b,c); - case 0: /* case 0: nothing left to add */ - break; - } - /*------------------------------------------------------ report the result */ - *pc=c; *pb=b; -} - - -/* -------------------------------------------------------------------------------- -hashlittle() -- hash a variable-length key into a 32-bit value - k : the key (the unaligned variable-length array of bytes) - length : the length of the key, counting by bytes - initval : can be any 4-byte value -Returns a 32-bit value. Every bit of the key affects every bit of -the return value. Two keys differing by one or two bits will have -totally different hash values. - -The best hash table sizes are powers of 2. There is no need to do -mod a prime (mod is sooo slow!). If you need less than 32 bits, -use a bitmask. For example, if you need only 10 bits, do - h = (h & hashmask(10)); -In which case, the hash table should have hashsize(10) elements. - -If you are hashing n strings (uint8_t **)k, do it like this: - for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h); - -By Bob Jenkins, 2006. bob...@bu.... You may use this -code any way you wish, private, educational, or commercial. It's free. - -Use for hash table lookup, or anything where one collision in 2^^32 is -acceptable. Do NOT use for cryptographic purposes. -------------------------------------------------------------------------------- -*/ - -uint32_t hashlittle( const void *key, size_t length, uint32_t initval) -{ - uint32_t a,b,c; /* internal state */ - union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; - - u.ptr = key; - if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { - const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ -#ifdef VALGRIND - const uint8_t *k8; -#endif - - /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - /* - * "k[2]&0xffffff" actually reads beyond the end of the string, but - * then masks off the part it's not allowed to read. Because the - * string is aligned, the masked-off tail is in the same word as the - * rest of the string. Every machine with memory protection I've seen - * does it on word boundaries, so is OK with this. But VALGRIND will - * still catch it and complain. The masking trick does make the hash - * noticably faster for short strings (like English words). - */ -#ifndef VALGRIND - - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]&0xffffff; a+=k[0]; break; - case 6 : b+=k[1]&0xffff; a+=k[0]; break; - case 5 : b+=k[1]&0xff; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]&0xffffff; break; - case 2 : a+=k[0]&0xffff; break; - case 1 : a+=k[0]&0xff; break; - case 0 : return c; /* zero length strings require no mixing */ - } - -#else /* make valgrind happy */ - - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]; break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ - case 1 : a+=k8[0]; break; - case 0 : return c; - } - -#endif /* !valgrind */ - - } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { - const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ - const uint8_t *k8; - - /*--------------- all but last block: aligned reads and different mixing */ - while (length > 12) - { - a += k[0] + (((uint32_t)k[1])<<16); - b += k[2] + (((uint32_t)k[3])<<16); - c += k[4] + (((uint32_t)k[5])<<16); - mix(a,b,c); - length -= 12; - k += 6; - } - - /*----------------------------- handle the last (probably partial) block */ - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[4]+(((uint32_t)k[5])<<16); - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=k[4]; - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=k[2]; - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=k[0]; - break; - case 1 : a+=k8[0]; - break; - case 0 : return c; /* zero length requires no mixing */ - } - - } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - a += ((uint32_t)k[1])<<8; - a += ((uint32_t)k[2])<<16; - a += ((uint32_t)k[3])<<24; - b += k[4]; - b += ((uint32_t)k[5])<<8; - b += ((uint32_t)k[6])<<16; - b += ((uint32_t)k[7])<<24; - c += k[8]; - c += ((uint32_t)k[9])<<8; - c += ((uint32_t)k[10])<<16; - c += ((uint32_t)k[11])<<24; - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; - case 1 : a+=k[0]; - break; - case 0 : return c; - } - } - - final(a,b,c); - return c; -} - - -/* - * hashlittle2: return 2 32-bit hash values - * - * This is identical to hashlittle(), except it returns two 32-bit hash - * values instead of just one. This is good enough for hash table - * lookup with 2^^64 buckets, or if you want a second hash if you're not - * happy with the first, or if you want a probably-unique 64-bit ID for - * the key. *pc is better mixed than *pb, so use *pc first. If you want - * a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)". - */ -void hashlittle2( - const void *key, /* the key to hash */ - size_t length, /* length of the key */ - uint32_t *pc, /* IN: primary initval, OUT: primary hash */ - uint32_t *pb) /* IN: secondary initval, OUT: secondary hash */ -{ - uint32_t a,b,c; /* internal state */ - union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32_t)length) + *pc; - c += *pb; - - u.ptr = key; - if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { - const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ -#ifdef VALGRIND - const uint8_t *k8; -#endif - - /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - /* - * "k[2]&0xffffff" actually reads beyond the end of the string, but - * then masks off the part it's not allowed to read. Because the - * string is aligned, the masked-off tail is in the same word as the - * rest of the string. Every machine with memory protection I've seen - * does it on word boundaries, so is OK with this. But VALGRIND will - * still catch it and complain. The masking trick does make the hash - * noticably faster for short strings (like English words). - */ -#ifndef VALGRIND - - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]&0xffffff; a+=k[0]; break; - case 6 : b+=k[1]&0xffff; a+=k[0]; break; - case 5 : b+=k[1]&0xff; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]&0xffffff; break; - case 2 : a+=k[0]&0xffff; break; - case 1 : a+=k[0]&0xff; break; - case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ - } - -#else /* make valgrind happy */ - - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]; break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ - case 1 : a+=k8[0]; break; - case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ - } - -#endif /* !valgrind */ - - } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { - const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ - const uint8_t *k8; - - /*--------------- all but last block: aligned reads and different mixing */ - while (length > 12) - { - a += k[0] + (((uint32_t)k[1])<<16); - b += k[2] + (((uint32_t)k[3])<<16); - c += k[4] + (((uint32_t)k[5])<<16); - mix(a,b,c); - length -= 12; - k += 6; - } - - /*----------------------------- handle the last (probably partial) block */ - k8 = (const uint8_t *)k; - switch(length) - { - case 12: c+=k[4]+(((uint32_t)k[5])<<16); - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ - case 10: c+=k[4]; - b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 9 : c+=k8[8]; /* fall through */ - case 8 : b+=k[2]+(((uint32_t)k[3])<<16); - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ - case 6 : b+=k[2]; - a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 5 : b+=k8[4]; /* fall through */ - case 4 : a+=k[0]+(((uint32_t)k[1])<<16); - break; - case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ - case 2 : a+=k[0]; - break; - case 1 : a+=k8[0]; - break; - case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ - } - - } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - a += ((uint32_t)k[1])<<8; - a += ((uint32_t)k[2])<<16; - a += ((uint32_t)k[3])<<24; - b += k[4]; - b += ((uint32_t)k[5])<<8; - b += ((uint32_t)k[6])<<16; - b += ((uint32_t)k[7])<<24; - c += k[8]; - c += ((uint32_t)k[9])<<8; - c += ((uint32_t)k[10])<<16; - c += ((uint32_t)k[11])<<24; - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=((uint32_t)k[11])<<24; - case 11: c+=((uint32_t)k[10])<<16; - case 10: c+=((uint32_t)k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t)k[7])<<24; - case 7 : b+=((uint32_t)k[6])<<16; - case 6 : b+=((uint32_t)k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3])<<24; - case 3 : a+=((uint32_t)k[2])<<16; - case 2 : a+=((uint32_t)k[1])<<8; - case 1 : a+=k[0]; - break; - case 0 : *pc=c; *pb=b; return; /* zero length strings require no mixing */ - } - } - - final(a,b,c); - *pc=c; *pb=b; -} - - - -/* - * hashbig(): - * This is the same as hashword() on big-endian machines. It is different - * from hashlittle() on all machines. hashbig() takes advantage of - * big-endian byte ordering. - */ -uint32_t hashbig( const void *key, size_t length, uint32_t initval) -{ - uint32_t a,b,c; - union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */ - - /* Set up the internal state */ - a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; - - u.ptr = key; - if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) { - const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ -#ifdef VALGRIND - const uint8_t *k8; -#endif - - /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ - while (length > 12) - { - a += k[0]; - b += k[1]; - c += k[2]; - mix(a,b,c); - length -= 12; - k += 3; - } - - /*----------------------------- handle the last (probably partial) block */ - /* - * "k[2]<<8" actually reads beyond the end of the string, but - * then shifts out the part it's not allowed to read. Because the - * string is aligned, the illegal read is in the same word as the - * rest of the string. Every machine with memory protection I've seen - * does it on word boundaries, so is OK with this. But VALGRIND will - * still catch it and complain. The masking trick does make the hash - * noticably faster for short strings (like English words). - */ -#ifndef VALGRIND - - switch(length) - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=k[2]&0xffffff00; b+=k[1]; a+=k[0]; break; - case 10: c+=k[2]&0xffff0000; b+=k[1]; a+=k[0]; break; - case 9 : c+=k[2]&0xff000000; b+=k[1]; a+=k[0]; break; - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=k[1]&0xffffff00; a+=k[0]; break; - case 6 : b+=k[1]&0xffff0000; a+=k[0]; break; - case 5 : b+=k[1]&0xff000000; a+=k[0]; break; - case 4 : a+=k[0]; break; - case 3 : a+=k[0]&0xffffff00; break; - case 2 : a+=k[0]&0xffff0000; break; - case 1 : a+=k[0]&0xff000000; break; - case 0 : return c; /* zero length strings require no mixing */ - } - -#else /* make valgrind happy */ - - k8 = (const uint8_t *)k; - switch(length) /* all the case statements fall through */ - { - case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; - case 11: c+=((uint32_t)k8[10])<<8; /* fall through */ - case 10: c+=((uint32_t)k8[9])<<16; /* fall through */ - case 9 : c+=((uint32_t)k8[8])<<24; /* fall through */ - case 8 : b+=k[1]; a+=k[0]; break; - case 7 : b+=((uint32_t)k8[6])<<8; /* fall through */ - case 6 : b+=((uint32_t)k8[5])<<16; /* fall through */ - case 5 : b+=((uint32_t)k8[4])<<24; /* fall through */ - case 4 : a+=k[0]; break; - case 3 : a+=((uint32_t)k8[2])<<8; /* fall through */ - case 2 : a+=((uint32_t)k8[1])<<16; /* fall through */ - case 1 : a+=((uint32_t)k8[0])<<24; break; - case 0 : return c; - } - -#endif /* !VALGRIND */ - - } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; - - /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ - while (length > 12) - { - a += ((uint32_t)k[0])<<24; - a += ((uint32_t)k[1])<<16; - a += ((uint32_t)k[2])<<8; - a += ((uint32_t)k[3]); - b += ((uint32_t)k[4])<<24; - b += ((uint32_t)k[5])<<16; - b += ((uint32_t)k[6])<<8; - b += ((uint32_t)k[7]); - c += ((uint32_t)k[8])<<24; - c += ((uint32_t)k[9])<<16; - c += ((uint32_t)k[10])<<8; - c += ((uint32_t)k[11]); - mix(a,b,c); - length -= 12; - k += 12; - } - - /*-------------------------------- last block: affect all 32 bits of (c) */ - switch(length) /* all the case statements fall through */ - { - case 12: c+=k[11]; - case 11: c+=((uint32_t)k[10])<<8; - case 10: c+=((uint32_t)k[9])<<16; - case 9 : c+=((uint32_t)k[8])<<24; - case 8 : b+=k[7]; - case 7 : b+=((uint32_t)k[6])<<8; - case 6 : b+=((uint32_t)k[5])<<16; - case 5 : b+=((uint32_t)k[4])<<24; - case 4 : a+=k[3]; - case 3 : a+=((uint32_t)k[2])<<8; - case 2 : a+=((uint32_t)k[1])<<16; - case 1 : a+=((uint32_t)k[0])<<24; - break; - case 0 : return c; - } - } - - final(a,b,c); - return c; -} - diff --git a/common/lookup3.h b/common/lookup3.h deleted file mode 100644 index a2fbdea..0000000 --- a/common/lookup3.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2009 Red Hat, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __LOOKUP3_H -#define __LOOKUP3_H - -#ifdef __GNUC__ - -#include <stdint.h> - -#else - -#ifdef QXLDD -#include <windef.h> -#include "os_dep.h" -#else -#include <stddef.h> -#include <basetsd.h> -#endif - -typedef UINT32 uint32_t; -typedef UINT16 uint16_t; -typedef UINT8 uint8_t; - -#endif - -uint32_t hashlittle(const void *key, size_t length, uint32_t initval); - -#endif |
From: Yaniv K. <yk...@re...> - 2010-02-01 11:25:15
|
repository: /home/tlv/ykamay/open_spice_upload/qxl branch: master commit 2abecc28260c4a13de8cc641b6071caf3a8c4bbf Author: Izik Eidus <ie...@re...> Date: Thu Jan 7 22:39:10 2010 +0200 spice: qxl win driver: change debug level check Signed-off-by: Izik Eidus <ie...@re...> diff --git a/win/display/driver.c b/win/display/driver.c index 2f34240..36aa9db 100644 --- a/win/display/driver.c +++ b/win/display/driver.c @@ -116,7 +116,7 @@ void DebugPrint(PDev *pdev, int level, const char *message, ...) { va_list ap; - if (level >= (pdev ? (int)*pdev->log_level : DBG_LEVEL)) { + if (level > (pdev ? (int)*pdev->log_level : DBG_LEVEL)) { return; } va_start(ap, message); |
From: Yaniv K. <yk...@re...> - 2010-02-01 11:16:30
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit 7928bbd488150552fa868d5c7db3f60a1860fa07 Author: Yonit Halperin <yha...@re...> Date: Tue Jan 12 08:15:38 2010 +0200 client: fix unsafe access to an event member diff --git a/client/process_loop.cpp b/client/process_loop.cpp index 794f29d..b7b42e2 100644 --- a/client/process_loop.cpp +++ b/client/process_loop.cpp @@ -49,7 +49,7 @@ void SyncEvent::response(AbstractProcessLoop& events_loop) void SyncEvent::wait() { #ifdef RED_DEBUG - ASSERT(!_process_loop || !_process_loop->is_same_thread(pthread_self())); + ASSERT(_process_loop && !_process_loop->is_same_thread(pthread_self())); #endif Lock lock(_mutex); while (!_ready) { @@ -123,9 +123,6 @@ void EventsQueue::process_events() lock.unlock(); event->response(_owner); -#ifdef RED_DEBUG - event->set_process_loop(NULL); -#endif event->unref(); } } |
From: Yaniv K. <yk...@re...> - 2010-02-01 10:49:22
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit b2851ae6901bc79eb64f2f808a440bb27e6577c9 Author: Uri Lublin <ur...@re...> Date: Mon Jan 25 00:51:05 2010 +0200 spice: configure: check spice-common version of 0.4.2 instead of 0.4.1 This only affects spice-client and spice-server builds that are configured with --with-spice-common (which means that are using an installed spice-common package). Version has been increased to 0.4.2 lately. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/configure.ac.shared b/configure.ac.shared index 8c686c1..eca9943 100644 --- a/configure.ac.shared +++ b/configure.ac.shared @@ -177,7 +177,7 @@ AC_ARG_WITH(spice-common, [use_spice_common=no]) if test "x$use_spice_common" != "xno"; then - PKG_CHECK_MODULES(SPICE_COMMON, spice-common = 0.4.1) + PKG_CHECK_MODULES(SPICE_COMMON, spice-common = 0.4.2) SPICE_COMMON_SRCDIR=$(pkg-config --variable=common_src_dir spice-common) fi |
From: Yaniv K. <yk...@re...> - 2010-01-11 18:03:16
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit 8ceb531958cb649b7cc7f16f2f504125cb430fe4 Author: Yaniv Kamay <yk...@re...> Date: Mon Jan 11 19:57:29 2010 +0200 client: add Platform::term_printf Platform::term_printf is a variant of printf that on windows dynamically opens console in order to have visible output during command line processing. diff --git a/client/application.cpp b/client/application.cpp index 839885d..7655809 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1635,7 +1635,8 @@ const std::string& Application::get_password() //controller interface end -bool Application::set_channels_security(CmdLineParser& parser, bool on, char *val) +bool Application::set_channels_security(CmdLineParser& parser, bool on, char *val, + const char* arg0) { RedPeer::ConnectionOptions::Type option; option = (on) ? RedPeer::ConnectionOptions::CON_OP_SECURE : @@ -1653,7 +1654,8 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va if (!strcmp(val, "all")) { if ((val = parser.next_argument())) { - std::cout << "\"all\" is exclusive in secure-channels\n"; + Platform::term_printf("%s: \"all\" is exclusive in secure-channels\n", arg0); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } PeerConnectionOptMap::iterator iter = _peer_con_opt.begin(); @@ -1666,7 +1668,8 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va do { ChannelsNamesMap::iterator iter = channels_names.find(val); if (iter == channels_names.end()) { - std::cout << "bad channel name \"" << val << "\" in secure-channels\n"; + Platform::term_printf("%s: bad channel name \"%s\" in secure-channels\n", arg0, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } _peer_con_opt[(*iter).second] = option; @@ -1674,7 +1677,7 @@ bool Application::set_channels_security(CmdLineParser& parser, bool on, char *va return true; } -bool Application::set_canvas_option(CmdLineParser& parser, char *val) +bool Application::set_canvas_option(CmdLineParser& parser, char *val, const char* arg0) { typedef std::map< std::string, CanvasOption> CanvasNamesMap; CanvasNamesMap canvas_types; @@ -1688,19 +1691,23 @@ bool Application::set_canvas_option(CmdLineParser& parser, char *val) canvas_types["gl_pbuff"] = CANVAS_OPTION_OGL_PBUFF; #endif _canvas_types.clear(); + do { CanvasNamesMap::iterator iter = canvas_types.find(val); if (iter == canvas_types.end()) { - std::cout << "bad canvas type \"" << val << "\"\n"; + Platform::term_printf("%s: bad canvas type \"%s\"\n", arg0, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } _canvas_types.resize(_canvas_types.size() + 1); _canvas_types[_canvas_types.size() - 1] = (*iter).second; } while ((val = parser.next_argument())); + return true; } -bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char *val) +bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char *val, + const char* arg0) { typedef std::map< std::string, int> ChannelsNamesMap; ChannelsNamesMap channels_names; @@ -1713,7 +1720,8 @@ bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char * if (!strcmp(val, "all")) { if ((val = parser.next_argument())) { - std::cout << "\"all\" is exclusive\n"; + Platform::term_printf("%s: \"all\" is exclusive\n", arg0); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } for (unsigned int i = 0; i < _enabled_channels.size(); i++) { @@ -1725,7 +1733,8 @@ bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char * do { ChannelsNamesMap::iterator iter = channels_names.find(val); if (iter == channels_names.end()) { - std::cout << "bad channel name \"" << val << "\"\n"; + Platform::term_printf("%s: bad channel name \"%s\"\n", arg0, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } _enabled_channels[(*iter).second] = enable; @@ -1733,6 +1742,12 @@ bool Application::set_enable_channels(CmdLineParser& parser, bool enable, char * return true; } +void Application::on_cmd_line_invalid_arg(const char* arg0, const char* what, const char* val) +{ + Platform::term_printf("%s: invalid %s value %s\n", arg0, what, val); + _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; +} + void Application::register_channels() { if (_enabled_channels[RED_CHANNEL_DISPLAY]) { @@ -1838,16 +1853,14 @@ bool Application::process_cmd_line(int argc, char** argv) break; case SPICE_OPT_PORT: { if ((port = str_to_port(val)) == -1) { - std::cout << "invalid port " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + on_cmd_line_invalid_arg(argv[0], "port", val); return false; } break; } case SPICE_OPT_SPORT: { if ((sport = str_to_port(val)) == -1) { - std::cout << "invalid secure port " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + on_cmd_line_invalid_arg(argv[0], "secure port", val); return false; } break; @@ -1855,8 +1868,7 @@ bool Application::process_cmd_line(int argc, char** argv) case SPICE_OPT_FULL_SCREEN: if (val) { if (strcmp(val, "auto-conf")) { - std::cout << "invalid full screen mode " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + on_cmd_line_invalid_arg(argv[0], "full screen mode", val); return false; } auto_display_res = true; @@ -1867,33 +1879,27 @@ bool Application::process_cmd_line(int argc, char** argv) password = val; break; case SPICE_OPT_SECURE_CHANNELS: - if (!set_channels_security(parser, true, val)) { + if (!set_channels_security(parser, true, val, argv[0])) { return false; } break; case SPICE_OPT_UNSECURE_CHANNELS: - if (!set_channels_security(parser, false, val)) { + if (!set_channels_security(parser, false, val, argv[0])) { return false; } break; case SPICE_OPT_ENABLE_CHANNELS: - if (!set_enable_channels(parser, true, val)) { - std::cout << "invalid channels " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + if (!set_enable_channels(parser, true, val, argv[0])) { return false; } break; case SPICE_OPT_DISABLE_CHANNELS: - if (!set_enable_channels(parser, false, val)) { - std::cout << "invalid channels " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + if (!set_enable_channels(parser, false, val, argv[0])) { return false; } break; case SPICE_OPT_CANVAS_TYPE: - if (!set_canvas_option(parser, val)) { - std::cout << "invalid canvas option " << val << "\n"; - _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; + if (!set_canvas_option(parser, val, argv[0])) { return false; } break; @@ -1901,14 +1907,16 @@ bool Application::process_cmd_line(int argc, char** argv) parser.show_help(); return false; case CmdLineParser::OPTION_ERROR: + _exit_code = SPICEC_ERROR_CODE_CMD_LINE_ERROR; return false; default: - throw Exception("cmd line error"); + throw Exception("cmd line error", SPICEC_ERROR_CODE_CMD_LINE_ERROR); } } if (parser.is_set(SPICE_OPT_SECURE_CHANNELS) && !parser.is_set(SPICE_OPT_SPORT)) { - std::cout << "missing --secure-port\n"; + Platform::term_printf("%s: missing --secure-port\n", argv[0]); + _exit_code = SPICEC_ERROR_CODE_CMD_LINE_ERROR; return false; } @@ -1936,7 +1944,9 @@ bool Application::process_cmd_line(int argc, char** argv) (*iter).second = RedPeer::ConnectionOptions::CON_OP_SECURE; continue; } - std::cout << "missing --port or --sport\n"; + + Platform::term_printf("%s: missing --port or --sport\n", argv[0]); + _exit_code = SPICEC_ERROR_CODE_CMD_LINE_ERROR; return false; } diff --git a/client/application.h b/client/application.h index e1c702d..47cf29e 100644 --- a/client/application.h +++ b/client/application.h @@ -216,11 +216,12 @@ public: static int main(int argc, char** argv, const char* version_str); private: - bool set_channels_security(CmdLineParser& parser, bool on, char *val); - bool set_enable_channels(CmdLineParser& parser, bool enable, char *val); - bool set_canvas_option(CmdLineParser& parser, char *val); - void register_channels(); + bool set_channels_security(CmdLineParser& parser, bool on, char *val, const char* arg0); + bool set_enable_channels(CmdLineParser& parser, bool enable, char *val, const char* arg0); + bool set_canvas_option(CmdLineParser& parser, char *val, const char* arg0); + void on_cmd_line_invalid_arg(const char* arg0, const char* what, const char* val); bool process_cmd_line(int argc, char** argv); + void register_channels(); void abort(); void init_menu(); void unpress_all(); diff --git a/client/cmd_line_parser.cpp b/client/cmd_line_parser.cpp index 65ae404..caa4b03 100644 --- a/client/cmd_line_parser.cpp +++ b/client/cmd_line_parser.cpp @@ -344,7 +344,7 @@ int CmdLineParser::get_option(char** val) int name_pos = (opt_obj->type == REQUIRED_ARGUMENT) ? optind - 2 : optind - 1; std::string cmd_name(_argv[name_pos] + 2); if (cmd_name.find(opt_obj->name) != 0) { - std::cout << _argv[0] << ": invalid option '--" << cmd_name << "'\n"; + Platform::term_printf("%s: invalid option '--%s'\n", _argv[0], cmd_name.c_str()); return OPTION_ERROR; } #endif @@ -360,11 +360,11 @@ int CmdLineParser::get_option(char** val) case -1: { *val = NULL; if (!_positional_args && optind != _argc) { - std::cout << _argv[0] << ": unexpected positional arguments\n"; + Platform::term_printf("%s: unexpected positional arguments\n", _argv[0]); return OPTION_ERROR; } if ((opt_obj = find_missing_opt())) { - std::cout << _argv[0] << ": option --" << opt_obj->name << " is required\n"; + Platform::term_printf("%s: option --%s is required\n", _argv[0], opt_obj->name.c_str()); return OPTION_ERROR; } _done = true; @@ -378,18 +378,19 @@ int CmdLineParser::get_option(char** val) #ifdef DISABLE_ABBREVIATE std::string cmd_name(_argv[optind - 1] + 2); if (cmd_name.find(opt_obj->name) != 0) { - std::cout << _argv[0] << ": invalid option '--" << cmd_name << "'\n"; + Platform::term_printf("%s: invalid option '--%s'\n", _argv[0], cmd_name.c_str()); return OPTION_ERROR; } #endif - std::cout << _argv[0] << ": option --" << opt_obj->name << " requires an argument\n"; + Platform::term_printf("%s: option --%s requires an argument\n", + _argv[0], opt_obj->name.c_str()); } else if (optopt == 0) { - std::cout << _argv[0] << ": invalid option '" << _argv[optind - 1] << "'\n"; + Platform::term_printf("%s: invalid option '%s'\n", _argv[0], _argv[optind - 1]); } else if ((opt_obj = find((char)optopt))) { - std::cout << _argv[0] << ": option '-" << opt_obj->short_name << - "' requires an argument\n"; + Platform::term_printf("%s: option '-%c' requires an argument\n", + _argv[0], opt_obj->short_name); } else { - std::cout << _argv[0] << ": invalid option '-" << char(optopt) << "'\n"; + Platform::term_printf("%s: invalid option '-%c'\n", _argv[0], char(optopt)); } return OPTION_ERROR; default: @@ -447,13 +448,13 @@ void CmdLineParser::show_help() { static const int HELP_START_POS = 30; static const int HELP_WIDTH = 80 - HELP_START_POS; + std::ostringstream os; - std::cout << basename(_argv[0]) << " - " << _description.c_str() << "\n\noptions:\n\n"; + os << basename(_argv[0]) << " - " << _description.c_str() << "\n\noptions:\n\n"; Options::iterator iter = _options.begin(); for (; iter != _options.end(); ++iter) { CmdLineParser::Option* opt = *iter; - std::ostringstream os; if (opt->short_name) { os << " -" << opt->short_name << ", "; @@ -516,9 +517,9 @@ void CmdLineParser::show_help() line.clear(); } } while (line.size() || std::getline(is, line)); - - std::cout << os.str(); } - std::cout << "\n"; + + os << "\n"; + Platform::term_printf(os.str().c_str()); } diff --git a/client/platform.h b/client/platform.h index ec33554..5eb909d 100644 --- a/client/platform.h +++ b/client/platform.h @@ -42,6 +42,7 @@ public: static void path_append(std::string& path, const std::string& partial_path); static uint64_t get_process_id(); static uint64_t get_thread_id(); + static void term_printf(const char* format, ...); static void error_beep(); static const MonitorsList& init_monitors(); diff --git a/client/windows/main.cpp b/client/windows/main.cpp index a1575e9..afc98c9 100644 --- a/client/windows/main.cpp +++ b/client/windows/main.cpp @@ -22,12 +22,6 @@ extern "C" { #include "pthread.h" } -//#define OPEN_CONSOLE -#ifdef OPEN_CONSOLE -#include <io.h> -#include <conio.h> -#endif - #include "application.h" #include "debug.h" #include "utils.h" @@ -83,23 +77,6 @@ int WINAPI WinMain(HINSTANCE hInstance, try { init_version_string(); -#ifdef OPEN_CONSOLE - AllocConsole(); - HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); - int hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); - FILE * fp = _fdopen(hConHandle, "w"); - *stdout = *fp; - - h = GetStdHandle(STD_INPUT_HANDLE); - hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); - fp = _fdopen(hConHandle, "r"); - *stdin = *fp; - - h = GetStdHandle(STD_ERROR_HANDLE); - hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); - fp = _fdopen(hConHandle, "w"); - *stderr = *fp; -#endif pthread_win32_process_attach_np(); init_winsock(); exit_val = Application::main(__argc, __argv, version_string); @@ -114,11 +91,10 @@ int WINAPI WinMain(HINSTANCE hInstance, LOG_ERROR("unhandled exception"); exit_val = SPICEC_ERROR_CODE_ERROR; } + log4cpp::Category::shutdown(); -#ifdef OPEN_CONSOLE - _getch(); -#endif pthread_win32_process_detach_np(); + return exit_val; } diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index 67bb1a0..c364b35 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -18,6 +18,8 @@ #include "common.h" #include <shlobj.h> +#include <io.h> +#include <conio.h> #include "platform.h" #include "win_platform.h" @@ -745,3 +747,65 @@ void WinPlatform::exit_modal_loop() KillTimer(paltform_win, MODAL_LOOP_TIMER_ID); modal_loop_active = false; } + +static bool has_console = false; + +static void create_console() +{ + static Mutex console_mutex; + + Lock lock(console_mutex); + + if (has_console) { + return; + } + + AllocConsole(); + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + int hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); + FILE * fp = _fdopen(hConHandle, "w"); + *stdout = *fp; + + h = GetStdHandle(STD_INPUT_HANDLE); + hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); + fp = _fdopen(hConHandle, "r"); + *stdin = *fp; + + h = GetStdHandle(STD_ERROR_HANDLE); + hConHandle = _open_osfhandle((intptr_t)h, _O_TEXT); + fp = _fdopen(hConHandle, "w"); + *stderr = *fp; + + has_console = true; + + HWND consol_window = GetConsoleWindow(); + + if (consol_window) { + SetForegroundWindow(consol_window); + } +} + +class ConsoleWait { +public: + ~ConsoleWait() + { + if (has_console) { + Platform::term_printf("\n\nPress any key to exit..."); + _getch(); + } + } + +} console_wait; + + +void Platform::term_printf(const char* format, ...) +{ + if (!has_console) { + create_console(); + } + + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); +} diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 02250f1..6f55013 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -268,6 +268,14 @@ void Platform::yield() pthread_yield(); } +void Platform::term_printf(const char* format, ...) +{ + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); +} + void Platform::set_thread_priority(void* thread, Platform::ThreadPriority in_priority) { ASSERT(thread == NULL); diff --git a/common/red_error_codes.h b/common/red_error_codes.h index c08fd51..0c06899 100644 --- a/common/red_error_codes.h +++ b/common/red_error_codes.h @@ -45,6 +45,7 @@ #define SPICEC_ERROR_CODE_VERSION_MISMATCH (-11) #define SPICEC_ERROR_CODE_PERMISSION_DENIED (-12) #define SPICEC_ERROR_CODE_INVALID_ARG (-13) +#define SPICEC_ERROR_CODE_CMD_LINE_ERROR (-14) #endif |
From: Yaniv K. <yk...@re...> - 2010-01-11 18:03:14
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit ad121810278c1e2851f74c370e1cb36e52367be3 Author: Yaniv Kamay <yk...@re...> Date: Mon Jan 11 19:30:39 2010 +0200 client: move log file to spicec appdata dir diff --git a/client/application.cpp b/client/application.cpp index d4fe59f..a0e3436 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -57,6 +57,8 @@ mutex_t cairo_surface_user_data_mutex; #endif +static const char* app_name = "spicec"; + void ConnectedEvent::response(AbstractProcessLoop& events_loop) { static_cast<Application*>(events_loop.get_owner())->on_connected(); @@ -1822,8 +1824,8 @@ bool Application::process_cmd_line(int argc, char** argv) _host_auth_opt.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_NAME; - Platform::get_spice_config_dir(_host_auth_opt.CA_file); - _host_auth_opt.CA_file += CA_FILE_NAME; + Platform::get_app_data_dir(_host_auth_opt.CA_file, app_name); + Platform::path_append(_host_auth_opt.CA_file, CA_FILE_NAME); parser.begin(argc, argv); @@ -1954,15 +1956,17 @@ bool Application::process_cmd_line(int argc, char** argv) void Application::init_logger() { - std::string temp_dir_name; - Platform::get_temp_dir(temp_dir_name); - std::string log_file_name = temp_dir_name + "spicec.log"; + std::string log_file_name; + Platform::get_app_data_dir(log_file_name, app_name); + Platform::path_append(log_file_name, "spicec.log"); int fd = ::open(log_file_name.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0644); + if (fd == -1) { log4cpp::BasicConfigurator::configure(); return; } + log4cpp::Category& root = log4cpp::Category::getRoot(); #ifdef RED_DEBUG root.setPriority(log4cpp::Priority::DEBUG); diff --git a/client/platform.h b/client/platform.h index 87a44bb..ec33554 100644 --- a/client/platform.h +++ b/client/platform.h @@ -38,6 +38,8 @@ public: static void yield(); static uint64_t get_monolithic_time(); static void get_temp_dir(std::string& path); + static void get_app_data_dir(std::string& path, const std::string& app_name); + static void path_append(std::string& path, const std::string& partial_path); static uint64_t get_process_id(); static uint64_t get_thread_id(); static void error_beep(); @@ -48,8 +50,6 @@ public: static void send_quit_request(); - static void get_spice_config_dir(std::string& path); - enum ThreadPriority { PRIORITY_INVALID, PRIORITY_TIME_CRITICAL, diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index f332fac..67bb1a0 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -30,8 +30,6 @@ #include "cursor.h" #include "named_pipe.h" -#define SPICE_CONFIG_DIR "spicec\\" - int gdi_handlers = 0; extern HINSTANCE instance; @@ -437,7 +435,7 @@ bool Platform::is_monitors_pos_valid() return true; } -void Platform::get_spice_config_dir(std::string& path) +void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { char app_data_path[MAX_PATH]; HRESULT res = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, app_data_path); @@ -446,10 +444,17 @@ void Platform::get_spice_config_dir(std::string& path) } path = app_data_path; - if (strcmp((app_data_path + strlen(app_data_path) - 2), "\\") != 0) { - path += "\\"; + path_append(path, app_name); + + if (!CreateDirectoryA(path.c_str(), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) { + throw Exception("create user app data dir failed"); } - path += SPICE_CONFIG_DIR; +} + +void Platform::path_append(std::string& path, const std::string& partial_path) +{ + path += "\\"; + path += partial_path; } void Platform::init() diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 4a1f9b2..df689c0 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -64,8 +64,6 @@ #define USE_XRANDR_1_2 #endif -#define SPICE_CONFIG_DIR ".spicec/" - static Display* x_display = NULL; static bool x_shm_avail = false; static XVisualInfo **vinfo = NULL; @@ -1913,16 +1911,27 @@ bool Platform::is_monitors_pos_valid() return (ScreenCount(x_display) == 1); } -void Platform::get_spice_config_dir(std::string& path) +void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { - char* home_dir = getenv("HOME"); + const char* home_dir = getenv("HOME"); + if (!home_dir) { throw Exception("get home dir failed"); } path = home_dir; + path += "/."; + path += app_name; + + if (mkdir(path.c_str(), 0700) == -1 && errno != EEXIST) { + throw Exception("create appdata dir failed"); + } +} + +void Platform::path_append(std::string& path, const std::string& partial_path) +{ path += "/"; - path += SPICE_CONFIG_DIR; + path += partial_path; } static void root_win_proc(XEvent& event) |
From: Yaniv K. <yk...@re...> - 2010-01-11 17:58:43
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit 766c74f63cb005ba614c11a59b5da844f01cb335 Author: Yaniv Kamay <yk...@re...> Date: Sun Jan 10 13:37:05 2010 +0200 client: change rerror code to be positive diff --git a/common/red_error_codes.h b/common/red_error_codes.h index 0c06899..bff53dd 100644 --- a/common/red_error_codes.h +++ b/common/red_error_codes.h @@ -31,21 +31,21 @@ #ifndef RED_ERROR_CODES_H #define RED_ERROR_CODES_H -#define SPICEC_ERROR_CODE_SUCCESS (0) -#define SPICEC_ERROR_CODE_ERROR (-1) -#define SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED (-2) -#define SPICEC_ERROR_CODE_CONNECT_FAILED (-3) -#define SPICEC_ERROR_CODE_SOCKET_FAILED (-4) -#define SPICEC_ERROR_CODE_SEND_FAILED (-5) -#define SPICEC_ERROR_CODE_RECV_FAILED (-6) -#define SPICEC_ERROR_CODE_SSL_ERROR (-7) -#define SPICEC_ERROR_CODE_NOT_ENOUGH_MEMORY (-8) -#define SPICEC_ERROR_CODE_AGENT_TIMEOUT (-9) -#define SPICEC_ERROR_CODE_AGENT_ERROR (-10) -#define SPICEC_ERROR_CODE_VERSION_MISMATCH (-11) -#define SPICEC_ERROR_CODE_PERMISSION_DENIED (-12) -#define SPICEC_ERROR_CODE_INVALID_ARG (-13) -#define SPICEC_ERROR_CODE_CMD_LINE_ERROR (-14) +#define SPICEC_ERROR_CODE_SUCCESS 0 +#define SPICEC_ERROR_CODE_ERROR 1 +#define SPICEC_ERROR_CODE_GETHOSTBYNAME_FAILED 2 +#define SPICEC_ERROR_CODE_CONNECT_FAILED 3 +#define SPICEC_ERROR_CODE_SOCKET_FAILED 4 +#define SPICEC_ERROR_CODE_SEND_FAILED 5 +#define SPICEC_ERROR_CODE_RECV_FAILED 6 +#define SPICEC_ERROR_CODE_SSL_ERROR 7 +#define SPICEC_ERROR_CODE_NOT_ENOUGH_MEMORY 8 +#define SPICEC_ERROR_CODE_AGENT_TIMEOUT 9 +#define SPICEC_ERROR_CODE_AGENT_ERROR 10 +#define SPICEC_ERROR_CODE_VERSION_MISMATCH 11 +#define SPICEC_ERROR_CODE_PERMISSION_DENIED 12 +#define SPICEC_ERROR_CODE_INVALID_ARG 13 +#define SPICEC_ERROR_CODE_CMD_LINE_ERROR 14 #endif |
From: Yaniv K. <yk...@re...> - 2010-01-11 17:40:04
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit 3c1ff6448d847e6e96425fa166446b99bac5e592 Author: Yaniv Kamay <yk...@re...> Date: Mon Jan 11 19:39:54 2010 +0200 client: fix logger init mix-up diff --git a/client/application.cpp b/client/application.cpp index a0e3436..839885d 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -1971,12 +1971,12 @@ void Application::init_logger() #ifdef RED_DEBUG root.setPriority(log4cpp::Priority::DEBUG); root.removeAllAppenders(); - ::close(fd); - root.addAppender(new log4cpp::RollingFileAppender("_", log_file_name)); + root.addAppender(new log4cpp::FileAppender("_", fd)); #else root.setPriority(log4cpp::Priority::INFO); root.removeAllAppenders(); - root.addAppender(new log4cpp::FileAppender("_", fd)); + ::close(fd); + root.addAppender(new log4cpp::RollingFileAppender("_", log_file_name)); #endif } diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index df689c0..02250f1 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -1915,11 +1915,17 @@ void Platform::get_app_data_dir(std::string& path, const std::string& app_name) { const char* home_dir = getenv("HOME"); - if (!home_dir) { + if (!home_dir || strlen(home_dir) == 0) { throw Exception("get home dir failed"); } path = home_dir; + std::string::iterator end = path.end(); + + while (end != path.begin() && *(end - 1) == '/') { + path.erase(--end); + } + path += "/."; path += app_name; |
From: Yaniv K. <yk...@re...> - 2010-01-11 17:11:04
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: master commit 3eae1c80d97ce6d1e0eee69f7454973abdb94ef6 Author: Yonit Halperin <yha...@re...> Date: Sun Jan 10 09:48:38 2010 +0200 server,client: server authentication for secured channels. 3 available mechanisms: by public key, by host name, and by certificate subject name. In the former method, chain of trust verification is not performed. The CA certificate files are looked for under <spice-config-dir>/spice_truststore.pem windows <spice-config-dir>=%APPDATA%\spicec\ linux <spice-config-dir>=$HOME/.spicec/ diff --git a/client/application.cpp b/client/application.cpp index ac5877c..d4fe59f 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -51,6 +51,8 @@ #define STICKY_KEY_PIXMAP ALT_IMAGE_RES_ID #define STICKY_KEY_TIMEOUT 750 +#define CA_FILE_NAME "spice_truststore.pem" + #ifdef CAIRO_CANVAS_CACH_IS_SHARED mutex_t cairo_surface_user_data_mutex; #endif @@ -1818,6 +1820,11 @@ bool Application::process_cmd_line(int argc, char** argv) _peer_con_opt[i] = RedPeer::ConnectionOptions::CON_OP_INVALID; } + _host_auth_opt.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_NAME; + + Platform::get_spice_config_dir(_host_auth_opt.CA_file); + _host_auth_opt.CA_file += CA_FILE_NAME; + parser.begin(argc, argv); char* val; @@ -1836,12 +1843,11 @@ bool Application::process_cmd_line(int argc, char** argv) break; } case SPICE_OPT_SPORT: { - if ((port = str_to_port(val)) == -1) { + if ((sport = str_to_port(val)) == -1) { std::cout << "invalid secure port " << val << "\n"; _exit_code = SPICEC_ERROR_CODE_INVALID_ARG; return false; } - sport = port; break; } case SPICE_OPT_FULL_SCREEN: diff --git a/client/application.h b/client/application.h index 5fa9335..e1c702d 100644 --- a/client/application.h +++ b/client/application.h @@ -187,6 +187,7 @@ public: void external_show(); void connect(); const PeerConnectionOptMap& get_con_opt_map() {return _peer_con_opt;} + const RedPeer::HostAuthOptions& get_host_auth_opt() { return _host_auth_opt;} uint32_t get_mouse_mode(); const std::vector<int>& get_canvas_types() { return _canvas_types;} @@ -280,6 +281,7 @@ private: private: RedClient _client; PeerConnectionOptMap _peer_con_opt; + RedPeer::HostAuthOptions _host_auth_opt; std::vector<bool> _enabled_channels; std::vector<RedScreen*> _screens; RedScreen* _main_screen; diff --git a/client/platform.h b/client/platform.h index 1b4ef43..87a44bb 100644 --- a/client/platform.h +++ b/client/platform.h @@ -48,6 +48,8 @@ public: static void send_quit_request(); + static void get_spice_config_dir(std::string& path); + enum ThreadPriority { PRIORITY_INVALID, PRIORITY_TIME_CRITICAL, diff --git a/client/red_channel.cpp b/client/red_channel.cpp index c7dce01..25e4e04 100644 --- a/client/red_channel.cpp +++ b/client/red_channel.cpp @@ -89,6 +89,8 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) header.major_version); } + _remote_minor = header.minor_version; + AutoArray<uint8_t> reply_buf(new uint8_t[header.size]); recive(reply_buf.get(), header.size); @@ -155,11 +157,11 @@ void RedChannelBase::link(uint32_t connection_id, const std::string& password) } void RedChannelBase::connect(const ConnectionOptions& options, uint32_t connection_id, - uint32_t ip, std::string password) + const char* host, std::string password) { if (options.allow_unsecure()) { try { - RedPeer::connect_unsecure(ip, options.unsecure_port); + RedPeer::connect_unsecure(host, options.unsecure_port); link(connection_id, password); return; } catch (...) { @@ -170,16 +172,10 @@ void RedChannelBase::connect(const ConnectionOptions& options, uint32_t connecti } } ASSERT(options.allow_secure()); - RedPeer::connect_secure(options, ip); + RedPeer::connect_secure(options, host); link(connection_id, password); } -void RedChannelBase::connect(const ConnectionOptions& options, uint32_t connection_id, - const char* host, std::string password) -{ - connect(options, connection_id, host_by_name(host), password); -} - void RedChannelBase::set_capability(ChannelCaps& caps, uint32_t cap) { uint32_t word_index = cap / 32; @@ -399,7 +395,8 @@ void RedChannel::run() set_state(CONNECTING_STATE); ConnectionOptions con_options(_client.get_connection_options(get_type()), _client.get_port(), - _client.get_sport()); + _client.get_sport(), + _client.get_host_auth_options()); RedChannelBase::connect(con_options, _client.get_connection_id(), _client.get_host().c_str(), _client.get_password().c_str()); diff --git a/client/red_channel.h b/client/red_channel.h index c2f94bd..996aaf6 100644 --- a/client/red_channel.h +++ b/client/red_channel.h @@ -55,14 +55,14 @@ public: uint8_t get_type() { return _type;} uint8_t get_id() { return _id;} - void connect(const ConnectionOptions& options, uint32_t connection_id, uint32_t ip, - std::string password); void connect(const ConnectionOptions& options, uint32_t connection_id, const char *host, std::string password); const ChannelCaps& get_common_caps() { return _common_caps;} const ChannelCaps& get_caps() {return _caps;} + uint32_t get_peer_minor() { return _remote_minor;} + protected: void set_common_capability(uint32_t cap); void set_capability(uint32_t cap); @@ -83,6 +83,8 @@ private: ChannelCaps _remote_common_caps; ChannelCaps _remote_caps; + + uint32_t _remote_minor; }; class SendTrigger: public EventSources::Trigger { diff --git a/client/red_client.cpp b/client/red_client.cpp index e040f63..57ec350 100644 --- a/client/red_client.cpp +++ b/client/red_client.cpp @@ -23,6 +23,15 @@ #include "utils.h" #include "debug.h" +#ifdef __GNUC__ +typedef struct __attribute__ ((__packed__)) OldRedMigrationBegin { +#else +typedef struct __declspec(align(1)) OldRedMigrationBegin { +#endif + uint16_t port; + uint16_t sport; + char host[0]; +} OldRedMigrationBegin; class MouseModeEvent: public Event { public: @@ -156,18 +165,19 @@ void Migrate::connect_one(MigChannel& channel, const RedPeer::ConnectionOptions& void Migrate::run() { uint32_t connection_id; + RedPeer::ConnectionOptions::Type conn_type; DBG(0, ""); try { - RedPeer::ConnectionOptions con_opt(_client.get_connection_options(RED_CHANNEL_MAIN), - _port, _port); + conn_type = _client.get_connection_options(RED_CHANNEL_MAIN); + RedPeer::ConnectionOptions con_opt(conn_type, _port, _sport, _auth_options); MigChannels::iterator iter = _channels.begin(); connection_id = _client.get_connection_id(); connect_one(**iter, con_opt, connection_id); + for (++iter; iter != _channels.end(); ++iter) { - con_opt = RedPeer::ConnectionOptions( - _client.get_connection_options((*iter)->get_type()), - _port, _sport); + conn_type = _client.get_connection_options((*iter)->get_type()); + con_opt = RedPeer::ConnectionOptions(conn_type, _port, _sport, _auth_options); connect_one(**iter, con_opt, connection_id); } _connected = true; @@ -199,9 +209,24 @@ void Migrate::start(const RedMigrationBegin* migrate) { DBG(0, ""); abort(); - _host.assign(migrate->host); - _port = migrate->port ? migrate->port : -1; - _sport = migrate->sport ? migrate->sport : -1; + if ((RED_VERSION_MAJOR == 1) && (_client.get_peer_minor() < 2)) { + LOG_INFO("server minor version incompatible for destination authentication" + "(missing dest pubkey in RedMigrationBegin)"); + OldRedMigrationBegin* old_migrate = (OldRedMigrationBegin*)migrate; + _host.assign(old_migrate->host); + _port = old_migrate->port ? old_migrate->port : -1; + _sport = old_migrate->sport ? old_migrate->sport : -1;; + _auth_options = _client.get_host_auth_options(); + } else { + _host.assign(((char*)migrate) + migrate->host_offset); + _port = migrate->port ? migrate->port : -1; + _sport = migrate->sport ? migrate->sport : -1; + _auth_options.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_PUBKEY; + _auth_options.host_pubkey.assign(((uint8_t*)migrate)+ migrate->pub_key_offset, + ((uint8_t*)migrate)+ migrate->pub_key_offset + + migrate->pub_key_size); + } + _password = _client._password; Lock lock(_lock); _running = true; @@ -433,6 +458,8 @@ void RedClient::connect() for (; iter != end; iter++) { _con_opt_map[(*iter).first] = (*iter).second; } + + _host_auth_opt = _application.get_host_auth_opt(); RedChannel::connect(); } diff --git a/client/red_client.h b/client/red_client.h index a98d2d2..7cc700e 100644 --- a/client/red_client.h +++ b/client/red_client.h @@ -76,6 +76,7 @@ private: std::string _host; int _port; int _sport; + RedPeer::HostAuthOptions _auth_options; Thread* _thread; Mutex _lock; Condition _cond; @@ -153,6 +154,7 @@ public: Application& get_application() { return _application;} bool is_auto_display_res() { return _auto_display_res;} RedPeer::ConnectionOptions::Type get_connection_options(uint32_t channel_type); + RedPeer::HostAuthOptions& get_host_auth_options() { return _host_auth_opt;} void get_sync_info(uint8_t channel_type, uint8_t channel_id, SyncInfo& info); void wait_for_channels(int wait_list_size, RedWaitForChannel* wait_list); PixmapCache& get_pixmap_cache() {return _pixmap_cache;} @@ -222,6 +224,7 @@ private: AutoRef<AgentTimer> _agent_timer; PeerConnectionOptMap _con_opt_map; + RedPeer::HostAuthOptions _host_auth_opt; Migrate _migrate; Mutex _channels_lock; typedef std::list<ChannelFactory*> Factorys; diff --git a/client/red_peer.cpp b/client/red_peer.cpp index 79409ed..0fd6024 100644 --- a/client/red_peer.cpp +++ b/client/red_peer.cpp @@ -16,16 +16,26 @@ */ #include "common.h" +#include <openssl/x509.h> +#include <openssl/x509v3.h> #include "red.h" #include "red_peer.h" #include "utils.h" #include "debug.h" #include "platform_utils.h" +typedef struct SslVerifyCbData { + RedPeer::HostAuthOptions info; + const char* host_name; + bool all_preverify_ok; +} SslVerifyCbData; + static void ssl_error() { + unsigned long last_error = ERR_peek_last_error(); + ERR_print_errors_fp(stderr); - THROW_ERR(SPICEC_ERROR_CODE_SSL_ERROR, "SSL Error"); + THROW_ERR(SPICEC_ERROR_CODE_SSL_ERROR, "SSL Error:", ERR_error_string(last_error, NULL)); } RedPeer::RedPeer() @@ -80,13 +90,15 @@ uint32_t RedPeer::host_by_name(const char* host) return ntohl(return_value); } -void RedPeer::connect_unsecure(uint32_t ip, int port) +void RedPeer::connect_unsecure(const char* host, int port) { struct sockaddr_in addr; int no_delay; - + uint32_t ip; ASSERT(_ctx == NULL && _ssl == NULL && _peer == INVALID_SOCKET); try { + ip = host_by_name(host); + addr.sin_port = htons(port); addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(ip); @@ -120,15 +132,349 @@ void RedPeer::connect_unsecure(uint32_t ip, int port) } } -void RedPeer::connect_unsecure(const char* host, int port) +bool RedPeer::verify_pubkey(X509* cert, const HostAuthOptions::PublicKey& key) +{ + EVP_PKEY* cert_pubkey = NULL; + EVP_PKEY* orig_pubkey = NULL; + BIO* bio = NULL; + uint8_t* c_key = NULL; + int ret = 0; + + if (key.empty()) { + return false; + } + + ASSERT(cert); + + try { + cert_pubkey = X509_get_pubkey(cert); + if (!cert_pubkey) { + THROW("reading public key from certificate failed"); + } + + c_key = new uint8_t[key.size()]; + memcpy(c_key, &key[0], key.size()); + + bio = BIO_new_mem_buf((void*)c_key, key.size()); + if (!bio) { + THROW("creating BIO failed"); + } + + orig_pubkey = d2i_PUBKEY_bio(bio, NULL); + if (!orig_pubkey) { + THROW("reading pubkey from bio failed"); + } + + ret = EVP_PKEY_cmp(orig_pubkey, cert_pubkey); + + BIO_free(bio); + EVP_PKEY_free(orig_pubkey); + EVP_PKEY_free(cert_pubkey); + delete []c_key; + if (ret == 1) { + DBG(0, "public keys match"); + return true; + } else if (ret == 0) { + DBG(0, "public keys mismatch"); + return false; + } else { + DBG(0, "public keys types mismatch"); + return false; + } + } catch (Exception& e) { + LOG_WARN("%s", e.what()); + + if (bio) { + BIO_free(bio); + } + + if (orig_pubkey) { + EVP_PKEY_free(orig_pubkey); + } + + if (cert_pubkey) { + EVP_PKEY_free(cert_pubkey); + } + delete []c_key; + return false; + } +} + +/* From gnutls: compare host_name against certificate, taking account of wildcards. + * return true on success or false on error. + * + * note: cert_name_size is required as X509 certs can contain embedded NULs in + * the strings such as CN or subjectAltName + */ +bool RedPeer::x509_cert_host_name_compare(const char *cert_name, int cert_name_size, + const char *host_name) { - connect_unsecure(host_by_name(host), port); + /* find the first different character */ + for (; *cert_name && *host_name && (toupper(*cert_name) == toupper(*host_name)); + cert_name++, host_name++, cert_name_size--); + + /* the strings are the same */ + if (cert_name_size == 0 && *host_name == '\0') + return true; + + if (*cert_name == '*') + { + /* a wildcard certificate */ + cert_name++; + cert_name_size--; + + while (true) + { + /* Use a recursive call to allow multiple wildcards */ + if (RedPeer::x509_cert_host_name_compare(cert_name, cert_name_size, host_name)) { + return true; + } + + /* wildcards are only allowed to match a single domain + component or component fragment */ + if (*host_name == '\0' || *host_name == '.') + break; + host_name++; + } + + return false; + } + + return false; } -// todo: use SSL_CTX_set_cipher_list, SSL_CTX_load_verify_location etc. -void RedPeer::connect_secure(const ConnectionOptions& options, uint32_t ip) +/* + * From gnutls_x509_crt_check_hostname - compares the hostname with certificate's hostname + * + * This function will check if the given certificate's subject matches + * the hostname. This is a basic implementation of the matching + * described in RFC2818 (HTTPS), which takes into account wildcards, + * and the DNSName/IPAddress subject alternative name PKIX extension. + * + */ +bool RedPeer::verify_host_name(X509* cert, const char* host_name) { - connect_unsecure(ip, options.secure_port); + GENERAL_NAMES* subject_alt_names; + bool found_dns_name = false; + struct in_addr addr; + int addr_len = 0; + bool cn_match = false; + + ASSERT(cert); + + // only IpV4 supported + if (inet_aton(host_name, &addr)) { + addr_len = sizeof(struct in_addr); + } + + /* try matching against: + * 1) a DNS name or IP address as an alternative name (subjectAltName) extension + * in the certificate + * 2) the common name (CN) in the certificate + * + * either of these may be of the form: *.domain.tld + * + * only try (2) if there is no subjectAltName extension of + * type dNSName + */ + + + subject_alt_names = (GENERAL_NAMES*)X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); + + if (subject_alt_names) { + int num_alts = sk_GENERAL_NAME_num(subject_alt_names); + for (int i = 0; i < num_alts; i++) { + const GENERAL_NAME* name = sk_GENERAL_NAME_value(subject_alt_names, i); + if (name->type == GEN_DNS) { + found_dns_name = true; + if (RedPeer::x509_cert_host_name_compare((char *)ASN1_STRING_data(name->d.dNSName), + ASN1_STRING_length(name->d.dNSName), + host_name)) { + DBG(0, "alt name match=%s", ASN1_STRING_data(name->d.dNSName)); + GENERAL_NAMES_free(subject_alt_names); + return true; + } + } else if (name->type == GEN_IPADD) { + int alt_ip_len = ASN1_STRING_length(name->d.iPAddress); + found_dns_name = true; + if ((addr_len == alt_ip_len)&& + !memcmp(ASN1_STRING_data(name->d.iPAddress), &addr, addr_len)) { + DBG(0, "alt name IP match=%s", + inet_ntoa(*((struct in_addr*)ASN1_STRING_data(name->d.dNSName)))); + GENERAL_NAMES_free(subject_alt_names); + return true; + } + } + } + GENERAL_NAMES_free(subject_alt_names); + } + + if (found_dns_name) + { + DBG(0, "SubjectAltName mismatch"); + return false; + } + + /* extracting commonNames */ + X509_NAME* subject = X509_get_subject_name(cert); + if (subject) { + int pos = -1; + X509_NAME_ENTRY* cn_entry; + ASN1_STRING* cn_asn1; + + while ((pos = X509_NAME_get_index_by_NID(subject, NID_commonName, pos)) != -1) { + cn_entry = X509_NAME_get_entry(subject, pos); + if (!cn_entry) { + continue; + } + cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry); + if (!cn_asn1) { + continue; + } + + if (RedPeer::x509_cert_host_name_compare((char*)ASN1_STRING_data(cn_asn1), + ASN1_STRING_length(cn_asn1), + host_name)) { + DBG(0, "common name match=%s", (char*)ASN1_STRING_data(cn_asn1)); + cn_match = true; + break; + } + } + } + + if (!cn_match) { + DBG(0, "common name mismatch"); + } + return cn_match; + +} + +bool RedPeer::verify_subject(X509* cert, const HostAuthOptions::CertFieldValueList& subject) +{ + X509_NAME* cert_subject = NULL; + HostAuthOptions::CertFieldValueList::const_iterator subject_iter; + X509_NAME* in_subject; + int ret; + + ASSERT(cert); + + cert_subject = X509_get_subject_name(cert); + if (!cert_subject) { + LOG_WARN("reading certificate subject failed"); + return false; + } + + if (X509_NAME_entry_count(cert_subject) != subject.size()) { + DBG(0, "subject mismatch: #entries cert=%d, input=%d", + X509_NAME_entry_count(cert_subject), subject.size()); + return false; + } + + in_subject = X509_NAME_new(); + if (!in_subject) { + LOG_WARN("failed to allocate X509_NAME"); + return false; + } + + for (subject_iter = subject.begin(); subject_iter != subject.end(); subject_iter++) { + if (!X509_NAME_add_entry_by_txt(in_subject, + subject_iter->first.c_str(), + MBSTRING_UTF8, + (const unsigned char*)subject_iter->second.c_str(), + subject_iter->second.length(), -1, 0)) { + LOG_WARN("failed to add entry %s=%s to X509_NAME", + subject_iter->first.c_str(), subject_iter->second.c_str()); + X509_NAME_free(in_subject); + return false; + } + } + + ret = X509_NAME_cmp(cert_subject, in_subject); + X509_NAME_free(in_subject); + + if (ret == 0) { + DBG(0, "subjects match"); + return true; + } else { + DBG(0, "subjects mismatch"); + return false; + } +} + +int RedPeer::ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx) +{ + int depth; + SSL *ssl; + X509* cert; + SslVerifyCbData* verify_data; + int auth_flags; + + depth = X509_STORE_CTX_get_error_depth(ctx); + + ssl = (SSL*)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); + if (!ssl) { + LOG_WARN("failed to get ssl connection"); + return 0; + } + + verify_data = (SslVerifyCbData*)SSL_get_app_data(ssl); + auth_flags = verify_data->info.type_flags; + + if (depth > 0) { + // if certificate verification failed, we can still authorize the server + // if its public key matches the one we hold in the peer_connect_options. + if (!preverify_ok) { + DBG(0, "openssl verify failed at depth=%d", depth); + verify_data->all_preverify_ok = false; + if (auth_flags & HostAuthOptions::HOST_AUTH_OP_PUBKEY) { + return 1; + } else { + return 0; + } + } else { + return preverify_ok; + } + } + + /* depth == 0 */ + cert = X509_STORE_CTX_get_current_cert(ctx); + if (!cert) { + LOG_WARN("failed to get server certificate"); + return 0; + } + + if (auth_flags & HostAuthOptions::HOST_AUTH_OP_PUBKEY) { + if (verify_pubkey(cert, verify_data->info.host_pubkey)) { + return 1; + } + } + + if (!verify_data->all_preverify_ok || !preverify_ok) { + return 0; + } + + if (auth_flags & HostAuthOptions::HOST_AUTH_OP_NAME) { + if (verify_host_name(cert, verify_data->host_name)) { + return 1; + } + } + + if (auth_flags & HostAuthOptions::HOST_AUTH_OP_SUBJECT) { + if (verify_subject(cert, verify_data->info.host_subject)) { + return 1; + } + } + return 0; +} + +// todo: use SSL_CTX_set_cipher_list, etc. +void RedPeer::connect_secure(const ConnectionOptions& options, const char* host) +{ + int return_code; + int auth_flags; + SslVerifyCbData auth_data; + + connect_unsecure(host, options.secure_port); ASSERT(_ctx == NULL && _ssl == NULL && _peer != INVALID_SOCKET); try { @@ -137,12 +483,39 @@ void RedPeer::connect_secure(const ConnectionOptions& options, uint32_t ip) #else SSL_METHOD *ssl_method = TLSv1_method(); #endif + auth_data.info = options.host_auth; + auth_data.host_name = host; + auth_data.all_preverify_ok = true; _ctx = SSL_CTX_new(ssl_method); if (_ctx == NULL) { ssl_error(); } + auth_flags = auth_data.info.type_flags; + if ((auth_flags & RedPeer::HostAuthOptions::HOST_AUTH_OP_NAME) || + (auth_flags & RedPeer::HostAuthOptions::HOST_AUTH_OP_SUBJECT)) { + std::string CA_file = auth_data.info.CA_file; + ASSERT(!CA_file.empty()); + + return_code = SSL_CTX_load_verify_locations(_ctx, CA_file.c_str(), NULL); + if (return_code != 1) { + if (auth_flags & RedPeer::HostAuthOptions::HOST_AUTH_OP_PUBKEY) { + LOG_WARN("SSL_CTX_load_verify_locations failed, CA_file=%s. " + "only pubkey authentication is active", CA_file.c_str()); + auth_data.info.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_PUBKEY; + } + else { + LOG_WARN("SSL_CTX_load_verify_locations failed CA_file=%s", CA_file.c_str()); + ssl_error(); + } + } + } + + if (auth_flags) { + SSL_CTX_set_verify(_ctx, SSL_VERIFY_PEER, ssl_verify_callback); + } + _ssl = SSL_new(_ctx); if (!_ssl) { THROW("create ssl failed"); @@ -154,10 +527,13 @@ void RedPeer::connect_secure(const ConnectionOptions& options, uint32_t ip) } SSL_set_bio(_ssl, sbio, sbio); + SSL_set_app_data(_ssl, &auth_data); - int return_code = SSL_connect(_ssl); + return_code = SSL_connect(_ssl); if (return_code <= 0) { - SSL_get_error(_ssl, return_code); + int ssl_error_code = SSL_get_error(_ssl, return_code); + LOG_WARN("failed to connect w/SSL, ssl_error %s", + ERR_error_string(ssl_error_code, NULL)); ssl_error(); } } catch (...) { @@ -167,11 +543,6 @@ void RedPeer::connect_secure(const ConnectionOptions& options, uint32_t ip) } } -void RedPeer::connect_secure(const ConnectionOptions& options, const char* host) -{ - connect_secure(options, host_by_name(host)); -} - void RedPeer::shutdown() { if (_peer != INVALID_SOCKET) { diff --git a/client/red_peer.h b/client/red_peer.h index 2a53eae..8a4060d 100644 --- a/client/red_peer.h +++ b/client/red_peer.h @@ -37,6 +37,30 @@ public: class OutMessage; class DisconnectedException {}; + class HostAuthOptions { + public: + + enum Type { + HOST_AUTH_OP_PUBKEY = 1, + HOST_AUTH_OP_NAME = (1 << 1), + HOST_AUTH_OP_SUBJECT = (1 << 2), + }; + + typedef std::vector<uint8_t> PublicKey; + typedef std::pair<std::string, std::string> CertFieldValuePair; + typedef std::list<CertFieldValuePair> CertFieldValueList; + + HostAuthOptions() : type_flags(0) {} + + public: + + int type_flags; + + PublicKey host_pubkey; + CertFieldValueList host_subject; + std::string CA_file; + }; + class ConnectionOptions { public: @@ -47,10 +71,12 @@ public: CON_OP_BOTH, }; - ConnectionOptions(Type in_type, int in_port, int in_sport) + ConnectionOptions(Type in_type, int in_port, int in_sport, + const HostAuthOptions& in_host_auth) : type (in_type) , unsecure_port (in_port) , secure_port (in_sport) + , host_auth (in_host_auth) { } @@ -70,12 +96,10 @@ public: Type type; int unsecure_port; int secure_port; + HostAuthOptions host_auth; // for secure connection }; - void connect_unsecure(uint32_t ip, int port); void connect_unsecure(const char* host, int port); - - void connect_secure(const ConnectionOptions& options, uint32_t ip); void connect_secure(const ConnectionOptions& options, const char* host); void disconnect(); @@ -95,6 +119,15 @@ protected: virtual void on_event() {} virtual int get_socket() { return _peer;} + static bool x509_cert_host_name_compare(const char *cert_name, int cert_name_size, + const char *host_name); + + static bool verify_pubkey(X509* cert, const HostAuthOptions::PublicKey& key); + static bool verify_host_name(X509* cert, const char* host_name); + static bool verify_subject(X509* cert, const HostAuthOptions::CertFieldValueList& subject); + + static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx); + private: void shutdown(); void cleanup(); diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp index 97c6dfc..f332fac 100644 --- a/client/windows/platform.cpp +++ b/client/windows/platform.cpp @@ -17,6 +17,8 @@ #include "common.h" +#include <shlobj.h> + #include "platform.h" #include "win_platform.h" #include "utils.h" @@ -28,6 +30,8 @@ #include "cursor.h" #include "named_pipe.h" +#define SPICE_CONFIG_DIR "spicec\\" + int gdi_handlers = 0; extern HINSTANCE instance; @@ -433,6 +437,21 @@ bool Platform::is_monitors_pos_valid() return true; } +void Platform::get_spice_config_dir(std::string& path) +{ + char app_data_path[MAX_PATH]; + HRESULT res = SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, app_data_path); + if (res != S_OK) { + throw Exception("get user app data dir failed"); + } + + path = app_data_path; + if (strcmp((app_data_path + strlen(app_data_path) - 2), "\\") != 0) { + path += "\\"; + } + path += SPICE_CONFIG_DIR; +} + void Platform::init() { create_message_wind(); diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp index 77025b6..4a1f9b2 100644 --- a/client/x11/platform.cpp +++ b/client/x11/platform.cpp @@ -64,6 +64,8 @@ #define USE_XRANDR_1_2 #endif +#define SPICE_CONFIG_DIR ".spicec/" + static Display* x_display = NULL; static bool x_shm_avail = false; static XVisualInfo **vinfo = NULL; @@ -1911,6 +1913,18 @@ bool Platform::is_monitors_pos_valid() return (ScreenCount(x_display) == 1); } +void Platform::get_spice_config_dir(std::string& path) +{ + char* home_dir = getenv("HOME"); + if (!home_dir) { + throw Exception("get home dir failed"); + } + + path = home_dir; + path += "/"; + path += SPICE_CONFIG_DIR; +} + static void root_win_proc(XEvent& event) { #ifdef USE_XRANDR_1_2 diff --git a/common/red.h b/common/red.h index dfd8512..22c0ec6 100644 --- a/common/red.h +++ b/common/red.h @@ -46,7 +46,7 @@ #define RED_MAGIC (*(uint32_t*)"REDQ") #define RED_VERSION_MAJOR (~(uint32_t)0 - 1) -#define RED_VERSION_MINOR 1 +#define RED_VERSION_MINOR 2 // Encryption & Ticketing Parameters #define RED_MAX_PASSWORD_LENGTH 60 @@ -209,10 +209,27 @@ typedef struct ATTR_PACKED RedMultiMediaTime { uint32_t time; } RedMultiMediaTime; +enum { + RED_PUBKEY_TYPE_INVALID, + RED_PUBKEY_TYPE_RSA, + RED_PUBKEY_TYPE_RSA2, + RED_PUBKEY_TYPE_DSA, + RED_PUBKEY_TYPE_DSA1, + RED_PUBKEY_TYPE_DSA2, + RED_PUBKEY_TYPE_DSA3, + RED_PUBKEY_TYPE_DSA4, + RED_PUBKEY_TYPE_DH, + RED_PUBKEY_TYPE_EC, +}; + typedef struct ATTR_PACKED RedMigrationBegin { uint16_t port; uint16_t sport; - char host[0]; + uint32_t host_offset; + uint32_t host_size; + uint16_t pub_key_type; + uint32_t pub_key_offset; + uint32_t pub_key_size; } RedMigrationBegin; enum { diff --git a/server/reds.c b/server/reds.c index 8a2700c..fb26901 100644 --- a/server/reds.c +++ b/server/reds.c @@ -61,9 +61,10 @@ static VDIPortInterface *vdagent = NULL; #define MIGRATION_NOTIFY_SPICE_KEY "spice_mig_ext" -#define REDS_MIG_VERSION 1 +#define REDS_MIG_VERSION 3 #define REDS_MIG_CONTINUE 1 #define REDS_MIG_ABORT 2 +#define REDS_MIG_DIFF_VERSION 3 #define REDS_AGENT_WINDOW_SIZE 10 #define REDS_TOKENS_TO_SEND 5 @@ -278,6 +279,7 @@ typedef struct RedsState { uint32_t ping_id; uint32_t net_test_id; int net_test_stage; + int peer_minor_version; } RedsState; uint64_t bitrate_per_sec = ~0; @@ -2908,6 +2910,8 @@ static void reds_handle_read_header_done(void *opaque) return; } + reds->peer_minor_version = header->minor_version; + if (header->size < sizeof(RedLinkMess)) { reds_send_link_error(link, RED_ERR_INVALID_DATA); red_printf("bad size %u", header->size); @@ -4175,12 +4179,20 @@ typedef struct RedsMigSpice { char *host; int port; int sport; + uint16_t cert_pub_key_type; + uint32_t cert_pub_key_len; + uint8_t* cert_pub_key; } RedsMigSpice; typedef struct RedsMigSpiceMessage { uint32_t link_id; } RedsMigSpiceMessage; +typedef struct RedsMigCertPubKeyInfo { + uint16_t type; + uint32_t len; +} RedsMigCertPubKeyInfo; + static int reds_mig_actual_read(RedsMigSpice *s) { for (;;) { @@ -4289,7 +4301,9 @@ static void reds_mig_continue(RedsMigSpice *s) red_printf(""); core->set_file_handlers(core, s->fd, NULL, NULL, NULL); host_len = strlen(s->host) + 1; - if (!(item = new_simple_out_item(RED_MIGRATE_BEGIN, sizeof(RedMigrationBegin) + host_len))) { + item = new_simple_out_item(RED_MIGRATE_BEGIN, + sizeof(RedMigrationBegin) + host_len + s->cert_pub_key_len); + if (!(item)) { red_printf("alloc item failed"); reds_disconnect(); return; @@ -4297,7 +4311,13 @@ static void reds_mig_continue(RedsMigSpice *s) migrate = (RedMigrationBegin *)item->data; migrate->port = s->port; migrate->sport = s->sport; - memcpy(migrate->host, s->host, host_len); + migrate->host_offset = sizeof(RedMigrationBegin); + 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_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); reds_push_pipe_item(&item->base); free(s->local_args); @@ -4362,6 +4382,68 @@ static void reds_mig_send_ticket(RedsMigSpice *s) BIO_free(bio_key); } +static void reds_mig_receive_cert_public_key(RedsMigSpice *s) +{ + s->cert_pub_key = malloc(s->cert_pub_key_len); + if (!s->cert_pub_key) { + red_printf("alloc failed"); + reds_mig_failed(s); + return; + } + + memcpy(s->cert_pub_key, s->read.buf, s->cert_pub_key_len); + + s->read.size = RED_TICKET_PUBKEY_BYTES; + s->read.end_pos = 0; + s->read.handle_data = reds_mig_send_ticket; + + core->set_file_handlers(core, s->fd, reds_mig_read, NULL, s); +} + +static void reds_mig_receive_cert_public_key_info(RedsMigSpice *s) +{ + RedsMigCertPubKeyInfo* pubkey_info = (RedsMigCertPubKeyInfo*)s->read.buf; + s->cert_pub_key_type = pubkey_info->type; + s->cert_pub_key_len = pubkey_info->len; + + if (s->cert_pub_key_len > RECIVE_BUF_SIZE) { + red_printf("certificate public key length exceeds buffer size"); + reds_mig_failed(s); + return; + } + + if (s->cert_pub_key_len) { + s->read.size = s->cert_pub_key_len; + s->read.end_pos = 0; + 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.end_pos = 0; + s->read.handle_data = reds_mig_send_ticket; + } + + core->set_file_handlers(core, s->fd, reds_mig_read, NULL, s); +} + +static void reds_mig_handle_send_abort_done(RedsMigSpice *s) +{ + reds_mig_failed(s); +} + +static void reds_mig_receive_version(RedsMigSpice *s) +{ + uint32_t* dest_version; + uint32_t resault; + dest_version = (uint32_t*)s->read.buf; + resault = REDS_MIG_ABORT; + memcpy(s->write.buf, &resault, sizeof(resault)); + s->write.length = sizeof(resault); + s->write.now = s->write.buf; + s->write.handle_done = reds_mig_handle_send_abort_done; + core->set_file_handlers(core, s->fd, reds_mig_write, reds_mig_write, s); +} + static void reds_mig_control(RedsMigSpice *spice_migration) { uint32_t *control; @@ -4371,9 +4453,9 @@ static void reds_mig_control(RedsMigSpice *spice_migration) switch (*control) { case REDS_MIG_CONTINUE: - spice_migration->read.size = RED_TICKET_PUBKEY_BYTES; + spice_migration->read.size = sizeof(RedsMigCertPubKeyInfo); spice_migration->read.end_pos = 0; - spice_migration->read.handle_data = reds_mig_send_ticket; + spice_migration->read.handle_data = reds_mig_receive_cert_public_key_info; core->set_file_handlers(core, spice_migration->fd, reds_mig_read, NULL, spice_migration); @@ -4382,6 +4464,15 @@ static void reds_mig_control(RedsMigSpice *spice_migration) red_printf("abort"); reds_mig_failed(spice_migration); break; + case REDS_MIG_DIFF_VERSION: + red_printf("different versions"); + spice_migration->read.size = sizeof(uint32_t); + spice_migration->read.end_pos = 0; + spice_migration->read.handle_data = reds_mig_receive_version; + + core->set_file_handlers(core, spice_migration->fd, reds_mig_read, + NULL, spice_migration); + break; default: red_printf("invalid control"); reds_mig_failed(spice_migration); @@ -4423,6 +4514,12 @@ static void reds_mig_started(void *opaque, const char *in_args) goto error; } + if ((RED_VERSION_MAJOR == 1) && (reds->peer_minor_version < 2)) { + red_printf("minor version mismatch client %u server %u", + reds->peer_minor_version, RED_VERSION_MINOR); + goto error; + } + spice_migration = (RedsMigSpice *)malloc(sizeof(RedsMigSpice)); if (!spice_migration) { red_printf("Could not allocate memory for spice migration structure"); @@ -4625,6 +4722,85 @@ static void reds_mig_write_all(int fd, void *buf, int len, const char *name) } } +static void reds_mig_send_cert_public_key(int fd) +{ + FILE* cert_file; + X509* x509; + EVP_PKEY* pub_key; + unsigned char* pp = NULL; + int length; + BIO* mem_bio; + RedsMigCertPubKeyInfo pub_key_info_msg; + + if (spice_secure_port == -1) { + pub_key_info_msg.type = RED_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; + } + + cert_file = fopen(ssl_parameters.certs_file, "r"); + if (!cert_file) { + red_error("opening certificate failed"); + } + + x509 = PEM_read_X509_AUX(cert_file, NULL, NULL, NULL); + if (!x509) { + red_error("reading x509 cert failed"); + } + pub_key = X509_get_pubkey(x509); + if (!pub_key) { + red_error("reading public key failed"); + } + + mem_bio = BIO_new(BIO_s_mem()); + i2d_PUBKEY_bio(mem_bio, pub_key); + if (BIO_flush(mem_bio) != 1) { + red_error("bio flush failed"); + } + length = BIO_get_mem_data(mem_bio, &pp); + + switch(pub_key->type) { + case EVP_PKEY_RSA: + pub_key_info_msg.type = RED_PUBKEY_TYPE_RSA; + break; + case EVP_PKEY_RSA2: + pub_key_info_msg.type = RED_PUBKEY_TYPE_RSA2; + break; + case EVP_PKEY_DSA: + pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA; + break; + case EVP_PKEY_DSA1: + pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA1; + break; + case EVP_PKEY_DSA2: + pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA2; + break; + case EVP_PKEY_DSA3: + pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA3; + break; + case EVP_PKEY_DSA4: + pub_key_info_msg.type = RED_PUBKEY_TYPE_DSA4; + break; + case EVP_PKEY_DH: + pub_key_info_msg.type = RED_PUBKEY_TYPE_DH; + break; + case EVP_PKEY_EC: + pub_key_info_msg.type = RED_PUBKEY_TYPE_EC; + break; + default: + red_error("invalid public key type"); + } + pub_key_info_msg.len = length; + reds_mig_write_all(fd, &pub_key_info_msg, sizeof(pub_key_info_msg), "cert public key info"); + reds_mig_write_all(fd, pp, length, "cert public key"); + + BIO_free(mem_bio); + fclose(cert_file); + EVP_PKEY_free(pub_key); + X509_free(x509); +} + static void reds_mig_recv(void *opaque, int fd) { uint32_t ack_message = *(uint32_t *)"ack_"; @@ -4639,16 +4815,36 @@ static void reds_mig_recv(void *opaque, int fd) BUF_MEM *buff; reds_mig_read_all(fd, &version, sizeof(version), "version"); - - if (version != REDS_MIG_VERSION) { + // starting from version 3, if the version of the src is bigger + // than ours, we send our version to the src. + if (version < REDS_MIG_VERSION) { resault = REDS_MIG_ABORT; reds_mig_write_all(fd, &resault, sizeof(resault), "resault"); mig->notifier_done(mig, reds->mig_notifier); return; + } else if (version > REDS_MIG_VERSION) { + uint32_t src_resault; + uint32_t self_version = REDS_MIG_VERSION; + resault = REDS_MIG_DIFF_VERSION; + reds_mig_write_all(fd, &resault, sizeof(resault), "resault"); + reds_mig_write_all(fd, &self_version, sizeof(self_version), "dest-version"); + reds_mig_read_all(fd, &src_resault, sizeof(src_resault), "src resault"); + + if (src_resault == REDS_MIG_ABORT) { + red_printf("abort (response to REDS_MIG_DIFF_VERSION)"); + mig->notifier_done(mig, reds->mig_notifier); + return; + } else if (src_resault != REDS_MIG_CONTINUE) { + red_printf("invalid response to REDS_MIG_DIFF_VERSION"); + mig->notifier_done(mig, reds->mig_notifier); + return; + } + } else { + resault = REDS_MIG_CONTINUE; + reds_mig_write_all(fd, &resault, sizeof(resault), "resault"); } - resault = REDS_MIG_CONTINUE; - reds_mig_write_all(fd, &resault, sizeof(resault), "resault"); + reds_mig_send_cert_public_key(fd); ticketing_info.bn = BN_new(); if (!ticketing_info.bn) { |
From: Yaniv K. <yk...@re...> - 2010-01-11 12:11:58
|
repository: /home/tlv/ykamay/open_spice_upload/vdesktop branch: master commit 2c004d83bfb48b6c2ef5586faf27c4b58a1d7a75 Author: Yaniv Kamay <yk...@re...> Date: Mon Jan 11 14:10:37 2010 +0200 qxl: prevent unnecessary update area while in VGA mode diff --git a/qemu/hw/qxl.c b/qemu/hw/qxl.c index 60210ef..d31dcfd 100644 --- a/qemu/hw/qxl.c +++ b/qemu/hw/qxl.c @@ -150,7 +150,6 @@ struct PCIQXLDevice { PCIDevice pci_dev; QXLState state; int id; - DisplayState ds; Rect dirty_rect; struct PCIQXLDevice *dev_next; struct PCIQXLDevice *vga_next; @@ -1385,21 +1384,93 @@ static void rect_union(Rect *dest, const Rect *r) dest->right = MAX(dest->right, r->right); } +static void qxl_vga_update_one(PCIQXLDevice *d) +{ + QXLDrawable *drawable; + QXLImage *image; + QXLCommandRing *ring; + QXLCommand *cmd; + int wait; + int notify; + Rect *dirty_rect; + + dirty_rect = &d->dirty_rect; + ring = &d->state.vga_ring; + RING_PROD_WAIT(ring, wait); + + if (wait) { + qxl_vga.need_update = TRUE; + return; + } + + drawable = (QXLDrawable *)malloc(sizeof(*drawable) + sizeof(*image)); + if (!drawable) { + printf("%s: alloc drawable failed\n", __FUNCTION__); + abort(); + } + + image = (QXLImage *)(drawable + 1); + drawable->bbox = *dirty_rect; + drawable->clip.type = CLIP_TYPE_NONE; + drawable->clip.data = 0; + drawable->effect = QXL_EFFECT_OPAQUE; + drawable->release_info.id = (UINT64)drawable; + drawable->bitmap_offset = 0; + drawable->type = QXL_DRAW_COPY; + + drawable->u.copy.rop_decriptor = ROPD_OP_PUT; + drawable->u.copy.src_bitmap = (PHYSICAL)image; + drawable->u.copy.src_area.left = drawable->u.copy.src_area.top = 0; + drawable->u.copy.src_area.right = dirty_rect->right - dirty_rect->left; + drawable->u.copy.src_area.bottom = dirty_rect->bottom - dirty_rect->top; + drawable->u.copy.scale_mode = 0; + memset(&drawable->u.copy.mask, 0, sizeof(QMask)); + + image->descriptor.type = IMAGE_TYPE_BITMAP; + image->descriptor.flags = 0; + QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_DEVICE, ++d->state.bits_unique); + image->bitmap.flags = QXL_BITMAP_DIRECT | QXL_BITMAP_TOP_DOWN | QXL_BITMAP_UNSTABLE; + image->bitmap.format = BITMAP_FMT_32BIT; + image->bitmap.stride = qxl_vga.ds->linesize; + image->descriptor.width = image->bitmap.x = drawable->u.copy.src_area.right; + image->descriptor.height = image->bitmap.y = drawable->u.copy.src_area.bottom; + image->bitmap.data = (PHYSICAL)(qxl_vga.ds->data + + dirty_rect->top * qxl_vga.ds->linesize + + dirty_rect->left * 4); + image->bitmap.palette = 0; + + cmd = RING_PROD_ITEM(ring); + cmd->type = QXL_CMD_DRAW; + cmd->data = (PHYSICAL)drawable; + RING_PUSH(ring, notify); + + if (notify) { + d->worker->wakeup(d->worker); + } + + memset(dirty_rect, 0, sizeof(*dirty_rect)); +} + static void qxl_display_update(struct DisplayState *ds, int x, int y, int w, int h) { PCIQXLDevice *client; Rect update_area; - qxl_vga.need_update = TRUE; - update_area.left = x, update_area.right = x + w; update_area.top = y; update_area.bottom = y + h; + if (rect_is_empty(&update_area)) { + return; + } + + qxl_vga.need_update = FALSE; + for (client = qxl_vga.clients; client; client = client->vga_next) { if (client->state.mode == QXL_MODE_VGA && client->state.running) { rect_union(&client->dirty_rect, &update_area); + qxl_vga_update_one(client); } } } @@ -1411,68 +1482,10 @@ static void qxl_vga_update(void) qxl_vga.need_update = FALSE; for (client = qxl_vga.clients; client; client = client->vga_next) { - if (client->state.mode == QXL_MODE_VGA && client->state.running) { - QXLDrawable *drawable; - QXLImage *image; - QXLCommandRing *ring; - QXLCommand *cmd; - int wait; - int notify; - Rect *dirty_rect = &client->dirty_rect; - - if (rect_is_empty(dirty_rect)) { - continue; - } - - ring = &client->state.vga_ring; - RING_PROD_WAIT(ring, wait); - if (wait) { - qxl_vga.need_update = TRUE; - continue; - } - - drawable = (QXLDrawable *)malloc(sizeof(*drawable) + sizeof(*image)); - if (!drawable) { - printf("%s: alloc drawable failed\n", __FUNCTION__); - abort(); - } - - image = (QXLImage *)(drawable + 1); - drawable->bbox = *dirty_rect; - drawable->clip.type = CLIP_TYPE_NONE; - drawable->clip.data = 0; - drawable->effect = QXL_EFFECT_OPAQUE; - drawable->release_info.id = (UINT64)drawable; - drawable->bitmap_offset = 0; - drawable->type = QXL_DRAW_COPY; - - drawable->u.copy.rop_decriptor = ROPD_OP_PUT; - drawable->u.copy.src_bitmap = (PHYSICAL)image; - drawable->u.copy.src_area.left = drawable->u.copy.src_area.top = 0; - drawable->u.copy.src_area.right = dirty_rect->right - dirty_rect->left; - drawable->u.copy.src_area.bottom = dirty_rect->bottom - dirty_rect->top; - drawable->u.copy.scale_mode = 0; - memset(&drawable->u.copy.mask, 0, sizeof(QMask)); - - image->descriptor.type = IMAGE_TYPE_BITMAP; - image->descriptor.flags = 0; - QXL_SET_IMAGE_ID(image, QXL_IMAGE_GROUP_DEVICE, ++client->state.bits_unique); - image->bitmap.flags = QXL_BITMAP_DIRECT | QXL_BITMAP_TOP_DOWN | QXL_BITMAP_UNSTABLE; - image->bitmap.format = BITMAP_FMT_32BIT; - image->bitmap.stride = qxl_vga.ds->linesize; - image->descriptor.width = image->bitmap.x = drawable->u.copy.src_area.right; - image->descriptor.height = image->bitmap.y = drawable->u.copy.src_area.bottom; - image->bitmap.data = (PHYSICAL)(qxl_vga.ds->data + dirty_rect->top * qxl_vga.ds->linesize + dirty_rect->left * 4); - image->bitmap.palette = 0; - - cmd = RING_PROD_ITEM(ring); - cmd->type = QXL_CMD_DRAW; - cmd->data = (PHYSICAL)drawable; - RING_PUSH(ring, notify); - if (notify) { - client->worker->wakeup(client->worker); - } - memset(dirty_rect, 0, sizeof(*dirty_rect)); + if (client->state.mode == QXL_MODE_VGA && client->state.running && + !rect_is_empty(&client->dirty_rect)) { + + qxl_vga_update_one(client); } } } @@ -1690,6 +1703,7 @@ static void qxl_vm_change_state_handler(void *opaque, int running) } if (running) { + qxl_vga.need_update = TRUE; d->state.running = TRUE; qemu_set_fd_handler(d->pipe_fd[0], qxl_pipe_read, NULL, d); d->worker->start(d->worker); |
From: Yaniv K. <yk...@re...> - 2010-01-10 21:30:50
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit e02374c544c5db22423d48a88bca03acfa597174 Author: Yaniv Kamay <yk...@re...> Date: Sun Jan 10 23:30:40 2010 +0200 change version to 0.4.2 diff --git a/client/configure.ac b/client/configure.ac index 32657dd..c73c3d6 100644 --- a/client/configure.ac +++ b/client/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.57]) m4_define([SPICE_MAJOR], 0) m4_define([SPICE_MINOR], 4) -m4_define([SPICE_MICRO], 1) +m4_define([SPICE_MICRO], 2) AC_INIT(spice-client, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-client) diff --git a/client/windows/redc.rc b/client/windows/redc.rc index 904de20..43527ee 100644 --- a/client/windows/redc.rc +++ b/client/windows/redc.rc @@ -62,8 +62,8 @@ ALT_IMAGE_RES_ID BITMAP "sticky_alt.bmp" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,4,1,0 - PRODUCTVERSION 0,4,1,0 + FILEVERSION 0,4,2,0 + PRODUCTVERSION 0,4,2,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -80,12 +80,12 @@ BEGIN BEGIN VALUE "CompanyName", "Red Hat Inc." VALUE "FileDescription", "Spice client" - VALUE "FileVersion", "0, 4, 1, 0" + VALUE "FileVersion", "0, 4, 2, 0" VALUE "InternalName", "spicec" VALUE "LegalCopyright", "Copyright (c) 2009 Red Hat, Inc. and/or its affiliates." VALUE "OriginalFilename", "spicec.exe" VALUE "ProductName", "Red Hat Spice" - VALUE "ProductVersion", "0, 4, 1, 0" + VALUE "ProductVersion", "0, 4, 2, 0" END END BLOCK "VarFileInfo" diff --git a/common/configure.ac b/common/configure.ac index 4cd9422..955624a 100644 --- a/common/configure.ac +++ b/common/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.57]) m4_define([SPICE_MAJOR], 0) m4_define([SPICE_MINOR], 4) -m4_define([SPICE_MICRO], 1) +m4_define([SPICE_MICRO], 2) AC_INIT(spice-common, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-common) diff --git a/configure.ac b/configure.ac index 742987e..01ee39e 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.57]) m4_define([SPICE_MAJOR], 0) m4_define([SPICE_MINOR], 4) -m4_define([SPICE_MICRO], 1) +m4_define([SPICE_MICRO], 2) AC_INIT(spice, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice) diff --git a/server/configure.ac b/server/configure.ac index b7eeffb..a63a810 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.57]) m4_define([SPICE_MAJOR], 0) m4_define([SPICE_MINOR], 4) -m4_define([SPICE_MICRO], 1) +m4_define([SPICE_MICRO], 2) AC_INIT(spice-server, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-server) |
From: Yaniv K. <yk...@re...> - 2010-01-10 21:28:52
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit ea8fce17e28809ec393ca2a5b566692a725069d9 Author: Uri Lublin <ur...@re...> Date: Sun Jan 10 23:11:46 2010 +0200 spice: config: Add DISTRIBUTION and PATCHID to configure summary Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/configure.ac b/client/configure.ac index f6e9116..32657dd 100644 --- a/client/configure.ac +++ b/client/configure.ac @@ -63,7 +63,7 @@ AC_OUTPUT dnl ========================================================================== echo " - Spice Client $VERSION + Spice Client $full_version ============== prefix: ${prefix} diff --git a/configure.ac.shared b/configure.ac.shared index c55a466..8c686c1 100644 --- a/configure.ac.shared +++ b/configure.ac.shared @@ -193,6 +193,14 @@ AC_ARG_VAR(DISTRIBUTION, [identify release by last distribution]) AH_TEMPLATE(DISTRIBUTION, [identify release by last distribution]) AC_DEFINE_UNQUOTED(DISTRIBUTION, ["$ac_env_DISTRIBUTION_value"]) +if test -n "${DISTRIBUTION}"; then + dist=".${DISTRIBUTION}" +fi +if test -n "${PATCHID}"; then + patchid="-${PATCHID}" +fi +full_version="${VERSION}${patchid}${dist}" + dnl =========================================================================== dnl check compiler flags diff --git a/server/configure.ac b/server/configure.ac index e078816..b7eeffb 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -38,7 +38,7 @@ AC_OUTPUT dnl ========================================================================== echo " - Spice Server $VERSION + Spice Server $full_version ============== prefix: ${prefix} |
From: Yaniv K. <yk...@re...> - 2010-01-10 20:21:50
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit a3110544226606e6fde79ef61f59ca82a8303ef4 Author: Uri Lublin <ur...@re...> Date: Sun Jan 10 20:42:29 2010 +0200 spice: add COPYING file to all subdirs (subdir config) GPL2 Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/COPYING b/client/COPYING new file mode 100644 index 0000000..08ddefd --- /dev/null +++ b/client/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/common/COPYING b/common/COPYING new file mode 100644 index 0000000..08ddefd --- /dev/null +++ b/common/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/server/COPYING b/server/COPYING new file mode 100644 index 0000000..08ddefd --- /dev/null +++ b/server/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + |
From: Yaniv K. <yk...@re...> - 2010-01-10 18:16:42
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 54535ba04e65e7815f572b7335713089907c7656 Author: Yaniv Kamay <yk...@re...> Date: Sun Jan 10 20:14:52 2010 +0200 add patch id and distro name to version string diff --git a/client/x11/main.cpp b/client/x11/main.cpp index de920f9..63b1134 100644 --- a/client/x11/main.cpp +++ b/client/x11/main.cpp @@ -24,7 +24,22 @@ static void cleanup() log4cpp::Category::shutdown(); } -const char * version_str = VERSION; +static std::string full_version_str; + +static void init_version_str() +{ + full_version_str += VERSION; + + if (strlen(PATCHID)) { + full_version_str += "-"; + full_version_str += PATCHID; + } + + if (strlen(DISTRIBUTION)) { + full_version_str += "."; + full_version_str += DISTRIBUTION; + } +} int main(int argc, char** argv) { @@ -32,7 +47,8 @@ int main(int argc, char** argv) atexit(cleanup); try { - exit_val = Application::main(argc, argv, version_str); + init_version_str(); + exit_val = Application::main(argc, argv, full_version_str.c_str()); LOG_INFO("Spice client terminated (exitcode = %d)", exit_val); } catch (Exception& e) { LOG_ERROR("unhandle exception: %s", e.what()); diff --git a/server/reds.c b/server/reds.c index d1f3ba1..f5de3ee 100644 --- a/server/reds.c +++ b/server/reds.c @@ -5371,13 +5371,17 @@ static void init_vd_agent_resources() state->plug.wakeup = reds_agent_wakeup; } -const char *version_string = VERSION; +static const char *version_string = VERSION; +static const char *patch_string = PATCHID; +static const char *distro_string = DISTRIBUTION; void __attribute__ ((visibility ("default"))) spice_init(CoreInterface *core_interface) { VDInterface *interface = NULL; - red_printf("starting %s", version_string); + red_printf("starting %s%s%s%s%s", version_string, + strlen(patch_string) ? "-" : "", patch_string, + strlen(distro_string) ? "." : "", distro_string); if (core_interface->base.base_version != VM_INTERFACE_VERSION) { red_error("bad base interface version"); |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:47:14
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 884beed580aab5a3609473e9c9291e7f4c8d2e7c Author: Uri Lublin <ur...@re...> Date: Sun Jan 10 14:27:44 2010 +0200 spice: server: rename spice.pc to spice-server.pc Signed-off-by: Yaniv Kamay <yk...@re...> Signed-off-by: Uri Lublin <ur...@re...> diff --git a/server/Makefile.am b/server/Makefile.am index d3b6d62..3cd9a70 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -84,11 +84,11 @@ EXTRA_DIST = \ $(NULL) pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = spice.pc +pkgconfig_DATA = spice-server.pc DISTCLEANFILES = \ ffmpeg_inc.h \ - spice.pc + spice-server.pc dist-hook: cp -p -f ./autogen.sh ../configure.ac.shared $(distdir) diff --git a/server/configure.ac b/server/configure.ac index 9ca80d5..e078816 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -32,7 +32,7 @@ AC_SUBST(SPICE_REQUIRES) AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) AC_SUBST(SPICE_NONPKGCONFIG_LIBS) -AC_CONFIG_FILES([Makefile spice.pc ffmpeg_inc.h]) +AC_CONFIG_FILES([Makefile spice-server.pc ffmpeg_inc.h]) AC_OUTPUT dnl ========================================================================== diff --git a/server/spice.pc.in b/server/spice-server.pc.in similarity index 100% rename from server/spice.pc.in rename to server/spice-server.pc.in |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:47:08
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit accabb79b10477a25e77ffff0088bb352b936d9f Author: Uri Lublin <ur...@re...> Date: Sun Jan 10 14:18:09 2010 +0200 spice: common: Do not m4_include configure.ac.shared (subdir config) There are some requirement checks in configure.ac.shared that spice-common does not need to do. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/common/configure.ac b/common/configure.ac index 0e51316..4cd9422 100644 --- a/common/configure.ac +++ b/common/configure.ac @@ -7,8 +7,14 @@ m4_define([SPICE_MICRO], 1) AC_INIT(spice-common, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-common) AC_CONFIG_MACRO_DIR([m4]) +AM_CONFIG_HEADER([config.h]) +AC_CONFIG_AUX_DIR(.) -m4_include(configure.ac.shared) +AM_INIT_AUTOMAKE([dist-bzip2]) +AM_MAINTAINER_MODE + +AC_PROG_INSTALL +AC_CANONICAL_HOST AC_CONFIG_FILES([Makefile spice-common.pc]) AC_OUTPUT |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:54
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 236b692a78964d08287b9adc208fda9e2b0a989b Author: Uri Lublin <ur...@re...> Date: Thu Jan 7 15:26:01 2010 +0200 spice: autogen.sh: call autogen.sh.shared separately from subdirs (subdir config) Move original autogen.sh to autogen.sh.shared Create links in each subdir (subdir/autogen.sh --> ../autogem.sh.shared) Make new autogen.sh which simply 1. cd subdir && ./autogen.sh 2. run autogen.sh.shared for the current dir (spice) Update all Makefile.am accordingly (dist-hook). Signed-off-by: Yaniv Kamay <yk...@re...> Signed-off-by: Uri Lublin <ur...@re...> diff --git a/autogen.sh b/autogen.sh index 140a31d..aed4440 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,33 +1,7 @@ -#! /bin/sh +#!/bin/sh set -e # exit on errors -# FIXME: can replace this entire script with -# the following line if we can require autoconf 2.60: -# autoreconf -v --force --install || exit 1 - -PACKAGE=spice - -ACLOCAL_FLAGS="" -LIBTOOLIZE=${LIBTOOLIZE-libtoolize} -LIBTOOLIZE_FLAGS="--copy --force" -AUTOHEADER=${AUTOHEADER-autoheader} -AUTOMAKE=${AUTOMAKE-automake} -AUTOMAKE_FLAGS="--add-missing --gnu" -AUTOCONF=${AUTOCONF-autoconf} - -# automake 1.8 requires autoconf 2.58 -# automake 1.7 requires autoconf 2.54 -automake_min_vers=1.7 -aclocal_min_vers=$automake_min_vers -autoconf_min_vers=2.54 -libtoolize_min_vers=1.4 - -# The awk-based string->number conversion we use needs a C locale to work -# as expected. Setting LC_ALL overrides whether the user set LC_ALL, -# LC_NUMERIC, or LANG. -LC_ALL=C - ARGV0=$0 # Allow invocation from a separate build directory; in that case, we change @@ -38,154 +12,20 @@ test -z "$srcdir" && srcdir=. ORIGDIR=`pwd` cd $srcdir -# Not all echo versions allow -n, so we check what is possible. This test is -# based on the one in autoconf. -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ;; - *c*,* ) ECHO_N=-n ;; - *) ECHO_N= ;; -esac - - -# some terminal codes ... -boldface="`tput bold 2>/dev/null || true`" -normal="`tput sgr0 2>/dev/null || true`" -printbold() { - echo $ECHO_N "$boldface" - echo "$@" - echo $ECHO_N "$normal" -} -printerr() { - echo "$@" >&2 -} - - -# Usage: -# compare_versions MIN_VERSION ACTUAL_VERSION -# returns true if ACTUAL_VERSION >= MIN_VERSION -compare_versions() { - ch_min_version=$1 - ch_actual_version=$2 - ch_status=0 - IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="." - set $ch_actual_version - for ch_min in $ch_min_version; do - ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes - if [ -z "$ch_min" ]; then break; fi - if [ -z "$ch_cur" ]; then ch_status=1; break; fi - if [ $ch_cur -gt $ch_min ]; then break; fi - if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi - done - IFS="$ch_save_IFS" - return $ch_status -} - -# Usage: -# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE -# checks to see if the package is available -version_check() { - vc_package=$1 - vc_variable=$2 - vc_checkprogs=$3 - vc_min_version=$4 - vc_source=$5 - vc_status=1 - - vc_checkprog=`eval echo "\\$$vc_variable"` - if [ -n "$vc_checkprog" ]; then - printbold "using $vc_checkprog for $vc_package" - return 0 - fi - - printbold "checking for $vc_package >= $vc_min_version..." - for vc_checkprog in $vc_checkprogs; do - echo $ECHO_N " testing $vc_checkprog... " - if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then - vc_actual_version=`$vc_checkprog --version | head -n 1 | \ - sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'` - if compare_versions $vc_min_version $vc_actual_version; then - echo "found $vc_actual_version" - # set variable - eval "$vc_variable=$vc_checkprog" - vc_status=0 - break - else - echo "too old (found version $vc_actual_version)" - fi - else - echo "not found." - fi - done - if [ "$vc_status" != 0 ]; then - printerr "***Error***: You must have $vc_package >= $vc_min_version installed" - printerr " to build $PROJECT. Download the appropriate package for" - printerr " from your distribution or get the source tarball at" - printerr " $vc_source" - printerr - fi - return $vc_status -} - -version_check autoconf AUTOCONF $AUTOCONF $autoconf_min_vers \ - "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-${autoconf_min_vers}.tar.gz" || DIE=1 -version_check automake AUTOMAKE "$AUTOMAKE automake automake-1.10 automake-1.9 automake-1.8 automake-1.7" $automake_min_vers \ - "http://ftp.gnu.org/pub/gnu/automake/automake-${automake_min_vers}.tar.gz" || DIE=1 -ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/` -version_check libtool LIBTOOLIZE "$LIBTOOLIZE glibtoolize libtoolize" $libtoolize_min_vers \ - "http://ftp.gnu.org/pub/gnu/libtool/libtool-${libtool_min_vers}.tar.gz" || DIE=1 - -if test -n "$DIE"; then - exit 1 -fi - - -if test -z "$*"; then - echo "$ARGV0: Note: \`./configure' will be run with no arguments." - echo " If you wish to pass any to it, please specify them on the" - echo " \`$0' command line." - echo -fi - -do_cmd() { - echo "$ARGV0: running \`$@'" - $@ -} - -# Run for top level directory - -printbold "Setting up $PACKAGE toplevel" - -config_specific_directory () -{ - local d=${1:-.} - local cur=$(pwd) - if [ "$d" != "." ]; then - cd $d - printbold " ----- Entering $d -----" - fi - touch NEWS README AUTHORS ChangeLog ### ToDo: define those. - mkdir -p m4 - do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS - do_cmd $ACLOCAL $ACLOCAL_FLAGS - do_cmd $AUTOHEADER - do_cmd $AUTOMAKE $AUTOMAKE_FLAGS - do_cmd $AUTOCONF --force - if [ "$d" != "." ]; then - cd $cur - printbold " ----- Exiting $d -----" - fi -} - subdirs=$(grep '^AC_CONFIG_SUBDIRS' configure.ac | \ sed 's/AC_CONFIG_SUBDIRS(\[\(.*\)\]) *$/\1/') -printbold "subdirs are $subdirs" - -for sd in $subdirs .; do - config_specific_directory $sd +echo "subdirs are $subdirs" + +for d in $subdirs; do + echo "START configuring $d" + cd $d + ./autogen.sh + cd .. + echo "FINISH configuring $d" done +echo "configuring SPICE top dir" +./autogen.sh.shared + cd $ORIGDIR || exit $? rm -f config.cache - -do_cmd $srcdir/configure --enable-maintainer-mode ${1+"$@"} || exit 1 - diff --git a/autogen.sh.shared b/autogen.sh.shared new file mode 100755 index 0000000..453dac2 --- /dev/null +++ b/autogen.sh.shared @@ -0,0 +1,158 @@ +#! /bin/sh + +set -e # exit on errors + +# FIXME: can replace this entire script with +# the following line if we can require autoconf 2.60: +# autoreconf -v --force --install || exit 1 + +PACKAGE=spice + +ACLOCAL_FLAGS="" +LIBTOOLIZE=${LIBTOOLIZE-libtoolize} +LIBTOOLIZE_FLAGS="--copy --force" +AUTOHEADER=${AUTOHEADER-autoheader} +AUTOMAKE=${AUTOMAKE-automake} +AUTOMAKE_FLAGS="--add-missing --gnu" +AUTOCONF=${AUTOCONF-autoconf} + +# automake 1.8 requires autoconf 2.58 +# automake 1.7 requires autoconf 2.54 +automake_min_vers=1.7 +aclocal_min_vers=$automake_min_vers +autoconf_min_vers=2.54 +libtoolize_min_vers=1.4 + +# The awk-based string->number conversion we use needs a C locale to work +# as expected. Setting LC_ALL overrides whether the user set LC_ALL, +# LC_NUMERIC, or LANG. +LC_ALL=C + +# Not all echo versions allow -n, so we check what is possible. This test is +# based on the one in autoconf. +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ;; + *c*,* ) ECHO_N=-n ;; + *) ECHO_N= ;; +esac + + +# some terminal codes ... +boldface="`tput bold 2>/dev/null || true`" +normal="`tput sgr0 2>/dev/null || true`" +printbold() { + echo $ECHO_N "$boldface" + echo "$@" + echo $ECHO_N "$normal" +} +printerr() { + echo "$@" >&2 +} + + +# Usage: +# compare_versions MIN_VERSION ACTUAL_VERSION +# returns true if ACTUAL_VERSION >= MIN_VERSION +compare_versions() { + ch_min_version=$1 + ch_actual_version=$2 + ch_status=0 + IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="." + set $ch_actual_version + for ch_min in $ch_min_version; do + ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes + if [ -z "$ch_min" ]; then break; fi + if [ -z "$ch_cur" ]; then ch_status=1; break; fi + if [ $ch_cur -gt $ch_min ]; then break; fi + if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi + done + IFS="$ch_save_IFS" + return $ch_status +} + +# Usage: +# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE +# checks to see if the package is available +version_check() { + vc_package=$1 + vc_variable=$2 + vc_checkprogs=$3 + vc_min_version=$4 + vc_source=$5 + vc_status=1 + + vc_checkprog=`eval echo "\\$$vc_variable"` + if [ -n "$vc_checkprog" ]; then + printbold "using $vc_checkprog for $vc_package" + return 0 + fi + + printbold "checking for $vc_package >= $vc_min_version..." + for vc_checkprog in $vc_checkprogs; do + echo $ECHO_N " testing $vc_checkprog... " + if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then + vc_actual_version=`$vc_checkprog --version | head -n 1 | \ + sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'` + if compare_versions $vc_min_version $vc_actual_version; then + echo "found $vc_actual_version" + # set variable + eval "$vc_variable=$vc_checkprog" + vc_status=0 + break + else + echo "too old (found version $vc_actual_version)" + fi + else + echo "not found." + fi + done + if [ "$vc_status" != 0 ]; then + printerr "***Error***: You must have $vc_package >= $vc_min_version installed" + printerr " to build $PROJECT. Download the appropriate package for" + printerr " from your distribution or get the source tarball at" + printerr " $vc_source" + printerr + fi + return $vc_status +} + +version_check autoconf AUTOCONF $AUTOCONF $autoconf_min_vers \ + "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-${autoconf_min_vers}.tar.gz" || DIE=1 +version_check automake AUTOMAKE "$AUTOMAKE automake automake-1.10 automake-1.9 automake-1.8 automake-1.7" $automake_min_vers \ + "http://ftp.gnu.org/pub/gnu/automake/automake-${automake_min_vers}.tar.gz" || DIE=1 +ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/` +version_check libtool LIBTOOLIZE "$LIBTOOLIZE glibtoolize libtoolize" $libtoolize_min_vers \ + "http://ftp.gnu.org/pub/gnu/libtool/libtool-${libtool_min_vers}.tar.gz" || DIE=1 + +if test -n "$DIE"; then + exit 1 +fi + + +if test -z "$*"; then + echo "$ARGV0: Note: \`./configure' will be run with no arguments." + echo " If you wish to pass any to it, please specify them on the" + echo " \`$0' command line." + echo +fi + +do_cmd() { + echo "$ARGV0: running \`$@'" + $@ +} + +# Run for top level directory + +p=$(awk -F '[(,]' '/^AC_INIT/ {print $2}' configure.ac) +if test -n "$p"; then + printbold "Setting up $p toplevel" +fi + +touch NEWS README AUTHORS ChangeLog ### ToDo: define those. +mkdir -p m4 +do_cmd $LIBTOOLIZE $LIBTOOLIZE_FLAGS +do_cmd $ACLOCAL $ACLOCAL_FLAGS +do_cmd $AUTOHEADER +do_cmd $AUTOMAKE $AUTOMAKE_FLAGS +do_cmd $AUTOCONF --force + diff --git a/client/Makefile.am b/client/Makefile.am index 54cd2ec..efe3952 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -92,4 +92,4 @@ EXTRA_DIST = $(RED_COMMON_SRCS) \ DISTCLEANFILES = x11/ffmpeg_inc.h dist-hook: - cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) + cp -p -f ./autogen.sh ../configure.ac.shared $(distdir) diff --git a/client/autogen.sh b/client/autogen.sh new file mode 120000 index 0000000..60bb39f --- /dev/null +++ b/client/autogen.sh @@ -0,0 +1 @@ +../autogen.sh.shared \ No newline at end of file diff --git a/common/Makefile.am b/common/Makefile.am index bdff878..0fca604 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -56,5 +56,5 @@ common_src_DATA = $(COMMON_SRCS) DISTCLEANFILES = spice-common.pc dist-hook: - cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) + cp -p -f ./autogen.sh ../configure.ac.shared $(distdir) diff --git a/common/autogen.sh b/common/autogen.sh new file mode 120000 index 0000000..60bb39f --- /dev/null +++ b/common/autogen.sh @@ -0,0 +1 @@ +../autogen.sh.shared \ No newline at end of file diff --git a/server/Makefile.am b/server/Makefile.am index 5df058c..d3b6d62 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -91,4 +91,4 @@ DISTCLEANFILES = \ spice.pc dist-hook: - cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) + cp -p -f ./autogen.sh ../configure.ac.shared $(distdir) diff --git a/server/autogen.sh b/server/autogen.sh new file mode 120000 index 0000000..60bb39f --- /dev/null +++ b/server/autogen.sh @@ -0,0 +1 @@ +../autogen.sh.shared \ No newline at end of file |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:45
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit cf60cddbdd3468ec49d387f1944c068bd35fca92 Author: Uri Lublin <ur...@re...> Date: Thu Jan 7 22:22:37 2010 +0200 spice: configure: mv ffmpeg_inc.h.in from common/ to client/ Moved common/win/ffmpeg_inc.h to client/windows/ Moved common/linux/ffmpeg_inc.h.in to client/x11/ Copied common/linux/ffmpeg_inc.h.in to server/ Update *configure.ac and */Makefile.am accordingly (* is for {common,server,client} Signed-off-by: Yaniv Kamay <yk...@re...> Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/Makefile.am b/client/Makefile.am index e948b5f..54cd2ec 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -86,7 +86,10 @@ RED_COMMON_SRCS = \ gdi_canvas.cpp \ $(NULL) -EXTRA_DIST = $(RED_COMMON_SRCS) +EXTRA_DIST = $(RED_COMMON_SRCS) \ + x11/ffmpeg_inc.h.in + +DISTCLEANFILES = x11/ffmpeg_inc.h dist-hook: cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) diff --git a/client/configure.ac b/client/configure.ac index d9012de..f6e9116 100644 --- a/client/configure.ac +++ b/client/configure.ac @@ -57,7 +57,7 @@ AC_SUBST(SPICE_REQUIRES) AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) AC_SUBST(SPICE_NONPKGCONFIG_LIBS) -AC_CONFIG_FILES([Makefile x11/Makefile x11/images/Makefile]) +AC_CONFIG_FILES([Makefile x11/Makefile x11/images/Makefile x11/ffmpeg_inc.h]) AC_OUTPUT dnl ========================================================================== diff --git a/common/win/ffmpeg_inc.h b/client/windows/ffmpeg_inc.h similarity index 100% rename from common/win/ffmpeg_inc.h rename to client/windows/ffmpeg_inc.h diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am index 9a8e555..1fd0eaf 100644 --- a/client/x11/Makefile.am +++ b/client/x11/Makefile.am @@ -15,7 +15,6 @@ INCLUDES = \ -I. \ -I.. \ -I$(COMMON_DIR) \ - -I$(COMMON_DIR)/linux \ -I$(CLIENT_DIR) \ $(GL_CFLAGS) \ $(ALSA_CFLAGS) \ diff --git a/common/linux/ffmpeg_inc.h.in b/client/x11/ffmpeg_inc.h.in similarity index 100% copy from common/linux/ffmpeg_inc.h.in copy to client/x11/ffmpeg_inc.h.in diff --git a/common/Makefile.am b/common/Makefile.am index 8f96366..bdff878 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -53,10 +53,8 @@ pkgconfig_DATA = spice-common.pc common_srcdir=$(prefix)/src/spice-common common_src_DATA = $(COMMON_SRCS) -linux_includedir=$(common_srcdir)/linux -linux_include_DATA=linux/ffmpeg_inc.h - -DISTCLEANFILES = spice-common.pc linux/ffmpeg_inc.h +DISTCLEANFILES = spice-common.pc dist-hook: cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) + diff --git a/common/configure.ac b/common/configure.ac index b2d7e22..0e51316 100644 --- a/common/configure.ac +++ b/common/configure.ac @@ -10,7 +10,7 @@ AC_CONFIG_MACRO_DIR([m4]) m4_include(configure.ac.shared) -AC_CONFIG_FILES([Makefile linux/ffmpeg_inc.h spice-common.pc]) +AC_CONFIG_FILES([Makefile spice-common.pc]) AC_OUTPUT dnl ========================================================================== diff --git a/server/Makefile.am b/server/Makefile.am index 335a71a..5df058c 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -5,7 +5,6 @@ COMMON_DIR=$(SPICE_COMMON_SRCDIR) INCLUDES = \ -I. \ -I$(COMMON_DIR) \ - -I$(COMMON_DIR)/linux \ $(FFMPEG_CFLAGS) \ $(QCAIRO_CFLAGS) \ $(GL_CFLAGS) \ @@ -81,12 +80,14 @@ libspiceinclude_HEADERS = \ EXTRA_DIST = \ glz_encode_match_tmpl.c \ glz_encode_tmpl.c \ + ffmpeg_inc.h.in \ $(NULL) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = spice.pc DISTCLEANFILES = \ + ffmpeg_inc.h \ spice.pc dist-hook: diff --git a/server/configure.ac b/server/configure.ac index bc31986..9ca80d5 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -32,7 +32,7 @@ AC_SUBST(SPICE_REQUIRES) AC_SUBST(SPICE_NONPKGCONFIG_CFLAGS) AC_SUBST(SPICE_NONPKGCONFIG_LIBS) -AC_CONFIG_FILES([Makefile spice.pc]) +AC_CONFIG_FILES([Makefile spice.pc ffmpeg_inc.h]) AC_OUTPUT dnl ========================================================================== diff --git a/common/linux/ffmpeg_inc.h.in b/server/ffmpeg_inc.h.in similarity index 98% rename from common/linux/ffmpeg_inc.h.in rename to server/ffmpeg_inc.h.in index 7e322b5..02b4e36 100644 --- a/common/linux/ffmpeg_inc.h.in +++ b/server/ffmpeg_inc.h.in @@ -8,5 +8,3 @@ extern "C" { #ifdef __GNUG__ } #endif - - |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:36
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 4569295e5c74de4fd3c36af4216e2f42e809e9e0 Author: Uri Lublin <ur...@re...> Date: Thu Jan 7 20:12:58 2010 +0200 client/x11/Makefile.am: make CLIENT_DIR $(top_srcdir) instead of .. Enables out-of-directory configure & compile Signed-off-by: Yaniv Kamay <yk...@re...> Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am index d497a7b..9a8e555 100644 --- a/client/x11/Makefile.am +++ b/client/x11/Makefile.am @@ -1,7 +1,7 @@ NULL = COMMON_DIR=$(SPICE_COMMON_SRCDIR) -CLIENT_DIR=.. +CLIENT_DIR=$(top_srcdir) SUBDIRS = images |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:29
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit ecc4e7d2cf9744acb18ab906348c98c89dcf5a13 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 19:31:29 2010 +0200 spice: subdirs: support ./autogen.sh in a "make dist" tarball (subdir config) Each subdir (common, client and server) can "make dist". This commit adds configure.ac.shared and autogen.sh to the tar file. Above files are copied from .. (spice/ directory) Also added configure.ac.shared (which is not part of "distribution" tarball) that only imports ../configure.ac.shared such that ./autogen.sh still works (on "git directories"). Signed-off-by: Uri Lublin <ur...@re...> diff --git a/client/Makefile.am b/client/Makefile.am index f30408c..e948b5f 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -87,3 +87,6 @@ RED_COMMON_SRCS = \ $(NULL) EXTRA_DIST = $(RED_COMMON_SRCS) + +dist-hook: + cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) diff --git a/client/configure.ac b/client/configure.ac index c1fd5b7..d9012de 100644 --- a/client/configure.ac +++ b/client/configure.ac @@ -12,7 +12,7 @@ AC_CONFIG_MACRO_DIR([m4]) # Maybe overwritten by ../configure.ac.shared SPICE_COMMON_SRCDIR='$(top_srcdir)'/../common -m4_include(../configure.ac.shared) +m4_include(configure.ac.shared) dnl ================ diff --git a/client/configure.ac.shared b/client/configure.ac.shared new file mode 100644 index 0000000..4c292cb --- /dev/null +++ b/client/configure.ac.shared @@ -0,0 +1 @@ +m4_include(../configure.ac.shared) diff --git a/common/Makefile.am b/common/Makefile.am index c1a55f1..8f96366 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -57,3 +57,6 @@ linux_includedir=$(common_srcdir)/linux linux_include_DATA=linux/ffmpeg_inc.h DISTCLEANFILES = spice-common.pc linux/ffmpeg_inc.h + +dist-hook: + cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) diff --git a/common/configure.ac b/common/configure.ac index 76318e6..b2d7e22 100644 --- a/common/configure.ac +++ b/common/configure.ac @@ -8,7 +8,7 @@ AC_INIT(spice-common, [SPICE_MAJOR.SPICE_MINOR.SPICE_MICRO], [], spice-common) AC_CONFIG_MACRO_DIR([m4]) -m4_include(../configure.ac.shared) +m4_include(configure.ac.shared) AC_CONFIG_FILES([Makefile linux/ffmpeg_inc.h spice-common.pc]) AC_OUTPUT diff --git a/common/configure.ac.shared b/common/configure.ac.shared new file mode 100644 index 0000000..4c292cb --- /dev/null +++ b/common/configure.ac.shared @@ -0,0 +1 @@ +m4_include(../configure.ac.shared) diff --git a/server/Makefile.am b/server/Makefile.am index f092fd1..335a71a 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -88,3 +88,6 @@ pkgconfig_DATA = spice.pc DISTCLEANFILES = \ spice.pc + +dist-hook: + cp -p -f ../autogen.sh ../configure.ac.shared $(distdir) diff --git a/server/configure.ac b/server/configure.ac index d047078..bc31986 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -12,7 +12,7 @@ AC_CONFIG_MACRO_DIR([m4]) # Maybe overwritten by ../configure.ac.shared SPICE_COMMON_SRCDIR='$(top_srcdir)'/../common -m4_include(../configure.ac.shared) +m4_include(configure.ac.shared) AC_PROG_LIBTOOL diff --git a/server/configure.ac.shared b/server/configure.ac.shared new file mode 100644 index 0000000..4c292cb --- /dev/null +++ b/server/configure.ac.shared @@ -0,0 +1 @@ +m4_include(../configure.ac.shared) |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:20
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 82a73df97ffc5e9a937bfe3530cceee4f3ea6441 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 19:31:29 2010 +0200 spice: configure.ac.shared: add PATCHID and DISTRIBUTION variables (subdir config) Define them with ./configure PATCHID=id DISTRIBUTION=dist They appear in config.h Add them to your version-printing function. Signed-off-by: Uri Lublin <ur...@re...> diff --git a/configure.ac.shared b/configure.ac.shared index 52b7167..c55a466 100644 --- a/configure.ac.shared +++ b/configure.ac.shared @@ -181,6 +181,18 @@ if test "x$use_spice_common" != "xno"; then SPICE_COMMON_SRCDIR=$(pkg-config --variable=common_src_dir spice-common) fi + +# +# patchid and distribution -- better identify the release +# +AC_ARG_VAR(PATCHID, [identify release by last patch id]) +AH_TEMPLATE(PATCHID, [identify release by last patch id]) +AC_DEFINE_UNQUOTED(PATCHID, ["$ac_env_PATCHID_value"]) + +AC_ARG_VAR(DISTRIBUTION, [identify release by last distribution]) +AH_TEMPLATE(DISTRIBUTION, [identify release by last distribution]) +AC_DEFINE_UNQUOTED(DISTRIBUTION, ["$ac_env_DISTRIBUTION_value"]) + dnl =========================================================================== dnl check compiler flags |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:12
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit f0eb948b5c433c16a188bb7fec6712df6e1c2b77 Author: Uri Lublin <ur...@re...> Date: Sun Jan 3 19:31:29 2010 +0200 spice: server: common/ files are not needed by "make dist" (subdir config) Signed-off-by: Uri Lublin <ur...@re...> diff --git a/server/Makefile.am b/server/Makefile.am index 15ed08e..f092fd1 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -69,9 +69,9 @@ libspice_la_SOURCES = \ snd_worker.h \ spice.h \ vd_interface.h \ - $(COMMON_SRCS) \ $(NULL) +nodist_libspice_la_SOURCES = $(COMMON_SRCS) libspiceincludedir = $(includedir)/libspice libspiceinclude_HEADERS = \ spice.h \ |
From: Yaniv K. <yk...@re...> - 2010-01-10 17:46:04
|
repository: /home/tlv/ykamay/open_spice_upload/spice branch: 0.4 commit 766bd244dc7972166e3d7cf0637721dafc8d5f4b Author: Uri Lublin <ur...@re...> Date: Tue Jan 5 22:40:58 2010 +0200 spice: configure.ac.shared: add option to use spice-common package (subdir config) Run ./configure --with-spice-common to use spice-common sources from spice-common package, instead of source in spice/common/ directory. This is usefull when building the spice client or spice server out of a "distribution" tarball, when ../common directory does not exist. diff --git a/configure.ac.shared b/configure.ac.shared index 0cb9859..52b7167 100644 --- a/configure.ac.shared +++ b/configure.ac.shared @@ -165,6 +165,21 @@ AC_ARG_ENABLE(static-linkage, AC_SUBST([SPICEC_STATIC_LINKAGE_BSTATIC]) AC_SUBST([SPICEC_STATIC_LINKAGE_BDYNAMIC]) +# +# Upon user request (./configure --with-spice-common) to use spice-common package +# Then check for spice-common package, and overwrite SPICE_COMMON_SRCDIR +# (with a directory specified in spice-common.pc). +# +AC_ARG_WITH(spice-common, + [AS_HELP_STRING([--with-spice-common], + [use sources found by spice-common.pc (default is no)])], + [use_spice_common=$withval], + [use_spice_common=no]) + +if test "x$use_spice_common" != "xno"; then + PKG_CHECK_MODULES(SPICE_COMMON, spice-common = 0.4.1) + SPICE_COMMON_SRCDIR=$(pkg-config --variable=common_src_dir spice-common) +fi dnl =========================================================================== dnl check compiler flags |