00001 00002 00003 00004 00005 // ----------------------------------------------------------------------^ 00006 // Copyright (C) 2004, 2005, 2006, 2007, 2008 Giorgio Calderone 00007 // (mailto: <gcalderone@ifc.inaf.it>) 00008 // 00009 // This file is part of MCS. 00010 // 00011 // MCS is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU General Public License as published by 00013 // the Free Software Foundation; either version 2 of the License, or 00014 // (at your option) any later version. 00015 // 00016 // MCS is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU General Public License 00022 // along with MCS; if not, write to the Free Software 00023 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 // 00025 // ----------------------------------------------------------------------$ 00026 00027 00028 00037 #ifndef DEF_MCS_C_H 00038 #define DEF_MCS_C_H 00039 00040 #ifndef DOXYGEN_SKIP 00041 //The following are needed to avoid redefinition's warning 00042 #undef PACKAGE_BUGREPORT 00043 #undef PACKAGE_NAME 00044 #undef PACKAGE_STRING 00045 #undef PACKAGE_TARNAME 00046 #undef PACKAGE_VERSION 00047 00048 //The following is needed for ENABLE_MYSQL 00049 #include "mcs_config.h" 00050 #endif //DOXYGEN_SKIP 00051 00052 #include "mcstypes.hh" 00053 00054 00055 // ----------------------------------------------------------------------^ 00056 // Copyright (C) 2004, 2005, 2006, 2007, 2008 Giorgio Calderone 00057 // (mailto: <gcalderone@ifc.inaf.it>) 00058 // 00059 // This file is part of MCS. 00060 // 00061 // MCS is free software; you can redistribute it and/or modify 00062 // it under the terms of the GNU General Public License as published by 00063 // the Free Software Foundation; either version 2 of the License, or 00064 // (at your option) any later version. 00065 // 00066 // MCS is distributed in the hope that it will be useful, 00067 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00068 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00069 // GNU General Public License for more details. 00070 // 00071 // You should have received a copy of the GNU General Public License 00072 // along with MCS; if not, write to the Free Software 00073 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00074 // 00075 // ----------------------------------------------------------------------$ 00076 00077 00078 /* 00079 IFD - C/C++ to C Interface Descriptor 00080 Giorgio Calderone - gcalderone@ifc.inaf.it 00081 */ 00082 00083 00084 00085 00086 00087 //Object pointer type 00088 #define IFD_OBJP void* 00089 #define IFD_ERR_LEN 200 00090 00091 00092 00093 00094 struct ifd_status { 00095 int error; 00096 char errormsg[200]; 00097 void* data; 00098 }; 00099 00100 typedef struct ifd_status IFD_STATUS; 00101 00102 //IFD routines 00103 00104 //IFD_C_SIMPLE_WRAP(IFD_STATUS*, ifd_new_status , , ); 00105 //IFD_C_WRAP_VOID( ifd_del_status ,, ); 00106 char* ifd_last_error (); 00107 int ifd_got_error (); 00108 void ifd_reset_error (); 00109 void* ifd_null (); 00110 //IFD_C_WRAP_VOID( ifd_set_error , , ARG(char*, msg)); 00111 00112 00113 #ifdef IFD_EXTRA 00114 #undef IFD_EXTRA 00115 #endif 00116 #define IFD_EXTRA 00117 00118 00119 //-------------------------------------------------------------------- 00120 //Wrapper for Data class 00121 00123 void* new_Data (void* dummy ,Types type ,unsigned short int maxLength ,short isunsigned); 00124 00125 00127 void* copy_Data (void* obj); 00128 00130 void del_Data (void* obj); 00131 00133 char* Data_name (void* obj ); 00134 00135 //IFD_WRAP(unsigned int, Data, flags , This->flags() ); 00136 Types Data_type (void* obj ); 00137 unsigned short int Data_maxLength (void* obj ); 00138 unsigned short int Data_length (void* obj ); 00139 short Data_isUnsigned (void* obj ); 00140 short Data_isNull (void* obj ); 00141 int Data_ival (void* obj ); 00142 unsigned int Data_uival (void* obj ); 00143 long long int Data_lval (void* obj ); 00144 unsigned long long int Data_ulval (void* obj ); 00145 float Data_fval (void* obj ); 00146 double Data_dval (void* obj ); 00147 char* Data_sval (void* obj ); 00148 unsigned int Data_tval (void* obj ); 00149 00150 00151 //IFD_WRAP_VOID( Data, tsval , This->tval(t), ARG(struct tm*, t)); 00152 00153 void Data_setNull (void* obj ); 00154 00155 void Data_setival (void* obj ,int val); 00156 void Data_setuival (void* obj ,unsigned int val); 00157 00158 void Data_setlval (void* obj ,long long int val); 00159 void Data_setulval (void* obj ,unsigned long long int val); 00160 00161 void Data_setdval (void* obj ,double val); 00162 00163 void Data_setsval (void* obj ,char* val); 00164 00165 void Data_setblob (void* obj ,void* lbuf ,unsigned int size); 00166 00167 00168 //IFD_WRAP_VOID( Data, settmstrval, This->settimeval(val), 00169 // ARG(struct tm*, val)); 00170 00171 void Data_settimeval (void* obj ,unsigned int val); 00172 00173 //IFD_WRAP_VOID( Data, parseTime , This->parseTime(s, ts), 00174 // ARG(char*, s) ARG(struct tm*, ts)); 00175 00176 char* Data_print (void* obj ); 00177 00178 void Data_setTag (void* obj ,short tag); 00179 00180 short Data_getTag (void* obj ); 00181 00182 00183 00184 00185 00186 00187 //-------------------------------------------------------------------- 00188 //Wrapper for Record class 00189 void* new_Record (void* dummy ); 00190 00191 void del_Record (void* obj); 00192 00193 void Record_clear (void* obj ); 00194 unsigned int Record_count (void* obj ); 00195 00196 void Record_addField (void* obj ,void* d); 00197 00198 00199 void* Record_pop (void* obj ,int x); 00200 00201 void* Record_field (void* obj ,int x); 00202 00203 int Record_posWhoseNameIs (void* obj ,char* name); 00204 00205 void Record_setFieldMap (void* obj ,char* s); 00206 00207 00208 00209 00210 //-------------------------------------------------------------------- 00211 //Wrapper for RecordSet class 00212 short RecordSet_setFirst (void* obj ); 00213 short RecordSet_setLast (void* obj ); 00214 short RecordSet_setNext (void* obj ); 00215 short RecordSet_setPrev (void* obj ); 00216 short RecordSet_setWhereS (void* obj ,unsigned int field ,char* where); 00217 00218 00219 short RecordSet_setWhereI (void* obj ,unsigned int field ,int where); 00220 00221 00222 short RecordSet_setPos (void* obj ,unsigned int newpos); 00223 00224 void RecordSet_dump (void* obj ,char* fn); 00225 00226 short RecordSet_know_nRows (void* obj ); 00227 short RecordSet_eof (void* obj ); 00228 short RecordSet_alwaysSameStructure (void* obj ); 00229 00230 unsigned int RecordSet_nRows (void* obj ); 00231 unsigned int RecordSet_nFields (void* obj ); 00232 unsigned int RecordSet_pos (void* obj ); 00233 void* RecordSet_rec (void* obj ); 00234 void* RecordSet_metarec (void* obj ); 00235 00236 00237 00238 00239 00240 00241 //-------------------------------------------------------------------- 00242 //Wrapper for DBConn, Query, Table classes 00243 00244 #if ENABLE_MYSQL 00245 void* new_DBConn (void* dummy ); 00246 00247 void del_DBConn (void* obj); 00248 00249 void DBConn_connect (void* obj ,char* user ,char* pass ,char* db ,char* host); 00250 00251 00252 00253 00254 00255 void DBConn_close (void* obj ); 00256 short DBConn_isOpen (void* obj ); 00257 void* DBConn_newDBConn (void* obj ); 00258 00259 00260 00261 00262 00263 void* new_Query (void* dummy ,void* lconn ,short handleNewDBConn); 00264 00265 00266 00267 void del_Query (void* obj); 00268 00269 00270 void Query_query (void* obj ,char* query ,short StoreResult); 00271 00272 00273 void Query_prepare (void* obj ,char* query); 00274 00275 00276 void Query_prepare_with_parameters (void* obj ,int op ,char* fields ,char* table ,char* where); 00277 00278 00279 00280 00281 00282 unsigned int Query_nAffectedRows (void* obj ); 00283 00284 void* Query_param (void* obj ); 00285 00286 void* Query_lookup (void* obj ,char* field ,char* table ,char* where); 00287 00288 00289 //IFD_WRAP(short, Query, resultRows, This->resultRows()); 00290 00291 short Query_gotRecordSet (void* obj ); 00292 00293 void Query_execute (void* obj ,short StoreResult); 00294 00295 00296 00297 void Query_close (void* obj ); 00298 00299 00300 00301 00302 00303 00304 #undef IFD_EXTRA 00305 #define IFD_EXTRA DBConn* conn = (DBConn*) lconn; 00306 void* new_Table (void* dummy ,void* lconn ,char* table ,char* fieldkey); 00307 00308 #undef IFD_EXTRA 00309 #define IFD_EXTRA 00310 00311 void del_Table (void* obj); 00312 00313 void Table_loadTable (void* obj ); 00314 00315 void* Table_newRec (void* obj ); 00316 00317 void Table_insert (void* obj ); 00318 void Table_update (void* obj ); 00319 #endif //ENABLE_MYSQL 00320 00321 00322 00323 00324 //-------------------------------------------------------------------- 00325 //Wrapper for Client class 00326 void* new_Client (void* dummy ,char* path ,char* server ,int port ,int ssl ,unsigned int timeout); 00327 00328 00329 00330 void del_Client (void* obj); 00331 00332 short Client_login (void* obj ,char* user ,char* pass ,char* db); 00333 00334 00335 short Client_exec (void* obj ,char* cmd ,void* data); 00336 00337 00338 00339 00340 void* Client_code (void* obj ); 00341 00342 void* Client_msg (void* obj ); 00343 00344 void* Client_out (void* obj ); 00345 00346 void* Client_recv (void* obj ); 00347 00348 void* Client_aux (void* obj ); 00349 00350 00351 00352 00353 00354 //-------------------------------------------------------------------- 00355 //Wrapper Conf class 00356 void* new_Conf (void* dummy ,char* filename); 00357 00358 void del_Conf (void* obj); 00359 00360 char* Conf_sval (void* obj ,char* section ,char* key); 00361 00362 00363 00364 int Conf_ival (void* obj ,char* section ,char* key); 00365 00366 00367 00368 00369 00370 00371 #endif // DEF_MCS_C_H
![]() |
MCS (My Customizable Server) ver. 0.3.3-alpha3
|