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).
34 * Opens a socket and binds it to @port, then sets it up to listen
35 * for connections. talloc_free() the pointer returned to shut it down
36 * (its parent is the tevent_context).
41 * oserver = oserver_setup(ev, OSERVER_PORT, "oserver.dump");
43 * err(1, "Failed to set up server");
45 * while (tevent_loop_wait(ev) == 0);
46 * err(1, "Event loop failed");
48 struct oserver *oserver_setup(struct tevent_context *ev, unsigned short port,
49 const char *dumpfile);
51 #define OSERVER_PORT 2828
52 #endif /* CCAN_OSERVER_H */