11 #ifndef IPV4_HEADER_HPP 12 #define IPV4_HEADER_HPP 56 unsigned char version()
const {
return (rep_[0] >> 4) & 0xF; }
65 unsigned char protocol()
const {
return rep_[9]; }
71 = { { rep_[12], rep_[13], rep_[14], rep_[15] } };
78 = { { rep_[16], rep_[17], rep_[18], rep_[19] } };
84 is.read(reinterpret_cast<char*>(header.rep_), 20);
86 is.setstate(std::ios::failbit);
88 if (options_length < 0 || options_length > 40)
89 is.setstate(std::ios::failbit);
91 is.read(reinterpret_cast<char*>(header.rep_) + 20, options_length);
96 unsigned short decode(
int a,
int b)
const 97 {
return (rep_[a] << 8) + rep_[
b]; }
99 unsigned char rep_[60];
102 #endif // IPV4_HEADER_HPP
Implements IP version 4 style addresses.
asio::basic_streambuf< Allocator > & b