Untested port of the Ishtar protocol, actually not much of a port since there was really not much to change. http://kisvm2.epfl.ch/record/125676/files/emav08-ishtar-final.pdf

Committer:
ssozonoff
Date:
Thu May 12 08:30:17 2011 +0000
Revision:
0:086ea145b6d7

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ssozonoff 0:086ea145b6d7 1 /*
ssozonoff 0:086ea145b6d7 2 Ishtar Embedded
ssozonoff 0:086ea145b6d7 3 Copyright (C) 2008-2009:
ssozonoff 0:086ea145b6d7 4
ssozonoff 0:086ea145b6d7 5 Alexandre Habersaat <alexandre dot habersaat at gmail dot com>
ssozonoff 0:086ea145b6d7 6 Antoine Beyeler <abeyeler at ab-ware dot com>
ssozonoff 0:086ea145b6d7 7 (http://www.ab-ware.com)
ssozonoff 0:086ea145b6d7 8 Stephane Magnenat <stephane at magnenat dot net>
ssozonoff 0:086ea145b6d7 9 (http://stephane.magnenat.net)
ssozonoff 0:086ea145b6d7 10
ssozonoff 0:086ea145b6d7 11 All rights reserved.
ssozonoff 0:086ea145b6d7 12
ssozonoff 0:086ea145b6d7 13 Ishtar Embedded is free software: you can redistribute it and/or modify
ssozonoff 0:086ea145b6d7 14 it under the terms of the GNU Lesser General Public License as published by
ssozonoff 0:086ea145b6d7 15 the Free Software Foundation, either version 3 of the License, or
ssozonoff 0:086ea145b6d7 16 (at your option) any later version.
ssozonoff 0:086ea145b6d7 17
ssozonoff 0:086ea145b6d7 18 Ishtar Embedded is distributed in the hope that it will be useful,
ssozonoff 0:086ea145b6d7 19 but WITHOUT ANY WARRANTY; without even the implied warranty of
ssozonoff 0:086ea145b6d7 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ssozonoff 0:086ea145b6d7 21 GNU General Public License for more details.
ssozonoff 0:086ea145b6d7 22
ssozonoff 0:086ea145b6d7 23 You should have received a copy of the GNU Lesser General Public License
ssozonoff 0:086ea145b6d7 24 along with Ishtar Embedded. If not, see <http://www.gnu.org/licenses/>.
ssozonoff 0:086ea145b6d7 25 */
ssozonoff 0:086ea145b6d7 26
ssozonoff 0:086ea145b6d7 27 /*!
ssozonoff 0:086ea145b6d7 28 * \file ishtar_def.h
ssozonoff 0:086ea145b6d7 29 * \brief Definition file of the Ishtar Embedded server
ssozonoff 0:086ea145b6d7 30 *
ssozonoff 0:086ea145b6d7 31 * \author Alexandre Habersaat, Antoine Beyeler
ssozonoff 0:086ea145b6d7 32 * \date 2008-06-12
ssozonoff 0:086ea145b6d7 33 *
ssozonoff 0:086ea145b6d7 34 * This file contains the defintions and enumerations used by the Ishtar protocol
ssozonoff 0:086ea145b6d7 35 *
ssozonoff 0:086ea145b6d7 36 */
ssozonoff 0:086ea145b6d7 37
ssozonoff 0:086ea145b6d7 38 #ifndef __ISHTAR_DEF_H__
ssozonoff 0:086ea145b6d7 39 #define __ISHTAR_DEF_H__
ssozonoff 0:086ea145b6d7 40
ssozonoff 0:086ea145b6d7 41 #ifdef ISHTAR_PREFIX
ssozonoff 0:086ea145b6d7 42 #include ISHTAR_PREFIX
ssozonoff 0:086ea145b6d7 43 #endif
ssozonoff 0:086ea145b6d7 44
ssozonoff 0:086ea145b6d7 45 #define ISHTAR_PROTOCOL_VERSION 7
ssozonoff 0:086ea145b6d7 46
ssozonoff 0:086ea145b6d7 47 #ifdef __cplusplus
ssozonoff 0:086ea145b6d7 48 extern "C" {
ssozonoff 0:086ea145b6d7 49 #endif
ssozonoff 0:086ea145b6d7 50
ssozonoff 0:086ea145b6d7 51 #define ISHTAR_HEADER1 (0x66)
ssozonoff 0:086ea145b6d7 52 #define ISHTAR_HEADER2 (0x57)
ssozonoff 0:086ea145b6d7 53 #define ISHTAR_HEADER3 (0xD9)
ssozonoff 0:086ea145b6d7 54 #define ISHTAR_HEADER4 (0xF4)
ssozonoff 0:086ea145b6d7 55
ssozonoff 0:086ea145b6d7 56 #define ISHTAR_NUMBER_OF_SIZE_BYTES 4
ssozonoff 0:086ea145b6d7 57 #define ISHTAR_NUMBER_OF_CHECKSUM_BYTES 2
ssozonoff 0:086ea145b6d7 58
ssozonoff 0:086ea145b6d7 59 //! Size definition for strings that have a variable size depending of their content
ssozonoff 0:086ea145b6d7 60 #define ISHTAR_STRING_SIZE 0
ssozonoff 0:086ea145b6d7 61
ssozonoff 0:086ea145b6d7 62 //! Enumeration for Answer messages (server to client)
ssozonoff 0:086ea145b6d7 63 enum IshtarAnswerType
ssozonoff 0:086ea145b6d7 64 {
ssozonoff 0:086ea145b6d7 65 //! Hello answer
ssozonoff 0:086ea145b6d7 66 HELLO=0,
ssozonoff 0:086ea145b6d7 67 //! OK message
ssozonoff 0:086ea145b6d7 68 OK,
ssozonoff 0:086ea145b6d7 69 //! Error
ssozonoff 0:086ea145b6d7 70 ERROR,
ssozonoff 0:086ea145b6d7 71 //! List of services
ssozonoff 0:086ea145b6d7 72 SERVICE_LIST,
ssozonoff 0:086ea145b6d7 73 //! Values of a given service
ssozonoff 0:086ea145b6d7 74 VALUES,
ssozonoff 0:086ea145b6d7 75 //! Confirmation of a set
ssozonoff 0:086ea145b6d7 76 SET_ACK
ssozonoff 0:086ea145b6d7 77
ssozonoff 0:086ea145b6d7 78 };
ssozonoff 0:086ea145b6d7 79
ssozonoff 0:086ea145b6d7 80 //! Enumeration for Call messages (client to server)
ssozonoff 0:086ea145b6d7 81 enum IshtarCallType
ssozonoff 0:086ea145b6d7 82 {
ssozonoff 0:086ea145b6d7 83 //! Hello call for connection
ssozonoff 0:086ea145b6d7 84 //HELLO=0,
ssozonoff 0:086ea145b6d7 85 //! Service list request
ssozonoff 0:086ea145b6d7 86 GET_SERVICE_LIST=1,
ssozonoff 0:086ea145b6d7 87 //! Values read request
ssozonoff 0:086ea145b6d7 88 GET_VALUES,
ssozonoff 0:086ea145b6d7 89 //! Values write request
ssozonoff 0:086ea145b6d7 90 SET_VALUES,
ssozonoff 0:086ea145b6d7 91 //! Disconnection notification
ssozonoff 0:086ea145b6d7 92 BYE_BYE
ssozonoff 0:086ea145b6d7 93 };
ssozonoff 0:086ea145b6d7 94
ssozonoff 0:086ea145b6d7 95 //! Enumeration for node type
ssozonoff 0:086ea145b6d7 96 enum IshtarNodeType
ssozonoff 0:086ea145b6d7 97 {
ssozonoff 0:086ea145b6d7 98 //! Ishtar server node
ssozonoff 0:086ea145b6d7 99 SERVER=0,
ssozonoff 0:086ea145b6d7 100 //! Ishtar client node
ssozonoff 0:086ea145b6d7 101 CLIENT
ssozonoff 0:086ea145b6d7 102 };
ssozonoff 0:086ea145b6d7 103
ssozonoff 0:086ea145b6d7 104 //! Enumeration for message type
ssozonoff 0:086ea145b6d7 105 enum IshtarMessageType
ssozonoff 0:086ea145b6d7 106 {
ssozonoff 0:086ea145b6d7 107 //! Connection was successful
ssozonoff 0:086ea145b6d7 108 CONNECTION_SUCCESSFUL = 0
ssozonoff 0:086ea145b6d7 109 };
ssozonoff 0:086ea145b6d7 110
ssozonoff 0:086ea145b6d7 111 //! Enumeration for error types
ssozonoff 0:086ea145b6d7 112 enum IshtarErrorTypes
ssozonoff 0:086ea145b6d7 113 {
ssozonoff 0:086ea145b6d7 114 //! A request service does not exists any more
ssozonoff 0:086ea145b6d7 115 SERVICE_DOES_NOT_EXISTS = 0,
ssozonoff 0:086ea145b6d7 116 //! The server and the client are running incompatible protocol version
ssozonoff 0:086ea145b6d7 117 INCOMPATIBLE_PROTOCOL_VERSION
ssozonoff 0:086ea145b6d7 118 };
ssozonoff 0:086ea145b6d7 119
ssozonoff 0:086ea145b6d7 120 //! Enumeration for protocol type
ssozonoff 0:086ea145b6d7 121 enum IshtarProtocolType
ssozonoff 0:086ea145b6d7 122 {
ssozonoff 0:086ea145b6d7 123 REGULAR = 0, //!< regular protocol should be used
ssozonoff 0:086ea145b6d7 124 EMBEDDED, //!< embedded version of the protocol should be used
ssozonoff 0:086ea145b6d7 125 INCOMPATIBLE //!< this server is not compatible with the request protocol version
ssozonoff 0:086ea145b6d7 126 };
ssozonoff 0:086ea145b6d7 127
ssozonoff 0:086ea145b6d7 128 //! Enumeration for variable types
ssozonoff 0:086ea145b6d7 129 enum IshtarType
ssozonoff 0:086ea145b6d7 130 {
ssozonoff 0:086ea145b6d7 131 LONG = 0, //!< 32 bits signed integer, corresponds to signed long
ssozonoff 0:086ea145b6d7 132 ULONG, //!< 32 bits unsigned integer, corresponds to unsigned long
ssozonoff 0:086ea145b6d7 133 SHORT, //!< 16 bits signed integer, corresponds to signed short
ssozonoff 0:086ea145b6d7 134 USHORT, //!< 16 bits unsigned integer, corresponds to unsigned short
ssozonoff 0:086ea145b6d7 135 CHAR, //!< 8 bits signed integer, corresponds to signed char
ssozonoff 0:086ea145b6d7 136 UCHAR, //!< 8 bits unsigned integer, corresponds to unsigned char
ssozonoff 0:086ea145b6d7 137 FLOAT, //!< 32 bits floating point value, corresponds to float
ssozonoff 0:086ea145b6d7 138 DOUBLE, //!< 64 bits double precision floating point value, corresponds to double
ssozonoff 0:086ea145b6d7 139 BOOL, //!< true/false value, serialized on a UCHAR
ssozonoff 0:086ea145b6d7 140
ssozonoff 0:086ea145b6d7 141 //TODO: depracated, remove
ssozonoff 0:086ea145b6d7 142 INT=0, //!< 32 bits signed integer, corresponds to signed long, deprecated alias for LONG
ssozonoff 0:086ea145b6d7 143 UINT, //!< 32 bits unsigned integer, corresponds to unsigned long, deprecated alias for ULONG
ssozonoff 0:086ea145b6d7 144
ssozonoff 0:086ea145b6d7 145 };
ssozonoff 0:086ea145b6d7 146
ssozonoff 0:086ea145b6d7 147 //! Enumeration for service options (flags)
ssozonoff 0:086ea145b6d7 148 enum IshtarFlags
ssozonoff 0:086ea145b6d7 149 {
ssozonoff 0:086ea145b6d7 150 //! No flags
ssozonoff 0:086ea145b6d7 151 NO_FLAGS=0,
ssozonoff 0:086ea145b6d7 152 //! Service can only be read
ssozonoff 0:086ea145b6d7 153 READ_ONLY=0x1,
ssozonoff 0:086ea145b6d7 154 //! Each value has a name
ssozonoff 0:086ea145b6d7 155 NAMED_VALUES=0x2,
ssozonoff 0:086ea145b6d7 156 //! Each value is bounded
ssozonoff 0:086ea145b6d7 157 CONSTRAINT_VALUES=0x4,
ssozonoff 0:086ea145b6d7 158 //! Service can be saved/loaded from memory
ssozonoff 0:086ea145b6d7 159 PERSISTENT=0x80
ssozonoff 0:086ea145b6d7 160 };
ssozonoff 0:086ea145b6d7 161
ssozonoff 0:086ea145b6d7 162 //! Enumeration for the memery errors
ssozonoff 0:086ea145b6d7 163 enum IshtarMemoryErrors
ssozonoff 0:086ea145b6d7 164 {
ssozonoff 0:086ea145b6d7 165 //! No error occured
ssozonoff 0:086ea145b6d7 166 NO_ERROR=0,
ssozonoff 0:086ea145b6d7 167 //! The write function is not defined
ssozonoff 0:086ea145b6d7 168 WRITE_FUNC_NULL,
ssozonoff 0:086ea145b6d7 169 //! The read function is not defined
ssozonoff 0:086ea145b6d7 170 READ_FUNC_NULL,
ssozonoff 0:086ea145b6d7 171 //! The memory space is too small
ssozonoff 0:086ea145b6d7 172 NOT_ENOUGH_SPACE,
ssozonoff 0:086ea145b6d7 173 //! The variable list has been modified since last save
ssozonoff 0:086ea145b6d7 174 CHECKSUM_WRONG,
ssozonoff 0:086ea145b6d7 175 //! The external function could not write
ssozonoff 0:086ea145b6d7 176 WRITE_ERROR,
ssozonoff 0:086ea145b6d7 177 //! The internal function could not read
ssozonoff 0:086ea145b6d7 178 READ_ERROR
ssozonoff 0:086ea145b6d7 179
ssozonoff 0:086ea145b6d7 180 };
ssozonoff 0:086ea145b6d7 181
ssozonoff 0:086ea145b6d7 182
ssozonoff 0:086ea145b6d7 183 #ifdef __cplusplus
ssozonoff 0:086ea145b6d7 184 }
ssozonoff 0:086ea145b6d7 185 #endif
ssozonoff 0:086ea145b6d7 186
ssozonoff 0:086ea145b6d7 187 #endif