Sponge
CS144's user-space TCP library
Classes | Enumerations | Functions
parser.hh File Reference
#include "buffer.hh"
#include <cstdint>
#include <cstdlib>
#include <string>
#include <utility>
Include dependency graph for parser.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  NetParser
 
struct  NetUnparser
 

Enumerations

enum  ParseResult {
  ParseResult::NoError = 0, ParseResult::BadChecksum, ParseResult::PacketTooShort, ParseResult::WrongIPVersion,
  ParseResult::HeaderTooShort, ParseResult::TruncatedPacket, ParseResult::Unsupported
}
 The result of parsing or unparsing an IP datagram, TCP segment, Ethernet frame, or ARP message. More...
 

Functions

std::string as_string (const ParseResult r)
 Output a string representation of a ParseResult. More...
 

Enumeration Type Documentation

◆ ParseResult

enum ParseResult
strong

The result of parsing or unparsing an IP datagram, TCP segment, Ethernet frame, or ARP message.

Enumerator
NoError 

Success.

BadChecksum 

Bad checksum.

PacketTooShort 

Not enough data to finish parsing.

WrongIPVersion 

Got a version of IP other than 4.

HeaderTooShort 

Header length is shorter than minimum required.

TruncatedPacket 

Packet length is shorter than header claims.

Unsupported 

Packet uses unsupported features.

Definition at line 12 of file parser.hh.

Function Documentation

◆ as_string()

std::string as_string ( const ParseResult  r)

Output a string representation of a ParseResult.

Parameters
[in]ris the ParseResult to show
Returns
a string representation of the ParseResult

Definition at line 7 of file parser.cc.