11 #ifndef IPV4_HEADER_HPP 12 #define IPV4_HEADER_HPP 15 #include <boost/asio/ip/address_v4.hpp> 56 unsigned char version()
const {
return (
rep_[0] >> 4) & 0xF; }
70 boost::asio::ip::address_v4::bytes_type bytes
71 = { {
rep_[12],
rep_[13], rep_[14], rep_[15] } };
72 return boost::asio::ip::address_v4(bytes);
77 boost::asio::ip::address_v4::bytes_type bytes
78 = { {
rep_[16],
rep_[17], rep_[18], rep_[19] } };
79 return boost::asio::ip::address_v4(bytes);
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 102 #endif // IPV4_HEADER_HPP