Sponge
CS144's user-space TCP library
ethernet_frame.hh
Go to the documentation of this file.
1 #ifndef SPONGE_LIBSPONGE_ETHERNET_FRAME_HH
2 #define SPONGE_LIBSPONGE_ETHERNET_FRAME_HH
3 
4 #include "buffer.hh"
5 #include "ethernet_header.hh"
6 
8 class EthernetFrame {
9  private:
12 
13  public:
16 
18  BufferList serialize() const;
19 
22  const EthernetHeader &header() const { return _header; }
23  EthernetHeader &header() { return _header; }
24 
25  const BufferList &payload() const { return _payload; }
26  BufferList &payload() { return _payload; }
28 };
29 
30 #endif // SPONGE_LIBSPONGE_ETHERNET_FRAME_HH
EthernetFrame::header
const EthernetHeader & header() const
Definition: ethernet_frame.hh:22
EthernetFrame::header
EthernetHeader & header()
Definition: ethernet_frame.hh:23
EthernetFrame::payload
BufferList & payload()
Definition: ethernet_frame.hh:26
EthernetFrame
Ethernet frame.
Definition: ethernet_frame.hh:8
EthernetFrame::_header
EthernetHeader _header
Definition: ethernet_frame.hh:10
BufferList
A reference-counted discontiguous string that can discard bytes from the front.
Definition: buffer.hh:56
buffer
std::string buffer
Definition: parser_example.cc:7
ethernet_header.hh
EthernetFrame::payload
const BufferList & payload() const
Definition: ethernet_frame.hh:25
EthernetHeader
Ethernet frame header.
Definition: ethernet_header.hh:18
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
EthernetFrame::parse
ParseResult parse(const Buffer buffer)
Parse the frame from a string.
Definition: ethernet_frame.cc:11
buffer.hh
EthernetFrame::_payload
BufferList _payload
Definition: ethernet_frame.hh:11
EthernetFrame::serialize
BufferList serialize() const
Serialize the frame to a string.
Definition: ethernet_frame.cc:19