DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
dueca::websock::WebSocketsServerBase Class Referenceabstract

Common base type for websocket servers. More...

#include <WebSocketsServer.hxx>

Inheritance diagram for dueca::websock::WebSocketsServerBase:
Inheritance graph
[legend]
Collaboration diagram for dueca::websock::WebSocketsServerBase:
Collaboration graph
[legend]

Public Member Functions

 WebSocketsServerBase (Entity *e, const char *part, const PrioritySpec &ts, const char *classname, unsigned char marker)
 Constructor.
 
template<typename S >
bool _complete_http (S &server)
 Helper function, templated with the server type.
 
virtual ~WebSocketsServerBase ()
 Destructor.
 
bool setTimeSpec (const TimeSpec &ts)
 Specify a time specification for the simulation activity.
 
bool checkTiming (const vector< int > &i)
 Request check on the timing.
 
bool setCurrentData (const std::vector< std::string > &i)
 Define a URL for reading latest data.
 
bool setFollowData (const std::vector< std::string > &i)
 Define a URL for following all data in a channel entry.
 
bool setChannelInfo (const std::vector< std::string > &i)
 Define a URL for tracking changes in a channel.
 
bool setWriterSetup (const std::vector< std::string > &i)
 Define a URL for writing to a channel.
 
bool setPresetWriterSetup (const std::vector< std::string > &i)
 Define a URL for writing to a channel.
 
bool setWriteReadSetup (const std::vector< std::string > &i)
 Two-way communication set-up.
 
bool setCertFiles (const std::vector< std::string > &i)
 Set SLL certificates; will convert to use SSL.
 
bool addMimeType (const std::vector< std::string > &i)
 Add a mime type.
 
bool isPrepared () final
 indicate that everything is ready.
 
void startModule (const TimeSpec &time) final
 start responsiveness to input data.
 
void stopModule (const TimeSpec &time) final
 stop responsiveness to input data.
 
void doTransfer (const TimeSpec &ts)
 the method that implements the main calculation.
 
unsigned char getMarker () const
 sending marker, binary or string
 
virtual void codeData (std::ostream &s, const DCOReader &r) const =0
 Send data with, in a "tick"/"data" struct.
 
virtual void codeEmpty (std::ostream &s) const =0
 Code empty, no data.
 
virtual void codeEntryInfo (std::ostream &s, const std::string &w_dataname, unsigned w_entryid, const std::string &r_dataname, unsigned r_entryid) const =0
 Write type information to given stream.
 
- Public Member Functions inherited from dueca::Module
virtual ~Module ()
 Destructor.
 
virtual bool complete ()
 Inform the module that all parameters have now been passed.
 
virtual bool isInitialPrepared ()
 To check whether the module is prepared to be prepared.
 
ObjectType getObjectType () const
 The object type within DUECA.
 
virtual void initialStartModule (const TimeSpec &time)
 Initial start opportunity.
 
virtual void finalStopModule (const TimeSpec &time)
 Final stop command.
 
const Entity * getMyEntity ()
 Return a pointer to the entity to which this module belongs.
 
const ModuleStategetState ()
 Return the module state.
 
- Public Member Functions inherited from dueca::NamedObject
const std::string getEntity () const
 Returns the "entity" part of the name.
 
const std::string getClass () const
 Returns the "class" part of the name.
 
const std::string getPart () const
 Returns the sub-entity or "part" part of the name.
 
const NameSetgetNameSet () const
 This returns the complete name set.
 
const GlobalIdgetId () const
 This returns the id.
 

Static Public Member Functions

static const ParameterTablegetMyParameterTable ()
 Return the parameter table.
 

Protected Attributes

unsigned char marker
 Marker token for the websocket send calls.
 
boost::scoped_ptr< WsServerserver
 Server, uncoded.
 
boost::scoped_ptr< WssServersserver
 Server, coded.
 
boost::scoped_ptr< HttpServer > http_server
 Http server, uncoded.
 
boost::scoped_ptr< HttpsServer > https_server
 Http Server, coded.
 
std::string server_crt
 Certificate for ssl use, if certificate and key are configured, the ssl version is used.
 
std::string server_key
 Associated key.
 
std::shared_ptr< boost::asio::io_context > runcontext
 IO context to perform a run.
 
unsigned port
 Port to be used.
 
unsigned http_port
 Port for http server.
 
std::string document_root
 Folder with files for http server.
 
std::map< std::string, std::string > mimemap
 Mime types map.
 
bool aggressive_reconnect
 Flag to indicate aggressive reconnection to preset entries.
 
bool immediate_start
 Immediate start, do not wait on DUECA's commands.
 
bool auto_started
 Start flag for immediate_start.
 
StateGuard thelock
 Access lock for shared data.
 
PrioritySpec read_prio
 Priority for reading.
 
TimeSpec time_spec
 Timing specification.
 
bool extended
 If true, use the extended, non-official JSON specification.
 
singleread_t readsingles
 Mapping connecting URL details to an object that reads a specific channel entry.
 
