6. Subsystem "Transports" (TTransportS)
"Transports" subsystem is represented by the TTransportS object, which contains modular objects of the transports' types TTypeTransport on the subsystem-level. Each type of transport contains objects TTransportIn of the incoming and TTransportOut of the outgoing transports. The overall structure of the subsystem is shown in Fig. 6.
Fig. 6. The layered structure of the transports subsystem.
The root object of the "Transports" subsystem's module provides information about the specific type of module and about the external OpenSCADA hosts/stations. As part of the single module it can be implemented the own general-module functionality. In general, for all modules, the access methods for both: inbound and outbound transports of the specific module are contained.
The object of the incoming transport TTransportIn provides an interface to the implementation of the modular method of incoming transport.
The object of the outgoing transport TTransportOut provides an interface to the implementation of the modular method of outgoing transport.
6.1. The object of the «Transports» subsystem (TTransportS)
Data:
External hosts mode (enum — ExtHost::Mode):
- User (0) — User.
- System (1) — System.
- UserSystem (2) — User and System.
The structure of the external OpenSCADA hosts/stations (class TTransportS::ExtHost):
- ExtHost( const string &iuser_open, const string &iid, const string &iname, const string &itransp, const string &iaddr, const string &iuser, const string &ipass ); — Constructor of the structure initialization.
- string user_open; — The user who created the record about the external host/station.
- string id; — Id of the external host/station.
- string name; — The name of an external host/station.
- string transp; — Transport which is used to access an external host/station.
- string addr; — Address for the transport, which is used to access an external host/station.
- string user; — The users of the external host/station.
- string pass; — The password of the external host/station user.
- bool link_ok; — The sign "Connection with the external host/station is done".
- int8_t mode; — The host mode.
Public methods:
- int subVer( ); — Subsystem's version.
- void inTrList( vector<string> &ls ); — Full list of incoming transports.
- void outTrList( vector<string> &ls ); — Full list of outgoing transports.
- string extHostsDB( ); — Database for the storing the list of external hosts.
- void extHostList( const string &user, vector<string> &list, bool andSYS = false ); — The list of external hosts, include system andSYS.
- bool extHostPresent( const string &user, const string &id ); — Check for an external host presence id on behalf of the user user ( "*" — for the system hosts).
- AutoHD<TTransportOut> extHost( TTransportS::ExtHost host, const string &pref = "" ); — Creation - request of the outgoing transport to service the external host host with the prefix of the identification of the system node pref.
- ExtHost extHostGet( const string &user, const string &id, bool andSYS = false ); — Getting the information object from the external host id on behalf of the user user, include system andSYS ( "*" — for the system hosts).
- void extHostSet( const ExtHost &host, bool andSYS = false ); — Setting of the external host/station host, include system andSYS.
- void extHostDel( const string &user, const string &id, bool andSYS = false ); — Deleting of the external host/station id on behalf of the user user, include system andSYS ( "*" — for the system hosts).
- int cntrIfCmd( XMLNode &node, const string &senderPref, const string &user = "" ); — Transfer of the control area request of the OpenSCADA node to the remote station.
- void subStart( ); — Start of the subsystem.
- void subStop( ); — Stop of the subsystem.
- TElem &inEl( ); — DB structure of the incoming transports
- TElem &outEl( ); — DB structure of the outgoing transports
- AutoHD<TTypeTransport> at( const string &id ); — Addressing/connection to the type of transport id.
6.2. The modular object of the transports' type (TTypeTransport)
Inherits: | TModule. |
Inherited: | By the root object of the subsystem's "Transports" modules.. |
Public methods:
- void inList( vector<string> &list ); — The list of the incoming transports.
- bool inPresent( const string &name ); — Check for an incoming transport presence.
- void inAdd( const string &name, const string &db = "*.*" ); — Addition of the incoming transport.
- void inDel( const string &name, bool complete = false ); — Deleting of the incoming transport. It is possible to completely delete with the database included, by setting the complete sign.
- AutoHD<TTransportIn> inAt( const string &name ); — Connection to the incoming transport.
- void outList( vector<string> &list ); — The list of the outgoing transports.
- bool outPresent( const string &name ); — Check for an outgoing transport presence.
- void outAdd( const string &name, const string &db = "*.*" ); — Addition of the outgoing transport.
- void outDel( const string &name, bool complete = false ); — Deleting of the outgoing transport. It is possible to completely delete with the database included, by setting the complete sign.
- AutoHD<TTransportOut> outAt( const string &name ) — Connection to the outgoing transport.
- TTransportS &owner( ); — "Transports" subsystem - the owner of the transport's type.
Protected methods:
- virtual TTransportIn *In( const string &name, const string &db ); — The modular method of the creating/opening of the new "incoming" transport.
- virtual TTransportOut *Out( const string &name, const string &db ); — The modular method of the creating/opening of the new "outgoing" transport.
6.3. The object of the incoming transports (TTransportIn)
Inherits: | TCntrNode, TConfig. |
Inherited: | By the objects of incoming transports of the subsystem's "Transports" modules. |
Public methods:
- TTransportIn( const string &id, const string &db, TElem *el ); — Initializing constructor.
- string id( ); — Transport's Id.
- string workId( ); — Full ID including the ID of the module.
- string name( ); — Transport's name.
- string dscr( ); — Transport's description.
- string addr( ); — Address.
- string protocol( ); — Linked transport protocol.
- virtual string getStatus( ); — Getting the status of the incoming transport.
- bool toStart( ); — The sign "To start".
- bool startStat( ); — The status "Running".
- string DB( ); — Transport's DB address.
- string tbl( ); — Transport's DB table.
- string fullDB( ); — The full name of the transport's DB table.
- void setName( const string &inm ); — Setting the name of transport in inm.
- void setDscr( const string &idscr ); — Setting the description of transport in idscr.
- void setAddr( const string &addr ); — Setting the address of transport in addr.
- void setProtocol( const string &prt ); — Setting of the linked transport protocol.
- void setToStart( bool val ); — Setting of the sign "To start".
- void setDB( const string &vl ); — Setting of the transport's DB address.
- virtual void start( ); — Start of the transport.
- virtual void stop( ); — Stop of the transport.
- virtual int writeTo( const string &sender, const string &data ); — Sending data backward to the sender.
- vector<AutoHD<TTransportOut> > assTrs( bool checkForCleanDisabled = false ); — The assigned output transports massive, created by the input transport for typical requests to the connection initiator. Set checkForCleanDisabled for prior checking and clean up disabled ones.
- TTypeTransport &owner( ); — Transport's type – the owner of the incoming transport.
Protected methods:
- string assTrO( const string &addr ); — The assigned output transport creation with address addr.
Protected attributes:
- bool run_st; — The sign «Run».
6.4. The object of the outgoing transports (TTransportOut)
Inherits: | TCntrNode, TConfig. |
Inherited: | By the objects of outgoing transports of the subsystem's "Transports" modules. |
Public methods:
- TTransportOut( const string &id, const string &db, TElem *el ); — Initializing constructor.
- string id( ); — Transport's Id.
- string workId( ); — Full ID including the ID of the module.
- string name( ); — The transport name.
- string dscr( ); — The transport description.
- string addr( ); — The transport address.
- virtual string timings( ); — The transport timeouts.
- int prm1( ); — The first backup parameter.
- int prm2( ); — The second backup parameter.
- bool toStart( ); — The sign "To start".
- bool startStat( ); — The status «Running».
- virtual string getStatus( ); — Getting the status of the transport.
- string DB( ); — Transport's DB address.
- string tbl( ); — Transport's DB table.
- string fullDB( ); — The full name of the transport's DB table.
- void setName( const string &inm ); — Setting the name of transport.
- void setDscr( const string &idscr ); — Setting the description of transport.
- void setAddr( const string &addr ); — Setting the address of transport.
- virtual void setTimings( const string &vl ); — Setting the transport timeouts.
- void setPrm1( int vl ); — Setting of the first backup parameter.
- void setPrm2( int vl ); — Setting of the second backup parameter.
- void setToStart( bool val ); — Setting of the sign "To start".
- void setDB( const string &vl ); — Setting of the transport's DB address.
- virtual void start( int time = 0 ); — Start of the transport with connection time time.
- virtual void stop( ); — Stop of the transport.
- virtual int messIO( const char *obuf, int len_ob, char *ibuf = NULL, int len_ib = 0, int time = 0, bool noRes = false ); — Sending of the data over the transport. The waiting time time of the connection (in milliseconds). noRes is used by the protocols for exclusive blocking of the transport for the time of working with him and to avoid its own blocking by the function. The time in negative disables the transport's request/respond mode and allow independent reading/writing to a buffer IO, with the reading timeout time in absolute.
- void messProtIO( XMLNode &io, const string &prot ); — Sending of the data in the XML tree in over the transport using the transport protocol prot.
- TTypeTransport &owner( ); — Type of transport - the owner of outgoing transport.
Protected attributes:
- bool run_st; — The sign «Running».