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();
55 wxString GetResponseData();
56 void AllowSelfSignTest(bool AllowSelfSignIn);
60 void SetupData(wxString Method, wxString FilenameLocation, wxString UploadData);
61 void ProcessDataThread();
62 void SetUploadMode(bool IncMode);
64 bool SetupResultBools(bool *SvrResult, bool *SvrMonitor);
65 int ProgressFuncProc(void *clientdata, double TTUp, double NUp, double TTDown, double NDown);
66 void SetupVariables(std::map<int, int> *actlist, int actindex);
67 wxString GetETagData();
68 void GetServerETagValue();
69 void GetServerETagValueThread();
70 void GetServerContactData();
71 wxString GetPageData();
72 void SetEditMode(bool EditModeInc);
73 ContactListData GetContactList(wxString SyncTokenInc);
74 void SetServerFilename(wxString Filename);
76 static int GetHTTPCode();
77 wxString GetErrorBuffer();
78 wxString GetDefaultAddressBookURL();
80 SSLCertCollection GetCertificateData();
81 static SSLCertCollection BuildSSLCollection(CURL *conn);
82 wxString ETagValueResult();
83 wxString GetErrorMessage();
85 // SSL Verification tests when connecting.
87 static CURLcode SSLVerifyTest();
88 static SSLCertCollection GetSSLVerifyResults();
90 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
92 static wxString ServerAddress;
93 static int ServerPort;
94 static wxString ServerUser;
95 static wxString ServerPass;
96 static wxString ServerPrefix;
97 static wxString ServerAccount;
98 static bool ServerSSL;
99 static bool *ServerResult;
100 static bool *ServerMonitor;
101 static bool SSLStatus;
102 static bool SSLVerified;
103 static bool ValidResponse;
104 static bool AuthPassed;
105 static bool HasCalDAVSupport;
106 static bool AbortConnection;
107 static wxString ServerResponse;
108 static wxString ServerMethod;
109 static wxString ServerFilenameLocation;
110 static wxString ServerUploadData;
111 static wxString ETagData;
112 static wxString ETagResult;
113 static bool UploadMode;
114 static bool EditMode;
115 static long ItemIndex;
116 static std::map<int, int> *ActivityListPtr;
117 //frmActivityMgr *ActMgrPtr;
118 static char curlerrbuffer[CURL_ERROR_SIZE];
119 static SSLCertCollection SSLCertCol;
120 static wxString ErrorMessage;
121 static wxString ErrorBufferMessage;
122 static bool AllowSelfSign;
124 static int SSLErrorCode;
125 static int ConnectionErrorCode;
126 static wxString PageHeader;
127 static wxString PageData;
128 static CURLcode claconncode;
129 static int HTTPErrorCode;
130 static SSLCertCollection VerifyCertCollection;