Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
e38c6145741f7fe42a52d0a61cefbca697a32604
[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 CertificateData{
25         std::multimap<wxString,wxString> CertificateData;
26         bool CertValid;
27         int CertError;
28 };
30 struct CertificateCollection{
31         std::map<int,CertificateData> Certificates;
32         std::map<int,int> ParentCerticiate;
33         bool AllCertsValid;
34         std::map<int,int> CertErrors;
35 };*/
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);
42 class CardDAV
43 {
44         public:
45                 CardDAV();
46                 ~CardDAV();
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);
49                 bool CanDoCardDAV();
50                 bool CanDoSSL();
51                 bool SSLVerify();
52                 bool AbleToLogin();
53                 bool HasValidResponse();
54                 bool IsSelfSigned();
55                 wxString GetResponseData();
56                 void AllowSelfSignTest(bool AllowSelfSignIn);           
57                 bool Connect();
58                 bool ConnectThread();
59                 void ProcessData();
60                 void SetupData(wxString Method, wxString FilenameLocation, wxString UploadData);
61                 void ProcessDataThread();
62                 void SetUploadMode(bool IncMode);
63                 void Abort();
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);
75                 int GetResultCode();
76                 static int GetHTTPCode();
77                 wxString GetErrorBuffer();
78                 wxString GetDefaultAddressBookURL();
79                 void GetSSLResults();
80                 SSLCertCollection GetCertificateData();
81                 static SSLCertCollection BuildSSLCollection(CURL *conn);
82                 wxString ETagValueResult();
83                 wxString GetErrorMessage();
84         
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);
91         private:
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;
123         protected:
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;
131                                 
132 };
134 #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