00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HTTPHANDLER_H
00012 #define HTTPHANDLER_H
00013
00014 #define PUSH_SCORE_URL "http://54.187.244.248/pushnames"
00015 #define GET_IP_URL "http://icanhazip.com"
00016 #define SCORES_URL "http://54.187.244.248/getnames"
00017
00018 #include "IwHTTP.h"
00019 #include <string>
00020 #include <sstream>
00021
00026 class HttpHandler
00027 {
00028 public:
00032 HttpHandler();
00033
00037 ~HttpHandler();
00038
00044 void PostTime(const char* username,
00045 float time);
00046
00053 static int32 GotHeaders(void *void1,
00054 void *void2);
00055
00062 static int32 GotData(void *void1,
00063 void *void2);
00064
00069 char* GetMyIP();
00070
00075 char* GetScores();
00076
00077 protected:
00079 static CIwHTTP *m_httpObject;
00080
00082 enum HTTPStatus { kNone, kDownloading, kOK, kError };
00083
00085 enum HTTPTest { kHead, kGet, kSecure };
00086
00088 static char* m_result;
00089
00091 static char* m_secureResult;
00092
00094 static uint32 m_len;
00095
00097 static HTTPStatus m_status;
00098
00100 static HTTPTest m_testType;
00101
00103 static bool m_headResult;
00104 };
00105
00106 #endif