📄 ctpconfig.h
字号:
/*
* Copyright (C) 2003-2007 Funambol, Inc
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/
#ifndef INCL_CTP_CONFIG
#define INCL_CTP_CONFIG
/** @cond DEV */
#include "stdio.h"
#include <stdio.h>
#include <windows.h>
#include "client/DMTClientConfig.h"
#include "spdm/ManagementNode.h"
#include "spdm/DMTreeFactory.h"
#include "spdm/DMTree.h"
#include "pim/SettingFunctions.h"
#include <string>
using namespace std;
class CTPConfig : public DMTClientConfig{
private:
/**
* This key enables the push feature. It is a bitmask,
* with bit 0 enabling the STP and bit 1 enabling the CTP.
* 0: None
* 1: STP
* 2: CTP
* 3: STP with fallback CTP
*/
int push;
/**
* This key enables the polling feature if the value is
* greater than 0, otherwise the polling is disabled.
*/
int polling;
/**
* Enable or disable the feature of storing the pending
* push requests during a sync.
*/
bool queuePush;
/**
* The time interval, in seconds, after which the
* client will restore the connection.
*/
int ctpRetry;
/**
* The time interval, in seconds, for the maximum
* retry timeout (see failure handling).
*/
int maxCtpRetry;
/**
* The time, in seconds, for which the client
* shall wait for the server response, after sending a command.
*/
int ctpCmdTimeout;
/**
* The time, in seconds, for which the connection with
* the server shall be kept open once it has been established.
* A value of zero indicates that the connection must be
* kept open forever.
*/
int ctpConnTimeout;
/**
* TCP/IP port used by the server to listen for CTP requests.
*/
int ctpPort;
/**
* the nonce used for the MD5 auth. The nonce is sent by the server
* in b64 encoding. It is read and saved to the registry in this
* way.
*/
string ctpNonce;
/**
* The interval of the heartbeat
*/
int ctpReady;
/**
* The url to contact. From DM
*/
string urlTo;
/**
* The url populated after a JUMP server command.
* it is in format <(ipAddress|address):port>
*/
string urlFrom;
/**
* The device id. From DM
*/
string devid;
/**
* The username. From DM
*/
string username;
/// 'true' when we're closing the CTP connection.
bool leavingState;
void setUsername(string v) { username = v; }
void setDeviceId(string v) { devid = v; }
public:
/**
* Constructor
*/
CTPConfig(const char* application_uri);
/**
* Destructor
*/
~CTPConfig();
/**
* Read the parameter configuration from the registry
*/
void readCTPConfig();
/**
* Save the parameter configuration to the registry.
* Actually the only needed parameter to be saved is the
* nonce sent by the server
*/
void saveCTPConfig();
/**
* set/get method for push parameter
*/
void setPush(int v) { push = v; }
int getPush() { return push; }
/**
* set/get method for polling parameter
*/
int getPolling() { return polling; }
void setPolling(int v) { polling = v; }
/**
* set/get method for queuePush parameter
*/
bool getQueuePush() { return queuePush; }
void setQueuePush(bool v) { queuePush = v; }
/**
* set/get method for ctpRetry parameter
*/
int getCtpRetry() { return ctpRetry; }
void setCtpRetry(int v) { ctpRetry = v; }
/**
* set/get method for maxCtpRetry parameter
*/
int getMaxCtpRetry() { return maxCtpRetry; }
void setMaxCtpRetry(int v) { maxCtpRetry = v; }
/**
* set/get method for ctpCmdTimeout parameter
*/
int getCtpCmdTimeout() { return ctpCmdTimeout; }
void setCtpCmdTimeout(int v) { ctpCmdTimeout = v; }
/**
* set/get method for ctpConnTimeout parameter
*/
int getCtpConnTimeout() { return ctpConnTimeout; }
void setCtpConnTimeout(int v) { ctpConnTimeout = v; }
/**
* set/get method for ctpPort parameter
*/
int getCtpPort() { return ctpPort; }
void setCtpPort(int v) { ctpPort = v; }
/**
* set/get method for ctpReady parameter
*/
int getCtpReady() { return ctpReady; }
void setCtpReady(int v) { ctpReady = v; }
/**
* set/get method for ctpNonce parameter
*/
string& getCtpNonce() { return ctpNonce; }
void setCtpNonce(string v) { ctpNonce = v; }
/**
* set/get method for urlTo parameter
*/
string& getUrlTo() { return urlTo; }
void setUrlTo(string v) { urlTo = v; }
/**
* set/get method for urlFrom parameter
*/
string& getUrlFrom() { return urlFrom; }
void setUrlFrom(string v) { urlFrom = v; }
/**
* get method for username parameter
*/
string& getUsername() { return username; }
/**
* get method for deviceId parameter
*/
string& getDeviceId() { return devid; }
/**
* get the host name form the url
*/
string getHostName(string syncUrl);
/**
* get the host port form the url. If the port doesn't exist
* it return 0
*/
int getHostPort(string syncUrl);
/// Set/get the leaving state flag.
bool isLeavingState() { return leavingState; }
void setLeavingState(bool v) { leavingState = v; }
};
/** @endcond */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -