diff options
| -rw-r--r-- | core/java/android/net/metrics/DhcpErrorEvent.java | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/core/java/android/net/metrics/DhcpErrorEvent.java b/core/java/android/net/metrics/DhcpErrorEvent.java index 8beaa40ec2fc..84823464a093 100644 --- a/core/java/android/net/metrics/DhcpErrorEvent.java +++ b/core/java/android/net/metrics/DhcpErrorEvent.java @@ -37,27 +37,6 @@ public final class DhcpErrorEvent implements IpConnectivityLog.Event { public static final int DHCP_ERROR = 4; public static final int MISC_ERROR = 5; - public static final int L2_TOO_SHORT = (L2_ERROR << 24) | (1 << 16); - public static final int L2_WRONG_ETH_TYPE = (L2_ERROR << 24) | (2 << 16); - - public static final int L3_TOO_SHORT = (L3_ERROR << 24) | (1 << 16); - public static final int L3_NOT_IPV4 = (L3_ERROR << 24) | (2 << 16); - public static final int L3_INVALID_IP = (L3_ERROR << 24) | (3 << 16); - - public static final int L4_NOT_UDP = (L4_ERROR << 24) | (1 << 16); - public static final int L4_WRONG_PORT = (L4_ERROR << 24) | (2 << 16); - - public static final int BOOTP_TOO_SHORT = (DHCP_ERROR << 24) | (1 << 16); - public static final int DHCP_BAD_MAGIC_COOKIE = (DHCP_ERROR << 24) | (2 << 16); - public static final int DHCP_INVALID_OPTION_LENGTH = (DHCP_ERROR << 24) | (3 << 16); - public static final int DHCP_NO_MSG_TYPE = (DHCP_ERROR << 24) | (4 << 16); - public static final int DHCP_UNKNOWN_MSG_TYPE = (DHCP_ERROR << 24) | (5 << 16); - public static final int DHCP_NO_COOKIE = (DHCP_ERROR << 24) | (6 << 16); - - public static final int BUFFER_UNDERFLOW = (MISC_ERROR << 24) | (1 << 16); - public static final int RECEIVE_ERROR = (MISC_ERROR << 24) | (2 << 16); - public static final int PARSING_ERROR = (MISC_ERROR << 24) | (3 << 16); - // error code byte format (MSB to LSB): // byte 0: error type // byte 1: error subtype @@ -66,6 +45,33 @@ public final class DhcpErrorEvent implements IpConnectivityLog.Event { /** @hide */ public final int errorCode; + private static final int L2_ERROR_TYPE = L2_ERROR << 8; + private static final int L3_ERROR_TYPE = L3_ERROR << 8; + private static final int L4_ERROR_TYPE = L4_ERROR << 8; + private static final int DHCP_ERROR_TYPE = DHCP_ERROR << 8; + private static final int MISC_ERROR_TYPE = MISC_ERROR << 8; + + public static final int L2_TOO_SHORT = (L2_ERROR_TYPE | 0x1) << 16; + public static final int L2_WRONG_ETH_TYPE = (L2_ERROR_TYPE | 0x2) << 16; + + public static final int L3_TOO_SHORT = (L3_ERROR_TYPE | 0x1) << 16; + public static final int L3_NOT_IPV4 = (L3_ERROR_TYPE | 0x2) << 16; + public static final int L3_INVALID_IP = (L3_ERROR_TYPE | 0x3) << 16; + + public static final int L4_NOT_UDP = (L4_ERROR_TYPE | 0x1) << 16; + public static final int L4_WRONG_PORT = (L4_ERROR_TYPE | 0x2) << 16; + + public static final int BOOTP_TOO_SHORT = (DHCP_ERROR_TYPE | 0x1) << 16; + public static final int DHCP_BAD_MAGIC_COOKIE = (DHCP_ERROR_TYPE | 0x2) << 16; + public static final int DHCP_INVALID_OPTION_LENGTH = (DHCP_ERROR_TYPE | 0x3) << 16; + public static final int DHCP_NO_MSG_TYPE = (DHCP_ERROR_TYPE | 0x4) << 16; + public static final int DHCP_UNKNOWN_MSG_TYPE = (DHCP_ERROR_TYPE | 0x5) << 16; + public static final int DHCP_NO_COOKIE = (DHCP_ERROR_TYPE | 0x6) << 16; + + public static final int BUFFER_UNDERFLOW = (MISC_ERROR_TYPE | 0x1) << 16; + public static final int RECEIVE_ERROR = (MISC_ERROR_TYPE | 0x2) << 16; + public static final int PARSING_ERROR = (MISC_ERROR_TYPE | 0x3) << 16; + public DhcpErrorEvent(int errorCode) { this.errorCode = errorCode; } |