23 lines
569 B
C++
23 lines
569 B
C++
#pragma once
|
|
|
|
#include "eth.h"
|
|
#include "ip4.h"
|
|
#include "udp4.h"
|
|
#include "dhcp4.h"
|
|
|
|
namespace packet {
|
|
struct packet {
|
|
eth::header const * eth;
|
|
ip4::header const * ip4;
|
|
udp4::header const * udp4;
|
|
dhcp4::message const * dhcp4;
|
|
};
|
|
|
|
void parse(uint8_t const * buf, int length, packet * p);
|
|
|
|
const int eth_offset = 0;
|
|
const int ip4_offset = (sizeof (eth::header));
|
|
const int udp4_offset = (sizeof (eth::header)) + (sizeof (ip4::header));
|
|
const int dhcp4_offset = (sizeof (eth::header)) + (sizeof (ip4::header)) + (sizeof (udp4::header));
|
|
};
|