Main Page Class Hierarchy Compound List File List Compound Members File Members

# ws_clientII.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE
    00004  *   CHECKED IT OUT USING THE COMMAND CHECKOUT.
    00005  *
    00006  *    $Id: ws__clientII_8h-source.html,v 1.1 2006/05/19 16:55:03 paulf Exp $
    00007  *
    00008  *    Revision history:
    00009  *     $Log: ws__clientII_8h-source.html,v $
    00009  *     Revision 1.1  2006/05/19 16:55:03  paulf
    00009  *     first inclusion
    00009  *
    00010  *     Revision 1.2  2000/09/29 19:25:45  alex
    00011  *     fixed comment re endtime=0 in getAscii call. Alex
    00012  *
    00013  *     Revision 1.1  2000/02/14 20:05:54  lucky
    00014  *     Initial revision
    00015  *
    00016  *
    00017  */
    00018
    00019 /* This is the include file for the WaveServerIV clientII routines
    00020 and associated structures */
    00021
    00022 /* 5/17/98: increased wsREPLEN; PNL */
    00023
    00024 #ifndef WS_CLIENT
    00025 #define WS_CLIENT
    00026
    00027 /* Return codes used by routines in ws_client.c
    00028  * Errors (negative values) indicate a problem that will affect other
    00029  * transactions at least with the same server.
    00030  * Warnings (positive values) indicate some problem with a transaction that
    00031  * should not affect other transactions.
    00032 *********************************************/
    00033 #define WS_WRN_FLAGGED               1   /* reply flagged by server */
    00034 #define WS_ERR_NONE                  0   /* All ok */
    00035 #define WS_ERR_INPUT                -1   /* Faulty or missing input */
    00036 #define WS_ERR_EMPTY_MENU           -2   /* Unexpected empty menu */
    00037 #define WS_ERR_SERVER_NOT_IN_MENU   -3   /* Server should have been in menu */
    00038 #define WS_ERR_SCN_NOT_IN_MENU      -4   /* SCN not found in menu */
    00039 #define WS_ERR_BUFFER_OVERFLOW      -5   /* reply truncated at buffer limit */
    00040 #define WS_ERR_MEMORY               -6   /* Couldn't allocate memory */
    00041 #define WS_ERR_PARSE                -7   /* Couldn't parse server's reply */
    00042 /* socket related errors: */
    00043 #define WS_ERR_TIMEOUT             -10   /* Socket transaction timed out */
    00044 #define WS_ERR_BROKEN_CONNECTION   -11   /* An open connection was broken */
    00045 #define WS_ERR_SOCKET              -12   /* problem setting up socket */
    00046 #define WS_ERR_NO_CONNECTION       -13   /* Could not make connection */
    00047
    00048
    00049 /* Trace Request structure
    00050  *************************/
    00051 /* the structure below is the 'form' which must be filled out to request a
    00052    snippet of trace data. The requester fills out the first part, and the
    00053    client routines fill out the second part. */
    00054 typedef struct
    00055 {
    00056         /* the request portion */
    00057         char    sta[7];         /* Site name */
    00058         char    chan[9];        /* Component/channel code */
    00059         char    net[9];         /* Network name */
    00060         short   pinno;          /* Pin number that maps to sta/net/chan */
    00061         double  reqStarttime;   /* requested starttime - seconds since 1970 */
    00062         double  reqEndtime;     /* requested endtime - seconds since 1970 */
    00063         int     partial;        /* 1=> I'll accept partial data;
    00064                                    0=> all or nothing
    00065                                 *** NOT IMPLEMENTED ***                 */
    00066         char*   pBuf;           /* pointer to user supplied buffer for trace */
    00067         unsigned long   bufLen; /* length of above */
    00068         long    timeout;        /* seconds after which we must return */
    00069         long    fill;           /* ASCII only: fill value for gaps in trace */
    00070
    00071         /* the reply portion */
    00072         char    retFlag;        /* return flag (if any) from wave server */
    00073         double  waitSec;        /* seconds to wait until requested data will be
    00074                                    available in the wave server.
    00075                                    *** NOT IMPLEMENTED */
    00076         double actStarttime;    /* actual start time of supplied trace */
    00077         double actEndtime;      /* actual end   time of supplied trace
    00078                                    *** NOT IMPLEMENTED in wsGetTraceAscii() */
    00079         long   actLen;          /* actual length in bytes */
    00080         double samprate;        /* nominal sampling rate - samples per second */
    00081
    00082 }
    00083 TRACE_REQ;
    00084
    00085 #define wsADRLEN    16    /* length for ip and port adrress strings */
    00086 #define wsREQLEN   256    /* length for MENU request */
    00087 #define wsREPLEN  20480   /* length for reply to MENU request(up to 256 SCNs) */
    00088
    00089
    00090 typedef struct _WS_PSCN_REC *WS_PSCN;
    00091 typedef struct _WS_PSCN_REC
    00092 {
    00093   char    sta[7];         /* Site name */
    00094   char    chan[9];        /* Component/channel code */
    00095   char    net[9];         /* Network name */
    00096   short   pinno;          /* Pin number that maps to sta/net/chan */
    00097   double  tankStarttime;  /* starttime for this SCN */
    00098   double  tankEndtime;    /* endtime for this SCN */
    00099
    00100   WS_PSCN next;
    00101 } WS_PSCN_REC;
    00102
    00103 typedef struct _WS_MENU_REC *WS_MENU;
    00104 typedef struct _WS_MENU_REC
    00105 {
    00106   char    addr[wsADRLEN];
    00107   char    port[wsADRLEN];
    00108   int     sock;
    00109
    00110   WS_PSCN pscn;
    00111   WS_MENU next;
    00112 } WS_MENU_REC;
    00113
    00114 typedef volatile struct
    00115 {
    00116   WS_MENU head;
    00117   WS_MENU tail;
    00118 } WS_MENU_QUEUE_REC;
    00119
    00120 /* to setup and connect to a list of servers, and get SCN menu of each server
    00121  ****************************************************************************/
    00122 int wsAppendMenu( char* , char*, WS_MENU_QUEUE_REC*, int );
    00123
    00124 /* to close all server sockets and deallocate the menus
    00125  ******************************************************/
    00126 void wsKillMenu( WS_MENU_QUEUE_REC* );
    00127
    00128 /* to deallocate a PSCN list
    00129 **************************************/
    00130 void wsKillPSCN( WS_PSCN );
    00131
    00132 /* To open a connection to a server
    00133 ***********************************/
    00134 int wsAttachServer( WS_MENU, int );
    00135
    00136 /* to close a single server socket after an error
    00137  ************************************************/
    00138 void wsDetachServer( WS_MENU );
    00139
    00140 /* wsGetServerPSCN: Return the pscn list for this server from the menu queue *
    00141  *****************************************************************************/
    00142 int wsGetServerPSCN( char*, char*, WS_PSCN*, WS_MENU_QUEUE_REC* );
    00143
    00144 /* to retrieve the binary trace snippet specified in the structure TRACE_REQ
    00145  ***************************************************************************/
    00146 int wsGetTraceBin( TRACE_REQ*, WS_MENU_QUEUE_REC*, int );
    00147
    00148 /* to retrieve the ASCII trace snippet specified in the structure TRACE_REQ
    00149  **************************************************************************/
    00150 int wsGetTraceAscii( TRACE_REQ*, WS_MENU_QUEUE_REC*, int );
    00151
    00152 /* return the PSCN list for this server
    00153 ***************************************/
    00154 int wsSearchSCN( TRACE_REQ*, WS_MENU*, WS_PSCN*, WS_MENU_QUEUE_REC* );
    00155
    00156 /* turn debugging on or off for the ws_clientII routines.
    00157 **********************************************************/
    00158 int setWsClient_ewDebug(int debug);
    00159
    00160
    00161 #endif /* WS_CLIENT */