Package org.openhab.core.net
Interface NetworkAddressService
- All Known Implementing Classes:
NetUtil
@NonNullByDefault
public interface NetworkAddressService
Interface that provides access to configured network addresses
- Author:
- Stefan Triller - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds aNetworkAddressChangeListenerthat is notified about changes.@Nullable StringReturns the user configured broadcast address, or the broadcast address of the user configured primary IPv4 if not provided@Nullable StringReturns the user configured primary IPv4 address of the systembooleanUse IPv6.booleanUse only one address per interface and family (IPv4 and IPv6).voidRemoves aNetworkAddressChangeListenerso that it is no longer notified about changes.
-
Method Details
-
getPrimaryIpv4HostAddress
@Nullable String getPrimaryIpv4HostAddress()Returns the user configured primary IPv4 address of the system- Returns:
- IPv4 address as a String in format xxx.xxx.xxx.xxx or
nullif there is no interface or an error occurred
-
getConfiguredBroadcastAddress
@Nullable String getConfiguredBroadcastAddress()Returns the user configured broadcast address, or the broadcast address of the user configured primary IPv4 if not provided- Returns:
- IPv4 broadcast address as a String in format xxx.xxx.xxx or
nullif no broadcast address is found or an error occurred
-
isUseOnlyOneAddress
boolean isUseOnlyOneAddress()Use only one address per interface and family (IPv4 and IPv6). If set listeners should bind only to one address per interface and family.- Returns:
- use only one address per interface and family
-
isUseIPv6
boolean isUseIPv6()Use IPv6. If not set, IPv6 addresses should be completely ignored by listeners.- Returns:
- use IPv6
-
addNetworkAddressChangeListener
Adds aNetworkAddressChangeListenerthat is notified about changes.- Parameters:
listener- The listener
-
removeNetworkAddressChangeListener
Removes aNetworkAddressChangeListenerso that it is no longer notified about changes.- Parameters:
listener- The listener
-