File: options.h

package info (click to toggle)
fence-virt 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 772 kB
  • sloc: ansic: 10,257; cpp: 382; makefile: 272; sh: 214; lex: 113; yacc: 105
file content (97 lines) | stat: -rw-r--r-- 2,384 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
  Copyright Red Hat, Inc. 2006

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2, or (at your option) any
  later version.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; see the file COPYING.  If not, write to the
  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge, 
  MA 02139, USA.
*/
#ifndef _XVM_OPTIONS_H
#define _XVM_OPTIONS_H

typedef enum {
	F_FOREGROUND	= 0x1,
	F_NOCCS		= 0x2,
	F_ERR		= 0x4,
	F_HELP		= 0x8,
	F_USE_UUID	= 0x10,
	F_VERSION	= 0x20,
	F_CCSERR	= 0x40,
	F_CCSFAIL	= 0x80,
	F_NOCLUSTER	= 0x100
} arg_flags_t;

typedef enum {
	MODE_MULTICAST  = 0,
	/*MODE_BROADCAST  = 1,*/
	MODE_SERIAL     = 2,
	MODE_VMCHANNEL  = 3,
	MODE_TCP		= 4,
	MODE_VSOCK		= 5
} client_mode_t;

typedef struct {
	char *domain;
	fence_cmd_t op;
	client_mode_t mode;
	int debug;
	int timeout;
	int delay;
	int retr_time;
	arg_flags_t flags;

	struct network_args {
		char *addr;
		char *ipaddr;
		char *key_file;
		uint32_t cid;
		int port;
		fence_hash_t hash;
		fence_auth_type_t auth;
		int family;
		unsigned int ifindex;
	} net;

	struct serial_args {
		char *device;		/* Serial device */
		char *speed;
		char *address;		/* vmchannel IP */
	} serial;
} fence_virt_args_t;

/* Private structure for commandline / stdin fencing args */
struct arg_info {
	char opt;
	char *opt_desc;
	char *stdin_opt;
	int eh;
	char *content_type;
	char *default_value;
	char *desc;
	void (*assign)(fence_virt_args_t *, struct arg_info *, char *);
};


/* Get options */
void args_init(fence_virt_args_t *args);
void args_finalize(fence_virt_args_t *args);

void args_get_getopt(int argc, char **argv, const char *optstr,
		     fence_virt_args_t *args);
void args_get_stdin(const char *optstr, fence_virt_args_t *args);
void args_get_ccs(const char *optstr, fence_virt_args_t *args);
void args_usage(char *progname, const char *optstr, int print_stdin);
void args_print(fence_virt_args_t *args);
void args_metadata(char *progname, const char *optstr);

#endif