1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 /************************************************************************* 29 * 30 * ATTENTION 31 * This file is intended to work inside and outside the StarOffice environment. 32 * Only adaption of file commtypes.hxx should be necessary. Else it is a bug! 33 * 34 ************************************************************************/ 35 36 #include <automation/commtypes.hxx> 37 #include <osl/endian.h> 38 39 #ifndef MAKEDWORD 40 #define MAKEDWORD(wl, wh) ((comm_DWORD)((wl) & 0xFFFF) | (((comm_DWORD)(wh) & 0xFFFF) << 16)) 41 #endif 42 #ifndef LOWORD 43 #define LOWORD(d) ((comm_WORD)((comm_DWORD)(d) & 0xFFFF)) 44 #endif 45 #ifndef HIWORD 46 #define HIWORD(d) ((comm_WORD)(((comm_DWORD)(d) >> 16) & 0xFFFF)) 47 #endif 48 #ifndef MAKEWORD 49 #define MAKEWORD(bl, bh) ((comm_WORD)((bl) & 0xFF) | (((comm_WORD)(bh) & 0xFF) << 8)) 50 #endif 51 #ifndef LOBYTE 52 #define LOBYTE(w) ((comm_BYTE)((comm_WORD)(w) & 0xFF)) 53 #endif 54 #ifndef HIBYTE 55 #define HIBYTE(w) ((comm_BYTE)(((comm_WORD)(w) >> 8) & 0xFF)) 56 #endif 57 #ifndef MAKEBYTE 58 #define MAKEBYTE(nl, nh) ((comm_BYTE)(((nl) & 0x0F) | (((nh) & 0x0F) << 4))) 59 #endif 60 #ifndef LONIBBLE 61 #define LONIBBLE(b) ((comm_BYTE)((b) & 0x0F)) 62 #endif 63 #ifndef HINIBBLE 64 #define HINIBBLE(b) ((comm_BYTE)(((b) >> 4) & 0x0F)) 65 #endif 66 67 #ifndef SWAPWORD 68 #define SWAPWORD(w) MAKEWORD(HIBYTE(w),LOBYTE(w)) 69 #endif 70 #ifndef SWAPDWORD 71 #define SWAPDWORD(d) MAKEDWORD(SWAPWORD(HIWORD(d)),SWAPWORD(LOWORD(d))) 72 #endif 73 74 #ifdef OSL_BIGENDIAN 75 #ifndef NETWORD 76 #define NETWORD(w) (comm_WORD)(w) 77 #endif 78 #ifndef NETDWORD 79 #define NETDWORD(d) (comm_DWORD)(d) 80 #endif 81 #endif // OSL_BIGENDIAN 82 83 #ifdef OSL_LITENDIAN 84 #ifndef NETWORD 85 #define NETWORD(w) MAKEWORD(HIBYTE(w),LOBYTE(w)) 86 #endif 87 #ifndef NETDWORD 88 #define NETDWORD(d) MAKEDWORD(NETWORD(HIWORD(d)),NETWORD(LOWORD(d))) 89 #endif 90 #endif // OSL_LITENDIAN 91 92 /** 93 Es gibt zwei arten von Datenpaketen 94 die erste enth�lt in den ersten 4 Byte die L�ngenangabe und in den Darauffolgenden die Daten 95 Die L�ngenangabe bezieht sich nur auf die Daten ohne die L�ngenangabe selbst. 96 97 Die Zweite Art von Datenpaketen enth�lt Header mit weitere Informationen 98 wie unten beschrieben. 99 100 Umgeschaltet wird mit dem Boolean bUseMultiChannel im Konstruktor des Managers. 101 **/ 102 /** 103 Defines f�r Header Typen: 104 105 Allgemeiner Header: 106 Byte L�nge Inhalt 107 0..3 4 L�nge des Paketes ohne diese 4 Byte 108 4 1 Pr�fsumme �ber die L�nge. Stimmt sie nicht wird die Verbindung geschlossen 109 5..6 2 L�nge des Headers ohne diese 2 Byte 110 7..8 2 Typ des Headers 111 112 CH_SimpleMultiChannel: 113 9..10 2 Channel 114 CH_Handshake Internal Use ONLY 115 Keine Weiteren Daten! 116 117 **/ 118 typedef comm_UINT16 CMProtocol; 119 120 #define CM_PROTOCOL_OLDSTYLE (CMProtocol)0x0001 121 #define CM_PROTOCOL_MARS (CMProtocol)0x0001 122 #define CM_PROTOCOL_BROADCASTER (CMProtocol)0x0002 123 #define CM_PROTOCOL_USER_START (CMProtocol)0x0100 124 125 typedef comm_USHORT HandshakeType; 126 typedef comm_USHORT CommunicationOption; 127 128 #define CH_NoHeader 0x0000 129 #define CH_SimpleMultiChannel 0x0001 130 #define CH_Handshake 0x0002 131 132 #define CH_REQUEST_HandshakeAlive ((HandshakeType)0x0101) /// Fordert eine Alive Antwort an 133 #define CH_RESPONSE_HandshakeAlive ((HandshakeType)0x0102) /// Alive Antwort 134 135 /** 136 Announce supported options: 137 Client announces available options 138 Server returns subset of these options (note that the sbset can be the entire set also) 139 **/ 140 #define CH_SUPPORT_OPTIONS ((HandshakeType)0x0103) 141 #define OPT_USE_SHUTDOWN_PROTOCOL ((CommunicationOption)0x0001) 142 143 /// these are for making sure all Data is read prior to shutting sown the link 144 #define CH_REQUEST_ShutdownLink ((HandshakeType)0x0104) /// Request to Shutdown this link 145 #define CH_ShutdownLink ((HandshakeType)0x0105) /// Shutdown this link 146 147 #define CH_SetApplication ((HandshakeType)0x0106) /// Set Description of Client 148 149