Examples of HardwareAddress


Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

     */
    public void encode( ByteBuffer byteBuffer, DhcpMessage message )
    {
        byteBuffer.put( message.getOp() );

        HardwareAddress hardwareAddress = message.getHardwareAddress();

        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getType() : 0 ) );
        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getLength() : 0 ) );
        byteBuffer.put( ( byte ) message.getHopCount() );
        byteBuffer.putInt( message.getTransactionId() );
        byteBuffer.putShort( ( short ) message.getSeconds() );
        byteBuffer.putShort( message.getFlags() );

        writeAddress( byteBuffer, message.getCurrentClientAddress() );
        writeAddress( byteBuffer, message.getAssignedClientAddress() );
        writeAddress( byteBuffer, message.getNextServerAddress() );
        writeAddress( byteBuffer, message.getRelayAgentAddress() );

        writeBytes( byteBuffer, ( null != hardwareAddress ? hardwareAddress.getAddress() : new byte[]
            {} ), 16 );

        writeString( byteBuffer, message.getServerHostname(), 64 );
        writeString( byteBuffer, message.getBootFileName(), 128 );

View Full Code Here

Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

        OptionsField options = decodeOptions( buffer );

        // message type option: may be null if option isn't set (BOOTP)
        DhcpMessageType mto = ( DhcpMessageType ) options.get( DhcpMessageType.class );

        return new DhcpMessage( null != mto ? mto.getType() : null, op, new HardwareAddress( htype, hlen, chaddr ),
            hops, xid, secs, flags, ciaddr, yiaddr, siaddr, giaddr, sname, file, options );
    }
View Full Code Here

Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

     */
    public void encode( ByteBuffer byteBuffer, DhcpMessage message )
    {
        byteBuffer.put( message.getOp() );

        HardwareAddress hardwareAddress = message.getHardwareAddress();

        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getType() : 0 ) );
        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getLength() : 0 ) );
        byteBuffer.put( ( byte ) message.getHopCount() );
        byteBuffer.putInt( message.getTransactionId() );
        byteBuffer.putShort( ( short ) message.getSeconds() );
        byteBuffer.putShort( message.getFlags() );

        writeAddress( byteBuffer, message.getCurrentClientAddress() );
        writeAddress( byteBuffer, message.getAssignedClientAddress() );
        writeAddress( byteBuffer, message.getNextServerAddress() );
        writeAddress( byteBuffer, message.getRelayAgentAddress() );

        writeBytes( byteBuffer, ( null != hardwareAddress ? hardwareAddress.getAddress() : new byte[]
            {} ), 16 );

        writeString( byteBuffer, message.getServerHostname(), 64 );
        writeString( byteBuffer, message.getBootFileName(), 128 );

View Full Code Here

Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

        OptionsField options = decodeOptions( buffer );

        // message type option: may be null if option isn't set (BOOTP)
        DhcpMessageType mto = ( DhcpMessageType ) options.get( DhcpMessageType.class );

        return new DhcpMessage( null != mto ? mto.getType() : null, op, new HardwareAddress( htype, hlen, chaddr ),
            hops, xid, secs, flags, ciaddr, yiaddr, siaddr, giaddr, sname, file, options );
    }
View Full Code Here

Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

     */
    public void encode( ByteBuffer byteBuffer, DhcpMessage message )
    {
        byteBuffer.put( message.getOp() );

        HardwareAddress hardwareAddress = message.getHardwareAddress();

        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getType() : 0 ) );
        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getLength() : 0 ) );
        byteBuffer.put( ( byte ) message.getHopCount() );
        byteBuffer.putInt( message.getTransactionId() );
        byteBuffer.putShort( ( short ) message.getSeconds() );
        byteBuffer.putShort( message.getFlags() );

        writeAddress( byteBuffer, message.getCurrentClientAddress() );
        writeAddress( byteBuffer, message.getAssignedClientAddress() );
        writeAddress( byteBuffer, message.getNextServerAddress() );
        writeAddress( byteBuffer, message.getRelayAgentAddress() );

        writeBytes( byteBuffer, ( null != hardwareAddress ? hardwareAddress.getAddress() : new byte[]
            {} ), 16 );

        writeString( byteBuffer, message.getServerHostname(), 64 );
        writeString( byteBuffer, message.getBootFileName(), 128 );

