C++ Native Functions: com.ibm.streamsx.network.ipv4

This page documents native functions that can be invoked from SPL, including the SPL interfaces that can be used to invoke each of the native functions.

Functions

public int32 compare(rstring ip1, rstring ip2)

Returns -1 if ip1 is less than ip2. Returns 0 if ip1 is equal to ip2. Returns 1 if ip1 is greater than ip2. Both ip1 and ip2 must be valid IPv4 addresses, otherwise returns a value of -2.

public uint32 convertHostnameToIPV4AddressNumeric(rstring hostname)

This function converts a hostname into a binary IPv4 address. If no address can be found for the hostname, zero is returned.

public rstring convertHostnameToIPV4AddressString(rstring hostname)

This function converts a hostname into a string representation of an IPv4 address. If no address can be found for the hostname, an empty string is returned.

public rstring convertIPV4AddressNumericToHostname(uint32 ip4AddressNumeric)

This function converts a four-byte binary representation of an IPv4 address into a hostname. If no hostname can be found for the address, an empty string is returned.

public rstring convertIPV4AddressNumericToString(uint32 ip4AddressNumeric)

This function converts a four-byte binary representation of an IPv4 address into a string representation.

public uint32 convertIPV4AddressNumericToSubnet(uint32 ipAddress, int32 maskbits)

This function converts a four-byte binary representation of an IPv4 address into a four-byte binary subnet address, using the specified number of mask bits.

public rstring convertIPV4AddressStringToHostname(rstring ipAddress)

This function converts a string containing an IPv4 address into a domain name, if the address has one. If not, the IP address is returned.

public uint32 convertIPV4AddressStringToNumeric(rstring ip4AddressString)

This function converts a string representation of an IPv4 address to a four-byte binary representation. If the string does not represent a valid IPv4 address, zero is returned.

public rstring convertIPV4AddressStringToSubnet(rstring ipAddress, int32 maskbits)

This function converts a string representing an IPv4 address into a string representation of the subnet address, using the specified number of mask bits. If the string does not represent a valid IPv4 address, or the count is negative, zero is returned.

public uint32 getAddressRangeInNetworkInt(rstring networkCIDR, uint32 addressStart, uint32 addressEnd)

Returns the range of IP addresses in the network as a start and end values. The networkCIDR argument must be in CIDR format (i.e. 0.0.0.0/24), otherwise an empty range will be reported.

public list<rstring> getAllAddressesInNetwork(rstring networkCIDR)

Returns a list of all IP addresses in the network as rstring values. The networkCIDR argument must be in CIDR format (i.e. 0.0.0.0/24), otherwise an empty list will be returned.

public list<uint32> getAllAddressesInNetworkInt(rstring networkCIDR)

Returns a list of all IP addresses in the network as uint32 values. The networkCIDR argument must be in CIDR format (i.e. 0.0.0.0/24), otherwise an empty list will be returned.

public boolean isEqualTo(rstring ip1, rstring ip2)

Returns true if ip1 and ip2 are valid IPv4 addresses and ip1 address is equal to ip2 address. Otherwise returns false.

public boolean isGlobal(rstring ip)

Returns true if a valid IPv4 address was provided and the IP address is not a reserved address. Also returns true if the IP address is a "6to4 Relay Anycast" address, since these can be globally routed (RFC6890). In all other cases, will return false.

public boolean isGreaterThan(rstring ip1, rstring ip2)

Returns true if ip1 and ip2 are valid IPv4 addresses and ip1 address is greater than ip2 address. Otherwise returns false.

public boolean isIPV4Address(rstring value)

Returns true if the value parameter contains a valid IPv4 address in dotted-decimal notation (i.e 0.0.0.0), otherwise returns false.

public boolean isIPV4CIDRNotation(rstring networkCIDR)

Returns true if a the networkCIDR argument contains a valid network address in CIDR format (i.e. 0.0.0.0/24). Otherwise returns false.

public boolean isInIPRange(rstring startIP, rstring endIP, rstring ip)

Returns true if startIP, endIP and ip are valid IPv4 addresses and ip falls within the range from startIP (inclusive) to endIP (exclusive). Otherwise returns false.

public boolean isInNetwork(rstring networkCIDR, rstring ip)

Return true if ip address is in the network provided by the networkCIDR argument. The networkCIDR argument must be a valid network in CIDR format and the ip argument must be a valid IPv4 address. Otherwise returns false.

public boolean isInNetwork(rstring networkCIDR, uint32 ip)

Return true if ip address is in the network provided by the networkCIDR argument. The networkCIDR argument must be a valid network in CIDR format and the ip argument must be a valid IPv4 address. Otherwise returns false.

public boolean isInNetworkList(list<rstring> networkList, rstring ip)

Return true if ip address is in at least one of the networks provided by the networkList argument. Each of the networks in the list must be a valid network in CIDR format format and the ip argument must be a valid IPv4 address. Otherwise returns false.

public boolean isLessThan(rstring ip1, rstring ip2)

Returns true if ip1 and ip2 are valid IPv4 addresses and ip1 address is less than ip2 address. Otherwise returns false.

public boolean isLinkLocal(rstring ip)

Returns true if a valid IPv4 address was provided and the IP address is a link local address (RFC3927). Otherwise returns false.

public boolean isLoopback(rstring ip)

Returns true if a valid IPv4 address was provided and the IP address is a loopback address (RFC6890). Otherwise returns false.

public boolean isMulticast(rstring ip)

Returns true if a valid IPv4 address was provided and the IP address is a multicast address (RFC5771). Otherwise returns false.

public boolean isNetworkOverlap(rstring networkCIDR1, rstring networkCIDR2)

Returns true if networkCIDR1 and networkCIDR2 are valid networks in CIDR format and the networks overlap. The networks are considered to be overlapping if at least one IP address is common between the two networks. Otherwise returns false.

public boolean isPrivate(rstring ip)

Returns true if a valid IPv4 address was provided and the IP address is a private address (RFC1918). Otherwise returns false.

public boolean isReserved(rstring ip)

Returns true if a valid IPv4 address was provided and the IP address is a reserved address (RFC1918). An IP address is considered to be reserved if it falls within within one of the special-use address ranges as defined by RFC6890. Otherwise returns false.

public uint32 numAddressesInIPRange(rstring startIP, rstring endIP)

Returns the number of IP addresses between ipStart (inclusive) and ipEnd (exclusive). Both ipStart and ipEnd must be valid IPv4 addresses, otherwise a value of 0 is returned.

public uint32 numAddressesInNetwork(rstring networkCIDR)

Returns the number of IP addresses contained within the network range. The networkCIDR argument must be a valid network in CIDR format, otherwise a value of 0 is returned.