home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / include / x11 / ice / icelib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-17  |  11.3 KB  |  529 lines

  1. /* $XConsortium: ICElib.h,v 1.40 94/06/01 10:48:43 mor Exp $ */
  2. /******************************************************************************
  3.  
  4.  
  5. Copyright (c) 1993  X Consortium
  6.  
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13.  
  14. The above copyright notice and this permission notice shall be included in
  15. all copies or substantial portions of the Software.
  16.  
  17. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  20. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  21. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  
  24. Except as contained in this notice, the name of the X Consortium shall not be
  25. used in advertising or otherwise to promote the sale, use or other dealings
  26. in this Software without prior written authorization from the X Consortium.
  27.  
  28. Author: Ralph Mor, X Consortium
  29. ******************************************************************************/
  30.  
  31. #ifndef _ICELIB_H_
  32. #define _ICELIB_H_
  33.  
  34. #include <X11/ICE/ICE.h>
  35. #include <X11/Xfuncproto.h>
  36.  
  37. #define Bool int
  38. #define Status int
  39. #define True 1
  40. #define False 0
  41.  
  42. #if NeedFunctionPrototypes
  43. typedef void *IcePointer;
  44. #else
  45. typedef char *IcePointer;
  46. #endif
  47.  
  48. typedef enum {
  49.     IcePoAuthHaveReply,
  50.     IcePoAuthRejected,
  51.     IcePoAuthFailed,
  52.     IcePoAuthDoneCleanup
  53. } IcePoAuthStatus;
  54.  
  55. typedef enum {
  56.     IcePaAuthContinue,
  57.     IcePaAuthAccepted,
  58.     IcePaAuthRejected,
  59.     IcePaAuthFailed
  60. } IcePaAuthStatus;
  61.  
  62. typedef enum {
  63.     IceConnectPending,
  64.     IceConnectAccepted,
  65.     IceConnectRejected,
  66.     IceConnectIOError
  67. } IceConnectStatus;
  68.  
  69. typedef enum {
  70.     IceProtocolSetupSuccess,
  71.     IceProtocolSetupFailure,
  72.     IceProtocolSetupIOError,
  73.     IceProtocolAlreadyActive
  74. } IceProtocolSetupStatus;
  75.  
  76. typedef enum {
  77.     IceAcceptSuccess,
  78.     IceAcceptFailure,
  79.     IceAcceptBadMalloc
  80. } IceAcceptStatus;
  81.  
  82. typedef enum {
  83.     IceClosedNow,
  84.     IceClosedASAP,
  85.     IceConnectionInUse,
  86.     IceStartedShutdownNegotiation
  87. } IceCloseStatus;
  88.  
  89. typedef enum {
  90.     IceProcessMessagesSuccess,
  91.     IceProcessMessagesIOError,
  92.     IceProcessMessagesConnectionClosed
  93. } IceProcessMessagesStatus;
  94.  
  95. typedef struct {
  96.     unsigned long    sequence_of_request;
  97.     int            major_opcode_of_request;
  98.     int            minor_opcode_of_request;
  99.     IcePointer        reply;
  100. } IceReplyWaitInfo;
  101.  
  102. typedef struct _IceConn *IceConn;
  103. typedef struct _IceListenObj *IceListenObj;
  104.  
  105. typedef void (*IceWatchProc) (
  106. #if NeedFunctionPrototypes
  107.     IceConn        /* iceConn */,
  108.     IcePointer        /* clientData */,
  109.     Bool        /* opening */,
  110.     IcePointer *    /* watchData */
  111. #endif
  112. );
  113.  
  114. typedef void (*IcePoProcessMsgProc) (
  115. #if NeedFunctionPrototypes
  116.     IceConn         /* iceConn */,
  117.     IcePointer        /* clientData */,
  118.     int            /* opcode */,
  119.     unsigned long    /* length */,
  120.     Bool        /* swap */,
  121.     IceReplyWaitInfo *  /* replyWait */,
  122.     Bool *        /* replyReadyRet */
  123. #endif
  124. );
  125.  
  126. typedef void (*IcePaProcessMsgProc) (
  127. #if NeedFunctionPrototypes
  128.     IceConn         /* iceConn */,
  129.     IcePointer        /* clientData */,
  130.     int            /* opcode */,
  131.     unsigned long    /* length */,
  132.     Bool        /* swap */
  133. #endif
  134. );
  135.  
  136. typedef struct {
  137.     int             major_version;
  138.     int             minor_version;
  139.     IcePoProcessMsgProc  process_msg_proc;
  140. } IcePoVersionRec;
  141.  
  142. typedef struct {
  143.     int             major_version;
  144.     int             minor_version;
  145.     IcePaProcessMsgProc  process_msg_proc;
  146. } IcePaVersionRec;
  147.  
  148. typedef IcePoAuthStatus (*IcePoAuthProc) (
  149. #if NeedFunctionPrototypes
  150.     IceConn        /* iceConn */,
  151.     IcePointer *    /* authStatePtr */,
  152.     Bool        /* cleanUp */,
  153.     Bool        /* swap */,
  154.     int            /* authDataLen */,
  155.     IcePointer        /* authData */,
  156.     int *        /* replyDataLenRet */,
  157.     IcePointer *    /* replyDataRet */,
  158.     char **        /* errorStringRet */
  159. #endif
  160. );
  161.  
  162. typedef IcePaAuthStatus (*IcePaAuthProc) (
  163. #if NeedFunctionPrototypes
  164.     IceConn        /* iceConn */,
  165.     IcePointer *    /* authStatePtr */,
  166.     Bool        /* swap */,
  167.     int            /* authDataLen */,
  168.     IcePointer        /* authData */,
  169.     int *        /* replyDataLenRet */,
  170.     IcePointer *    /* replyDataRet */,
  171.     char **        /* errorStringRet */
  172. #endif
  173. );
  174.  
  175. typedef Bool (*IceHostBasedAuthProc) (
  176. #if NeedFunctionPrototypes
  177.     char *        /* hostName */
  178. #endif
  179. );
  180.  
  181. typedef Status (*IceProtocolSetupProc) (
  182. #if NeedFunctionPrototypes
  183.     IceConn         /* iceConn */,
  184.     int            /* majorVersion */,
  185.     int            /* minorVersion */,
  186.     char *        /* vendor */,
  187.     char *        /* release */,
  188.     IcePointer *    /* clientDataRet */,
  189.     char **        /* failureReasonRet */
  190. #endif
  191. );
  192.  
  193. typedef void (*IceProtocolActivateProc) (
  194. #if NeedFunctionPrototypes
  195.     IceConn         /* iceConn */,
  196.     IcePointer        /* clientData */
  197. #endif
  198. );
  199.  
  200. typedef void (*IceIOErrorProc) (
  201. #if NeedFunctionPrototypes
  202.     IceConn         /* iceConn */
  203. #endif
  204. );
  205.  
  206. typedef void (*IcePingReplyProc) (
  207. #if NeedFunctionPrototypes
  208.     IceConn         /* iceConn */,
  209.     IcePointer        /* clientData */
  210. #endif
  211. );
  212.  
  213. typedef void (*IceErrorHandler) (
  214. #if NeedFunctionPrototypes
  215.     IceConn         /* iceConn */,
  216.     Bool        /* swap */,
  217.     int            /* offendingMinorOpcode */,
  218.     unsigned long     /* offendingSequence */,
  219.     int         /* errorClass */,
  220.     int            /* severity */,
  221.     IcePointer        /* values */
  222. #endif
  223. );
  224.  
  225. typedef void (*IceIOErrorHandler) (
  226. #if NeedFunctionPrototypes
  227.     IceConn         /* iceConn */
  228. #endif
  229. );
  230.  
  231.  
  232. /*
  233.  * Function prototypes
  234.  */
  235.  
  236. _XFUNCPROTOBEGIN
  237.  
  238. extern int IceRegisterForProtocolSetup (
  239. #if NeedFunctionPrototypes
  240.     char *            /* protocolName */,
  241.     char *            /* vendor */,
  242.     char *            /* release */,
  243.     int                /* versionCount */,
  244.     IcePoVersionRec *        /* versionRecs */,
  245.     int                /* authCount */,
  246.     char **            /* authNames */,
  247.     IcePoAuthProc *        /* authProcs */,
  248.     IceIOErrorProc        /* IOErrorProc */
  249. #endif
  250. );
  251.  
  252. extern int IceRegisterForProtocolReply (
  253. #if NeedFunctionPrototypes
  254.     char *            /* protocolName */,
  255.     char *            /* vendor */,
  256.     char *            /* release */,
  257.     int                /* versionCount */,
  258.     IcePaVersionRec *        /* versionRecs */,
  259.     int                /* authCount */,
  260.     char **            /* authNames */,
  261.     IcePaAuthProc *        /* authProcs */,
  262.     IceHostBasedAuthProc    /* hostBasedAuthProc */,
  263.     IceProtocolSetupProc    /* protocolSetupProc */,
  264.     IceProtocolActivateProc    /* protocolActivateProc */,
  265.     IceIOErrorProc        /* IOErrorProc */
  266. #endif
  267. );
  268.  
  269. extern IceConn IceOpenConnection (
  270. #if NeedFunctionPrototypes
  271.     char *        /* networkIdsList */,
  272.     IcePointer        /* context */,
  273.     Bool        /* mustAuthenticate */,
  274.     int            /* majorOpcodeCheck */,
  275.     int            /* errorLength */,
  276.     char *        /* errorStringRet */
  277. #endif
  278. );
  279.  
  280. extern IcePointer IceGetConnectionContext (
  281. #if NeedFunctionPrototypes
  282.     IceConn        /* iceConn */
  283. #endif
  284. );
  285.  
  286. extern Status IceListenForConnections (
  287. #if NeedFunctionPrototypes
  288.     int *        /* countRet */,
  289.     IceListenObj **    /* listenObjsRet */,
  290.     int            /* errorLength */,
  291.     char *        /* errorStringRet */
  292. #endif
  293. );
  294.  
  295. extern int IceGetListenConnectionNumber (
  296. #if NeedFunctionPrototypes
  297.     IceListenObj    /* listenObj */
  298. #endif
  299. );
  300.  
  301. extern char *IceGetListenConnectionString (
  302. #if NeedFunctionPrototypes
  303.     IceListenObj    /* listenObj */
  304. #endif
  305. );
  306.  
  307. extern char *IceComposeNetworkIdList (
  308. #if NeedFunctionPrototypes
  309.     int            /* count */,
  310.     IceListenObj *    /* listenObjs */
  311. #endif
  312. );
  313.  
  314. extern void IceFreeListenObjs (
  315. #if NeedFunctionPrototypes
  316.     int            /* count */,
  317.     IceListenObj *    /* listenObjs */
  318. #endif
  319. );
  320.  
  321. extern void IceSetHostBasedAuthProc (
  322. #if NeedFunctionPrototypes
  323.     IceListenObj        /* listenObj */,
  324.     IceHostBasedAuthProc       /* hostBasedAuthProc */
  325. #endif
  326. );
  327.  
  328. extern IceConn IceAcceptConnection (
  329. #if NeedFunctionPrototypes
  330.     IceListenObj    /* listenObj */,
  331.     IceAcceptStatus *    /* statusRet */
  332. #endif
  333. );
  334.  
  335. extern void IceSetShutdownNegotiation (
  336. #if NeedFunctionPrototypes
  337.     IceConn        /* iceConn */,
  338.     Bool        /* negotiate */
  339. #endif
  340. );
  341.  
  342. extern Bool IceCheckShutdownNegotiation (
  343. #if NeedFunctionPrototypes
  344.     IceConn        /* iceConn */
  345. #endif
  346. );
  347.  
  348. extern IceCloseStatus IceCloseConnection (
  349. #if NeedFunctionPrototypes
  350.     IceConn        /* iceConn */
  351. #endif
  352. );
  353.  
  354. extern Status IceAddConnectionWatch (
  355. #if NeedFunctionPrototypes
  356.     IceWatchProc        /* watchProc */,
  357.     IcePointer            /* clientData */
  358. #endif
  359. );
  360.  
  361. extern void IceRemoveConnectionWatch (
  362. #if NeedFunctionPrototypes
  363.     IceWatchProc        /* watchProc */,
  364.     IcePointer            /* clientData */
  365. #endif
  366. );
  367.  
  368. extern IceProtocolSetupStatus IceProtocolSetup (
  369. #if NeedFunctionPrototypes
  370.     IceConn        /* iceConn */,
  371.     int         /* myOpcode */,
  372.     IcePointer        /* clientData */,
  373.     Bool        /* mustAuthenticate */,
  374.     int    *        /* majorVersionRet */,
  375.     int    *        /* minorVersionRet */,
  376.     char **        /* vendorRet */,
  377.     char **        /* releaseRet */,
  378.     int            /* errorLength */,
  379.     char *        /* errorStringRet */
  380. #endif
  381. );
  382.  
  383. extern Status IceProtocolShutdown (
  384. #if NeedFunctionPrototypes
  385.     IceConn        /* iceConn */,
  386.     int            /* majorOpcode */
  387. #endif
  388. );
  389.  
  390. extern IceProcessMessagesStatus IceProcessMessages (
  391. #if NeedFunctionPrototypes
  392.     IceConn        /* iceConn */,
  393.     IceReplyWaitInfo *    /* replyWait */,
  394.     Bool *        /* replyReadyRet */
  395. #endif
  396. );
  397.  
  398. extern Status IcePing (
  399. #if NeedFunctionPrototypes
  400.    IceConn        /* iceConn */,
  401.    IcePingReplyProc    /* pingReplyProc */,
  402.    IcePointer        /* clientData */
  403. #endif
  404. );
  405.  
  406. extern char *IceAllocScratch (
  407. #if NeedFunctionPrototypes
  408.    IceConn        /* iceConn */,
  409.    unsigned long    /* size */
  410. #endif
  411. );
  412.  
  413. extern IceFlush (
  414. #if NeedFunctionPrototypes
  415.    IceConn        /* iceConn */
  416. #endif
  417. );
  418.  
  419. extern int IceGetOutBufSize (
  420. #if NeedFunctionPrototypes
  421.    IceConn        /* iceConn */
  422. #endif
  423. );
  424.  
  425. extern int IceGetInBufSize (
  426. #if NeedFunctionPrototypes
  427.    IceConn        /* iceConn */
  428. #endif
  429. );
  430.  
  431. extern IceConnectStatus IceConnectionStatus (
  432. #if NeedFunctionPrototypes
  433.     IceConn        /* iceConn */
  434. #endif
  435. );
  436.  
  437. extern char *IceVendor (
  438. #if NeedFunctionPrototypes
  439.     IceConn        /* iceConn */
  440. #endif
  441. );
  442.  
  443. extern char *IceRelease (
  444. #if NeedFunctionPrototypes
  445.     IceConn        /* iceConn */
  446. #endif
  447. );
  448.  
  449. extern int IceProtocolVersion (
  450. #if NeedFunctionPrototypes
  451.     IceConn        /* iceConn */
  452. #endif
  453. );
  454.  
  455. extern int IceProtocolRevision (
  456. #if NeedFunctionPrototypes
  457.     IceConn        /* iceConn */
  458. #endif
  459. );
  460.  
  461. extern int IceConnectionNumber (
  462. #if NeedFunctionPrototypes
  463.     IceConn        /* iceConn */
  464. #endif
  465. );
  466.  
  467. extern char *IceConnectionString (
  468. #if NeedFunctionPrototypes
  469.     IceConn        /* iceConn */
  470. #endif
  471. );
  472.  
  473. extern unsigned long IceLastSentSequenceNumber (
  474. #if NeedFunctionPrototypes
  475.     IceConn        /* iceConn */
  476. #endif
  477. );
  478.  
  479. extern unsigned long IceLastReceivedSequenceNumber (
  480. #if NeedFunctionPrototypes
  481.     IceConn        /* iceConn */
  482. #endif
  483. );
  484.  
  485. extern Bool IceSwapping (
  486. #if NeedFunctionPrototypes
  487.     IceConn        /* iceConn */
  488. #endif
  489. );
  490.  
  491. extern IceErrorHandler IceSetErrorHandler (
  492. #if NeedFunctionPrototypes
  493.     IceErrorHandler     /* handler */
  494. #endif
  495. );
  496.  
  497. extern IceIOErrorHandler IceSetIOErrorHandler (
  498. #if NeedFunctionPrototypes
  499.     IceIOErrorHandler     /* handler */
  500. #endif
  501. );
  502.  
  503.  
  504. /*
  505.  * Multithread Routines
  506.  */
  507.  
  508. extern Status IceInitThreads (
  509. #if NeedFunctionPrototypes
  510.     void
  511. #endif
  512. );
  513.  
  514. extern void IceAppLockConn (
  515. #if NeedFunctionPrototypes
  516.     IceConn        /* iceConn */
  517. #endif
  518. );
  519.  
  520. extern void IceAppUnlockConn (
  521. #if NeedFunctionPrototypes
  522.     IceConn        /* iceConn */
  523. #endif
  524. );
  525.  
  526. _XFUNCPROTOEND
  527.  
  528. #endif /* _ICELIB_H_ */
  529.