00001
00032 #ifndef LLUSERAUTH_H
00033 #define LLUSERAUTH_H
00034
00035 #include <string>
00036 #include <vector>
00037 #include <map>
00038 typedef struct _xmlrpc_value* XMLRPC_VALUE;
00039
00040
00041 class LLXMLRPCTransaction;
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
00072
00073 class LLUserAuth : public LLSingleton<LLUserAuth>
00074 {
00075 public:
00076 LLUserAuth();
00077 ~LLUserAuth();
00078
00079
00080 typedef enum {
00081 E_NO_RESPONSE_YET = -2,
00082 E_DOWNLOADING = -1,
00083 E_OK = 0,
00084 E_COULDNT_RESOLVE_HOST,
00085 E_SSL_PEER_CERTIFICATE,
00086 E_SSL_CACERT,
00087 E_SSL_CONNECT_ERROR,
00088 E_UNHANDLED_ERROR,
00089 E_LAST
00090 } UserAuthcode;
00091
00092
00093 typedef std::map<std::string, std::string> response_t;
00094 typedef std::vector<response_t> options_t;
00095
00096
00097 void authenticate(
00098 const char* auth_uri,
00099 const char* auth_method,
00100 const char* firstname,
00101 const char* lastname,
00102 LLUUID web_login_key,
00103 const char* start,
00104 BOOL skip_optional_update,
00105 BOOL accept_tos,
00106 BOOL accept_critical_message,
00107 BOOL last_exec_froze,
00108 const std::vector<const char*>& requested_options,
00109 const std::string& hashed_mac,
00110 const std::string& hashed_volume_serial);
00111
00112
00113 void authenticate(
00114 const char* auth_uri,
00115 const char* auth_method,
00116 const char* firstname,
00117 const char* lastname,
00118 const char* password,
00119 const char* start,
00120 BOOL skip_optional_update,
00121 BOOL accept_tos,
00122 BOOL accept_critical_message,
00123 BOOL last_exec_froze,
00124 const std::vector<const char*>& requested_options,
00125 const std::string& hashed_mac,
00126 const std::string& hashed_volume_serial);
00127
00128 UserAuthcode authResponse();
00129
00130
00131 void reset();
00132
00133 std::string errorMessage() const { return mErrorMessage; }
00134
00135
00136
00137 const char* getResponse(const char* name) const;
00138 BOOL getOptions(const char* name, options_t& options) const;
00139
00140 F64 getLastTransferRateBPS() const { return mLastTransferRateBPS; }
00141
00142 private:
00143 LLXMLRPCTransaction* mTransaction;
00144
00145 UserAuthcode mAuthResponse;
00146 std::string mErrorMessage;
00147
00148
00149 typedef std::map<std::string, options_t> all_options_t;
00150 response_t mResponses;
00151 all_options_t mOptions;
00152
00153 UserAuthcode parseResponse();
00154
00155 F64 mLastTransferRateBPS;
00156 };
00157
00158 #endif