00001 #ifndef SESSION_H 00002 #define SESSION_H 00003 00007 struct msgHeader1 { 00008 int release; 00009 unsigned int size; 00010 int msgType; 00011 char attributes; 00012 char sequenceNumber; 00013 }; 00014 class Session; 00015 00016 #include "Socket.hpp" 00017 #include "TcpStream.hpp" 00018 #include "DB.hpp" 00019 00020 #include <string> 00021 00022 class Bkmd; 00023 00027 class Session { 00028 public: 00033 Session(Bkmd* bkmd, Socket& server); 00034 00039 int poll(); 00040 00044 void send(msgHeader1& header, const string& data); 00045 00051 void response(int msgType, const string& data, msgHeader1& header); 00052 00057 DB* getDb(); 00058 00059 private: 00063 TCPStream _tcpstream; 00064 00068 bool processMessage(); 00069 00073 void processBody(msgHeader1& header); 00074 00080 Bkmd* _bkmd; 00081 }; 00082 00083 #endif