4 #include <ccan/tevent/tevent.h>
7 * oserver_restore - restore an oserver from dump
8 * @ev: tevent context to use.
9 * @dumpfile: file to with saved state.
11 * Tries to restore an oserver from the dump file. Returns NULL on failure.
12 * talloc_free() the pointer returned to shut it down
13 * (its parent is the tevent_context).
16 * struct oserver *oserver;
17 * struct tevent_context *ev;
19 * ev = tevent_context_init(NULL);
20 * oserver = oserver_restore(ev, "oserver.dump");
22 * printf("Restored oserver!");
24 struct oserver *oserver_restore(struct tevent_context *ev,
25 const char *dumpfile);
29 * oserver_setup - set up an oserver
30 * @ev: tevent context to use.
31 * @port: port to use (usually OSERVER_PORT)
32 * @dumpfile: file to save state to on SIGHUP (if non-NULL).
33 * @argv: arguments to re-exec on SIGHUP (if non-NULL).
35 * Opens a socket and binds it to @port, then sets it up to listen
36 * for connections. talloc_free() the pointer returned to shut it down
37 * (its parent is the tevent_context).
42 * oserver = oserver_setup(ev, OSERVER_PORT, "oserver.dump", argv);
44 * err(1, "Failed to set up server");
46 * while (tevent_loop_wait(ev) == 0);
47 * err(1, "Event loop failed");
49 struct oserver *oserver_setup(struct tevent_context *ev, unsigned short port,
50 const char *dumpfile, char *argv[]);
52 #define OSERVER_PORT 2828
53 #endif /* CCAN_OSERVER_H */