• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

dbPrivate.h

Go to the documentation of this file.
00001 /**************************************************************************
00002 * E.S.O. - VLT project
00003 #
00004 # "@(#) $Id: dbPrivate.h,v 1.24 2003/01/28 16:43:51 vltsccm Exp $" 
00005 *
00006 * <dbPrivate.h> -  CCS/ON-LINE DATABASE Internal Interface
00007 *                  This interface is used by the inner most levels 
00008 *                  of the database library.
00009 *
00010 * who        when      what
00011 * ---------  --------  ----------------------------------------------
00012 * rabuter   14/03/96  Added support for MultiRead and MultiWrite LCU commands
00013 * M.COMIN   27/05/93  Preliminary version
00014 * M.COMIN   05/07/93  First official release.
00015 * M.COMIN   09/07/93  Take away Global data section
00016 * M.COMIN   10/08/93  Add extern rtErrno
00017 * rabuter   14/03/96  Added support for MultiRead and MultiWrite LCU commands
00018 * mcomin    06/05/98  dbAddTable,dbLockConfig,dbUnlockConfig moved to 
00019 *                     dbCCS.h for backwards compatibility
00020 * bgilli    05/05/98  dbParseClassAttr moved to dbCCS.h for backwards compat.
00021 *
00022 * ------------------
00023 *
00024 * M.COMIN   20/01/94  Changed according to the CCS design
00025 * M.COMIN   28/03/94  Add global data structure to keep track 
00026 *                     of opened connections 
00027 *
00028 * M.COMIN   12/04/94  Variable numbLinks and linkTables defined as extern
00029 *                     Add routine dbParseIndex()
00030 * M.COMIN   25/04/94  Add data structures for LCU access
00031 *
00032 * G.CHIOZZI 19/10/94  Added new functions to handle static attributes
00033 *                     and point classes. Some of them could become
00034 *                     public.
00035 * T.HERLIN  31/10/94  Added function to resolve remote direct address
00036 *
00037 * ------------------
00038 *
00039 * M.COMIN   25/01/95  Modifications due to db.h splitting into CCS and LCC parts
00040 * J.I.LEON  23/05/95  Add rtDateElemSize for CCS light. 
00041 * B.Gilli   17/11/95  Added dbXrefToAlias.
00042 * T.Ebert   19/04/96  Added dbGetDirAddrOnEnv()
00043 * T.Ebert   05/06/96  Added dbREAD_WRITE
00044 * T.Ebert   18/06/96  Added definition of dbLCU_TIMEOUT
00045 * mcomin    12/09/96  Move definition for data quality to dbCCS.h
00046 *           25/02/97  Move some define to dbCCS.h
00047 * mcomin    27/03/97  Add dbStringToString()
00048 *           11/09/97  Add dbCloseOpen()
00049 *           13/09/97  Add defines for link up, down or new
00050 *           18/03/98  Functions dbParseStatus, dbXrefToAlias and 
00051 *                     dbGetDirAddrOnEnv moved to db.h
00052 *
00053 *************************************************************************/
00054 #ifndef DB_PRIVATE_H
00055 #define DB_PRIVATE_H
00056 
00057 #include "msg.h"
00058 #include "lccErrors.h"
00059 #include "ccsRtap.h"
00060 
00061 #define LCU_DATABASE   "rdbServer"
00062 #define dbLCU_TIMEOUT  30000
00063 
00064 
00065 /****************************************************
00066  *                                                  *
00067  *  ONLINE DATABASE   : Internal data Structures    *
00068  *                                                  *
00069  ****************************************************/
00070 
00071 #define  MAX_CONNECTIONS  100
00072 #define  dbLINK_DOWN      0
00073 #define  dbLINK_UP        1
00074 #define  dbLINK_NEW       2
00075 #define  dbLINK_CLOSED    3
00076 
00077 typedef struct {
00078     ccsENVNAME  envName;          /* Environment name                */
00079     vltUINT8    status;           /* Status of the link : UP/DOWN    */
00080     ccsENV_TYPE type;             /* Type of environment : WS or LCU */
00081     dbHANDLE    linkId;           /* Handle to access the database   */
00082     } dbLinkStatus;
00083 
00084 extern vltUINT32  numbLinks; 
00085 
00086 /* The first record of the table is for the local database */
00087 extern dbLinkStatus linkTable[MAX_CONNECTIONS];
00088 
00089 typedef vltUINT16 dbDIRECT_TYPE;    
00090 
00091 typedef enum {
00092     dbDB_DIRECT,
00093     dbDB_SYMBOLIC
00094 } dbADDRESS_TYPE;
00095 
00096 typedef enum {
00097     dbSYM_HIERARCHICAL,
00098     dbSYM_ALIAS,
00099     dbSYM_UNKNOWN
00100 } dbSYMBOLIC_TYPE;
00101 
00102 typedef struct {
00103     dbDIRECT_TYPE     type;     /* type of direct address  */
00104     vltUINT16         reserved;
00105     dbPOINT          *pointId;  /* direct address          */
00106 } dbDIRECT_ADDR;
00107 
00108 typedef struct {
00109     dbSYMBOLIC_TYPE   type;     /* type of symbolic address                 */
00110     char             *name;     /* symbolic name                            */
00111 } dbSYMBOLIC_ADDR;
00112 
00113 typedef struct {
00114     dbADDRESS_TYPE      type;     /* type of address, direct or symbolic    */
00115     union {
00116         dbDIRECT_ADDR   direct;   /* direct address                         */
00117         dbSYMBOLIC_ADDR symbolic; /* symbolic address                       */
00118     }                   ds;
00119 } dbDB_ADDRESS;
00120 
00121 typedef struct {
00122     dbDB_ADDRESS      addr;      /* database address                        */
00123     vltUINT32         quality;   /* quality of value (not used on LCU)      */
00124     vltUINT16         recordCnt; /* number of records read/written          */
00125     dbATTRTYPE        attrType;
00126     vltUINT8          reserved; 
00127     dbTYPE            *deTypes; 
00128     vltUINT8          *buffer;   /* data buffer                             */
00129     vltINT32          size;      /* size of buffer                          */
00130     vltINT32          actual;    /* actual size of data read/written        */
00131 } dbREAD_WRITE;
00132 
00133 /***********************************************************************
00134  *                                                                     *
00135  *  ONLINE DATABASE   : Internal Routines                              *
00136  *                                                                     *
00137  ***********************************************************************/
00138 
00139 /* The application programmer must use routines ccsInit to connect     */
00140 /* to the local database and routine ccsExit to close all connections. */  
00141 /* The connection to a remote database is established at the moment    */
00142 /* the user access it.                                                 */
00143 /*                                                                     */
00144 /* The following two routines should not be used directly by the       */
00145 /* application programmer.                                             */
00146 
00147 
00148 
00149 ccsCOMPL_STAT dbSendCmd(           /* Sends a command to a LCU        */
00150                                    /* to perform database operations  */
00151          msgCMD          command,  /* ASCII command      */ 
00152          ccsENVNAME      envName,  /* Environment name   */
00153          char           *cmdParam, /* Command parameters */
00154          msgLENGTH       paramLen, /* Buffer length of cmd parameters */
00155          msgCHECKFLAG    flag,     /* Checking options (not used yet) */
00156          char          **recvMsg,  /* Pointer to received message     */
00157          ccsERROR       *error     /* returned error structure        */
00158    );
00159 
00160 
00161 ccsCOMPL_STAT dbParseIndex(        /* Parses the attribute specification and */
00162                                    /* gives back the associated indexes.     */
00163    char         *attrName,         /* Attribute name  */
00164    dbATTRTYPE   attrType,          /* Attribute type : scalar,vector, table */
00165    vltUINT8     fieldCnt,         
00166    vltUINT16    recCnt,
00167    vltUINT16    *startRec,
00168    vltUINT16    *endRec,
00169    vltUINT8     *startField,
00170    vltUINT8     *endField
00171    );
00172 
00173 char *dbPadString (     /* Pad strings with NULL characters */
00174   dbTYPE      dataType,
00175   char       *buffer,
00176   vltINT32    size,
00177   vltINT32   *newSize
00178 );
00179 
00180 ccsCOMPL_STAT dbOpenLink (    /* Re-opens a DB connection  */
00181    const ccsENVNAME envName,  /* Environment name          */
00182    int       lkIndex,         /* Entry to table of existing connections */
00183    ccsERROR  *error
00184 );
00185 
00186 ccsCOMPL_STAT dbCloseLink ( 
00187    int       index,
00188    ccsERROR *error
00189 );
00190 
00191 ccsCOMPL_STAT dbSetLinkStatus ( 
00192    const ccsENVNAME envName,
00193    vltUINT8  newStatus 
00194 );
00195 
00196 ccsCOMPL_STAT dbStringToString (
00197    char          *source,
00198    vltINT32       size,
00199    unsigned char *buffer
00200 );
00201 
00202 dbVIEW dbParseView (                /* Extract the View specifier in the    */
00203                                     /* symbolic address of a point          */
00204    const dbSYMADDRESS  fullName,    /* Full point Name with env. specifier  */
00205          dbSYMADDRESS  **pointName  /* Point address without env. specifier */
00206    );
00207    
00208 
00209 ccsCOMPL_STAT dbGetAddrType( 
00210    dbSYMADDRESS     *address,
00211    dbSYMADDRESS     **pointName,
00212    rtDbAddress      *dbAddress
00213    );
00214 
00215 /*
00216  ***********************************************************************
00217  * Configuration operations to modify the DB structure.                *
00218  * The Operations allow to add/delete points and attributes,           *
00219  * copy points with their attributes or entire DB branches.            *
00220  ***********************************************************************
00221  */
00222 
00223 #ifndef CCS_LIGHT
00224                 
00225 ccsCOMPL_STAT dbAddPoint(            /* Add a point to the database     */
00226   const dbSYMADDRESS  parentPoint,   /* Reference to the parent point   */
00227   const dbSYMADDRESS  pointName,     /* Name of the new database point  */
00228   const dbSYMADDRESS  alias,         /* Alias of the new point          */
00229         dbRESIDENCE   residence,     /* RAM or DISK resident            */
00230         ccsERROR      *error         /* returned error structure.       */
00231     );
00232 
00233 ccsCOMPL_STAT dbAddScalar(           /* Add SCALAR attribute to a point */
00234   const dbSYMADDRESS  pointName,     /* Reference to the database point */
00235   const dbATTRIBUTE   attrName,      /* Name of the Attribute           */
00236         dbTYPE        dataType,      /* Attribute data type             */
00237         ccsERROR      *error         /* returned error structure.       */
00238     );  
00239 
00240 ccsCOMPL_STAT dbAddVector(           /* Add VECTOR attribute to a point  */
00241   const dbSYMADDRESS  pointName,     /* Reference to the database point  */
00242   const dbATTRIBUTE   attrName,      /* Name of the attribute            */
00243         dbTYPE        dataType,      /* Element data type                */
00244         vltUINT16     elemCnt,       /* Number of elements               */
00245         ccsERROR      *error         /* returned error structure         */
00246     );
00247 
00248 ccsCOMPL_STAT dbDelAttr(            /* delete one attribute from a point */
00249   const dbSYMADDRESS pointName,     /* Reference to the database point   */
00250   const dbATTRIBUTE  attrName,      /* Name of the Attribute             */
00251         dbATTRTYPE   type,          /* Attribute data type               */
00252         ccsERROR     *error         /* returned error structure.         */
00253     );
00254 
00255 ccsCOMPL_STAT dbChangeAlias(        /* change alias of a point         */
00256   const dbSYMADDRESS pointName,     /* Reference to the database point */
00257   const dbSYMADDRESS newAlias,      /* New Alias Name                  */
00258         ccsERROR     *error         /* returned error structure.       */
00259     ); 
00260 
00261 ccsCOMPL_STAT dbChangeName(         /* change name  of a point         */
00262   const dbSYMADDRESS pointName,     /* Reference to the database point */
00263   const dbSYMADDRESS newName,       /* New Alias Name                  */
00264         ccsERROR     *error         /* returned error structure.       */
00265     );
00266 
00267 ccsCOMPL_STAT dbChangeAttrName(     /* change name for an attribute    */
00268   const dbSYMADDRESS pointName,     /* Reference to the database point */
00269   const dbATTRIBUTE  attrName,      /* Name of the Attribute           */
00270   const dbATTRIBUTE  newAttrName,   /* New Attribute name              */
00271         ccsERROR     *error         /* returned error structure.       */
00272     );
00273 
00274 ccsCOMPL_STAT dbCopyAttr(            /* copy one attribute name         */
00275   const dbATTRIBUTE   attrName,      /* attribute                       */
00276   const dbSYMADDRESS  origPoint,     /* copy from that point            */
00277   const dbATTRIBUTE   newName,       /* New attribute name (optional)   */
00278   const dbSYMADDRESS  destPoint,     /* ... to that other point         */
00279         ccsERROR      *error         /* returned error structure.       */
00280     );
00281 
00282 ccsCOMPL_STAT dbCopyBranch(          /* copy one complete db branch     */
00283   const dbSYMADDRESS  origPoint,     /* copy from that point down       */
00284   const dbSYMADDRESS  destPoint,     /* ... to that other point         */
00285         ccsERROR      *error         /* returned error structure.       */
00286     );
00287 
00288 ccsCOMPL_STAT dbCopyPoint(           /* copy one complete point         */
00289   const dbSYMADDRESS  origPoint,     /* copy from that point            */
00290   const dbSYMADDRESS  destPoint,     /* ... to that other point         */
00291         ccsERROR      *error         /* returned error structure.       */
00292     );
00293 
00294 ccsCOMPL_STAT dbDelBranch(           /* delete a complete db Branch     */
00295   const dbSYMADDRESS  origPoint,     /* delete from that point on       */
00296         ccsERROR      *error         /* returned error structure.       */
00297     );
00298 
00299 ccsCOMPL_STAT dbDelPoint(            /* delete a complete point         */
00300   const dbSYMADDRESS  origPoint,     /* delete that point               */
00301         ccsERROR      *error         /* returned error structure.       */
00302     );
00303 
00304 ccsCOMPL_STAT dbMovePoint(           /* move one complete point and child */
00305   const dbSYMADDRESS  origPoint,     /* move from that point              */
00306   const dbSYMADDRESS  destPoint,     /* ... to that other point           */
00307         ccsERROR      *error         /* returned error structure.         */
00308     );
00309 #endif
00310 
00311 ccsCOMPL_STAT dbChangeResidence(     /* change point residence RAM <-> DISK */
00312   const dbSYMADDRESS  origPoint,     /* point to be changed                 */
00313         ccsERROR      *error         /* returned error structure.           */
00314     );
00315 
00316 ccsCOMPL_STAT dbGetClass(            /* Retrives from the given point addr   */
00317   const dbSYMADDRESS  point,         /* the symbolic address for its base    */
00318         dbSYMADDRESS  classAddr,     /* class.                               */
00319         ccsERROR      *error
00320     );
00321 
00322 ccsCOMPL_STAT dbTestSymaddr(         /* Tests if the given symbolic address  */
00323   const dbSYMADDRESS  point,         /* correspond to an existing database   */
00324         vltLOGICAL   *result,        /* entity                               */
00325         ccsERROR     *error
00326     );
00327 
00328 ccsCOMPL_STAT dbXrefToAlias( 
00329     const ccsENVNAME env,
00330     const DB_XREF    *addr,
00331     char       *string,
00332     ccsERROR   *error
00333     );
00334 
00335 
00336 ccsCOMPL_STAT dbLcuMultiRead  (dbLISTID listId, ccsERROR *error );
00337 ccsCOMPL_STAT dbLcuMultiWrite (dbLISTID listId, vltUINT8 writemode, 
00338                                ccsERROR *error);
00339 ccsCOMPL_STAT dbConnectLite   (const ccsENVNAME envName, ccsERROR *error);
00340 ccsCOMPL_STAT dbDisconnectLite(const ccsENVNAME envName, ccsERROR *error);
00341 ccsCOMPL_STAT dbCmdToServer   (msgCMD command, ccsENVNAME envName,
00342                                char *buffer, msgLENGTH bufLen,
00343                                char **recParam, ccsERROR *error);
00344 
00345 #endif 

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0