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 UploadDataStruc{
30 /*struct CertificateData{
31 std::multimap<wxString,wxString> CertificateData;
36 struct CertificateCollection{
37 std::map<int,CertificateData> Certificates;
38 std::map<int,int> ParentCerticiate;
40 std::map<int,int> CertErrors;
43 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
45 size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, wxString *userdata);
46 int ProgressFunc(void *clientdata, double TTDown, double NDown, double TTUp, double NUp);
47 size_t UploadReadFunc(void *ptr, size_t size, size_t nmemb, void *userdata);
54 bool SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL);
55 bool SetupConnection(wxString SvrAddress, int SvrPort, wxString SvrUser, wxString SvrPass, bool SvrSSL, wxString SvrPrefix, wxString SvrAccount);
60 bool HasValidResponse();
62 wxString GetResponseData();
63 void AllowSelfSignTest(bool AllowSelfSignIn);
67 void SetupData(wxString Method, wxString FilenameLocation, wxString UploadData);
68 void ProcessDataThread();
69 void SetUploadMode(bool IncMode);
71 bool SetupResultBools(bool *SvrResult, bool *SvrMonitor);
72 int ProgressFuncProc(void *clientdata, double TTUp, double NUp, double TTDown, double NDown);
73 void SetupVariables(std::map<int, int> *actlist, int actindex);
74 wxString GetETagData();
75 void GetServerETagValue();
76 void GetServerETagValueThread();
77 void GetServerContactData();
78 wxString GetPageData();
79 void SetEditMode(bool EditModeInc);
80 ContactListData GetContactList(wxString SyncTokenInc);
81 void SetServerFilename(wxString Filename);
83 static int GetHTTPCode();
84 wxString GetErrorBuffer();
85 wxString GetDefaultAddressBookURL();
87 SSLCertCollection GetCertificateData();
88 static SSLCertCollection BuildSSLCollection(CURL *conn);
89 wxString ETagValueResult();
90 wxString GetErrorMessage();
92 // SSL Verification tests when connecting.
94 static CURLcode SSLVerifyTest();
95 static SSLCertCollection GetSSLVerifyResults();
97 //size_t WritebackFunc(char *ptr, size_t size, size_t nmemb, FILE *userdata);
99 static wxString ServerAddress;
100 static int ServerPort;
101 static wxString ServerUser;
102 static wxString ServerPass;
103 static wxString ServerPrefix;
104 static wxString ServerAccount;
105 static bool ServerSSL;
106 static bool *ServerResult;
107 static bool *ServerMonitor;
108 static bool SSLStatus;
109 static bool SSLVerified;
110 static bool ValidResponse;
111 static bool AuthPassed;
112 static bool HasCalDAVSupport;
113 static bool AbortConnection;
114 static wxString ServerResponse;
115 static wxString ServerMethod;
116 static wxString ServerFilenameLocation;
117 static wxString ServerUploadData;
118 static wxString ETagData;
119 static wxString ETagResult;
120 static bool UploadMode;
121 static bool EditMode;
122 static long ItemIndex;
123 static std::map<int, int> *ActivityListPtr;
124 //frmActivityMgr *ActMgrPtr;
125 static char curlerrbuffer[CURL_ERROR_SIZE];
126 static SSLCertCollection SSLCertCol;
127 static wxString ErrorMessage;
128 static wxString ErrorBufferMessage;
129 static bool AllowSelfSign;
131 static int SSLErrorCode;
132 static int ConnectionErrorCode;
133 static wxString PageHeader;
134 static wxString PageData;
135 static CURLcode claconncode;
136 static int HTTPErrorCode;
137 static SSLCertCollection VerifyCertCollection;