static void dhcp_decode(const uint8_t *buf, int size,

                        int *pmsg_type)

{

    const uint8_t *p, *p_end;

    int len, tag;



    *pmsg_type = 0;



    p = buf;

    p_end = buf + size;

    if (size < 5)

        return;

    if (memcmp(p, rfc1533_cookie, 4) != 0)

        return;

    p += 4;

    while (p < p_end) {

        tag = p[0];

        if (tag == RFC1533_PAD) {

            p++;

        } else if (tag == RFC1533_END) {

            break;

        } else {

            p++;

            if (p >= p_end)

                break;

            len = *p++;

            dprintf("dhcp: tag=0x%02x len=%d\n", tag, len);



            switch(tag) {

            case RFC2132_MSG_TYPE:

                if (len >= 1)

                    *pmsg_type = p[0];

                break;

            default:

                break;

            }

            p += len;

        }

    }

}

static void dhcp_decode(const uint8_t *buf, int size,

                        int *pmsg_type)

{

    const uint8_t *p, *p_end;

    int len, tag;



    *pmsg_type = 0;



    p = buf;

    p_end = buf + size;

    if (size < 5)

        return;

    if (memcmp(p, rfc1533_cookie, 4) != 0)

        return;

    p += 4;

    while (p < p_end) {

        tag = p[0];

        if (tag == RFC1533_PAD) {

            p++;

        } else if (tag == RFC1533_END) {

            break;

        } else {

            p++;

            if (p >= p_end)

                break;

            len = *p++;

            dprintf("dhcp: tag=0x%02x len=%d\n", tag, len);



            switch(tag) {

            case RFC2132_MSG_TYPE:

                if (len >= 1)

                    *pmsg_type = p[0];

                break;

            default:

                break;

            }

            p += len;

        }

    }

}

static void FUNC_0(const uint8_t *VAR_0, int VAR_1,

                        int *VAR_2)

{

    const uint8_t *VAR_3, *p_end;

    int VAR_4, VAR_5;



    *VAR_2 = 0;



    VAR_3 = VAR_0;

    p_end = VAR_0 + VAR_1;

    if (VAR_1 < 5)

        return;

    if (memcmp(VAR_3, rfc1533_cookie, 4) != 0)

        return;

    VAR_3 += 4;

    while (VAR_3 < p_end) {

        VAR_5 = VAR_3[0];

        if (VAR_5 == RFC1533_PAD) {

            VAR_3++;

        } else if (VAR_5 == RFC1533_END) {

            break;

        } else {

            VAR_3++;

            if (VAR_3 >= p_end)

                break;

            VAR_4 = *VAR_3++;

            dprintf("dhcp: VAR_5=0x%02x VAR_4=%d\n", VAR_5, VAR_4);



            switch(VAR_5) {

            case RFC2132_MSG_TYPE:

                if (VAR_4 >= 1)

                    *VAR_2 = VAR_3[0];

                break;

            default:

                break;

            }

            VAR_3 += VAR_4;

        }

    }

}

static void FUNC_0(const uint8_t *VAR_0, int VAR_1,
int *VAR_2)
{ const uint8_t *VAR_3, *p_end; int VAR_4, VAR_5; *VAR_2 = 0; VAR_3 = VAR_0; p_end = VAR_0 + VAR_1; if (VAR_1 < 5)
return; if (memcmp(VAR_3, rfc1533_cookie, 4) != 0)
return; VAR_3 += 4; while (VAR_3 < p_end) { VAR_5 = VAR_3[0]; if (VAR_5 == RFC1533_PAD) { VAR_3++; } else if (VAR_5 == RFC1533_END) { break; } else { VAR_3++; if (VAR_3 >= p_end)
break; VAR_4 = *VAR_3++; dprintf("dhcp: VAR_5=0x%02x VAR_4=%d\n", VAR_5, VAR_4); switch(VAR_5) { case RFC2132_MSG_TYPE:
if (VAR_4 >= 1)
*VAR_2 = VAR_3[0]; break; default:
break; } VAR_3 += VAR_4; } } }