12 #include "../endian_conversion.h"
15 #include "../fframe.h"
16 #include "../caddress.h"
40 enum ipv4_ip_proto_t {
51 uint16_t offset_flags;
58 } __attribute__((packed));
61 bit_reserved = (1 << 0),
62 bit_dont_fragment = (1 << 1),
63 bit_more_fragments = (1 << 2),
69 #if __BYTE_ORDER == __LITTLE_ENDIAN
74 #elif __BYTE_ORDER == __BIG_ENDIAN
83 #if __BYTE_ORDER == __LITTLE_ENDIAN
86 #elif __BYTE_ORDER == __BIG_ENDIAN
96 } __attribute__((packed));
101 IP_FLAG_RSVD = (1 << 1),
102 IP_FLAG_DONT_FRAGMENT = (1 << 2),
103 IP_FLAG_MORE_FRAGMENTS = (1 << 3),
136 struct fipv4frame::ipv4_option_hdr_t*
137 option_insert(
enum fpppoeframe::pppoe_tag_t type,
char *fmt, ...);
142 struct fipv4frame::ipv4_option_hdr_t*
143 option_find(
enum fpppoeframe::pppoe_tag_t) throw (ePPPoEFrameTagNotFound);
168 validate(uint16_t total_len = 0)
const;
181 uint8_t *data,
size_t datalen)
throw (eFrameOutOfRange);
187 payload()
const throw (eFrameNoPayload);
207 set_ipv4_ihl(uint8_t ihl = 5);
212 get_ipv4_ihl() const;
217 set_ipv4_version(uint8_t version = 4);
222 get_ipv4_version() const;
237 get_ipv4_src() const;
252 get_ipv4_dst() const;
257 set_ipv4_dscp(uint8_t dscp);
262 get_ipv4_dscp() const;
267 set_ipv4_ecn(uint8_t ecn);
272 get_ipv4_ecn() const;
277 set_ipv4_ttl(uint8_t ttl);
292 set_ipv4_proto(uint8_t proto);
307 set_ipv4_length(uint16_t length);
342 struct ipv4_hdr_t *ipv4_hdr;
364 operator<< (std::ostream& os,
fipv4frame const& frame) {
365 os << dynamic_cast<fframe const&>( frame );
366 os << indent(2) <<
"<fipv4frame ";
367 os <<
"src:" << frame.get_ipv4_src() <<
" ";
368 os <<
"dst:" << frame.get_ipv4_dst() <<
" ";
369 os <<
"dscp:" << (int)frame.get_ipv4_dscp() <<
" ";
370 os <<
"ecn:" << (int)frame.get_ipv4_ecn() <<
" ";
371 os <<
">" << std::endl;
void set_ipv4_src(uint32_t src)
Definition: fipv4frame.cc:210
virtual void initialize()
Definition: fipv4frame.cc:31
virtual size_t need_bytes() const
Definition: fipv4frame.cc:73
virtual size_t payloadlen() const
Definition: fipv4frame.cc:115
Definition: fipv4frame.h:45
virtual void payload_insert(uint8_t *data, size_t datalen)
Definition: fipv4frame.cc:91
virtual void validate(uint16_t total_len=0) const
Definition: fipv4frame.cc:126
void ipv4_calc_checksum()
Definition: fipv4frame.cc:175
Definition: fipv4frame.h:25
virtual uint8_t * payload() const
Definition: fipv4frame.cc:105
Definition: fipv4frame.h:22
Definition: fipv4frame.h:31
virtual const char * c_str()
Definition: fipv4frame.cc:136
virtual bool complete() const
Definition: fipv4frame.cc:60
fipv4frame(uint8_t *data, size_t datalen)
Definition: fipv4frame.cc:9
virtual ~fipv4frame()
Definition: fipv4frame.cc:23
void set_ipv4_dst(uint32_t dst)
Definition: fipv4frame.cc:232
Definition: fipv4frame.h:24