#ifndef _LIBSERVER_H_ #define _LIBSERVER_H_ #include "SDDAS_types.h" #include "Time_t.h" #include "DbDefs.h" typedef enum {_H_AND_D_, _HEADER_, _DATA_, _VIDF_} RequestedDataType; /* Error Codes for get_data_key : */ #define DKEY_PROJECT -145 #define DKEY_MISSION -146 #define DKEY_EXPERIMENT -147 #define DKEY_INSTRUMENT -148 #define DKEY_VINST -149 #define ALL_OKAY 1 /* this #define defines the maximum length of a project, mission, experiment, instrument, and virtual */ #define MAX_IDFS_NAME 25 #define MAX_IDFS_VIRT_NAME 9 #ifdef __cplusplus extern "C" { #endif /* These are the new routines */ /* initialize the DB sub-system */ void dbInitialize (); SDDAS_BOOL dbInitializeMsg (); /* check if the database is read only */ SDDAS_BOOL dbIsReadOnly(const char*); /* close the DB sub-system */ void dbClose (); /* get the name of a database file */ char *dbFilename (SDDAS_ULONG); /* return a data key from a hierarchy */ SDDAS_ULONG dbGetDataKey (char *, char *, char *, char *, char *); /* return a header/data file name from a given time */ int dbIDFSGetRealTimeFile (SDDAS_ULONG, RequestedDataType, const char *, char *, char *); int dbIDFSGetFile (SDDAS_ULONG, SDDAS_SHORT, SDDAS_SHORT, SDDAS_LONG, SDDAS_SHORT, SDDAS_SHORT, SDDAS_LONG, RequestedDataType, const char *, char *, char *); int dbIDFSGetFileAndTimes (SDDAS_ULONG, SDDAS_SHORT *, SDDAS_SHORT *, SDDAS_LONG *, SDDAS_SHORT, SDDAS_SHORT, SDDAS_LONG, RequestedDataType, const char *, char *, char *); /* return the strings given a data key - returns either sFalse on error or sTrue if all is well */ SDDAS_BOOL dbKeyToStrings (SDDAS_ULONG, char *, char *, char *, char *, char *); SDDAS_BOOL dbKeyToStrings_r (SDDAS_ULONG, char *, char *, char *, char *, char *); /* return a list of strings defining the hierarchy */ char **dbHierarchy (int numargs, ...); void dbFreeHierarchyList (char **ret_val); /* return a nicely formatted hierarchy string */ char *dbHierarchyString (SDDAS_ULONG); /* return the virtual name */ char *dbVirtualName (SDDAS_ULONG); int dbVirtualName_r (SDDAS_ULONG data_key, char *, int); /* return an error message given an error code */ char *dbErrorMsg (); /* use these when you have a data key and not the full hierarchy */ char *dbCfgItem (SDDAS_ULONG, const char *, int); char *dbCfgPath (SDDAS_ULONG, const char *); /* use this to query the data base */ void *dbQuery (const char *); int dbQueryExec (const char *); void *dbQueryStore (const char *); /* if the above is supposed to return NULL, use this function to see if the query was valid! */ unsigned int dbBadQuery (); /* free the resulting query */ void dbFreeResult (void *); /* return sTrue if database is connected */ SDDAS_BOOL dbConnected (); /* END OF NEW ROUTINES */ SDDAS_INT find_entry (SDDAS_INT, SDDAS_INT, SDDAS_CHAR *, Time_t, Time_t, SDDAS_BOOL); SDDAS_INT get_file_name (SDDAS_ULONG, Time_t *, Time_t, RequestedDataType, const char *, SDDAS_CHAR *); SDDAS_SHORT get_data_key (SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_ULONG *); void key_to_fields (SDDAS_ULONG, SDDAS_SHORT *); void fields_to_key (SDDAS_SHORT *, SDDAS_ULONG *); int KeysToStr (SDDAS_SHORT *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *); int StrToKey (SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_CHAR *, SDDAS_SHORT *); SDDAS_CHAR *db_msgs (SDDAS_INT); void server_error_string (SDDAS_INT error_code, char *e_str); int get_first_vidf_times (SDDAS_ULONG data_key, SDDAS_SHORT *btime_yr, SDDAS_SHORT *btime_day, SDDAS_ULONG *btime_msec); #ifdef __cplusplus } #endif #endif