source: trunk/include/ws_clientII.h @ 5054

Revision 2375, 7.2 KB checked in by davek, 12 years ago (diff)

Upped the max menu str len (as defined by wsREPLEN) so that it is large
enough to handle a 5000+ SCNL menu from a single wave_server.
Downside is that it must temporarily allocate 500kb instead of 80kb when
parsing a menu. This seemed like a reasonable tradeoff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2/*
3 *   THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE
4 *   CHECKED IT OUT USING THE COMMAND CHECKOUT.
5 *
6 *    $Id$
7 *
8 *    Revision history:
9 *     $Log$
10 *     Revision 1.6  2006/06/19 20:58:17  davek
11 *     Upped the max menu str len (as defined by wsREPLEN) so that it is large
12 *     enough to handle a 5000+ SCNL menu from a single wave_server.
13 *     Downside is that it must temporarily allocate 500kb instead of 80kb when
14 *     parsing a menu.  This seemed like a reasonable tradeoff.
15 *
16 *     Revision 1.5  2005/11/28 16:53:19  friberg
17 *     modified wsREQLEN and wsREPLEN to allow 1024 SNCL's as per Winston Servers
18 *
19 *     Revision 1.4  2004/07/02 01:03:58  lombard
20 *     Added non-location-code versions of several functions.
21 *     Added `L' to the name of location-code-enabled functions
22 *     and to structures with SCN in the name.
23 *
24 *     Revision 1.3  2004/05/18 22:28:47  lombard
25 *     Modified for location code; no structure names have changed here.
26 *
27 *     Revision 1.2  2000/09/29 19:25:45  alex
28 *     fixed comment re endtime=0 in getAscii call. Alex
29 *
30 *     Revision 1.1  2000/02/14 20:05:54  lucky
31 *     Initial revision
32 *
33 *
34 */
35
36/* This is the include file for the WaveServerIV clientII routines
37   and associated structures */
38
39/* 5/17/98: increased wsREPLEN; PNL */
40
41#ifndef WS_CLIENT
42#define WS_CLIENT
43
44#include <trace_buf.h>
45
46/* Return codes used by routines in ws_client.c
47 * Errors (negative values) indicate a problem that will affect other
48 * transactions at least with the same server.
49 * Warnings (positive values) indicate some problem with a transaction that
50 * should not affect other transactions.
51 *********************************************/
52#define WS_WRN_FLAGGED               1   /* reply flagged by server */
53#define WS_ERR_NONE                  0   /* All ok */
54#define WS_ERR_INPUT                -1   /* Faulty or missing input */
55#define WS_ERR_EMPTY_MENU           -2   /* Unexpected empty menu */
56#define WS_ERR_SERVER_NOT_IN_MENU   -3   /* Server should have been in menu */
57#define WS_ERR_SCNL_NOT_IN_MENU     -4   /* SCNL not found in menu */
58#define WS_ERR_BUFFER_OVERFLOW      -5   /* reply truncated at buffer limit */
59#define WS_ERR_MEMORY               -6   /* Couldn't allocate memory */
60#define WS_ERR_PARSE                -7   /* Couldn't parse server's reply */
61/* socket related errors: */
62#define WS_ERR_TIMEOUT             -10   /* Socket transaction timed out */
63#define WS_ERR_BROKEN_CONNECTION   -11   /* An open connection was broken */
64#define WS_ERR_SOCKET              -12   /* problem setting up socket */
65#define WS_ERR_NO_CONNECTION       -13   /* Could not make connection */
66
67
68/* Trace Request structure
69*************************/
70/* the structure below is the 'form' which must be filled out to request a
71   snippet of trace data. The requester fills out the first part, and the
72   client routines fill out the second part. */
73typedef struct
74{
75    /* the request portion */
76    char    sta[TRACE2_STA_LEN];        /* Site name */
77    char    chan[TRACE2_CHAN_LEN];      /* Component/channel code */
78    char    net[TRACE2_NET_LEN];        /* Network name */
79    char    loc[TRACE2_LOC_LEN];        /* Location code */
80    short   pinno;              /* Pin number that maps to sta/net/chan */
81    double  reqStarttime;       /* requested starttime - seconds since 1970 */
82    double  reqEndtime; /* requested endtime - seconds since 1970 */
83    int     partial;            /* 1=> I'll accept partial data;
84                                   0=> all or nothing
85                                   *** NOT IMPLEMENTED ***                */
86    char*   pBuf;               /* pointer to user supplied buffer for trace */
87    unsigned long       bufLen; /* length of above */
88    long    timeout;    /* seconds after which we must return */
89    long    fill;               /* ASCII only: fill value for gaps in trace */
90
91    /* the reply portion */
92    char        retFlag;        /* return flag (if any) from wave server */
93    double      waitSec;        /* seconds to wait until requested data will be
94                                   available in the wave server.
95                                   *** NOT IMPLEMENTED */
96    double actStarttime;        /* actual start time of supplied trace */
97    double actEndtime;  /* actual end   time of supplied trace
98                       *** NOT IMPLEMENTED in wsGetTraceAscii() */
99    long   actLen;              /* actual length in bytes */
100    double samprate;    /* nominal sampling rate - samples per second */
101       
102}
103TRACE_REQ;
104
105#define wsADRLEN    16    /* length for ip and port adrress strings */
106#define wsREQLEN   1024    /* length for MENU request */
107#define wsREPLEN  409600   /* length for reply to MENU request(up to 5000+ SCNLs) */
108
109
110typedef struct _WS_PSCNL_REC *WS_PSCNL;
111typedef struct _WS_PSCNL_REC
112{
113    char    sta[TRACE2_STA_LEN];        /* Site name */
114    char    chan[TRACE2_CHAN_LEN];      /* Component/channel code */
115    char    net[TRACE2_NET_LEN];        /* Network name */
116    char    loc[TRACE2_LOC_LEN];        /* Location code */
117    short   pinno;          /* Pin number that maps to sta/net/chan */
118    double  tankStarttime;  /* starttime for this SCNL */       
119    double  tankEndtime;    /* endtime for this SCNL */ 
120    WS_PSCNL next;
121} WS_PSCNL_REC;
122
123typedef struct _WS_MENU_REC *WS_MENU;
124typedef struct _WS_MENU_REC
125{
126    char    addr[wsADRLEN];
127    char    port[wsADRLEN]; 
128    int     sock;
129
130    WS_PSCNL pscnl;
131    WS_MENU next;
132} WS_MENU_REC;
133
134typedef volatile struct
135{
136    WS_MENU head;
137    WS_MENU tail;
138} WS_MENU_QUEUE_REC;
139
140/* to setup and connect to a list of servers, and get SCNL menu of each server
141****************************************************************************/
142int wsAppendMenu( char* , char*, WS_MENU_QUEUE_REC*, int );
143
144/* to close all server sockets and deallocate the menus
145******************************************************/
146void wsKillMenu( WS_MENU_QUEUE_REC* );
147
148/* to deallocate a PSCNL list
149**************************************/
150void wsKillPSCNL( WS_PSCNL );
151
152/* To open a connection to a server
153***********************************/
154int wsAttachServer( WS_MENU, int );
155
156/* to close a single server socket after an error
157************************************************/
158void wsDetachServer( WS_MENU );
159
160/* wsGetServerPSCNL: Return the pscn list for this server from the menu queue *
161*****************************************************************************/
162int wsGetServerPSCN( char*, char*, WS_PSCNL*, WS_MENU_QUEUE_REC* );
163int wsGetServerPSCNL( char*, char*, WS_PSCNL*, WS_MENU_QUEUE_REC* );
164
165/* to retrieve the binary trace snippet specified in the structure TRACE_REQ
166***************************************************************************/
167int wsGetTraceBin( TRACE_REQ*, WS_MENU_QUEUE_REC*, int );
168int wsGetTraceBinL( TRACE_REQ*, WS_MENU_QUEUE_REC*, int );
169
170/* to retrieve the ASCII trace snippet specified in the structure TRACE_REQ
171**************************************************************************/
172int wsGetTraceAscii( TRACE_REQ*, WS_MENU_QUEUE_REC*, int );
173int wsGetTraceAsciiL( TRACE_REQ*, WS_MENU_QUEUE_REC*, int );
174
175/* return the PSCNL list for this server
176***************************************/
177int wsSearchSCN( TRACE_REQ*, WS_MENU*, WS_PSCNL*, WS_MENU_QUEUE_REC* );
178int wsSearchSCNL( TRACE_REQ*, WS_MENU*, WS_PSCNL*, WS_MENU_QUEUE_REC* );
179
180/* turn debugging on or off for the ws_clientII routines.
181**********************************************************/
182int setWsClient_ewDebug(int debug);
183
184
185#endif /* WS_CLIENT */
Note: See TracBrowser for help on using the repository browser.