00001 /* 00002 * Author: MA Hartman 00003 * Date: jan 16, 2007 00004 * 00005 * Function: 00006 * Biosphere.h defines common functions and datastructures for the 00007 * Bio-SPHERE platform. 00008 * 00009 * License information: 00010 * 00011 * Copyright (c) 2006 Maurits Hartman 00012 * 00013 * Permission is hereby granted, free of charge, to any person 00014 * obtaining a copy of this software and associated documentation 00015 * files (the "Software"), to deal in the Software without 00016 * restriction, including without limitation the rights to use, 00017 * copy, modify, merge, publish, distribute, sublicense, and/or sell 00018 * copies of the Software, and to permit persons to whom the 00019 * Software is furnished to do so, subject to the following 00020 * conditions: 00021 * 00022 * The above copyright notice and this permission notice shall be 00023 * included in all copies or substantial portions of the Software. 00024 * 00025 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00026 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 00027 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00028 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 00029 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 00030 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00031 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00032 * OTHER DEALINGS IN THE SOFTWARE. 00033 * 00034 */ 00035 00036 #ifndef BIOSPHERE_H 00037 #define BIOSPHERE_H 00038 00039 #ifdef __cplusplus 00040 extern "C" { 00041 #endif 00042 00049 /******************************************************* 00050 * * 00051 * GENERAL DEFINITIONS * 00052 * * 00053 *******************************************************/ 00054 00058 #define BIOSPHERE_VERSION_MAJOR 0 00059 #define BIOSPHERE_VERSION_MINOR 0 00060 #define BIOSPHERE_VERSION_PATCH 3 00061 #define BIOSPHERE_VERSION_STRING "Bio-SPHERE/0.0.3 (May 30, 2007)" 00062 00063 #ifndef TRUE 00064 #define TRUE 1 00065 #define FALSE 0 00066 #endif 00067 00071 typedef unsigned char bs_bool; 00072 typedef unsigned char bs_byte; 00073 typedef short bs_int16; 00074 typedef unsigned short bs_uint16; 00075 typedef int bs_int32; 00076 typedef unsigned int bs_uint32; 00077 typedef long long bs_int64; 00078 typedef unsigned long long bs_uint64; 00079 typedef double bs_double; 00080 00084 #define BS_UINT64_FMT "llu" 00085 #define BS_INT64_FMT "lld" 00086 00087 /* Only include after the types are defined since biosphere_error.h 00088 * relies on those. */ 00089 #include <biosphere_error.h> 00090 00091 00092 /******************************************************* 00093 * * 00094 * SERVICE DEFINITION STRUCTURES * 00095 * * 00096 *******************************************************/ 00097 00101 typedef struct bs_data_type 00102 { 00103 char *name; 00105 bs_bool builtin; 00106 bs_bool from_mp; 00107 } bs_data_type; 00108 00112 typedef struct bs_message_part 00113 { 00114 char *name; 00115 bs_data_type *type; 00117 bs_bool from_mp; 00118 } bs_message_part; 00119 00125 typedef struct bs_message 00126 { 00127 char *name; 00129 bs_message_part **parts; 00130 bs_uint16 num_parts; 00132 bs_bool from_mp; 00133 } bs_message; 00134 00138 typedef struct bs_operation 00139 { 00140 char *name; 00142 bs_message *input; 00143 bs_message *output; 00144 bs_message *fault; 00146 bs_bool from_mp; 00147 } bs_operation; 00148 00152 typedef struct bs_port_type 00153 { 00154 char *name; 00156 bs_operation **operations; 00157 bs_uint16 num_operations; 00159 bs_bool from_mp; 00160 } bs_port_type; 00161 00166 typedef struct bs_port 00167 { 00168 char *name; 00169 bs_port_type *port_type; 00171 bs_bool from_mp; 00172 } bs_port; 00173 00177 typedef struct bs_service 00178 { 00179 char *name; 00180 bs_port **ports; 00181 bs_uint16 num_ports; 00183 bs_bool from_mp; 00184 } bs_service; 00185 00190 typedef struct bs_definition 00191 { 00192 char *name; 00194 bs_data_type **data_types; 00195 bs_uint16 num_data_types; 00197 bs_message **messages; 00198 bs_uint16 num_messages; 00200 bs_port_type **port_types; 00201 bs_uint16 num_port_types; 00203 bs_service **services; 00204 bs_uint16 num_services; 00206 bs_bool from_mp; 00207 } bs_definition; 00208 00209 /******************************************************* 00210 * * 00211 * SERVICE REQUEST STRUCTURES * 00212 * * 00213 *******************************************************/ 00214 00215 typedef struct bs_part_instance 00216 { 00217 char *name; 00218 bs_data_type *type; 00219 char *data; 00220 bs_uint64 size; 00222 bs_bool from_mp; 00223 } bs_part_instance; 00224 00225 typedef struct bs_message_instance 00226 { 00227 char *name; 00228 bs_part_instance **parts; 00229 bs_uint16 num_parts; 00231 bs_bool from_mp; 00232 } bs_message_instance; 00233 00237 typedef struct bs_service_request 00238 { 00239 bs_byte uuid[16]; 00240 char *service; 00241 char *port; 00242 char *operation; 00244 bs_message_instance *input; 00246 bs_bool from_mp; 00247 } bs_service_request; 00248 00249 /******************************************************* 00250 * * 00251 * SERVICE RESPONSE STRUCTURES * 00252 * * 00253 *******************************************************/ 00254 00255 typedef struct bs_service_response 00256 { 00257 bs_byte uuid[16]; 00258 char *service; 00259 char *port; 00260 char *operation; 00262 bs_message_instance *output; 00263 bs_message_instance *fault; 00265 bs_bool from_mp; 00266 } bs_service_response; 00267 00272 #ifdef __cplusplus 00273 } 00274 #endif 00275 #endif /*BIOSPHERE_H*/