Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed2e54a5 authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Gerrit Code Review
Browse files

Merge "Refactor DhcpErrorEvent error codes"

parents e1dda15d c32d602c
Loading
Loading
Loading
Loading
+27 −21
Original line number Original line Diff line number Diff line
@@ -37,27 +37,6 @@ public final class DhcpErrorEvent implements IpConnectivityLog.Event {
    public static final int DHCP_ERROR = 4;
    public static final int DHCP_ERROR = 4;
    public static final int MISC_ERROR = 5;
    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):
    // error code byte format (MSB to LSB):
    // byte 0: error type
    // byte 0: error type
    // byte 1: error subtype
    // byte 1: error subtype
@@ -66,6 +45,33 @@ public final class DhcpErrorEvent implements IpConnectivityLog.Event {
    /** @hide */
    /** @hide */
    public final int errorCode;
    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) {
    public DhcpErrorEvent(int errorCode) {
        this.errorCode = errorCode;
        this.errorCode = errorCode;
    }
    }