16 #ifndef DABC_ConnectionManager
17 #define DABC_ConnectionManager
19 #ifndef DABC_ModuleAsync
23 #ifndef DABC_ReferencesVector
75 bool match(
const std::string localurl,
const std::string remoteurl)
107 static const
char*
ReqArg() {
return "#REQ"; }
#define DABC_COMMAND(cmd_class, cmd_name)
#define SET_PAR_FIELD(field_name, value)
#define GET_PAR_FIELD(field_name, defvalue)
#define DABC_REFERENCE(RefClass, ParentClass, T)
static const char * ReqArg()
CmdConnectionManagerHandle(ConnectionRequestFull &req)
Here is description how connection between two nodes are build and which states are used.
std::string GetReq() const
std::string GetUrl2() const
void SetUrl2(const std::string &url2)
void SetUrl1(const std::string &url1)
std::string GetUrl1() const
Represents command with its arguments.
void ReplyBool(bool res)
Reply on the command with true or false value.
bool SetStr(const std::string &name, const char *value)
std::string GetStr(const std::string &name, const std::string &dflt="") const
Connections manager class.
ConnectionRequestFull FindConnection(const std::string &url1, const std::string &url2)
virtual bool ReplyCommand(Command cmd)
Reimplement this method to react on command reply Return true if command can be destroyed by framewor...
int fConnCounter
counter for issued connections
@ progrDoingConnect
at this state device should drive connection itself and inform about completion or failure
@ progrWaitReply
connection request is send to the remote side and waiting for reply
@ progrFailed
fail state, request will be ignored forever
@ progrConnected
this is normal state when connection is active
@ progrPending
state when record is prepared and can try connect
@ progrDoingInit
state when record should be prepared by device
void HandleCmdGlobalConnectReply(CmdGlobalConnect cmd)
React on the reply of global connect command.
virtual double ProcessTimeout(double last_diff)
Check status of connections establishing.
void CheckConnectionRecs(bool finish_command=false)
Check current situation with connections.
int fDoingConnection
flag indicates that about connection activity: 0 - nothing, -1 - closing, 1 - establishing
virtual int ExecuteCommand(Command cmd)
Main method where commands are executed.
Command fConnCmd
actual global command for connections establishing/closing
virtual void ProcessParameterEvent(const ParameterEvent &evnt)
Process changes in connection recs.
bool FillAnswerOnRemoteConnectCmd(Command cmd, ConnectionRequestFull &req)
Fill answer on remote connection request and invoke device to start connection When device confirms t...
ConnectionManager(const std::string &name, Command cmd=nullptr)
virtual void ModuleCleanup()
Destroy all connections, if necessary - request to cleanup custom data by device.
void HandleConnectRequestCmdReply(CmdConnectionManagerHandle cmd)
Analyze reply of the command, send to the device.
virtual ~ConnectionManager()
Container for connection parameters.
Full description of connection request.
std::string GetConnId() const
std::string GetConnInfo()
void SetCustomData(Reference ref)
void SetRemoteCommand(dabc::Command cmd)
bool match(const std::string localurl, const std::string remoteurl)
Reference TakeCustomData()
std::string GetServerId() const
void ReplyRemoteCommand(bool res)
void SetConnTimeoutDirectly(double tm)
std::string GetClientId() const
void SetUseAcknDirectly(bool on)
void SetInlineDataSize(int size)
int GetInlineDataSize() const
void SetClientId(const std::string &id)
void SetServerId(const std::string &id)
void SetConnId(const std::string &id)
void SetUseAckn(bool on=true)
std::string GetLocalUrl() const
void SetAllowedField(const std::string &name="")
std::string GetRemoteUrl() const
Return url of data source to which connection should be established.
void SetConnTimeout(double tm)
bool IsServerSide() const
Indicates if local node in connection is server or client.
Lock guard for posix mutex.
Base class for user-derived code, implementing event-processing.
Reference on the arbitrary object
void Release()
Releases reference on the object.
Object * GetObject() const
Return pointer on the object.
Mutex * ObjectMutex() const
Vector of dabc::Reference objects.
const char * xmlTimeoutAttr
const char * xmlUseacknAttr