29 lines
669 B
C++
29 lines
669 B
C++
// Задача 04 — разбор IPv4-пакета. Заполни реализации.
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
|
|
struct Ipv4Header {
|
|
uint8_t version;
|
|
uint8_t ihl;
|
|
uint8_t protocol;
|
|
uint16_t total_length;
|
|
uint32_t src_ip;
|
|
uint32_t dst_ip;
|
|
uint16_t header_checksum;
|
|
};
|
|
|
|
bool parse_ipv4(const uint8_t* buf, size_t len, Ipv4Header* out) {
|
|
(void)buf; (void)len; (void)out;
|
|
return false; // TODO
|
|
}
|
|
|
|
uint16_t compute_checksum(const uint8_t* buf, size_t len) {
|
|
(void)buf; (void)len;
|
|
return 0; // TODO
|
|
}
|
|
|
|
bool checksum_valid(const uint8_t* buf, size_t len) {
|
|
(void)buf; (void)len;
|
|
return false; // TODO
|
|
}
|