Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #ifndef __SP_NETWORK_SESSION_LOGIN_H__
00009 #define __SP_NETWORK_SESSION_LOGIN_H__
00010 
00011 
00012 #include "Base/spStandard.hpp"
00013 
00014 #ifdef SP_COMPILE_WITH_NETWORKSYSTEM
00015 
00016 
00017 #include "Framework/Network/spNetworkBaseUDP.hpp"
00018 #include "Framework/Network/spNetworkAddress.hpp"
00019 
00020 #include <boost/function.hpp>
00021 
00022 
00023 namespace sp
00024 {
00025 namespace network
00026 {
00027 
00028 
00035 typedef boost::function<void (const NetworkAddress &ReceptionAddress, const io::stringc &SessionDescription)> SessionAnswerCallback;
00036 
00037 
00070 class SP_EXPORT NetworkSessionLogin : public NetworkBaseUDP
00071 {
00072     
00073     public:
00074         
00075         NetworkSessionLogin();
00076         ~NetworkSessionLogin();
00077         
00078         
00079         
00087         bool request(const NetworkAddress &Address);
00088         
00090         bool request(u16 Port, const std::list<io::stringc> &IPAddressList);
00091         
00098         bool receiveAnswer();
00099         
00100         
00101         
00103         inline void setSessionKey(const io::stringc &Key)
00104         {
00105             SessionKey_ = Key;
00106         }
00107         inline io::stringc getSessionKey() const
00108         {
00109             return SessionKey_;
00110         }
00111         
00112         void setSessionAnswerCallback(const SessionAnswerCallback &Callback_)
00113         {
00114             AnswerCallback_ = Callback_;
00115         }
00116         
00117     private:
00118         
00119         
00120         
00121         bool sendRequestPacket(const NetworkAddress &Address);
00122         
00123         
00124         
00125         io::stringc SessionKey_;
00126         
00127         SessionAnswerCallback AnswerCallback_;
00128         
00129 };
00130 
00131 
00132 } 
00133 
00134 } 
00135 
00136 
00137 #endif
00138 
00139 #endif
00140 
00141 
00142 
00143