/* The secnet program goes through a number of phases in its lifetime.
Module code may arrange to be called just as various phases are
- entered. */
-
-#define PHASE_INIT 0
-#define PHASE_GETOPTS 1 /* Process command-line arguments */
-#define PHASE_READCONFIG 2 /* Parse and process configuration file */
-#define PHASE_SETUP 3 /* Process information in configuration */
-#define PHASE_GETRESOURCES 4 /* Obtain all external resources */
-#define PHASE_DROPPRIV 5 /* Last chance for privileged operations */
-#define PHASE_RUN 6
-#define PHASE_SHUTDOWN 7 /* About to die; delete key material, etc. */
-#define NR_PHASES 8
+ entered.
+
+ Remember to update the table in util.c if changing the set of
+ phases. */
+
+enum phase {
+ PHASE_INIT,
+ PHASE_GETOPTS, /* Process command-line arguments */
+ PHASE_READCONFIG, /* Parse and process configuration file */
+ PHASE_SETUP, /* Process information in configuration */
+ PHASE_DAEMONIZE, /* Become a daemon (if necessary) */
+ PHASE_GETRESOURCES, /* Obtain all external resources */
+ PHASE_DROPPRIV, /* Last chance for privileged operations */
+ PHASE_RUN,
+ PHASE_SHUTDOWN, /* About to die; delete key material, etc. */
+ /* Keep this last: */
+ NR_PHASES,
+};
typedef void hook_fn(void *self, uint32_t newphase);
bool_t add_hook(uint32_t phase, hook_fn *f, void *state);
comm_notify_fn *fn);
typedef bool_t comm_sendmsg_fn(void *commst, struct buffer_if *buf,
const struct comm_addr *dest);
+typedef const char *comm_addr_to_string_fn(void *commst,
+ const struct comm_addr *ca);
+ /* Returned string is in a static buffer. */
struct comm_if {
void *st;
int32_t min_start_pad;
comm_request_notify_fn *request_notify;
comm_release_notify_fn *release_notify;
comm_sendmsg_fn *sendmsg;
+ comm_addr_to_string_fn *addr_to_string;
};
/* LOG interface */