4 #include <libxml/parser.h>
5 #include <libxml/tree.h>
7 #include "../vcard/vcard.h"
8 #include "../frmActivityMgr.h"
9 #include "../common/sslcertstructs.h"
11 #ifndef CALDAV_CALDAV_H
12 #define CALDAV_CALDAV_H
15 unsigned int DataFlag:2;
19 struct ContactListData{
21 std::map<wxString,FileSyncData> ListData;
24 /*struct CertificateData{
25 std::multimap<wxString,wxString> CertificateData;
30 struct CertificateCollection{
31 std::map<int,CertificateData> Certificates;
32 std::map<int,int> ParentCerticiate;
34 std::map<int,int> CertErrors;
37 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
39 size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *userdata);
40 int ProgressFunc(void *clientdata, double TTDown, double NDown, double TTUp, double NUp);
47 bool SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL);
48 bool SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL, wxString SvrPrefix, wxString SvrAccount);
53 bool HasValidResponse();
54 wxString GetResponseData();
58 void SetupData(wxString Method, wxString FilenameLocation, wxString UploadData);
59 void ProcessDataThread();
60 void SetUploadMode(bool IncMode);
62 bool SetupResultBools(bool *SvrResult, bool *SvrMonitor);
63 int ProgressFuncProc(void *clientdata, double TTUp, double NUp, double TTDown, double NDown);
64 void SetupVariables(std::map<int, int> *actlist, int actindex);
65 wxString GetETagData();
66 void GetServerETagValue();
67 void GetServerETagValueThread();
68 void GetServerContactData();
69 wxString GetPageData();
70 void SetEditMode(bool EditModeInc);
71 ContactListData GetContactList(wxString SyncTokenInc);
72 void SetServerFilename(wxString Filename);
74 static int GetHTTPCode();
75 wxString GetErrorBuffer();
76 wxString GetDefaultAddressBookURL();
78 SSLCertCollection GetCertificateData();
79 static SSLCertCollection BuildSSLCollection(CURL *conn);
80 wxString ETagValueResult();
81 wxString GetErrorMessage();
83 // SSL Verification tests when connecting.
85 static CURLcode SSLVerifyTest();
86 static SSLCertCollection GetSSLVerifyResults();
88 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
90 static wxString ServerAddress;
91 static int ServerPort;
92 static wxString ServerUser;
93 static wxString ServerPass;
94 static wxString ServerPrefix;
95 static wxString ServerAccount;
96 static bool ServerSSL;
97 static bool *ServerResult;
98 static bool *ServerMonitor;
99 static bool SSLStatus;
100 static bool SSLVerified;
101 static bool ValidResponse;
102 static bool AuthPassed;
103 static bool HasCalDAVSupport;
104 static bool AbortConnection;
105 static wxString ServerResponse;
106 static wxString ServerMethod;
107 static wxString ServerFilenameLocation;
108 static wxString ServerUploadData;
109 static wxString ETagData;
110 static wxString ETagResult;
111 static bool UploadMode;
112 static bool EditMode;
113 static long ItemIndex;
114 static std::map<int, int> *ActivityListPtr;
115 //frmActivityMgr *ActMgrPtr;
116 static char curlerrbuffer[CURL_ERROR_SIZE];
117 static SSLCertCollection SSLCertCol;
118 static wxString ErrorMessage;
119 static wxString ErrorBufferMessage;
121 static int SSLErrorCode;
122 static int ConnectionErrorCode;
123 static wxString PageHeader;
124 static wxString PageData;
125 static CURLcode claconncode;
126 static int HTTPErrorCode;
127 static SSLCertCollection VerifyCertCollection;