nmxptool_getoptlong.h 3.51 KB
Newer Older
Matteo Quintiliani's avatar
Matteo Quintiliani committed
1
2
3
4
5
6
7
8
9
/*! \file
 *
 * \brief Nanometrics Protocol Tool
 *
 * Author:
 * 	Matteo Quintiliani
 * 	Istituto Nazionale di Geofisica e Vulcanologia - Italy
 *	quintiliani@ingv.it
 *
10
 * $Id: nmxptool_getoptlong.h,v 1.83 2008-02-28 12:22:01 mtheo Exp $
Matteo Quintiliani's avatar
Matteo Quintiliani committed
11
12
13
 *
 */

14
15
#ifndef NMXPTOOL_GETLONG_H
#define NMXPTOOL_GETLONG_H 1
16
17
18
19

#include <getopt.h>
#include <stdint.h>

20
/* For stable release set to "" */
Matteo Quintiliani's avatar
Matteo Quintiliani committed
21
#define PACKAGE_BUILD "-beta27"
Matteo Quintiliani's avatar
Matteo Quintiliani committed
22

23
24
#define NMXP_STR_STATE_EXT ".nmxpstate"

Matteo Quintiliani's avatar
Matteo Quintiliani committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#define DEFAULT_NETWORK  	"XX"
#define DEFAULT_PORT_DAP 	28002
#define DEFAULT_PORT_PDS 	28000

#define DEFAULT_STC_MINIMUM	-1
#define DEFAULT_STC_MAXIMUM	300
#define DEFAULT_STC      	-1

#define DEFAULT_RATE_MINIMUM   	-1
#define DEFAULT_RATE_MAXIMUM   	1000
#define DEFAULT_RATE     	-1

#define DEFAULT_DELAY_MINIMUM  	60
#define DEFAULT_DELAY_MAXIMUM  	86400
#define DEFAULT_DELAY    	0

Matteo Quintiliani's avatar
Matteo Quintiliani committed
41
42
43
44
45
46
47
#define DEFAULT_MAX_TOLERABLE_LATENCY_MINIMUM	60
#define DEFAULT_MAX_TOLERABLE_LATENCY_MAXIMUM	600
#define DEFAULT_MAX_TOLERABLE_LATENCY 		600

#define DEFAULT_TIMEOUTRECV 			0
#define DEFAULT_TIMEOUTRECV_MINIMUM 		10
#define DEFAULT_TIMEOUTRECV_MAXIMUM 		300
48

49
#define DEFAULT_VERBOSE_LEVEL 			NMXP_LOG_D_NULL
50
51
#define DEFAULT_VERBOSE_LEVEL_MINIMUM		NMXP_LOG_D_NULL
#define DEFAULT_VERBOSE_LEVEL_MAXIMUM		NMXP_LOG_D_ANY
52

53
#define DEFAULT_BUFFERED_TIME			-1.0
54

55
56
#define DEFAULT_INTERVAL_NO_VALUE		-1
#define DEFAULT_INTERVAL_INFINITE		0
57
#define DEFAULT_INTERVAL_MAXIMUM		(86400 * 31)
Matteo Quintiliani's avatar
Matteo Quintiliani committed
58

59
#define DEFAULT_MAX_TIME_TO_RETRIEVE_MINIMUM	0
60
#define DEFAULT_MAX_TIME_TO_RETRIEVE_MAXIMUM	86400
61
#define DEFAULT_MAX_TIME_TO_RETRIEVE 		0
62

63
64
65
66
67
68
69
70
/*! \brief Struct that stores information about parameter of the program */
typedef struct {
    char *hostname;
    int portnumberdap;
    int portnumberpds;
    char *channels;
    char *network;
    char *location;
71
72
    double start_time;
    double end_time;
Matteo Quintiliani's avatar
Matteo Quintiliani committed
73
    int32_t interval;
74
75
    char *datas_username;
    char *datas_password;
76
77
    int32_t stc;
    int32_t rate;
78
    char *plugin_slink;
79
    int32_t delay;
Matteo Quintiliani's avatar
Matteo Quintiliani committed
80
    int32_t max_tolerable_latency;
Matteo Quintiliani's avatar
Matteo Quintiliani committed
81
    int32_t timeoutrecv;
82
    int32_t verbose_level;
83
    char *ew_configuration_file;
84
    char *statefile;
85
    double buffered_time;
86
    int32_t max_data_to_retrieve;
87
88
    int flag_writeseed;
    int flag_listchannels;
89
    int flag_listchannelsnaqs;
90
    int flag_request_channelinfo;
91
    int flag_writefile;
92
    int flag_slink;
93
    int flag_buffered;
94
    int flag_logdata;
Matteo Quintiliani's avatar
Matteo Quintiliani committed
95
    int flag_logsample;
96
} NMXPTOOL_PARAMS;
97

98
99
100
101
102
103
/*! \brief Print author and e-mail for support and bugs */
void nmxptool_author_support();

/*! \brief Print version of tool */
void nmxptool_version();

Matteo Quintiliani's avatar
Matteo Quintiliani committed
104
105
106
/*! \brief Print supports of tool i.e. libmseed, earthworm, ...*/
void nmxptool_supports();

107
108
109
110
/*! \brief Print the usage of paramters */
void nmxptool_usage(struct option long_options[]);


111
112
113
114
115
116
117
118
/*! \brief Read channel states from file
 *
 * \param filename File name of state file
 *
 * \retval Argument string for -C
 * */
char *get_channel_list_argument_from_state_file(const char *filename);

119
/*! \brief Calls getopt_long and set struct NMXPTOOL_PARAMS
120
121
122
123
124
125
126
127
128
 *
 * \param argc
 * \param argv
 * \param params
 *
 * \retval 0 on success.
 * \retval >0 Number of errors.
 *
 */
129
int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params);
130
131


132
133
134
135
136
137
138
/*! \brief Print value of NMXPTOOL_PARAMS
 *
 * \param params Struct to validate.
 *
 */
void nmxptool_log_params(NMXPTOOL_PARAMS *params);

139
/*! \brief Check semantyc of values in struct NMXPTOOL_PARAMS
140
141
142
143
144
145
 *
 * \param params Struct to validate.
 *
 * \retval 0 on success.
 * \retval -1 on error.
 */
146
int nmxptool_check_params(NMXPTOOL_PARAMS *params);
147
148
149

#endif