<?xml version="1.0"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../resource/schema/rti_routing_service.xsd">

    <!--
        Default values of the XML configuration variables. Set to the example
        default values for site A.
    -->
    <configuration_variables>
        <element>
            <name>PUBLIC_ADDRESS</name>
            <value>10.10.1.140</value>
        </element>
        <element>
            <name>BIND_PORT</name>
            <value>7400</value>
        </element>
        <element>
            <name>REMOTE_RS_PEER</name>
            <value>10.10.1.150</value>
        </element>
         <element>
            <name>LAN_DOMAIN_ID</name>
            <value>0</value>
        </element>        
    </configuration_variables>

    <qos_library name="QosLib">
        <qos_profile name="TcpWanProfile">
            <!--
                We define here the common properties to configure the TCP transport,
                which includes mostly the loading of the transport implementation library.
                Specific values for public address and port are set appropriate on each
            RS.
            -->
            <domain_participant_qos>
                <transport_builtin>
                    <mask>MASK_NONE</mask>
                </transport_builtin>
                <property>
                    <value>
                        <element>
                            <name>dds.transport.load_plugins</name>
                            <value>dds.transport.TCPv4.tcp1</value>
                        </element>
                        <element>
                            <name>dds.transport.TCPv4.tcp1.library</name>
                            <value>nddstransporttcp</value>
                        </element>
                        <element>
                            <name>dds.transport.TCPv4.tcp1.create_function</name>
                            <value>NDDS_Transport_TCPv4_create</value>
                        </element>
                        <element>
                            <name>dds.transport.TCPv4.tcp1.parent.classid</name>
                            <value>NDDS_TRANSPORT_CLASSID_TCPV4_WAN</value>
                        </element>
                        <element>
                            <name>dds.transport.TCPv4.tcp1.public_address</name>
                            <value>$(PUBLIC_ADDRESS)</value>
                        </element>
                        <element>
                            <name>dds.transport.TCPv4.tcp1.server_bind_port</name>
                            <value>$(BIND_PORT)</value>
                        </element>
                        <element>
                            <name>dds.transport.TCPv4.tcp1.disable_nagle</name>
                            <value>1</value>
                        </element>
                    </value>
                </property>
                <discovery>
                    <initial_peers>
                        <element>$(REMOTE_RS_PEER)</element>
                    </initial_peers>
                </discovery>
            </domain_participant_qos>
        </qos_profile>
    </qos_library>

    <routing_service name="WanGateway">
        <annotation>
            <documentation>
                <![CDATA[
                Routes bidirectionally the all topics betwen a LAN domain 
                to a WAN domain through the RTI TCP transport ]]>
            </documentation>
        </annotation>

        <domain_route name="DR_UDPLAN_TCPWAN">
            <!--
                With default participant QoS, which uses UDP LAN and Shared memory
                as trasnports. Uses the configuration variable LAN_DOMAIN_ID to
                customize the ID for the LAN domain.
            -->
            <participant name="DomainLAN">
                <domain_id>$(LAN_DOMAIN_ID)</domain_id>
            </participant>

            <participant name="DomainWAN">
                <domain_id>1</domain_id>
                <!--
                    With participant QoS configured to use the TCP transport. Requires
                    setting the variableS PUBLIC_ADDRESS AND BIND_PORT to the actual
                    values used in to route the traffic to this RS.
                -->
                <participant_qos base_name="QosLib::TcpWanProfile"/>
            </participant>

            <session name="Session">
                <auto_topic_route name="FromLANtoWAN">
                    <input participant="DomainLAN">
                        <deny_topic_name_filter>rti/*</deny_topic_name_filter>
                    </input>
                    <output participant="DomainWAN">
                        <deny_topic_name_filter>rti/*</deny_topic_name_filter>
                    </output>
                </auto_topic_route>

                <auto_topic_route name="FromWANtoLAN">
                    <input participant="DomainWAN">
                        <deny_topic_name_filter>rti/*</deny_topic_name_filter>
                    </input>
                    <output participant="DomainLAN">
                        <deny_topic_name_filter>rti/*</deny_topic_name_filter>
                    </output>
                </auto_topic_route>
            </session>

        </domain_route>
        
    </routing_service>
</dds>
