2 * Copyright © 2008 Kristian Høgsberg
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 #ifndef _CONNECTION_H_
24 #define _CONNECTION_H_
27 #include "wayland-util.h"
31 #define WL_CONNECTION_READABLE 0x01
32 #define WL_CONNECTION_WRITABLE 0x02
34 typedef int (*wl_connection_update_func_t)(struct wl_connection *connection,
35 uint32_t mask, void *data);
37 struct wl_connection *wl_connection_create(int fd,
38 wl_connection_update_func_t update,
40 void wl_connection_destroy(struct wl_connection *connection);
41 void wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
42 void wl_connection_consume(struct wl_connection *connection, size_t size);
43 int wl_connection_data(struct wl_connection *connection, uint32_t mask);
44 void wl_connection_write(struct wl_connection *connection, const void *data, size_t count);
46 void wl_connection_vmarshal(struct wl_connection *connection,
47 struct wl_object *sender,
48 uint32_t opcode, va_list ap,
49 const struct wl_message *message);
51 void wl_connection_demarshal(struct wl_connection *connection,
53 struct wl_hash_table *objects,
55 void *data, struct wl_object *target,
56 const struct wl_message *message);