Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Removed Entity Tag from DeleteContact in ConnectionObject interface
[xestiaab/.git] / source / connobject / ConnectionObject.h
1 // ConnectionObject.h - ConnectionObject interface header file.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #ifndef __CONNOBJECT_CONNECTIONOBJECT_H__
20 #define __CONNOBJECT_CONNECTIONOBJECT_H__
22 #include <string>
23 #include <vector>
24 #include <iostream>
25 #include "../common/sslcertstructs.h"
27 enum COConnectResult {
28         COCONNECT_UNITTESTFAIL = -1,
29         COCONNECT_OK,
30         COCONNECT_SSLFAIL,
31         COCONNECT_INVALID,
32         COCONNECT_TIMEOUT,
33         COCONNECT_AUTHFAIL
34 };
36 enum CORequestResult {
37         COREQUEST_UNITTESTFAIL = -1,
38         COREQUEST_OK,
39         COREQUEST_ERROR_NOTCONNECTED,
40         COREQUEST_ERROR_SERVER,
41 };
43 enum COSSLVerified {
44         COSSL_UNITTESTFAIL = -1,
45         COSSL_VERIFIED,
46         COSSL_VERIFIED_USER,
47         COSSL_UNABLETOVERIFY,
48         COSSL_NOTAPPLICABLE,
49         COSSL_NORESULT
50 };
52 struct COServerResponse {
53         CORequestResult RequestResult;
54         std::string EntityTag;
55         int SessionCode;
56         int ResultCode;
57         std::string ResultMessage;
58 };
60 struct COContactData {
61         std::string Location;
62         std::string Data;
63 };
65 struct COContactList {
66         COServerResponse ServerResponse;
67         std::vector<COContactData> ListData;
68         std::string SyncToken;
69 };
71 class ConnectionObject{
72         
73         public:
74                 ConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL);
75                 ConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL, std::string ServerPrefix, std::string ServerAccount);
76         
77                 // Virtual functions to be setup by the inheriting classes.
78         
79                 virtual void SetupConnectionObject() { };
80                 //virtual ~ConnectionObject() {};
81                 
82                 virtual bool IsTaskCompleted() {};
83                 
84                 virtual COConnectResult Connect(bool DoAuthentication) {};
85                 virtual void BypassSSLVerification(bool EnableBypass) {};
86                 
87                 virtual COServerResponse GetDefaultPrefix(std::string *ServerPrefix) {};
88                 virtual COServerResponse AddContact(std::string Location, std::string Data) {};
89                 virtual COServerResponse EditContact(std::string Location, std::string Data) {};
90                 virtual COServerResponse DeleteContact(std::string Location) {};
91                 virtual COServerResponse GetServerEntityTagValue(std::string Location) {};
92                 virtual COServerResponse GetContact(std::string Location, std::string *PageData) {};
93                 virtual COContactList GetContactList(std::string SyncToken) {};
94                 
95                 virtual bool CanDoProcessing() {};
96                 virtual bool CanDoSSL() {};
97                 virtual COSSLVerified SSLVerify() {};
98                 virtual bool AbleToLogin() {};
99                 virtual bool HasValidResponse() {};
100                 virtual bool IsSelfSigned() {};
101                 virtual std::string GetErrorMessage() {};
102         
103                 // OS specific functions.
104                 
105 #if defined(__APPLE__)
106 #elif defined(__WIN32__)
107 #else
108                 SSLCertCollectionString BuildSSLCollection() {};
110 #endif
111                 
112         protected:
113                 // Test Mode.
114         
115                 bool TestMode = false;
116         
117                 // Server variables.
118         
119                 std::string ServerAddress = "";
120                 unsigned int ServerPort = 8080;
121                 std::string ServerUser = "";
122                 std::string ServerPass = "";
123                 std::string ServerPrefix = "";
124                 std::string ServerAccount = "";
125                 bool ServerSSL = true;
126                 std::string ErrorMessage = "";
127         
128                 // Connect results.
129         
130                 bool SSLStatus = false;
131                 COSSLVerified SSLVerified = COSSL_NORESULT;
132                 bool ValidResponse = false;
133                 bool AuthPassed = false;
134                 bool CanProcess = false;
135                 bool SSLSelfSigned = false;
136                 bool TaskCompleted = false;
137                 
138         private:
140 };
142 #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