View Full Code Here

Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

     */
    public void encode( ByteBuffer byteBuffer, DhcpMessage message )
    {
        byteBuffer.put( message.getOp() );

        HardwareAddress hardwareAddress = message.getHardwareAddress();

        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getType() : 0 ) );
        byteBuffer.put( ( byte ) ( null != hardwareAddress ? hardwareAddress.getLength() : 0 ) );
        byteBuffer.put( ( byte ) message.getHopCount() );
        byteBuffer.putInt( message.getTransactionId() );
        byteBuffer.putShort( ( short ) message.getSeconds() );
        byteBuffer.putShort( message.getFlags() );

        writeAddress( byteBuffer, message.getCurrentClientAddress() );
        writeAddress( byteBuffer, message.getAssignedClientAddress() );
        writeAddress( byteBuffer, message.getNextServerAddress() );
        writeAddress( byteBuffer, message.getRelayAgentAddress() );

        writeBytes( byteBuffer, ( null != hardwareAddress ? hardwareAddress.getAddress() : new byte[]
            {} ), 16 );

        writeString( byteBuffer, message.getServerHostname(), 64 );
        writeString( byteBuffer, message.getBootFileName(), 128 );

View Full Code Here

Examples of org.apache.directory.server.dhcp.messages.HardwareAddress

        OptionsField options = decodeOptions( buffer );

        // message type option: may be null if option isn't set (BOOTP)
        DhcpMessageType mto = ( DhcpMessageType ) options.get( DhcpMessageType.class );

        return new DhcpMessage( null != mto ? mto.getType() : null, op, new HardwareAddress( htype, hlen, chaddr ),
            hops, xid, secs, flags, ciaddr, yiaddr, siaddr, giaddr, sname, file, options );
    }
View Full Code Here

Examples of org.dhcp4java.HardwareAddress

      pac0.setFileRaw(new byte[129]);
    }
   
    @Test
    public void testGetHardwareAddress() {
        HardwareAddress ha = new HardwareAddress(HTYPE_ETHER, "001122334455");
        assertEquals(ha, refPacketFromSratch.getHardwareAddress());
        DHCPPacket pac2 = refPacketFromSratch.clone();
        pac2.setHlen((byte)17);
        HardwareAddress ha2 = new HardwareAddress(HTYPE_ETHER, "00112233445566778899AABBCCDDEEFF");
        assertEquals(ha2, pac2.getHardwareAddress());
    }
View Full Code Here

Examples of org.dhcp4java.HardwareAddress

  public void testConstructor() {
    assertEquals(DHCPConstants.HTYPE_ETHER, ha.getHardwareType());
    assertEquals("001122334455", ha.getHardwareAddressHex());
    assertTrue(Arrays.equals(HexUtils.hexToBytes("001122334455"), ha.getHardwareAddress()));
   
    HardwareAddress ha2 = new HardwareAddress(DHCPConstants.HTYPE_ETHER, HexUtils.hexToBytes("001122334455"));
    assertEquals(ha, ha2);
    HardwareAddress ha3 = new HardwareAddress(HexUtils.hexToBytes("001122334455"));
    assertEquals(ha, ha3);
    HardwareAddress ha4 = new HardwareAddress("001122334455");
    assertEquals(ha, ha4);
    HardwareAddress ha5 = new HardwareAddress(DHCPConstants.HTYPE_FDDI, HexUtils.hexToBytes("001122334455"));
    assertFalse(ha.equals(ha5));
   
    assertTrue(ha.hashCode() != 0);
    assertEquals(ha.hashCode(), ha2.hashCode());
    assertEquals(ha.hashCode(), ha3.hashCode());
    assertEquals(ha.hashCode(), ha4.hashCode());
    assertTrue(ha.hashCode() != ha5.hashCode());
   
    assertFalse(ha.equals(null));
    assertFalse(ha.equals(new Object()));
  }
View Full Code Here

Examples of org.dhcp4java.HardwareAddress

  }
 
  @Test
  public void testToString() {
    assertEquals("00:11:22:33:44:55", ha.toString());
    HardwareAddress ha2 = new HardwareAddress(DHCPConstants.HTYPE_FDDI, "0011045508");
    assertEquals("8/00:11:04:55:08", ha2.toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.