1#ifndef NETWORK_CONFIGURATION_H
2#define NETWORK_CONFIGURATION_H
6#include "../../arxml/arxml_reader.h"
7#include "../../ara/com/option/option.h"
13 static const std::array<std::string, 7> cIpAddressShallowChildren(
18 "COMMUNICATION-CLUSTER",
19 "ETHERNET-PHYSICAL-CHANNEL",
20 "NETWORK-ENDPOINTS"});
22 static const std::array<std::string, 4> cIpAddressDeepChildren(
24 "NETWORK-ENDPOINT-ADDRESSES",
25 "IPV-4-CONFIGURATION",
28 static const std::array<std::string, 6> cPortNumberShallowChildren(
33 "ETHERNET-COMMUNICATION-CONNECTOR",
34 "AP-APPLICATION-ENDPOINTS"});
36 static const std::array<std::string, 5> cTcpPortNumberDeepChildren(
37 {
"AP-APPLICATION-ENDPOINT",
43 static const std::array<std::string, 5> cUdpPortNumberDeepChildren(
44 {
"AP-APPLICATION-ENDPOINT",
70 template <
typename T,
size_t M,
size_t N>
73 const std::array<std::string, M> &shallowChildren,
74 const std::array<std::string, N> &deepChildren,
75 std::string shortNameFilter,
79 shallowReader.
GetNodes(shallowChildren)};
81 for (
const auto cShallowNode : cShallowNodes)
83 if (shortNameFilter.empty())
85 deepValue = cShallowNode.GetValue<T>();
89 std::string _shortName{cShallowNode.GetShortName()};
90 if (_shortName == shortNameFilter)
92 std::string _content{cShallowNode.GetContent()};
113 std::string networkEndpoint,
114 std::string applicationEndpoint,
116 NetworkConfiguration &configuration);
126 const std::string &configFilepath,
127 std::string networkEndpoint,
128 std::string applicationEndpoint,
130 NetworkConfiguration &configuration);
Read-only range of ARXML nodes.
Definition: arxml_node_range.h:13
A class that represents a XML node within a ARXML configuration.
Definition: arxml_node.h:11
T GetValue(T defaultValue={}) const
Get the node value.
Definition: arxml_node.h:27
A class to read ARXML configuration files.
Definition: arxml_reader.h:14
ArxmlNodeRange GetNodes(std::initializer_list< std::string > children) const
Get a range of ARXML nodes deep down the ARXML content.
Definition: arxml_reader.cpp:77
ArxmlNode GetRootNode(std::initializer_list< std::string > children) const
Get (relative) ARXML root node.
Definition: arxml_reader.cpp:63
bool TryGetNetworkConfiguration(const arxml::ArxmlReader &reader, std::string networkEndpoint, std::string applicationEndpoint, ara::com::option::Layer4ProtocolType protocol, NetworkConfiguration &configuration)
Try to get a nework configuration based on a ARXML configuration file.
Definition: network_configuration.cpp:7
bool TryExtractDeepValue(const arxml::ArxmlReader &shallowReader, const std::array< std::string, M > &shallowChildren, const std::array< std::string, N > &deepChildren, std::string shortNameFilter, T &deepValue)
Try to extract a deep value from an XML content.
Definition: network_configuration.h:71
AUTOSAR application namespace.
Definition: diag_message_handler.cpp:5
Layer4ProtocolType
OSI layer-4 protocol type.
Definition: option.h:30
Data model for a network configuration.
Definition: network_configuration.h:52
std::string ipAddress
Netowrk IPv4 address.
Definition: network_configuration.h:54
uint16_t portNumber
Network TCP/UDP port number.
Definition: network_configuration.h:57