Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Removed references to the boost library in frmSearch.
[xestiaab/.git] / source / carddav / carddav.h
1 #include <iostream>
2 #include <map>
3 #include <wx/wx.h>
4 #include <libxml/parser.h>
5 #include <libxml/tree.h>
6 #include <curl/curl.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
14 struct FileSyncData{
15         unsigned int DataFlag:2;
16         wxString ETagData;
17 };
19 struct ContactListData{
20         wxString SyncToken;
21         std::map<wxString,FileSyncData> ListData;
22 };
24 struct UploadDataStruc{
25         wxString *readptr;
26         long sizeleft;
27         int seek = 0;
28 };
30 /*struct CertificateData{
31         std::multimap<wxString,wxString> CertificateData;
32         bool CertValid;
33         int CertError;
34 };
36 struct CertificateCollection{
37         std::map<int,CertificateData> Certificates;
38         std::map<int,int> ParentCerticiate;
39         bool AllCertsValid;
40         std::map<int,int> CertErrors;
41 };*/
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);
49 class CardDAV
50 {
51         public:
52                 CardDAV();
53                 ~CardDAV();
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);
56                 bool CanDoCardDAV();
57                 bool CanDoSSL();
58                 bool SSLVerify();
59                 bool AbleToLogin();
60                 bool HasValidResponse();
61                 bool IsSelfSigned();
62                 wxString GetResponseData();
63                 void AllowSelfSignTest(bool AllowSelfSignIn);           
64                 bool Connect();
65                 bool ConnectThread();
66                 void ProcessData();
67                 void SetupData(wxString Method, wxString FilenameLocation, wxString UploadData);
68                 void ProcessDataThread();
69                 void SetUploadMode(bool IncMode);
70                 void Abort();
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);
82                 int GetResultCode();
83                 static int GetHTTPCode();
84                 wxString GetErrorBuffer();
85                 wxString GetDefaultAddressBookURL();
86                 void GetSSLResults();
87                 SSLCertCollection GetCertificateData();
88                 static SSLCertCollection BuildSSLCollection(CURL *conn);
89                 wxString ETagValueResult();
90                 wxString GetErrorMessage();
91         
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);
98         private:
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;
130         protected:
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;
138                                 
139 };
141 #endif
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy