{
    "$meta": {
        "description": "A `router` object can be obtained by either using [get_router](#GENERAL_GET_ROUTER) or [get_switch](#GENERAL_GET_SWITCH). The `classID` used for this object is `\"router\"`."
    },
    "device_ports": {
        "description": "Returns a `list` where each item is an open `port` related to the device of the provided LAN IP address. The device needs to be within the network of the `router`. In case of failure, this method will return `null` or a `string` with details. In case an empty ip is provided this method will throw a runtime exception.",
        "example": [
            "router = get_router",
            "devices = router.devices_lan_ip",
            "for ip in devices",
            "   ports = router.device_ports(ip)",
            "   openPorts = []",
            "   for port in ports",
            "      if port.is_closed then continue",
            "      openPorts.push(port)",
            "   end for",
            "",
            "   if (openPorts.len == 0) then",
            "      print(ip + \" has no open ports\")",
            "   else",
            "      print(ip + \" contains following open ports:\")",
            "      for port in openPorts",
            "         print(\"|-\" +  port.port_number)",
            "      end for",
            "   end if",
            "end for"
        ]
    },
    "devices_lan_ip": {
        "description": "Returns a `list` where each item is a `string` representing a LAN IP address. All devices are within the network of the router and can be reached by using the `ping` method. Some of the devices might be behind a firewall.",
        "example": [
            "router = get_router",
            "devices = router.devices_lan_ip",
            "for ip in devices",
            "   print(ip + \" found!\")",
            "end for"
        ]
    },
    "bssid_name": {
        "description": "Returns a `string` with the BSSID value of the router.",
        "example": [
            "router = get_router",
            "bssid = router.bssid_name",
            "print(\"BSSID: \" + bssid)"
        ]
    },
    "essid_name": {
        "description": "Returns a `string` with the ESSID value of the router.",
        "example": [
            "router = get_router",
            "essid = router.essid_name",
            "print(\"ESSID: \" + essid)"
        ]
    },
    "firewall_rules": {
        "description": "Returns a `list` where each item is a `string` containing a firewall rule.",
        "example": [
            "router = get_router",
            "rules = router.firewall_rules",
            "print(\"Firewall rules: \" + rules.join(\", \"))"
        ]
    },
    "kernel_version": {
        "description": "Returns a `string` with the version of the `kernel_router.so` library.",
        "example": [
            "router = get_router",
            "version = router.kernel_version",
            "print(\"Kernel router version: \" + version)"
        ]
    },
    "local_ip": {
        "description": "Returns a `string` with the local IP address of the router.",
        "example": [
            "router = get_router",
            "localIp = router.local_ip",
            "print(\"Local IP: \" + localIp)"
        ]
    },
    "public_ip": {
        "description": "Returns a `string` with the public IP address of the router.",
        "example": [
            "router = get_router",
            "publicIp = router.public_ip",
            "print(\"Public IP: \" + publicIp)"
        ]
    },
    "used_ports": {
        "description": "Returns a `list` where each item is a `port` used inside the router.",
        "example": [
            "router = get_router",
            "ports = router.used_ports",
            "for port in ports",
            "   print(\"Port \" + port.port_number + \" is available!\")",
            "end for"
        ]
    },
    "ping_port": {
        "description": "Returns a `port` that is behind the port `number` provided. In case the `port` does not exist `null` gets returned.",
        "example": [
            "router = get_router",
            "ports = router.used_ports",
            "for port in ports",
            "   pingedPort = router.ping_port(port.port_number)",
            "   if (pingedPort == null) then continue",
            "   print(\"Pinged \" + pingedPort.port_number)",
            "end for"
        ]
    },
    "port_info": {
        "description": "Returns a `string` with information about the provided port, including details about the running service and its version. For example, the output could be `\"http 1.0.0\"`. If the operation fails, `null` will be returned.",
        "example": [
            "router = get_router",
            "ports = router.used_ports",
            "for port in ports",
            "   info = router.port_info(port)",
            "   print(info)",
            "end for"
        ]
    }
}
