nds2-client - ClientDeveloper  0.16.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nds1.h
Go to the documentation of this file.
1 /* -*- tab-width:8 c-basic-offset:4 indent-tabs-mode:nil -*- */
2 /* set vi: ts=8:softtabstop=4,shiftwidth=4,expandtab */
3 
4 #ifndef DAQC_NDS1_H
5 #define DAQC_NDS1_H
6 
7 #ifndef DLL_EXPORT
8 #if WIN32 || WIN64
9 #define DLL_EXPORT __declspec( dllexport )
10 #else
11 #define DLL_EXPORT
12 #endif /* WIN32 || WIN64 */
13 #endif /* DLL_EXPORT */
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /*
20  * Cycle the connection to the nds1 server. This will reuse the
21  * host and port information. This only works after a successful
22  * connection. It is a work around for ticket 282 where the nds1
23  * server sends DAQD_ERROR after some number of requests.
24  *
25  * This function is used to help transparently cycle the connection
26  * and reset whatever is causing nds1 issues.
27  */
28 DLL_EXPORT int nds1_reconnect( daq_t* daq );
29 
30 /*
31  * Connect to the DAQD server on the host identified by `ip' address.
32  * Returns zero if OK or the error code if failed.
33  */
34 int nds1_connect( daq_t* daq, const char* host, int port );
35 
36 /*
37  * Disconnect from the DAQD server. Send a quit command and close the
38  * socket.
39  * Returns zero if OK or the error code if failed.
40  */
41 int nds1_disconnect( daq_t* daq );
42 
43 /*
44  * Get the most recent error message recorded by the server.
45  * Returns zero if OK or the error code if failed.
46  */
47 int nds1_get_last_message( daq_t* daq, char* buf, size_t max_len, int* len );
48 
49 /*
50  * Initialize the nds1 client
51  * Returns zero if OK or the error code if failed.
52  */
53 int nds1_initalize( void );
54 
55 /*
56  * Receive channel data using the NDS1 protocol
57  */
58 int nds1_recv_channels( daq_t* daq,
59  daq_channel_t* channel,
60  int num_channels,
61  int* num_channels_received );
62 
63 /*
64  * Receive channel data using the NDS1 protocol for a single channel, by name.
65  *
66  * FIXME: The NDS1 protocol's "status channels" command accepts any number of
67  * channel names as an optional argument, but the metadata is only valid for
68  * the zeroth channel. For the first, second, ..., Nth channels, the metadata
69  * (sample rate, type, units, etc.) are blank. If this bug in the NDS1 servers
70  * is ever fixed, then we should implement a multi-channel version of this
71  * query.
72  */
73 int nds1_recv_channel( daq_t* daq, daq_channel_t* channel, const char* name );
74 
75 /* nds1_request_check(daq_t*, time_t, time_t)
76  *
77  * Get requested channel data status for the specified interval.
78  */
79 int nds1_request_check( daq_t* daq, time_t start, time_t end );
80 
81 /* nds1_request_data(daq_t*, time_t, time_t)
82  *
83  * Get requested channel data for the specified interval.
84  */
85 int nds1_request_data( daq_t* daq, time_t start, time_t dt );
86 
87 /* nds1_receive_reconfigure(daq_t* daq, long block_len)
88  *
89  * Receive a reconfigure block. receive_reconfigure is received after the
90  * block header has been read in. The block length does not include the
91  * header length.
92  */
93 int nds1_receive_reconfigure( daq_t* daq, size_t block_len );
94 
95 /*
96  * Initialize the nds1 client
97  * Returns zero if OK or the error code if failed.
98  */
99 int nds1_startup( void );
100 
101 /*
102  * Supported NDS1 protocols
103  */
104 #define MAX_NDS1_PROTOCOL_VERSION 12
105 #define MIN_NDS1_PROTOCOL_VERSION 11
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
111 #endif /* !defined(DAQC_NDS1_H) */
int nds1_recv_channel(daq_t *daq, daq_channel_t *channel, const char *name)
Definition: nds1_access.c:932
#define DLL_EXPORT
Definition: nds1.h:11
int nds1_recv_channels(daq_t *daq, daq_channel_t *channel, int num_channels, int *num_channels_received)
Definition: nds1_access.c:908
Channel description structure.
Definition: daqc.h:303
int nds1_get_last_message(daq_t *daq, char *buf, size_t max_len, int *len)
Definition: nds1_access.c:390
DLL_EXPORT int nds1_reconnect(daq_t *daq)
Definition: nds1_access.c:169
int nds1_initalize(void)
int nds1_receive_reconfigure(daq_t *daq, size_t block_len)
Definition: nds1_access.c:1240
int nds1_request_check(daq_t *daq, time_t start, time_t end)
Definition: nds1_access.c:1010
int nds1_startup(void)
Definition: nds1_access.c:1317
NDS1/2 client status structure.
Definition: daqc.h:232
int nds1_disconnect(daq_t *daq)
Definition: nds1_access.c:349
int nds1_request_data(daq_t *daq, time_t start, time_t dt)
Definition: nds1_access.c:1020
int nds1_connect(daq_t *daq, const char *host, int port)
Definition: nds1_access.c:252