#ifndef __RemoteHistoryResponse_h_ #define __RemoteHistoryResponse_h_ #include /* RemoteHistoryResponse is the server side to go with * RemoteHistoryConnection.C on the client side. When you want to send a * response to the client, use one of these functions to mark up the response * so RemoteHistoryConnection.C knows what to do with the message. */ namespace RemoteHistoryResponse { // Write any string. Call debugMessage() on that string, then send it // to the client. This can come at any time before the session is closed. // The string will be sent to the client's log file. void debugMessage(std::string &message); // Send this message when we are done with the request. The client will // stop listening to this channel. The client will decide, based on the // details of the specific request, if it wants to send another request. // Always send this when you are done! std::string gracefulClose(); // Write any string. Call dataMessage() on that string then send it to // the client. RemoteHistoryConnection will pass the original message on // to whatever library originally requested the data. The meaning of this // message is dependant on who requested it. I.e. the details will be // different for a top lists vs oddsmaker. void dataMessage(std::string &message); // Write this if you can't find the file that the user asked for. This // will respond with an updated ServerList so the client will know who // it should send the request to next time. RemoteHistoryConnection will // catch this message and deal with it accordingly. Do not call // fileNotFound() and dataMessage() on the same request. Send // gracefulClose() after sending this. std::string fileNotFound(); // This is semi-private. It is shared by RemoteHistoryResponse.C and // RemoteHistoryConnection.C. It is used to encode and decode the ideas // described in the functions listed above. enum class Type : char { Debug = 'A', Close, Data, FileNotFound }; } #endif