1 #ifndef ARTDAQ_DAQDATA_PORTMANAGER_HH
2 #define ARTDAQ_DAQDATA_PORTMANAGER_HH
5 #include <fhiclcpp/fwd.h>
6 #include "fhiclcpp/types/Atom.h"
7 #include "fhiclcpp/types/ConfigurationTable.h"
8 #include <netinet/in.h>
10 #define DEFAULT_BASE 10000
11 #define DEFAULT_PORTS_PER_PARTITION 1000
12 #define DEFAULT_ROUTING_TOKEN_OFFSET 10
13 #define DEFAULT_ROUTING_TABLE_ACK_OFFSET 30
14 #define DEFAULT_XMLRPC_OFFSET 100
15 #define DEFAULT_TCPSOCKET_OFFSET 500
16 #define DEFAULT_REQUEST_PORT 3001
17 #define DEFAULT_ROUTING_TABLE_PORT 3001
18 #define DEFAULT_MULTICAST_GROUP_OFFSET 128
29 fhicl::Atom<int>
artdaq_base_port{ fhicl::Name{
"artdaq_base_port" }, fhicl::Comment{
"Base port for all artdaq partitions. Should be the same across all running systems. Overridden by environment variable ARTDAQ_BASE_PORT." }, DEFAULT_BASE };
31 fhicl::Atom<int>
ports_per_partition{ fhicl::Name{
"ports_per_partition" }, fhicl::Comment{
"Number of ports to reserve for each partition. Should be the same across all running systems. Overridden by environment variable ARTDAQ_PORTS_PER_PARTITION." },DEFAULT_PORTS_PER_PARTITION };
33 fhicl::Atom<std::string>
multicast_output_interface{ fhicl::Name{
"multicast_output_interface" }, fhicl::Comment{
"Name of the interface to be used for all multicasts. Has precedence over \"multicast_output_network\". OPTIONAL"},
"" };
35 fhicl::Atom<std::string>
multicast_output_network{ fhicl::Name{
"multicast_output_network" }, fhicl::Comment{
"Address in network to be used for all multicasts. OPTIONAL"},
"0.0.0.0" };
37 fhicl::Atom<int>
multicast_group_offset{ fhicl::Name{
"multicast_group_offset" }, fhicl::Comment{
"Number to add to last byte of multicast groups, to avoid problematic 0s."},DEFAULT_MULTICAST_GROUP_OFFSET };
39 fhicl::Atom<int>
routing_token_port_offset{ fhicl::Name{
"routing_token_port_offset" }, fhicl::Comment{
"Offset from partition base port for routing token ports"},DEFAULT_ROUTING_TOKEN_OFFSET };
41 fhicl::Atom<int>
routing_table_ack_port_offset{ fhicl::Name{
"routing_table_ack_port_offset" }, fhicl::Comment{
"Offset from partition base port for routing table ack ports"},DEFAULT_ROUTING_TABLE_ACK_OFFSET };
43 fhicl::Atom<int>
xmlrpc_port_offset{ fhicl::Name{
"xmlrpc_port_offset" }, fhicl::Comment{
"Offset from partition base port for XMLRPC ports"},DEFAULT_XMLRPC_OFFSET };
45 fhicl::Atom<int>
tcp_socket_port_offset{ fhicl::Name{
"tcp_socket_port_offset" }, fhicl::Comment{
"Offset from partition base port for TCP Socket ports"},DEFAULT_TCPSOCKET_OFFSET };
47 fhicl::Atom<int>
request_port{ fhicl::Name{
"request_port" }, fhicl::Comment{
"Port to use for request messages (multicast)"},DEFAULT_REQUEST_PORT };
49 fhicl::Atom<std::string>
request_pattern{ fhicl::Name{
"request_pattern" }, fhicl::Comment{
"Pattern to use to generate request multicast group. PPP => Partition number, SSS => Subsystem ID (default 0)"},
"227.128.PPP.SSS" };
51 fhicl::Atom<int>
routing_table_port{ fhicl::Name{
"routing_table_port" }, fhicl::Comment{
"Port to use for routing tables (multicast)"},DEFAULT_ROUTING_TABLE_PORT };
53 fhicl::Atom<std::string>
routing_table_pattern{ fhicl::Name{
"routing_table_pattern" }, fhicl::Comment{
"Pattern to use to generate routing table multicast group. PPP => Partition number, SSS => Subsystem ID (default 0)."},
"227.129.PPP.SSS" };
55 fhicl::Atom<int>
multicast_transfer_port_offset{ fhicl::Name{
"multicast_transfer_port_offset" }, fhicl::Comment{
"Offset to use for MulticastTransfer ports (port = offset + rank)"},1024 };
57 fhicl::Atom<std::string>
multicast_transfer_pattern{ fhicl::Name{
"multicast_transfer_pattern" }, fhicl::Comment{
"Pattern to use to generate Multicast Transfer group address. PPP => Partition Number, SSS => Subsystem ID (default 0), RRR => Rank"},
"227.130.14.PPP" };
60 using Parameters = fhicl::WrappedTable<Config>;
63 void UpdateConfiguration(fhicl::ParameterSet
const& ps);
65 int GetRoutingTokenPort(
int subsystemID = 0);
66 int GetRoutingAckPort(
int subsystemID = 0);
67 int GetXMLRPCPort(
int rank);
68 int GetTCPSocketTransferPort(
int rank);
69 int GetRequestMessagePort();
70 std::string GetRequestMessageGroupAddress(
int subsystemID = 0);
71 int GetRoutingTablePort();
72 std::string GetRoutingTableGroupAddress(
int subsystemID = 0);
73 int GetMulticastTransferPort(
int rank);
74 std::string GetMulticastTransferGroupAddress();
76 in_addr GetMulticastOutputAddress(std::string interface_name =
"", std::string interface_address =
"");
80 bool base_configured_;
81 bool multicasts_configured_;
83 bool routing_tokens_configured_;
84 bool routing_acks_configured_;
85 bool xmlrpc_configured_;
86 bool tcpsocket_configured_;
87 bool request_port_configured_;
88 bool request_pattern_configured_;
89 bool routing_table_port_configured_;
90 bool routing_table_pattern_configured_;
91 bool multicast_transfer_port_configued_;
92 bool multicast_transfer_pattern_configured_;
95 int ports_per_partition_;
97 in_addr multicast_interface_address_;
98 int multicast_group_offset_;
100 int routing_token_offset_;
101 int routing_ack_offset_;
103 int tcp_socket_offset_;
104 int request_message_port_;
105 int routing_table_port_;
106 int multicast_transfer_offset_;
107 std::string request_message_group_pattern_;
108 std::string routing_table_group_pattern_;
109 std::string multicast_transfer_group_pattern_;
112 std::string parse_pattern_(std::string pattern,
int subsystemID = 0,
int rank = 0);
116 #endif //ARTDAQ_DAQDATA_PORTMANAGER_HH
fhicl::Atom< std::string > routing_table_pattern
"routing_table_pattern" (Default: "227.129.PPP.SSS"): Pattern to use to generate routing table multic...
fhicl::Atom< int > multicast_group_offset
"multicast_group_offset" (Default: 128): Number to add to last byte of multicast groups, to avoid problematic 0s.
fhicl::Atom< std::string > multicast_output_network
"multicast_output_network" (Default: "0.0.0.0"): Address in network to be used for all multicasts...
fhicl::Atom< std::string > multicast_output_interface
"multicast_output_interface" (Default: ""): Name of the interface to be used for all multicasts...
fhicl::Atom< std::string > request_pattern
"request_pattern" (Default: "227.128.PPP.SSS"): Pattern to use to generate request multicast group...
fhicl::Atom< int > routing_table_ack_port_offset
"routing_table_ack_port_offset" (Default: 30): Offset from partition base port for routing table ack ...
fhicl::Atom< int > request_port
"request_port" (Default: 3001): Port to use for request messages (multicast)
fhicl::Atom< int > multicast_transfer_port_offset
"multicast_transfer_port_offset" (Default: 1024): Offset to use for MulticastTransfer ports (port = o...
fhicl::Atom< int > routing_table_port
"routing_table_port" (Default: 3001): Port to use for routing tables (multicast)
Configuration of PortManager. May be used for parameter validation
fhicl::Atom< int > ports_per_partition
"ports_per_partition" (Default: 1000): Number of ports to reserve for each partition. Should be the same across all running systems. Overridden by environment variable ARTDAQ_PORTS_PER_PARTITION.
fhicl::Atom< std::string > multicast_transfer_pattern
"multicast_transfer_pattern" (Default: "227.130.14.PPP"): Pattern to use to generate Multicast Transf...
fhicl::Atom< int > artdaq_base_port
"artdaq_base_port" (Default: 10000): Base port for all artdaq partitions. Should be the same across a...
fhicl::Atom< int > xmlrpc_port_offset
"xmlrpc_port_offset" (Default: 100): Offset from partition base port for XMLRPC ports ...
fhicl::Atom< int > tcp_socket_port_offset
"tcp_socket_port_offset" (Default: 500): Offset from partition base port for TCP Socket ports ...
fhicl::Atom< int > routing_token_port_offset
"routing_token_port_offset" (Default: 10): Offset from partition base port for routing token ports ...