+#ifndef CCAN_OSERVER_TYPES_H
+#define CCAN_OSERVER_TYPES_H
+#include <stdlib.h>
+
+enum state {
+ SENDING_GREETING,
+ RECEIVING_USER_QUESTION,
+ SENDING_OTHER_QUESTION_PREFIX,
+ SENDING_OTHER_QUESTION,
+ RECEIVING_OTHER_ANSWER,
+ SENDING_ANSWER_PREFIX,
+ SENDING_ANSWER,
+ FINISHED
+};
+
+struct client {
+ /* What are we doing today, brain? */
+ enum state state;
+ /* Our event info, and the file descriptor. */
+ struct tevent_fd *fde;
+ int fd;
+ /* The question we read from client. */
+ char *question;
+ /* The answer to the client. */
+ char *answer;
+ /* 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 {
+ /* 5 clients should be enough for anybody! */
+ struct client *clients[5];
+ int fd;
+ struct tevent_fd *fde;
+};
+#endif /* CCAN_OSERVER_TYPES_H */