Module ip

Typedefs

typedef ip::cidr
  • Base type string

  • Type constraint (ip::is_valid_cidr(self) == true)

typedef ip::cidr_v10
  • Base type string

  • Type constraint (ip::is_valid_cidr_v10(self) == true)

typedef ip::cidr_v6
  • Base type string

  • Type constraint (ip::is_valid_cidr_v6(self) == true)

typedef ip::ip
  • Base type string

  • Type constraint (ip::is_valid_ip(self) == true)

typedef ip::ip_v10
  • Base type string

  • Type constraint (ip::is_valid_ip_v10(self) == true)

typedef ip::ip_v6
  • Base type string

  • Type constraint (ip::is_valid_ip_v6(self) == true)

typedef ip::mask
  • Base type string

  • Type constraint ip::is_valid_netmask(self)

typedef ip::port
  • Base type int

  • Type constraint ((self >= 0) and (self < 65536))

typedef ip::protocol
  • Base type string

  • Type constraint (((((self == 'tcp') or (self == 'udp')) or (self == 'icmp')) or (self == 'sctp')) or (self == 'all'))

Entities

entity ip::Address

Parents: ip::Alias

The following implements statements select implementations for this entity:

entity ip::Alias

Parents: ip::IP

attribute ip::ip netmask='0.0.0.0'
attribute number alias=0
attribute bool dhcp=false
relation ip::services::Server server [0:*]

other end: ip::services::Server.ips [0:*]

The following implements statements select implementations for this entity:

entity ip::DstService

Parents: ip::Service

The following implements statements select implementations for this entity:

entity ip::Host

Parents: std::Host

Like std::Host, kept for backwards compatibility.

relation ip::services::Server servers [0:*]

other end: ip::services::Server.host [1]

relation ip::services::Client clients [0:*]

other end: ip::services::Client.host [1]

The following implements statements select implementations for this entity:

entity ip::IP

Parents: std::Entity

Base class for all ip addresses

attribute ip::ip v4='0.0.0.0'

The following implements statements select implementations for this entity:

entity ip::Network

Parents: std::Entity

A network in this infrastructure.

attribute string network
attribute string netmask
attribute string name
attribute bool dhcp

The following implements statements select implementations for this entity:

entity ip::Port

Parents: ip::PortRange

attribute ip::port high=0

The following implements statements select implementations for this entity:

entity ip::PortRange

Parents: std::Entity

attribute ip::port low
attribute ip::port high

The following implements statements select implementations for this entity:

entity ip::Service

Parents: std::Entity

Define a service as a protocol and a source and destination port range

attribute ip::protocol proto
relation ip::PortRange dst_range [0:*]
relation ip::PortRange src_range [0:*]
relation ip::services::BaseServer listening_servers [0:*]

other end: ip::services::BaseServer.services [0:*]

The following implements statements select implementations for this entity:

entity ip::services::BaseClient

Parents: std::Entity

Base client class that connects to a server

relation ip::services::BaseServer servers [0:*]

other end: ip::services::BaseServer.clients [0:*]

entity ip::services::BaseServer

Parents: std::Entity

Base class for servers that accept connections from clients

relation ip::Service services [0:*]

other end: ip::Service.listening_servers [0:*]

relation ip::services::BaseClient clients [0:*]

other end: ip::services::BaseClient.servers [0:*]

entity ip::services::Client

Parents: ip::services::BaseClient

This interface models a client that is linked to a host

relation ip::Host host [1]

other end: ip::Host.clients [0:*]

The following implements statements select implementations for this entity:

entity ip::services::Server

Parents: ip::services::BaseServer

This interface models a server that accepts connections from a client

relation ip::Host host [1]

other end: ip::Host.servers [0:*]

relation ip::Alias ips [0:*]

other end: ip::Alias.server [0:*]

The following implements statements select implementations for this entity:

entity ip::services::VirtualClient

Parents: ip::services::BaseClient, ip::services::VirtualSide

This interface models a virtual client. It can for example represent all clients that exist on the internet.

attribute string name

The following implements statements select implementations for this entity:

entity ip::services::VirtualHost

Parents: ip::services::VirtualScope

An address represented by a hostname

attribute std::hoststring hostname

The following implements statements select implementations for this entity:

entity ip::services::VirtualIp

Parents: ip::services::VirtualScope

Only one ip

attribute ip::ip address
entity ip::services::VirtualNetwork

Parents: ip::services::VirtualScope

Define a virtual network segment

attribute ip::ip network
attribute ip::ip netmask
entity ip::services::VirtualRange

Parents: ip::services::VirtualScope

A range defined by from/to

attribute ip::ip from
attribute ip::ip to

The following implements statements select implementations for this entity:

entity ip::services::VirtualScope

Parents: std::Entity

This interface represents a scope to determine what a virtual client or server is.

relation ip::services::VirtualSide side [0:*]

other end: ip::services::VirtualSide.scope [0:*]

entity ip::services::VirtualServer

Parents: ip::services::BaseServer, ip::services::VirtualSide

Same as VirtualClient but then for a server

attribute string name
entity ip::services::VirtualSide

Parents: std::Entity

A base class for a virtual server or client

relation ip::services::VirtualScope scope [0:*]

other end: ip::services::VirtualScope.side [0:*]

Plugins

ip.add(addr: 'ip::ip_v10', n: 'number') 'ip::ip_v10'

Add a number to the given ip.

ip.cidr_to_network(cidr: 'string') 'string'

Given cidr return the network address

ip.concat(host: 'std::hoststring', domain: 'std::hoststring') 'std::hoststring'

Concat host and domain

ip.hostname(fqdn: 'string') 'string'

Return the hostname part of the fqdn

ip.ipindex(addr: 'ip::cidr_v10', position: 'number') 'string'

Return the address at position in the network.

ip.ipnet(addr: 'ip::cidr_v10', what: 'string') 'string'

Return the ip, prefixlen, netmask or network address of the CIDR

Parameters:
  • addr – CIDR

  • what

    The required result:

    • ip: The IP address of addr object.

    • prefixlen: The prefix length of addr object.

    • netmask: The subnet mask of addr object.

    • network: The network address of addr object.

For instance:

std::print(ipnet(“192.168.1.100/24”, “ip”)) –> 192.168.1.100
std::print(ipnet(“192.168.1.100/24”, “prefixlen”)) –> 24
std::print(ipnet(“192.168.1.100/24”, “netmask”)) –> 255.255.255.0
std::print(ipnet(“192.168.1.100/24”, “network”)) –> 192.168.1.0
ip.is_valid_cidr(addr: 'string') 'bool'
ip.is_valid_cidr_v10(addr: 'string') 'bool'

Validate if the string matches a v6 or a v4 network in CIDR notation

ip.is_valid_cidr_v6(addr: 'string') 'bool'
ip.is_valid_ip(addr: 'string') 'bool'
ip.is_valid_ip_v10(addr: 'string') 'bool'

Validate if the string matches a v6 or v4 address

ip.is_valid_ip_v6(addr: 'string') 'bool'
ip.is_valid_netmask(netmask: 'string') 'bool'

Validate if the string matches a netmask

ip.net_to_nm(network_addr: 'string') 'string'
ip.netmask(cidr: 'number') 'ip::ip'

Given the cidr, return the netmask

ip.network(ip: 'ip::ip', cidr: 'string') 'string'

Given the ip and the cidr, return the network address