Remove c->out.vec. Pass iovecs directly down the call tree. Add _xcb_out_flush_to...
[free-sw/xcb/libxcb] / src / xcb.h
1 /*
2  * Copyright (C) 2001-2004 Bart Massey, Jamey Sharp, and Josh Triplett.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  * 
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  * 
22  * Except as contained in this notice, the names of the authors or their
23  * institutions shall not be used in advertising or otherwise to promote the
24  * sale, use or other dealings in this Software without prior written
25  * authorization from the authors.
26  */
27
28 #ifndef __XCB_H
29 #define __XCB_H
30 #include <X11/Xmd.h>
31 #include <X11/X.h>
32 #include <sys/uio.h>
33 #include <pthread.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
40 #define deprecated __attribute__((__deprecated__))
41 #else
42 #define deprecated
43 #endif
44
45 /* Pre-defined constants */
46
47 /* current protocol version */
48 #define X_PROTOCOL 11
49
50 /* current minor version */
51 #define X_PROTOCOL_REVISION 0
52
53 /* X_TCP_PORT + display number = server port for TCP transport */
54 #define X_TCP_PORT 6000
55
56 #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
57
58
59 /* Opaque structures */
60
61 typedef struct XCBConnection XCBConnection;
62
63
64 /* Other types */
65
66 typedef struct {
67     void *data;
68     int rem;
69     int index;
70 } XCBGenericIter;
71
72 typedef struct {
73     BYTE response_type;
74     CARD8 pad0;
75     CARD16 sequence;
76     CARD32 length;
77 } XCBGenericRep;
78
79 typedef struct {
80     BYTE response_type;
81     CARD8 pad0;
82     CARD16 sequence;
83     CARD32 pad[7];
84     CARD32 full_sequence;
85 } XCBGenericEvent;
86
87 typedef struct {
88     BYTE response_type;
89     BYTE error_code;
90     CARD16 sequence;
91     CARD32 pad[7];
92     CARD32 full_sequence;
93 } XCBGenericError;
94
95 typedef struct {
96     unsigned int sequence;
97 } XCBVoidCookie;
98
99
100 /* Include the generated xproto and xcb_types headers. */
101 #include "xcb_types.h"
102 #include "xproto.h"
103
104
105 /* xcb_auth.c */
106
107 typedef struct XCBAuthInfo {
108     int namelen;
109     char *name;
110     int datalen;
111     char *data;
112 } XCBAuthInfo;
113
114 int XCBGetAuthInfo(int fd, XCBAuthInfo *info) deprecated;
115
116
117 /* xcb_out.c */
118
119 int XCBFlush(XCBConnection *c);
120 CARD32 XCBGetMaximumRequestLength(XCBConnection *c);
121
122
123 /* xcb_in.c */
124
125 XCBGenericEvent *XCBWaitEvent(XCBConnection *c) deprecated;
126 XCBGenericEvent *XCBWaitForEvent(XCBConnection *c);
127 XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error);
128 unsigned int XCBGetRequestRead(XCBConnection *c);
129
130
131 /* xcb_ext.c */
132
133 typedef struct XCBExtension XCBExtension;
134
135 /* Do not free the returned XCBQueryExtensionRep - on return, it's aliased
136  * from the cache. */
137 const XCBQueryExtensionRep *XCBGetExtensionData(XCBConnection *c, XCBExtension *ext);
138
139 void XCBPrefetchExtensionData(XCBConnection *c, XCBExtension *ext);
140
141
142 /* xcb_conn.c */
143
144 XCBConnSetupSuccessRep *XCBGetSetup(XCBConnection *c);
145 int XCBGetFileDescriptor(XCBConnection *c);
146
147 XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info);
148 void XCBDisconnect(XCBConnection *c);
149
150
151 /* xcb_util.c */
152
153 int XCBParseDisplay(const char *name, char **host, int *display, int *screen);
154 int XCBOpen(const char *host, int display) deprecated;
155 int XCBOpenTCP(const char *host, unsigned short port) deprecated;
156 int XCBOpenUnix(const char *file) deprecated;
157
158 XCBConnection *XCBConnectBasic(void) deprecated;
159 XCBConnection *XCBConnect(const char *displayname, int *screenp);
160 XCBConnection *XCBConnectToDisplayWithAuthInfo(const char *display, XCBAuthInfo *auth, int *screen);
161
162 int XCBSync(XCBConnection *c, XCBGenericError **e);
163
164
165 #ifdef __cplusplus
166 }
167 #endif
168
169 #endif