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"
32 #define WL_CONNECTION_READABLE 0x01
33 #define WL_CONNECTION_WRITABLE 0x02
35 typedef int (*wl_connection_update_func_t)(struct wl_connection *connection,
36 uint32_t mask, void *data);
38 struct wl_connection *wl_connection_create(int fd,
39 wl_connection_update_func_t update,
41 void wl_connection_destroy(struct wl_connection *connection);
42 void wl_connection_copy(struct wl_connection *connection, void *data, size_t size);
43 void wl_connection_consume(struct wl_connection *connection, size_t size);
44 int wl_connection_data(struct wl_connection *connection, uint32_t mask);
45 void wl_connection_write(struct wl_connection *connection, const void *data, size_t count);
48 wl_connection_vmarshal(struct wl_connection *connection,
49 struct wl_object *sender,
50 uint32_t opcode, va_list ap,
51 const struct wl_message *message);
54 wl_connection_demarshal(struct wl_connection *connection,
56 struct wl_hash_table *objects,
57 const struct wl_message *message);
59 wl_closure_invoke(struct wl_closure *closure,
60 struct wl_object *target, void (*func)(void), void *data);
62 wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
64 wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send);
66 wl_closure_destroy(struct wl_closure *closure);