 |
helics
3.3.0
|
9 #include "CommsInterface.hpp"
10 #include "helics/helics-config.h"
24 int findOpenPort(
int count, std::string_view host =
"localhost");
25 void setStartingPortNumber(
int startPort) { startingPort = startPort; }
26 int getDefaultStartingPort()
const {
return startingPort; }
27 void addUsedPort(
int port);
28 void addUsedPort(std::string_view host,
int port);
31 int startingPort = -1;
32 std::map<std::string_view, std::set<int>> usedPort;
33 std::map<std::string_view, int> nextPorts;
34 bool isPortUsed(std::string_view host,
int port)
const;
35 std::set<std::string> hosts;
36 std::string_view addNewHost(std::string_view newHost);
56 virtual void setFlag(std::string_view flag,
bool val)
override;
69 const gmlc::networking::InterfaceTypes networkType;
70 gmlc::networking::InterfaceNetworks network{gmlc::networking::InterfaceNetworks::IPV4};
71 std::atomic<bool> hasBroker{
false};
75 PortAllocator openPorts;
std::string brokerTargetAddress
the base for the broker address
Definition: CommsInterface.hpp:125
bool propertyLock()
Definition: CommsInterface.cpp:153
virtual void setFlag(std::string_view flag, bool val) override
Definition: NetworkCommsInterface.cpp:209
int connectionPort
the port number for connecting
Definition: NetworkBrokerData.hpp:40
std::string name
the name of the object
Definition: CommsInterface.hpp:123
bool use_os_port
specify that any automatic port allocation should use operating system allocation
Definition: NetworkBrokerData.hpp:50
thread_generation
Definition: CommsInterface.hpp:29
void setPortNumber(int localPortNumber)
Definition: NetworkCommsInterface.cpp:190
std::atomic< int > PortNumber
port to use for the local connection
Definition: NetworkCommsInterface.hpp:60
bool appendNameToAddress
flag indicating that the name should be appended to the address
Definition: NetworkBrokerData.hpp:53
bool forceConnection
Definition: NetworkCommsInterface.hpp:68
std::string brokerInitString
the initialization string for any automatically generated broker
Definition: CommsInterface.hpp:128
int getPortNumber() const
Definition: NetworkCommsInterface.hpp:52
Definition: NetworkBrokerData.hpp:23
Definition: GlobalFederateId.hpp:72
std::string getAddress() const
Definition: NetworkCommsInterface.cpp:260
Definition: ActionMessage.hpp:30
ActionMessage generateReplyToIncomingMessage(ActionMessage &cmd)
Definition: NetworkCommsInterface.cpp:226
uint16_t counter
26 counter for filter tracking or message counter
Definition: ActionMessage.hpp:41
int brokerPort
the port number to use for the main broker interface
Definition: NetworkBrokerData.hpp:39
bool useOsPortAllocation
use the operating system to allocate a port number
Definition: NetworkCommsInterface.hpp:62
void setBrokerPort(int brokerPortNumber)
Definition: NetworkCommsInterface.cpp:170
@ dual
indicate that separate threads are used, 1 for transmission and 1 for reception
void setAutomaticPortStartPort(int startingPort)
Definition: NetworkCommsInterface.cpp:201
bool autoPortNumber
use an automatic port numbering based on broker responses
Definition: NetworkCommsInterface.hpp:61
int32_t messageID
8 – message ID for a variety of purposes
Definition: ActionMessage.hpp:36
void setExtraData(int32_t data)
Definition: ActionMessage.hpp:157
bool useJsonSerialization
true to make all connections use JSON serialization
Definition: CommsInterface.hpp:143
virtual int getDefaultBrokerPort() const =0
int findOpenPort(int count, std::string_view host)
Definition: NetworkCommsInterface.cpp:178
int brokerPort
standardized broker port to use for connection to the brokers
Definition: NetworkCommsInterface.hpp:59
bool noAckConnection
Definition: NetworkBrokerData.hpp:54
std::string localTargetAddress
the base for the receive address
Definition: CommsInterface.hpp:124
std::string brokerName
Definition: CommsInterface.hpp:126
NetworkCommsInterface(gmlc::networking::InterfaceTypes type, CommsInterface::thread_generation threads=CommsInterface::thread_generation::dual) noexcept
Definition: NetworkCommsInterface.cpp:22
Definition: CommsInterface.hpp:25
int portStart
the starting port for automatic port definitions
Definition: NetworkBrokerData.hpp:42
virtual void loadNetworkInfo(const NetworkBrokerData &netInfo) override
Definition: NetworkCommsInterface.cpp:97
bool noAckConnection
flag to bypass the connection acknowledge requirement
Definition: NetworkCommsInterface.hpp:64
bool isProtocolCommand(const ActionMessage &command) noexcept
Definition: ActionMessage.hpp:226
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
virtual void loadNetworkInfo(const NetworkBrokerData &netInfo)
Definition: CommsInterface.cpp:104
bool serverMode
some comms have a server mode and non-server mode
Definition: CommsInterface.hpp:141
bool encrypted
Definition: NetworkCommsInterface.hpp:65
int getPort() const
Definition: NetworkCommsInterface.hpp:85
bool mRequireBrokerConnection
specify that the comms should assume we have a broker
Definition: CommsInterface.hpp:139
Definition: NetworkCommsInterface.hpp:18
int portNumber
the port number for the local interface
Definition: NetworkBrokerData.hpp:38
bool appendNameToAddress
flag to append the name to the network address
Definition: NetworkCommsInterface.hpp:63
bool useJsonSerialization
for message serialization use JSON
Definition: NetworkBrokerData.hpp:56
int maxRetries
the maximum number of retries to establish a network connection
Definition: NetworkBrokerData.hpp:45
virtual void setFlag(std::string_view flag, bool val)
Definition: CommsInterface.cpp:531
GlobalFederateId source_id
12 – for federate_id or route_id
Definition: ActionMessage.hpp:37