#ifndef CCAN_OSERVER_TYPES_H
#define CCAN_OSERVER_TYPES_H
#include <stdlib.h>
+#include <ccan/cdump/cdump.h>
-enum state {
+CDUMP_SAVED enum state {
SENDING_GREETING,
RECEIVING_USER_QUESTION,
SENDING_OTHER_QUESTION_PREFIX,
FINISHED
};
-struct client {
+CDUMP_SAVED struct client {
/* What are we doing today, brain? */
enum state state;
/* Our event info, and the file descriptor. */
- struct tevent_fd *fde;
+ struct tevent_fd *fde CDUMP_IGNORE;
int fd;
+ /* Position in oserver's clients array. */
+ unsigned int id;
/* The question we read from client. */
char *question;
/* The answer to the client. */
/* How many bytes of the reply we sent so far. */
size_t bytes_sent;
/* Our server. */
- struct oserver *oserver;
- /* Whose question this client is answering. */
- struct client *subclient;
- /* Who is answering our question. */
- struct client *oracle;
+ struct oserver *oserver CDUMP_IGNORE;
+ /* Whose question this client is answering (-1 for none) */
+ int subclient;
+ /* Who is answering our question (-1 for none) */
+ int oracle;
};
-struct oserver {
+CDUMP_SAVED struct oserver {
/* 5 clients should be enough for anybody! */
struct client *clients[5];
int fd;
- struct tevent_fd *fde;
+ struct tevent_fd *fde CDUMP_IGNORE;
+ const char *dumpfile;
};
#endif /* CCAN_OSERVER_TYPES_H */