# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
# SPDX-License-Identifier: Apache-2.0

nodes = {
    udp_node = {
        type = "socket",

        # Receive and sent 30 samples per message (combining)
        vectorize = 30,

        # The maximum number of samples this node can receive
        samplelen = 10

        # By default, all nodes will have a few builtin hooks attached to them
        # When collecting statistics or measurements these are undesired
        builtin = false,

        # Layer can be one of:
        #   - udp   Send / receive L4 UDP packets
        #   - ip    Send / receive L3 IP packets
        #   - eth   Send / receive L2 Ethernet frames (IEEE802.3)
        layer = "udp",


        format = "gtnet",

        in = {
            # This node only received messages on this IP:Port pair
            address = "127.0.0.1:12001"

            # Check if source address of incoming packets matches the remote address
            verify_source = true
        },
        out = {
            # This node sends outgoing messages to this IP:Port pair
            address = "127.0.0.1:12000",
        }
    }

    # Raw Ethernet frames
    ethernet_node = {
        type = "socket",

        layer = "eth",
        in = {
            address = "12:34:56:78:90:AB%lo:12002"
        },
        out = {
            address = "12:34:56:78:90:AB%lo:12002"
        }
    },

    # Datagram UNIX domain sockets require two endpoints
    unix_domain_node = {
        type = "socket",
        layer = "unix",

        in = {
            address = "/var/run/villas-node/node.sock"
        },
        out = {
            address = "/var/run/villas-node/client.sock"
        }
    }

    udp_multicast_node = {
        type = "socket",

        in = {
            # This node only received messages on this IP:Port pair
            address = "127.0.0.1:12001"

            # IGMP multicast is only support for layer = (ip|udp)
            multicast = {
                enabled = true,

                # The multicast group. Must be within 224.0.0.0/4
                group = "224.1.2.3",

                # The IP address of the interface which should receive multicast packets
                interface = "1.2.3.4",

                # The time to live for outgoing multicast packets
                ttl = 128,

                # Whether or not to loopback outgoing multicast packets to the local host
                loop = false,
            }
        },
        out = {
            # This node sends outgoing messages to this IP:Port pair
            address = "127.0.0.1:12000",
        }
    }
}