00001 
00032 #ifndef LLUSERAUTH_H
00033 #define LLUSERAUTH_H
00034 
00035 #include <string>
00036 #include <vector>
00037 #include <map>
00038 
00039 class LLXMLRPCTransaction;
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 class LLUserAuth
00072 {
00073 public:
00074         LLUserAuth();
00075         ~LLUserAuth();
00076 
00077         
00078         typedef enum {
00079                 E_NO_RESPONSE_YET = -2,
00080                 E_DOWNLOADING = -1,
00081                 E_OK = 0,
00082                 E_COULDNT_RESOLVE_HOST,
00083                 E_SSL_PEER_CERTIFICATE,
00084                 E_SSL_CACERT,
00085                 E_SSL_CONNECT_ERROR,
00086                 E_UNHANDLED_ERROR,
00087                 E_LAST                                          
00088         } UserAuthcode;
00089 
00090         
00091         typedef std::map<std::string, std::string> response_t;
00092         typedef std::vector<response_t> options_t;
00093 
00094         void authenticate(
00095                 const char* auth_uri,
00096                 const char* auth_method,
00097                 const char* firstname,
00098                 const char* lastname,
00099                 const char* passwd,
00100                 const char* start,
00101                 BOOL skip_optional_update,
00102                 BOOL accept_tos,
00103                 BOOL accept_critical_message,
00104                 const LLUUID& viewer_digest,
00105                 BOOL last_exec_froze, 
00106                 const std::vector<const char*>& requested_options,
00107                 const std::string& hashed_mac,
00108                 const std::string& hashed_volume_serial);
00109 
00110         UserAuthcode authResponse();
00111         
00112         std::string errorMessage() const { return mErrorMessage; }
00113 
00114         
00115         
00116         const char* getResponse(const char* name) const;
00117         BOOL getOptions(const char* name, options_t& options) const;
00118 
00119         F64 getLastTransferRateBPS() const { return mLastTransferRateBPS; }
00120 
00121 private:
00122         LLXMLRPCTransaction* mTransaction;
00123 
00124         UserAuthcode mAuthResponse;
00125         std::string mErrorMessage;
00126         
00127         
00128         typedef std::map<std::string, options_t> all_options_t;
00129         response_t mResponses;
00130         all_options_t mOptions;
00131         
00132         UserAuthcode parseResponse();
00133 
00134         F64 mLastTransferRateBPS;       
00135 };
00136 
00137 extern LLUserAuth *gUserAuthp;
00138 
00139 #endif