nmxptool_getoptlong.h 3.4 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
 *
Matteo Quintiliani's avatar
Matteo Quintiliani committed
10
 * $Id: nmxptool_getoptlong.h,v 1.58 2008-01-17 14:00:16 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 "-beta16"
Matteo Quintiliani's avatar
Matteo Quintiliani committed
22

Matteo Quintiliani's avatar
Matteo Quintiliani committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#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
39
40
41
42
43
44
45
#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
46

47
#define DEFAULT_VERBOSE_LEVEL 			NMXP_LOG_D_NULL
48
49
#define DEFAULT_VERBOSE_LEVEL_MINIMUM		NMXP_LOG_D_NULL
#define DEFAULT_VERBOSE_LEVEL_MAXIMUM		NMXP_LOG_D_ANY
50

51
#define DEFAULT_BUFFERED_TIME			-1.0
52

53
54
#define DEFAULT_INTERVAL_NO_VALUE		-1
#define DEFAULT_INTERVAL_INFINITE		0
Matteo Quintiliani's avatar
Matteo Quintiliani committed
55

56
#define DEFAULT_MAX_TIME_TO_RETRIEVE_MINIMUM	30
57
58
#define DEFAULT_MAX_TIME_TO_RETRIEVE_MAXIMUM	86400
#define DEFAULT_MAX_TIME_TO_RETRIEVE 		60
59

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

94
95
96
97
98
99
/*! \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
100
101
102
/*! \brief Print supports of tool i.e. libmseed, earthworm, ...*/
void nmxptool_supports();

103
104
105
106
/*! \brief Print the usage of paramters */
void nmxptool_usage(struct option long_options[]);


107
108
109
110
111
112
113
114
/*! \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);

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


128
129
130
131
132
133
134
/*! \brief Print value of NMXPTOOL_PARAMS
 *
 * \param params Struct to validate.
 *
 */
void nmxptool_log_params(NMXPTOOL_PARAMS *params);

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

#endif