• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

dcop

ICElibint.h

Go to the documentation of this file.
00001 /* $Xorg: ICElibint.h,v 1.3 2000/08/17 19:44:10 cpqbld Exp $ */
00002 /******************************************************************************
00003 
00004 
00005 Copyright (c) 1993, 1998  The Open Group
00006 
00007 All Rights Reserved.
00008 
00009 The above copyright notice and this permission notice shall be included in
00010 all copies or substantial portions of the Software.
00011 
00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00013 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00014 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00015 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00016 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00017 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018 
00019 Except as contained in this notice, the name of The Open Group shall not be
00020 used in advertising or otherwise to promote the sale, use or other dealings
00021 in this Software without prior written authorization from The Open Group.
00022 
00023 Author: Ralph Mor, X Consortium
00024 ******************************************************************************/
00025 /* $XFree86: xc/lib/ICE/ICElibint.h,v 1.4 2001/01/17 19:41:29 dawes Exp $ */
00026 #ifndef _ICELIBINT_H_
00027 #define _ICELIBINT_H_
00028 
00029 #include "config.h"
00030 #if defined Q_WS_X11 && ! defined K_WS_QTONLY
00031 #include <X11/Xos.h>
00032 #include <X11/Xfuncs.h>
00033 #include <X11/Xmd.h> //schroder
00034 #else
00035 #define _SIZEOF(x) sz_##x
00036 #define SIZEOF(x) _SIZEOF(x)
00037 #endif
00038 #include <KDE-ICE/ICEproto.h>
00039 #include <KDE-ICE/ICEconn.h>
00040 #include <KDE-ICE/ICEmsg.h>
00041 
00042 #ifndef X_NOT_STDC_ENV
00043 #include <stdlib.h>
00044 #else
00045 char *malloc();
00046 #endif
00047 
00048 #ifndef NULL
00049 #define NULL 0
00050 #endif
00051 
00052 
00053 /*
00054  * Vendor & Release
00055  */
00056 
00057 #define IceVendorString  "MIT"
00058 #define IceReleaseString "1.0"
00059 
00060 
00061 /*
00062  * Pad to a 64 bit boundary
00063  */
00064 
00065 #define PAD64(_bytes) ((8 - ((unsigned int) (_bytes) % 8)) % 8)
00066 
00067 #define PADDED_BYTES64(_bytes) (_bytes + PAD64 (_bytes))
00068 
00069 
00070 /*
00071  * Pad to 32 bit boundary
00072  */
00073 
00074 #define PAD32(_bytes) ((4 - ((unsigned int) (_bytes) % 4)) % 4)
00075 
00076 #define PADDED_BYTES32(_bytes) (_bytes + PAD32 (_bytes))
00077 
00078 
00079 /*
00080  * Number of 8 byte units in _bytes.
00081  */
00082 
00083 #define WORD64COUNT(_bytes) (((unsigned int) ((_bytes) + 7)) >> 3)
00084 
00085 
00086 /*
00087  * Number of 4 byte units in _bytes.
00088  */
00089 
00090 #define WORD32COUNT(_bytes) (((unsigned int) ((_bytes) + 3)) >> 2)
00091 
00092 
00093 /*
00094  * Given a string, compute the number of bytes for the STRING representation
00095  */
00096 
00097 #define STRING_BYTES(_string) \
00098     (2 + strlen (_string) + PAD32 (2 + strlen (_string)))
00099 
00100 
00101 /*
00102  * Size of ICE input/output buffers
00103  */
00104 
00105 #define ICE_INBUFSIZE 1024
00106 
00107 #define ICE_OUTBUFSIZE 1024
00108 
00109 
00110 /*
00111  * Maxium number of ICE authentication methods allowed, and maxiumum
00112  * number of authentication data entries allowed to be set in the
00113  * IceSetPaAuthData function.
00114  *
00115  * We should use linked lists, but this is easier and should suffice.
00116  */
00117 
00118 #define MAX_ICE_AUTH_NAMES 32
00119 #define ICE_MAX_AUTH_DATA_ENTRIES 100
00120 
00121 
00122 /*
00123  * ICE listen object
00124  */
00125 
00126 struct _IceListenObj {
00127     struct _XtransConnInfo  *trans_conn; /* transport connection object */
00128     char            *network_id;
00129     IceHostBasedAuthProc    host_based_auth_proc;
00130 };
00131 
00132 
00133 /*
00134  * Some internal data structures for processing ICE messages.
00135  */
00136 
00137 typedef void (*_IceProcessCoreMsgProc) (
00138 #if NeedFunctionPrototypes
00139     IceConn         /* iceConn */,
00140     int         /* opcode */,
00141     unsigned long   /* length */,
00142     Bool        /* swap */,
00143     IceReplyWaitInfo *  /* replyWait */,
00144     Bool *      /* replyReadyRet */,
00145     Bool *      /* connectionClosedRet */
00146 #endif
00147 );
00148 
00149 typedef struct {
00150     int             major_version;
00151     int             minor_version;
00152     _IceProcessCoreMsgProc  process_core_msg_proc;
00153 } _IceVersion;
00154 
00155 
00156 /*
00157  * STORE FOO
00158  */
00159 
00160 #define STORE_CARD8(_pBuf, _val) \
00161 { \
00162     *((CARD8 *) _pBuf) = _val; \
00163     _pBuf += 1; \
00164 }
00165 
00166 #ifndef WORD64
00167 
00168 #define STORE_CARD16(_pBuf, _val) \
00169 { \
00170     *((CARD16 *) _pBuf) = _val; \
00171     _pBuf += 2; \
00172 }
00173 
00174 #define STORE_CARD32(_pBuf, _val) \
00175 { \
00176     *((CARD32 *) _pBuf) = _val; \
00177     _pBuf += 4; \
00178 }
00179 
00180 #else /* WORD64 */
00181 
00182 #define STORE_CARD16(_pBuf, _val) \
00183 { \
00184     struct { \
00185         int value   :16; \
00186         int pad     :16; \
00187     } _d; \
00188     _d.value = _val; \
00189     memcpy (_pBuf, &_d, 2); \
00190     _pBuf += 2; \
00191 }
00192 
00193 #define STORE_CARD32(_pBuf, _val) \
00194 { \
00195     struct { \
00196         int value   :32; \
00197     } _d; \
00198     _d.value = _val; \
00199     memcpy (_pBuf, &_d, 4); \
00200     _pBuf += 4; \
00201 }
00202 
00203 #endif /* WORD64 */
00204 
00205 #define STORE_STRING(_pBuf, _string) \
00206 { \
00207     CARD16 _len = strlen (_string); \
00208     STORE_CARD16 (_pBuf, _len); \
00209     memcpy (_pBuf, _string, _len); \
00210     _pBuf += _len; \
00211     if (PAD32 (2 + _len)) \
00212         _pBuf += PAD32 (2 + _len); \
00213 }
00214 
00215 
00216 /*
00217  * EXTRACT FOO
00218  */
00219 
00220 #define EXTRACT_CARD8(_pBuf, _val) \
00221 { \
00222     _val = *((CARD8 *) _pBuf); \
00223     _pBuf += 1; \
00224 }
00225 
00226 #ifndef WORD64
00227 
00228 #define EXTRACT_CARD16(_pBuf, _swap, _val) \
00229 { \
00230     _val = *((CARD16 *) _pBuf); \
00231     _pBuf += 2; \
00232     if (_swap) \
00233         _val = lswaps (_val); \
00234 }
00235 
00236 #define EXTRACT_CARD32(_pBuf, _swap, _val) \
00237 { \
00238     _val = *((CARD32 *) _pBuf); \
00239     _pBuf += 4; \
00240     if (_swap) \
00241         _val = lswapl (_val); \
00242 }
00243 
00244 #else /* WORD64 */
00245 
00246 #define EXTRACT_CARD16(_pBuf, _swap, _val) \
00247 { \
00248     _val = *(_pBuf + 0) & 0xff;     /* 0xff incase _pBuf is signed */ \
00249     _val <<= 8; \
00250     _val |= *(_pBuf + 1) & 0xff;\
00251     _pBuf += 2; \
00252     if (_swap) \
00253         _val = lswaps (_val); \
00254 }
00255 
00256 #define EXTRACT_CARD32(_pBuf, _swap, _val) \
00257 { \
00258     _val = *(_pBuf + 0) & 0xff;     /* 0xff incase _pBuf is signed */ \
00259     _val <<= 8; \
00260     _val |= *(_pBuf + 1) & 0xff;\
00261     _val <<= 8; \
00262     _val |= *(_pBuf + 2) & 0xff;\
00263     _val <<= 8; \
00264     _val |= *(_pBuf + 3) & 0xff;\
00265     _pBuf += 4; \
00266     if (_swap) \
00267         _val = lswapl (_val); \
00268 }
00269 
00270 #endif /* WORD64 */
00271 
00272 #define EXTRACT_STRING(_pBuf, _swap, _string) \
00273 { \
00274     CARD16 _len; \
00275     EXTRACT_CARD16 (_pBuf, _swap, _len); \
00276     _string = (char *) malloc (_len + 1); \
00277     memcpy (_string, _pBuf, _len); \
00278     _pBuf += _len; \
00279     _string[_len] = '\0'; \
00280     if (PAD32 (2 + _len)) \
00281         _pBuf += PAD32 (2 + _len); \
00282 }
00283 
00284 #define EXTRACT_LISTOF_STRING(_pBuf, _swap, _count, _strings) \
00285 { \
00286     int _i; \
00287     for (_i = 0; _i < _count; _i++) \
00288         EXTRACT_STRING (_pBuf, _swap, _strings[_i]); \
00289 }
00290 
00291 
00292 #define SKIP_STRING(_pBuf, _swap, _end, _bail) \
00293 { \
00294     CARD16 _len; \
00295     EXTRACT_CARD16 (_pBuf, _swap, _len); \
00296    _pBuf += _len + PAD32(2+_len); \
00297     if (_pBuf > _end) { \
00298        _bail; \
00299     } \
00300 }
00301 
00302 #define SKIP_LISTOF_STRING(_pBuf, _swap, _count, _end, _bail) \
00303 { \
00304     int _i; \
00305     for (_i = 0; _i < _count; _i++) \
00306         SKIP_STRING (_pBuf, _swap, _end, _bail); \
00307 }
00308 
00309 
00310 
00311 /*
00312  * Byte swapping
00313  */
00314 
00315 /* byte swap a long literal */
00316 #define lswapl(_val) ((((_val) & 0xff) << 24) |\
00317            (((_val) & 0xff00) << 8) |\
00318            (((_val) & 0xff0000) >> 8) |\
00319            (((_val) >> 24) & 0xff))
00320 
00321 /* byte swap a short literal */
00322 #define lswaps(_val) ((((_val) & 0xff) << 8) | (((_val) >> 8) & 0xff))
00323 
00324 
00325 
00326 /*
00327  * ICE replies (not processed via callbacks because we block)
00328  */
00329 
00330 #define ICE_CONNECTION_REPLY    1
00331 #define ICE_CONNECTION_ERROR    2
00332 #define ICE_PROTOCOL_REPLY  3
00333 #define ICE_PROTOCOL_ERROR  4
00334 
00335 typedef struct {
00336     int       type;
00337     int       version_index;
00338     char      *vendor;
00339     char          *release;
00340 } _IceConnectionReply;
00341 
00342 typedef struct {
00343     int       type;
00344     char      *error_message;
00345 } _IceConnectionError;
00346 
00347 typedef struct {
00348     int       type;
00349     int       major_opcode;
00350     int       version_index;
00351     char      *vendor;
00352     char      *release;
00353 } _IceProtocolReply;
00354 
00355 typedef struct {
00356     int       type;
00357     char      *error_message;
00358 } _IceProtocolError;
00359 
00360 
00361 typedef union {
00362     int         type;
00363     _IceConnectionReply connection_reply;
00364     _IceConnectionError connection_error;
00365     _IceProtocolReply   protocol_reply;
00366     _IceProtocolError   protocol_error;
00367 } _IceReply;
00368 
00369 
00370 /*
00371  * Watch for ICE connection create/destroy.
00372  */
00373 
00374 typedef struct _IceWatchedConnection {
00375     IceConn             iceConn;
00376     IcePointer              watch_data;
00377     struct _IceWatchedConnection    *next;
00378 } _IceWatchedConnection;
00379 
00380 typedef struct _IceWatchProc {
00381     IceWatchProc        watch_proc;
00382     IcePointer          client_data;
00383     _IceWatchedConnection   *watched_connections;
00384     struct _IceWatchProc    *next;
00385 } _IceWatchProc;
00386 
00387 
00388 /*
00389  * Locking
00390  */
00391 
00392 #define IceLockConn(_iceConn)
00393 #define IceUnlockConn(_iceConn)
00394 
00395 
00396 /*
00397  * Extern declarations
00398  */
00399 
00400 extern IceConn      _IceConnectionObjs[];
00401 extern char         *_IceConnectionStrings[];
00402 extern int          _IceConnectionCount;
00403 
00404 extern int      _IceAuthCount;
00405 extern const char   *_IceAuthNames[];
00406 extern IcePoAuthProc    _IcePoAuthProcs[];
00407 extern IcePaAuthProc    _IcePaAuthProcs[];
00408 
00409 extern int      _IceVersionCount;
00410 
00411 #define _IceErrorBadMajor _kde_IceErrorBadMajor
00412 
00413 
00414 extern void _IceErrorBadMajor (
00415 #if NeedFunctionPrototypes
00416     IceConn     /* iceConn */,
00417     int         /* offendingMajor */,
00418     int         /* offendingMinor */,
00419     int         /* severity */
00420 #endif
00421 );
00422 
00423 #define _IceErrorNoAuthentication _kde_IceErrorNoAuthentication
00424 
00425 extern void _IceErrorNoAuthentication (
00426 #if NeedFunctionPrototypes
00427     IceConn     /* iceConn */,
00428     int         /* offendingMinor */
00429 #endif
00430 );
00431 
00432 #define _IceErrorNoVersion _kde_IceErrorNoVersion
00433 
00434 extern void _IceErrorNoVersion (
00435 #if NeedFunctionPrototypes
00436     IceConn     /* iceConn */,
00437     int         /* offendingMinor */
00438 #endif
00439 );
00440 
00441 #define _IceErrorSetupFailed _kde_IceErrorSetupFailed
00442 
00443 extern void _IceErrorSetupFailed (
00444 #if NeedFunctionPrototypes
00445     IceConn     /* iceConn */,
00446     int         /* offendingMinor */,
00447     const char *    /* reason */
00448 #endif
00449 );
00450 
00451 #define _IceErrorAuthenticationRejected _kde_IceErrorAuthenticationRejected
00452 
00453 extern void _IceErrorAuthenticationRejected (
00454 #if NeedFunctionPrototypes
00455     IceConn     /* iceConn */,
00456     int         /* offendingMinor */,
00457     const char *    /* reason */
00458 #endif
00459 );
00460 
00461 #define _IceErrorAuthenticationFailed _kde_IceErrorAuthenticationFailed
00462 
00463 extern void _IceErrorAuthenticationFailed (
00464 #if NeedFunctionPrototypes
00465     IceConn     /* iceConn */,
00466     int         /* offendingMinor */,
00467     const char *    /* reason */
00468 #endif
00469 );
00470 
00471 #define _IceErrorProtocolDuplicate _kde_IceErrorProtocolDuplicate
00472 
00473 extern void _IceErrorProtocolDuplicate (
00474 #if NeedFunctionPrototypes
00475     IceConn     /* iceConn */,
00476     const char *    /* protocolName */
00477 #endif
00478 );
00479 
00480 #define _IceErrorMajorOpcodeDuplicate _kde_IceErrorMajorOpcodeDuplicate
00481 
00482 extern void _IceErrorMajorOpcodeDuplicate (
00483 #if NeedFunctionPrototypes
00484     IceConn     /* iceConn */,
00485     int         /* majorOpcode */
00486 #endif
00487 );
00488 
00489 #define _IceErrorUnknownProtocol _kde_IceErrorUnknownProtocol
00490 
00491 extern void _IceErrorUnknownProtocol (
00492 #if NeedFunctionPrototypes
00493     IceConn     /* iceConn */,
00494     const char *    /* protocolName */
00495 #endif
00496 );
00497 
00498 #define _IceAddOpcodeMapping _kde_IceAddOpcodeMapping
00499 
00500 extern void _IceAddOpcodeMapping (
00501 #if NeedFunctionPrototypes
00502     IceConn     /* iceConn */,
00503     int         /* hisOpcode */,
00504     int         /* myOpcode */
00505 #endif
00506 );
00507 
00508 #define _IceGetPeerName _kde_IceGetPeerName
00509 
00510 extern char *_IceGetPeerName (
00511 #if NeedFunctionPrototypes
00512     IceConn     /* iceConn */
00513 #endif
00514 );
00515 
00516 #define _IceFreeConnection _kde_IceFreeConnection
00517 
00518 extern void _IceFreeConnection (
00519 #if NeedFunctionPrototypes
00520     IceConn     /* iceConn */
00521 #endif
00522 );
00523 
00524 #define _IceAddReplyWait _kde_IceAddReplyWait
00525 
00526 extern void _IceAddReplyWait (
00527 #if NeedFunctionPrototypes
00528     IceConn     /* iceConn */,
00529     IceReplyWaitInfo *  /* replyWait */
00530 #endif
00531 );
00532 
00533 #define _IceSearchReplyWaits _kde_IceSearchReplyWaits
00534 
00535 extern IceReplyWaitInfo *_IceSearchReplyWaits (
00536 #if NeedFunctionPrototypes
00537     IceConn     /* iceConn */,
00538     int         /* majorOpcode */
00539 #endif
00540 );
00541 
00542 #define _IceSetReplyReady _kde_IceSetReplyReady
00543 
00544 extern void _IceSetReplyReady (
00545 #if NeedFunctionPrototypes
00546     IceConn     /* iceConn */,
00547     IceReplyWaitInfo *  /* replyWait */
00548 #endif
00549 );
00550 
00551 #define _IceCheckReplyReady _kde_IceCheckReplyReady
00552 
00553 extern Bool _IceCheckReplyReady (
00554 #if NeedFunctionPrototypes
00555     IceConn     /* iceConn */,
00556     IceReplyWaitInfo *  /* replyWait */
00557 #endif
00558 );
00559 
00560 #define _IceConnectionOpened _kde_IceConnectionOpened
00561 
00562 extern void _IceConnectionOpened (
00563 #if NeedFunctionPrototypes
00564     IceConn     /* iceConn */
00565 #endif
00566 );
00567 
00568 #define _IceConnectionClosed _kde_IceConnectionClosed
00569 
00570 extern void _IceConnectionClosed (
00571 #if NeedFunctionPrototypes
00572     IceConn     /* iceConn */
00573 #endif
00574 );
00575 
00576 #define _IceGetPoAuthData _kde_IceGetPoAuthData
00577 
00578 extern void _IceGetPoAuthData (
00579 #if NeedFunctionPrototypes
00580     const char *    /* protocol_name */,
00581     const char *    /* address */,
00582     const char *    /* auth_name */,
00583     unsigned short *    /* auth_data_length_ret */,
00584     char **     /* auth_data_ret */
00585 #endif
00586 );
00587 
00588 #define _IceGetPaAuthData _kde_IceGetPaAuthData
00589 
00590 extern void _IceGetPaAuthData (
00591 #if NeedFunctionPrototypes
00592     const char *    /* protocol_name */,
00593     const char *    /* address */,
00594     const char *    /* auth_name */,
00595     unsigned short *    /* auth_data_length_ret */,
00596     char **     /* auth_data_ret */
00597 #endif
00598 );
00599 
00600 #define _IceGetPoValidAuthIndices _kde_IceGetPoValidAuthIndices
00601 
00602 extern void _IceGetPoValidAuthIndices (
00603 #if NeedFunctionPrototypes
00604     const char *    /* protocol_name */,
00605     const char *    /* address */,
00606     int         /* num_auth_names */,
00607     const char **   /* auth_names */,
00608     int *       /* num_indices_ret */,
00609     int *       /* indices_ret */
00610 #endif
00611 );
00612 
00613 #define _IceGetPaValidAuthIndices _kde_IceGetPaValidAuthIndices
00614 
00615 extern void _IceGetPaValidAuthIndices (
00616 #if NeedFunctionPrototypes
00617     const char *    /* protocol_name */,
00618     const char *    /* address */,
00619     int         /* num_auth_names */,
00620     const char **   /* auth_names */,
00621     int *       /* num_indices_ret */,
00622     int *       /* indices_ret */
00623 #endif
00624 );
00625 
00626 #endif /* _ICELIBINT_H_ */

dcop

Skip menu "dcop"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal