| 1 |
/****************************************************************************** |
| 2 |
|
| 3 |
|
| 4 |
Copyright 1993, 1998 The Open Group |
| 5 |
|
| 6 |
Permission to use, copy, modify, distribute, and sell this software and its |
| 7 |
documentation for any purpose is hereby granted without fee, provided that |
| 8 |
the above copyright notice appear in all copies and that both that |
| 9 |
copyright notice and this permission notice appear in supporting |
| 10 |
documentation. |
| 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 |
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 19 |
AN 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 name of The Open Group shall not be |
| 23 |
used in advertising or otherwise to promote the sale, use or other dealings |
| 24 |
in this Software without prior written authorization from The Open Group. |
| 25 |
|
| 26 |
Author: Ralph Mor, X Consortium |
| 27 |
******************************************************************************/ |
| 28 |
|
| 29 |
#ifndef _ICELIB_H_ |
| 30 |
#define _ICELIB_H_ |
| 31 |
|
| 32 |
#include <X11/ICE/ICE.h> |
| 33 |
#include <X11/Xfuncproto.h> |
| 34 |
|
| 35 |
#define Bool int |
| 36 |
#define Status int |
| 37 |
#define True 1 |
| 38 |
#define False 0 |
| 39 |
|
| 40 |
typedef void *IcePointer; |
| 41 |
|
| 42 |
typedef enum { |
| 43 |
IcePoAuthHaveReply, |
| 44 |
IcePoAuthRejected, |
| 45 |
IcePoAuthFailed, |
| 46 |
IcePoAuthDoneCleanup |
| 47 |
} IcePoAuthStatus; |
| 48 |
|
| 49 |
typedef enum { |
| 50 |
IcePaAuthContinue, |
| 51 |
IcePaAuthAccepted, |
| 52 |
IcePaAuthRejected, |
| 53 |
IcePaAuthFailed |
| 54 |
} IcePaAuthStatus; |
| 55 |
|
| 56 |
typedef enum { |
| 57 |
IceConnectPending, |
| 58 |
IceConnectAccepted, |
| 59 |
IceConnectRejected, |
| 60 |
IceConnectIOError |
| 61 |
} IceConnectStatus; |
| 62 |
|
| 63 |
typedef enum { |
| 64 |
IceProtocolSetupSuccess, |
| 65 |
IceProtocolSetupFailure, |
| 66 |
IceProtocolSetupIOError, |
| 67 |
IceProtocolAlreadyActive |
| 68 |
} IceProtocolSetupStatus; |
| 69 |
|
| 70 |
typedef enum { |
| 71 |
IceAcceptSuccess, |
| 72 |
IceAcceptFailure, |
| 73 |
IceAcceptBadMalloc |
| 74 |
} IceAcceptStatus; |
| 75 |
|
| 76 |
typedef enum { |
| 77 |
IceClosedNow, |
| 78 |
IceClosedASAP, |
| 79 |
IceConnectionInUse, |
| 80 |
IceStartedShutdownNegotiation |
| 81 |
} IceCloseStatus; |
| 82 |
|
| 83 |
typedef enum { |
| 84 |
IceProcessMessagesSuccess, |
| 85 |
IceProcessMessagesIOError, |
| 86 |
IceProcessMessagesConnectionClosed |
| 87 |
} IceProcessMessagesStatus; |
| 88 |
|
| 89 |
typedef struct { |
| 90 |
unsigned long sequence_of_request; |
| 91 |
int major_opcode_of_request; |
| 92 |
int minor_opcode_of_request; |
| 93 |
IcePointer reply; |
| 94 |
} IceReplyWaitInfo; |
| 95 |
|
| 96 |
typedef struct _IceConn *IceConn; |
| 97 |
typedef struct _IceListenObj *IceListenObj; |
| 98 |
|
| 99 |
typedef void (*IceWatchProc) ( |
| 100 |
IceConn /* iceConn */, |
| 101 |
IcePointer /* clientData */, |
| 102 |
Bool /* opening */, |
| 103 |
IcePointer * /* watchData */ |
| 104 |
); |
| 105 |
|
| 106 |
typedef void (*IcePoProcessMsgProc) ( |
| 107 |
IceConn /* iceConn */, |
| 108 |
IcePointer /* clientData */, |
| 109 |
int /* opcode */, |
| 110 |
unsigned long /* length */, |
| 111 |
Bool /* swap */, |
| 112 |
IceReplyWaitInfo * /* replyWait */, |
| 113 |
Bool * /* replyReadyRet */ |
| 114 |
); |
| 115 |
|
| 116 |
typedef void (*IcePaProcessMsgProc) ( |
| 117 |
IceConn /* iceConn */, |
| 118 |
IcePointer /* clientData */, |
| 119 |
int /* opcode */, |
| 120 |
unsigned long /* length */, |
| 121 |
Bool /* swap */ |
| 122 |
); |
| 123 |
|
| 124 |
typedef struct { |
| 125 |
int major_version; |
| 126 |
int minor_version; |
| 127 |
IcePoProcessMsgProc process_msg_proc; |
| 128 |
} IcePoVersionRec; |
| 129 |
|
| 130 |
typedef struct { |
| 131 |
int major_version; |
| 132 |
int minor_version; |
| 133 |
IcePaProcessMsgProc process_msg_proc; |
| 134 |
} IcePaVersionRec; |
| 135 |
|
| 136 |
typedef IcePoAuthStatus (*IcePoAuthProc) ( |
| 137 |
IceConn /* iceConn */, |
| 138 |
IcePointer * /* authStatePtr */, |
| 139 |
Bool /* cleanUp */, |
| 140 |
Bool /* swap */, |
| 141 |
int /* authDataLen */, |
| 142 |
IcePointer /* authData */, |
| 143 |
int * /* replyDataLenRet */, |
| 144 |
IcePointer * /* replyDataRet */, |
| 145 |
char ** /* errorStringRet */ |
| 146 |
); |
| 147 |
|
| 148 |
typedef IcePaAuthStatus (*IcePaAuthProc) ( |
| 149 |
IceConn /* iceConn */, |
| 150 |
IcePointer * /* authStatePtr */, |
| 151 |
Bool /* swap */, |
| 152 |
int /* authDataLen */, |
| 153 |
IcePointer /* authData */, |
| 154 |
int * /* replyDataLenRet */, |
| 155 |
IcePointer * /* replyDataRet */, |
| 156 |
char ** /* errorStringRet */ |
| 157 |
); |
| 158 |
|
| 159 |
typedef Bool (*IceHostBasedAuthProc) ( |
| 160 |
char * /* hostName */ |
| 161 |
); |
| 162 |
|
| 163 |
typedef Status (*IceProtocolSetupProc) ( |
| 164 |
IceConn /* iceConn */, |
| 165 |
int /* majorVersion */, |
| 166 |
int /* minorVersion */, |
| 167 |
char * /* vendor */, |
| 168 |
char * /* release */, |
| 169 |
IcePointer * /* clientDataRet */, |
| 170 |
char ** /* failureReasonRet */ |
| 171 |
); |
| 172 |
|
| 173 |
typedef void (*IceProtocolActivateProc) ( |
| 174 |
IceConn /* iceConn */, |
| 175 |
IcePointer /* clientData */ |
| 176 |
); |
| 177 |
|
| 178 |
typedef void (*IceIOErrorProc) ( |
| 179 |
IceConn /* iceConn */ |
| 180 |
); |
| 181 |
|
| 182 |
typedef void (*IcePingReplyProc) ( |
| 183 |
IceConn /* iceConn */, |
| 184 |
IcePointer /* clientData */ |
| 185 |
); |
| 186 |
|
| 187 |
typedef void (*IceErrorHandler) ( |
| 188 |
IceConn /* iceConn */, |
| 189 |
Bool /* swap */, |
| 190 |
int /* offendingMinorOpcode */, |
| 191 |
unsigned long /* offendingSequence */, |
| 192 |
int /* errorClass */, |
| 193 |
int /* severity */, |
| 194 |
IcePointer /* values */ |
| 195 |
); |
| 196 |
|
| 197 |
typedef void (*IceIOErrorHandler) ( |
| 198 |
IceConn /* iceConn */ |
| 199 |
); |
| 200 |
|
| 201 |
|
| 202 |
/* |
| 203 |
* Function prototypes |
| 204 |
*/ |
| 205 |
|
| 206 |
_XFUNCPROTOBEGIN |
| 207 |
|
| 208 |
extern int IceRegisterForProtocolSetup ( |
| 209 |
const char * /* protocolName */, |
| 210 |
const char * /* vendor */, |
| 211 |
const char * /* release */, |
| 212 |
int /* versionCount */, |
| 213 |
IcePoVersionRec * /* versionRecs */, |
| 214 |
int /* authCount */, |
| 215 |
const char ** /* authNames */, |
| 216 |
IcePoAuthProc * /* authProcs */, |
| 217 |
IceIOErrorProc /* IOErrorProc */ |
| 218 |
); |
| 219 |
|
| 220 |
extern int IceRegisterForProtocolReply ( |
| 221 |
const char * /* protocolName */, |
| 222 |
const char * /* vendor */, |
| 223 |
const char * /* release */, |
| 224 |
int /* versionCount */, |
| 225 |
IcePaVersionRec * /* versionRecs */, |
| 226 |
int /* authCount */, |
| 227 |
const char ** /* authNames */, |
| 228 |
IcePaAuthProc * /* authProcs */, |
| 229 |
IceHostBasedAuthProc /* hostBasedAuthProc */, |
| 230 |
IceProtocolSetupProc /* protocolSetupProc */, |
| 231 |
IceProtocolActivateProc /* protocolActivateProc */, |
| 232 |
IceIOErrorProc /* IOErrorProc */ |
| 233 |
); |
| 234 |
|
| 235 |
extern IceConn IceOpenConnection ( |
| 236 |
char * /* networkIdsList */, |
| 237 |
IcePointer /* context */, |
| 238 |
Bool /* mustAuthenticate */, |
| 239 |
int /* majorOpcodeCheck */, |
| 240 |
int /* errorLength */, |
| 241 |
char * /* errorStringRet */ |
| 242 |
); |
| 243 |
|
| 244 |
extern IcePointer IceGetConnectionContext ( |
| 245 |
IceConn /* iceConn */ |
| 246 |
); |
| 247 |
|
| 248 |
extern Status IceListenForConnections ( |
| 249 |
int * /* countRet */, |
| 250 |
IceListenObj ** /* listenObjsRet */, |
| 251 |
int /* errorLength */, |
| 252 |
char * /* errorStringRet */ |
| 253 |
); |
| 254 |
|
| 255 |
extern Status IceListenForWellKnownConnections ( |
| 256 |
char * /* port */, |
| 257 |
int * /* countRet */, |
| 258 |
IceListenObj ** /* listenObjsRet */, |
| 259 |
int /* errorLength */, |
| 260 |
char * /* errorStringRet */ |
| 261 |
); |
| 262 |
|
| 263 |
extern int IceGetListenConnectionNumber ( |
| 264 |
IceListenObj /* listenObj */ |
| 265 |
); |
| 266 |
|
| 267 |
extern char *IceGetListenConnectionString ( |
| 268 |
IceListenObj /* listenObj */ |
| 269 |
); |
| 270 |
|
| 271 |
extern char *IceComposeNetworkIdList ( |
| 272 |
int /* count */, |
| 273 |
IceListenObj * /* listenObjs */ |
| 274 |
); |
| 275 |
|
| 276 |
extern void IceFreeListenObjs ( |
| 277 |
int /* count */, |
| 278 |
IceListenObj * /* listenObjs */ |
| 279 |
); |
| 280 |
|
| 281 |
extern void IceSetHostBasedAuthProc ( |
| 282 |
IceListenObj /* listenObj */, |
| 283 |
IceHostBasedAuthProc /* hostBasedAuthProc */ |
| 284 |
); |
| 285 |
|
| 286 |
extern IceConn IceAcceptConnection ( |
| 287 |
IceListenObj /* listenObj */, |
| 288 |
IceAcceptStatus * /* statusRet */ |
| 289 |
); |
| 290 |
|
| 291 |
extern void IceSetShutdownNegotiation ( |
| 292 |
IceConn /* iceConn */, |
| 293 |
Bool /* negotiate */ |
| 294 |
); |
| 295 |
|
| 296 |
extern Bool IceCheckShutdownNegotiation ( |
| 297 |
IceConn /* iceConn */ |
| 298 |
); |
| 299 |
|
| 300 |
extern IceCloseStatus IceCloseConnection ( |
| 301 |
IceConn /* iceConn */ |
| 302 |
); |
| 303 |
|
| 304 |
extern Status IceAddConnectionWatch ( |
| 305 |
IceWatchProc /* watchProc */, |
| 306 |
IcePointer /* clientData */ |
| 307 |
); |
| 308 |
|
| 309 |
extern void IceRemoveConnectionWatch ( |
| 310 |
IceWatchProc /* watchProc */, |
| 311 |
IcePointer /* clientData */ |
| 312 |
); |
| 313 |
|
| 314 |
extern IceProtocolSetupStatus IceProtocolSetup ( |
| 315 |
IceConn /* iceConn */, |
| 316 |
int /* myOpcode */, |
| 317 |
IcePointer /* clientData */, |
| 318 |
Bool /* mustAuthenticate */, |
| 319 |
int * /* majorVersionRet */, |
| 320 |
int * /* minorVersionRet */, |
| 321 |
char ** /* vendorRet */, |
| 322 |
char ** /* releaseRet */, |
| 323 |
int /* errorLength */, |
| 324 |
char * /* errorStringRet */ |
| 325 |
); |
| 326 |
|
| 327 |
extern Status IceProtocolShutdown ( |
| 328 |
IceConn /* iceConn */, |
| 329 |
int /* majorOpcode */ |
| 330 |
); |
| 331 |
|
| 332 |
extern IceProcessMessagesStatus IceProcessMessages ( |
| 333 |
IceConn /* iceConn */, |
| 334 |
IceReplyWaitInfo * /* replyWait */, |
| 335 |
Bool * /* replyReadyRet */ |
| 336 |
); |
| 337 |
|
| 338 |
extern Status IcePing ( |
| 339 |
IceConn /* iceConn */, |
| 340 |
IcePingReplyProc /* pingReplyProc */, |
| 341 |
IcePointer /* clientData */ |
| 342 |
); |
| 343 |
|
| 344 |
extern char *IceAllocScratch ( |
| 345 |
IceConn /* iceConn */, |
| 346 |
unsigned long /* size */ |
| 347 |
); |
| 348 |
|
| 349 |
extern int IceFlush ( |
| 350 |
IceConn /* iceConn */ |
| 351 |
); |
| 352 |
|
| 353 |
extern int IceGetOutBufSize ( |
| 354 |
IceConn /* iceConn */ |
| 355 |
); |
| 356 |
|
| 357 |
extern int IceGetInBufSize ( |
| 358 |
IceConn /* iceConn */ |
| 359 |
); |
| 360 |
|
| 361 |
extern IceConnectStatus IceConnectionStatus ( |
| 362 |
IceConn /* iceConn */ |
| 363 |
); |
| 364 |
|
| 365 |
extern char *IceVendor ( |
| 366 |
IceConn /* iceConn */ |
| 367 |
); |
| 368 |
|
| 369 |
extern char *IceRelease ( |
| 370 |
IceConn /* iceConn */ |
| 371 |
); |
| 372 |
|
| 373 |
extern int IceProtocolVersion ( |
| 374 |
IceConn /* iceConn */ |
| 375 |
); |
| 376 |
|
| 377 |
extern int IceProtocolRevision ( |
| 378 |
IceConn /* iceConn */ |
| 379 |
); |
| 380 |
|
| 381 |
extern int IceConnectionNumber ( |
| 382 |
IceConn /* iceConn */ |
| 383 |
); |
| 384 |
|
| 385 |
extern char *IceConnectionString ( |
| 386 |
IceConn /* iceConn */ |
| 387 |
); |
| 388 |
|
| 389 |
extern unsigned long IceLastSentSequenceNumber ( |
| 390 |
IceConn /* iceConn */ |
| 391 |
); |
| 392 |
|
| 393 |
extern unsigned long IceLastReceivedSequenceNumber ( |
| 394 |
IceConn /* iceConn */ |
| 395 |
); |
| 396 |
|
| 397 |
extern Bool IceSwapping ( |
| 398 |
IceConn /* iceConn */ |
| 399 |
); |
| 400 |
|
| 401 |
extern IceErrorHandler IceSetErrorHandler ( |
| 402 |
IceErrorHandler /* handler */ |
| 403 |
); |
| 404 |
|
| 405 |
extern IceIOErrorHandler IceSetIOErrorHandler ( |
| 406 |
IceIOErrorHandler /* handler */ |
| 407 |
); |
| 408 |
|
| 409 |
extern char *IceGetPeerName ( |
| 410 |
IceConn /* iceConn */ |
| 411 |
); |
| 412 |
|
| 413 |
/* |
| 414 |
* Multithread Routines |
| 415 |
*/ |
| 416 |
|
| 417 |
extern Status IceInitThreads ( |
| 418 |
void |
| 419 |
); |
| 420 |
|
| 421 |
extern void IceAppLockConn ( |
| 422 |
IceConn /* iceConn */ |
| 423 |
); |
| 424 |
|
| 425 |
extern void IceAppUnlockConn ( |
| 426 |
IceConn /* iceConn */ |
| 427 |
); |
| 428 |
|
| 429 |
_XFUNCPROTOEND |
| 430 |
|
| 431 |
#endif /* _ICELIB_H_ */ |