]> git.decadent.org.uk Git - nfs-utils.git/blob - utils/statd/statd.h
13c80da4edccad86c1cce5247c08a717efd1892a
[nfs-utils.git] / utils / statd / statd.h
1 /* 
2  * Copyright (C) 1995-1997, 1999 Jeffrey A. Uphoff
3  * Modified by Olaf Kirch, Dec. 1996.
4  *
5  * NSM for Linux.
6  */
7
8 #ifdef HAVE_CONFIG_H
9 #include <config.h>
10 #endif
11
12 #include "sm_inter.h"
13 #include "system.h"
14 #include "log.h"
15
16 /*
17  * Paths and filenames.
18  */
19 #if defined(NFS_STATEDIR)
20 # define DEFAULT_DIR_BASE       NFS_STATEDIR "/"
21 #else
22 # define DEFAULT_DIR_BASE       "/var/lib/nfs/"
23 #endif
24
25 #define DEFAULT_SM_DIR          DEFAULT_DIR_BASE "sm"
26 #define DEFAULT_SM_BAK_DIR      DEFAULT_DIR_BASE "sm.bak"
27 #define DEFAULT_SM_STAT_PATH    DEFAULT_DIR_BASE "state"
28
29 /* Added to support run-time specification of state directory path.
30  * j_carlos_gomez@yahoo.com
31  */
32
33 extern char * DIR_BASE;
34 extern char *  SM_DIR;
35 extern char *  SM_BAK_DIR;
36 extern char *  SM_STAT_PATH;
37
38 /*
39  * Status definitions.
40  */
41 #define STAT_FAIL       stat_fail
42 #define STAT_SUCC       stat_succ
43
44 /*
45  * Function prototypes.
46  */
47 extern void     change_state(void);
48 extern void     do_regist(u_long, void (*)());
49 extern void     my_svc_run(void);
50 extern void     notify_hosts(void);
51 extern void     shuffle_dirs(void);
52 extern int      process_notify_list(void);
53 extern int      process_reply(FD_SET_TYPE *);
54 extern char *   xstrdup(const char *);
55 extern void *   xmalloc(size_t);
56 extern void     xunlink (char *, char *, short int);
57
58 /*
59  * Host status structure and macros.
60  */
61 stat_chge               SM_stat_chge;
62 #define MY_NAME         SM_stat_chge.mon_name
63 #define MY_STATE        SM_stat_chge.state
64
65 /*
66  * Some timeout values.  (Timeout values are in whole seconds.)
67  */
68 #define CALLBACK_TIMEOUT         3 /* For client call-backs. */
69 #define NOTIFY_TIMEOUT           5 /* For status-change notifications. */
70 #define SELECT_TIMEOUT          10 /* Max select() timeout when work to do. */
71 #define MAX_TRIES                5 /* Max number of tries for any host. */
72
73 /*
74  * Modes of operation - Lon
75  */
76 extern int run_mode;
77 #define MODE_NODAEMON 1         /* No-daemon/foreground mode. */
78 #define MODE_LOG_STDERR 2       /* in foreground mode, log to stderr */
79 #define MODE_NOTIFY_ONLY 4      /* Send SM_NOTIFY to everyone monitored on
80                                    a single interface/alias */
81 /* LH - notify_only mode would be for notifying hosts on an IP alias
82  * that just came back up, for ex, when failing over a HA service to
83  * another host.... */
84 #define STATIC_HOSTNAME 8       /* Always use the hostname set by -n */
85
86 /*
87  * Program name and version pointers -- See statd.c for the reasoning
88  * as to why they're global.
89  */
90 extern char *name_p;            /* program basename */
91 extern const char *version_p;   /* program version */
92