@Override public IpAddress subnetMask() { return IpAddress.of(255, 255, 255, 0); }
@Override IpAddress read(ByteBuffer buffer, int length) { return IpAddress.read(buffer); }
@Override public SocketAddress broadcast(int port) { return broadcast.toInetSocketAddress(port); }
public static IpAddress of(int ip0, int ip1, int ip2, int ip3) { byte[] value = new byte[] { (byte) ip0, (byte) ip1, (byte) ip2, (byte) ip3 }; return new IpAddress(value); }
public DhcpServerBuilderDsl localhost(int port) { this.port = port; ipAddress = IpAddress.localhost(); return new LocalhostDsl(); }
boolean matches(AbstractServer server) { IpAddress serverAddress = server.ipAddress(); return option(Option054ServerId.instance()).equals(serverAddress); }
static DiscoveryMessage of(HardwareAddress hardwareAddress, ParamRequestList requestList) { return new DiscoveryMessage( TransactionId.next(), NetShort.zero(), hardwareAddress, Options.builder() .put(Option053MessageType.instance(), MessageType.DHCPDISCOVER) .put(Option050RequestedIpAddress.instance(), IpAddress.zero()) .put(Option055ParamRequestList.instance(), requestList) .build()); }
public static IpAddress read(ByteBuffer buffer) { byte[] value = new byte[4]; buffer.get(value); return new IpAddress(value); }
IpAddress subnetMask(HardwareAddress chaddr) { return IpAddress.of(255, 255, 255, 0); }
@Override IpAddress read(ByteBuffer buffer, int length) { return IpAddress.read(buffer); }
final void send(Message message, IpAddress target) throws UdpException { send(message, target.toInetSocketAddress(clientPort())); }
public static IpAddress localhost() { try { InetAddress localHost = InetAddress.getLocalHost(); byte[] value = localHost.getAddress(); return new IpAddress(value); } catch (UnknownHostException e) { return ZERO; } }
@Override IpAddress ipAddress(HardwareAddress chaddr) { return IpAddress.of(192, 168, 0, 102); }
@Override IpAddress read(ByteBuffer buffer, int length) { return IpAddress.read(buffer); }
public static IpAddress of(InetAddress address) { return new IpAddress(address.getAddress()); }
public IpAddress broadcastAddress() { return IpAddress.of(192, 168, 0, 255); }
@Override IpAddress read(ByteBuffer buffer, int length) { return IpAddress.read(buffer); }
public static IpAddress fromString(String address) { String[] parts = address.split("\\."); if (parts.length != 4) { throw new IllegalArgumentException(); } byte[] value = new byte[4]; for (int i = 0; i < parts.length; i++) { value[i] = (byte) Integer.parseInt(parts[i]); } return new IpAddress(value); }
public static Array read(ByteBuffer buffer, int length) { int size = length / 4; IpAddress[] value = new IpAddress[size]; for (int i = 0; i < size; i++) { value[i] = IpAddress.read(buffer); } return new Array(value); }