Sponge
CS144's user-space TCP library
libsponge
tcp_helpers
ipv4_datagram.hh
Go to the documentation of this file.
1
#ifndef SPONGE_LIBSPONGE_IPV4_DATAGRAM_HH
2
#define SPONGE_LIBSPONGE_IPV4_DATAGRAM_HH
3
4
#include "
buffer.hh
"
5
#include "
ipv4_header.hh
"
6
8
class
IPv4Datagram
{
9
private
:
10
IPv4Header
_header
{};
11
BufferList
_payload
{};
12
13
public
:
15
ParseResult
parse
(
const
Buffer
buffer
);
16
18
BufferList
serialize
()
const
;
19
22
const
IPv4Header
&
header
()
const
{
return
_header
; }
23
IPv4Header
&
header
() {
return
_header
; }
24
25
const
BufferList
&
payload
()
const
{
return
_payload
; }
26
BufferList
&
payload
() {
return
_payload
; }
28
};
29
30
using
InternetDatagram
=
IPv4Datagram
;
31
32
#endif // SPONGE_LIBSPONGE_IPV4_DATAGRAM_HH
IPv4Datagram::_header
IPv4Header _header
Definition:
ipv4_datagram.hh:10
IPv4Datagram::_payload
BufferList _payload
Definition:
ipv4_datagram.hh:11
ipv4_header.hh
BufferList
A reference-counted discontiguous string that can discard bytes from the front.
Definition:
buffer.hh:56
IPv4Datagram
IPv4 Internet datagram
Definition:
ipv4_datagram.hh:8
buffer
std::string buffer
Definition:
parser_example.cc:7
Buffer
A reference-counted read-only string that can discard bytes from the front.
Definition:
buffer.hh:14
ParseResult
ParseResult
The result of parsing or unparsing an IP datagram, TCP segment, Ethernet frame, or ARP message.
Definition:
parser.hh:12
IPv4Datagram::payload
BufferList & payload()
Definition:
ipv4_datagram.hh:26
IPv4Datagram::parse
ParseResult parse(const Buffer buffer)
Parse the segment from a string.
Definition:
ipv4_datagram.cc:11
IPv4Header
IPv4 Internet datagram header
Definition:
ipv4_header.hh:8
buffer.hh
IPv4Datagram::header
IPv4Header & header()
Definition:
ipv4_datagram.hh:23
IPv4Datagram::serialize
BufferList serialize() const
Serialize the segment to a string.
Definition:
ipv4_datagram.cc:23
IPv4Datagram::header
const IPv4Header & header() const
Definition:
ipv4_datagram.hh:22
IPv4Datagram::payload
const BufferList & payload() const
Definition:
ipv4_datagram.hh:25
Generated by
1.8.17