singleread_t autosingles
 Mapping connecting URL details to an object that reads a specific channel entry.
 
singlereadmap_t singlereadsmapped
 Mapping connection id to SingleEntryRead objects.
 
followread_t followers
 Mapping connecting URL details to an object that reads and follows the data in a specific channel entry.
 
followread_t autofollowers
 Mapping connecting URL details to an object that reads and follows the data in a specific channel entry.
 
monitormap_t monitors
 map from URL to monitors
 
writeables_t writersetup
 map from URL to writer setup
 
presetwrites_t presetwriters
 map with preconfigured writeables; these have the channel token created
 
writers_t writers
 map from connection pointers to the actual writers
 
writereadables_t writereadsetup
 map from URL to write/read combination setup
 
writersreaders_t writersreaders
 map with active write/read combinations
 
- Protected Attributes inherited from dueca::Module
ModuleState state
 Flag to remember whether we are stopped due to some error with hardware device manipulation.
 

Additional Inherited Members

- Protected Member Functions inherited from dueca::Module
 Module (const Entity *e, const char *m_class, const char *part)
 Constructor.
 
virtual void setSafetyStop ()
 Put a brake on this module's activities.
 
- Protected Member Functions inherited from dueca::NamedObject
 NamedObject (const GlobalId &id)
 Reserve for AssociateObject.
 
 NamedObject (const NameSet &ns)
 Normal constructor, protected, because it has no use to create a NamedObject by itself.
 
virtual ~NamedObject ()
 Destructor.
 

Detailed Description

Common base type for websocket servers.

Constructor & Destructor Documentation

◆ WebSocketsServerBase()

dueca::websock::WebSocketsServerBase::WebSocketsServerBase ( Entity * e,
const char * part,
const PrioritySpec & ts,
const char * classname,
unsigned char marker )

Constructor.

Is normally called from scheme/the creation script.

Member Function Documentation

◆ isPrepared()

bool dueca::websock::WebSocketsServerBase::isPrepared ( )
finalvirtual

indicate that everything is ready.

Implements dueca::Module.

◆ startModule()

void dueca::websock::WebSocketsServerBase::startModule ( const TimeSpec & time)
finalvirtual

start responsiveness to input data.

Implements dueca::Module.

◆ stopModule()

void dueca::websock::WebSocketsServerBase::stopModule ( const TimeSpec & time)
finalvirtual

stop responsiveness to input data.

Implements dueca::Module.

◆ codeData()

virtual void dueca::websock::WebSocketsServerBase::codeData ( std::ostream & s,
const DCOReader & r ) const
pure virtual

Send data with, in a "tick"/"data" struct.

Implemented in dueca::websock::WebSocketsServer< Encoder, Decoder >.

◆ codeEmpty()

virtual void dueca::websock::WebSocketsServerBase::codeEmpty ( std::ostream & s) const
pure virtual

Code empty, no data.

Implemented in dueca::websock::WebSocketsServer< Encoder, Decoder >.

◆ codeEntryInfo()

virtual void dueca::websock::WebSocketsServerBase::codeEntryInfo ( std::ostream & s,
const std::string & w_dataname,
unsigned w_entryid,
const std::string & r_dataname,
unsigned r_entryid ) const
pure virtual

Write type information to given stream.

Implemented in dueca::websock::WebSocketsServer< Encoder, Decoder >.

Member Data Documentation

◆ readsingles

singleread_t dueca::websock::WebSocketsServerBase::readsingles
protected

Mapping connecting URL details to an object that reads a specific channel entry.

This is a map, indexed by Name+Entry, mapping URL basename + entry ID to SingleEntryRead objects with a read token. These are configured through the start script.

◆ autosingles

singleread_t dueca::websock::WebSocketsServerBase::autosingles
protected

Mapping connecting URL details to an object that reads a specific channel entry.

Same type as the readsingles, however, created automatically from channel entries detected in one of the monitor locations, and only created when a client asks for access.

◆ singlereadsmapped

singlereadmap_t dueca::websock::WebSocketsServerBase::singlereadsmapped
protected

Mapping connection id to SingleEntryRead objects.

A mapping from connection ID/pointer to the SingleEntryRead objects in use by these connections. These objects are either common with the readsingles or autosingles maps.

◆ followers

followread_t dueca::websock::WebSocketsServerBase::followers
protected

Mapping connecting URL details to an object that reads and follows the data in a specific channel entry.

Maps url name and entry id to a SingleEntryFollow object. The SingleEntryFollow object has a list of connections as clients that will get new data from the followed entry as it comes in.

◆ autofollowers

followread_t dueca::websock::WebSocketsServerBase::autofollowers
protected

Mapping connecting URL details to an object that reads and follows the data in a specific channel entry.

Maps url name and entry id to a SingleEntryFollow object, created on the basis of a monitor. The SingleEntryFollow object has a list of connections as clients that will get new data from the followed entry as it comes in.


The documentation for this class was generated from the following file: