DHCPv6 addr reg: get the DHCPv6 message type.

Flag: EXEMPT guarded by an legacy experiment flag
Bug: 293393743
Test: TH
Change-Id: If072a5bce0c8516af3fa4f7f9b63137de86b7500
This commit is contained in:
Xiao Ma 2025-06-12 01:14:06 +09:00
commit 307112f889
9 changed files with 62 additions and 1 deletions

View file

@ -48,6 +48,13 @@ public class Dhcp6AddrRegInformPacket extends Dhcp6Packet {
mValid = valid;
}
/**
* Return the DHCPv6 ADDR_REG_INFORM message type (36).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_ADDR_REG_INFORM;
}
/**
* Build a DHCPv6 ADDR-REG-INFORM message with the specific parameters.
*/

View file

@ -49,6 +49,13 @@ public class Dhcp6AddrRegReplyPacket extends Dhcp6Packet {
mValid = valid;
}
/**
* Return the DHCPv6 ADDR_REG_REPLY message type (37).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_ADDR_REG_REPLY;
}
/**
* Build a DHCPv6 ADDR-REG-REPLY message with the specific parameters.
*/

View file

@ -35,6 +35,13 @@ public class Dhcp6AdvertisePacket extends Dhcp6Packet {
super(transId, 0 /* elapsedTime */, clientDuid, serverDuid, iapd);
}
/**
* Return the DHCPv6 ADVERTISE message type (2).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_ADVERTISE;
}
/**
* Build a DHCPv6 Advertise message with the specific parameters.
*/

View file

@ -47,7 +47,7 @@ import java.util.OptionalInt;
*
* @hide
*/
public class Dhcp6Packet {
public abstract class Dhcp6Packet {
private static final String TAG = Dhcp6Packet.class.getSimpleName();
/** DHCP constants copied from NetworkStackConstants.java */
protected static final int DHCP_MAX_LENGTH = 1500;
@ -72,6 +72,11 @@ public class Dhcp6Packet {
public static final byte DHCP6_MESSAGE_TYPE_ADDR_REG_INFORM = 36;
public static final byte DHCP6_MESSAGE_TYPE_ADDR_REG_REPLY = 37;
/**
* Returns a specific DHCPv6 message type.
*/
public abstract byte getMessageType();
/**
* DHCPv6 Optional Type: Client Identifier.
* DHCPv6 message from client must have this option.

View file

@ -36,6 +36,13 @@ public class Dhcp6RebindPacket extends Dhcp6Packet {
super(transId, elapsedTime, clientDuid, null /* serverDuid */, iapd);
}
/**
* Return the DHCPv6 REBIND message type (6).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_REBIND;
}
/**
* Build a DHCPv6 Rebind message with the specific parameters.
*/

View file

@ -36,6 +36,13 @@ public class Dhcp6RenewPacket extends Dhcp6Packet {
super(transId, elapsedTime, clientDuid, serverDuid, iapd);
}
/**
* Return the DHCPv6 RENEW message type (5).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_RENEW;
}
/**
* Build a DHCPv6 Renew message with the specific parameters.
*/

View file

@ -37,6 +37,13 @@ public class Dhcp6ReplyPacket extends Dhcp6Packet {
mRapidCommit = rapidCommit;
}
/**
* Return the DHCPv6 REPLY message type (7).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_REPLY;
}
/**
* Build a DHCPv6 Reply message with the specific parameters.
*/

View file

@ -35,6 +35,13 @@ public class Dhcp6RequestPacket extends Dhcp6Packet {
super(transId, elapsedTime, clientDuid, serverDuid, iapd);
}
/**
* Return the DHCPv6 REQUEST message type (3).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_REQUEST;
}
/**
* Build a DHCPv6 Request message with the specific parameters.
*/

View file

@ -35,6 +35,13 @@ public class Dhcp6SolicitPacket extends Dhcp6Packet {
mRapidCommit = rapidCommit;
}
/**
* Return the DHCPv6 SOLICIT message type (1).
*/
public byte getMessageType() {
return DHCP6_MESSAGE_TYPE_SOLICIT;
}
/**
* Build a DHCPv6 Solicit message with the specific parameters.
*/