1 // ConnectionObject.h - ConnectionObject interface header file.
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
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.
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.
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/>
22 enum COConnectResult {
23 COCONNECT_UNITTESTFAIL = -1,
30 enum CORequestResult {
31 COREQUEST_UNITTESTFAIL = -1,
33 COREQUEST_ERROR_NOTCONNECTED,
34 COREQUEST_ERROR_SERVER
37 struct COServerResponse {
38 CORequestResult RequestResult;
39 std::string EntityTag;
42 std::string ResultMessage;
45 struct COContactData {
50 struct COContactList {
51 COServerResponse ServerResponse;
52 std::vector<COContactData> ListData;
53 std::string SyncToken;
56 class ConnectionObject{
59 ConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL);
60 ConnectionObject(std::string ServerAddress, int ServerPort, std::string ServerUser, std::string ServerPass, bool ServerSSL, std::string ServerPrefix, std::string ServerAccount);
62 // Virtual functions to be setup by the inheriting classes.
64 virtual void SetupConnectionObject() {};
65 virtual ~ConnectionObject() {};
67 virtual COConnectResult Connect() {};
69 virtual std::string GetDefaultPrefix() {};
70 virtual COServerResponse AddContact(std::string Location, std::string Data) {};
71 virtual COServerResponse EditContact(std::string Location, std::string Data) {};
72 virtual COServerResponse DeleteContact(std::string Location, std::string EntityTag) {};
73 virtual COServerResponse GetServerEntityTagValue(std::string Location) {};
74 virtual COServerResponse GetContact(std::string Location) {};
75 virtual COContactList GetContactList(std::string SyncToken) {};
77 virtual bool CanDoProcessing() {};
78 virtual bool CanDoSSL() {};
79 virtual bool SSLVerify() {};
80 virtual bool AbleToLogin() {};
81 virtual bool HasValidResponse() {};
86 bool TestMode = false;
90 std::string ServerAddress = "";
91 unsigned int ServerPort = 8080;
92 std::string ServerUser = "";
93 std::string ServerPass = "";
94 std::string ServerPrefix = "";
95 std::string ServerAccount = "";
96 bool ServerSSL = true;
97 std::string ErrorMessage = "";
98 std::string ErrorBufferMessage = "";
102 bool SSLStatus = false;
103 bool SSLVerified = false;
104 bool ValidResponse = false;
105 bool AuthPassed = false;
106 bool CanProcess = false;
107 bool SSLSelfSigned = false;