/* * clientProtocol.h * * Gouverneur Th. - Cuisinier Gi. * * Declare the client-side protocol function */ #ifndef CLIENT_PROTOCOL_H #define CLIENT_PROTOCOL_H #include #include #include /* * this class is a sort-of "storing class" * containing the different method, called * when a message is received from network * by the client sideo. * * Also, this class cannot be in the librairy, * indeed, this class make the link between * the parser (general), and the protocol * that is implemented in THIS client/server. * * this class can also be used internally, * for storing somes "global vars" that should * be accessible from protocol function * such as the state of authentification of * the client * */ class ClientProtocol { public: static bool auth; static bool waiting; /* char-oriented */ static void cmdLogin (Message *); static void cmdBRoom (Message *); static void cmdCRoom (Message *); static void cmdLRooms (Message *); static void sendSusp (Message *); /* bytes-oriented */ /* NOT YET IMPLEMENTED */ /* protocol-exceptions */ struct exErrAuth : Exception { exErrAuth() : Exception("Error, authentification incorrect...") {} ; }; struct exWantExit : Exception { exWantExit() : Exception("Userinput: Asked to exit program.") {} ; }; struct exUnknownOpt : Exception { exUnknownOpt() : Exception("Unknown option from menu..") {} ; }; /* menu actions */ static bool execOption(int, Sock_Client *); /* returns: if we should wait for an response or not. */ static bool execBRoom (Sock_Client *); static bool execCRoom (Sock_Client *); static bool execLRooms(Sock_Client *); }; #endif