41#ifndef _DWMMPLSLABEL_HH_
42#define _DWMMPLSLABEL_HH_
89 uint8_t
Exp(uint8_t exp);
119 std::istream &
Read(std::istream & is);
124 std::ostream &
Write(std::ostream & os)
const;
183 friend std::ostream &
189 friend std::istream &
Encapsulates an MPLS label.
Definition DwmMplsLabel.hh:59
bool S() const
Returns true if the S (bottom-of-stack) bit is set.
ssize_t Write(int fd) const
Writes the MPLS label to a file descriptor.
size_t Write(FILE *f) const
Writes the MPLS label to a FILE.
friend std::ostream & operator<<(std::ostream &os, const MplsLabel &label)
Prints to an ostream in 'label:exp:s:ttl' format.
bool S(bool s)
Sets the S bit.
bool operator==(const MplsLabel &label) const
operator ==
size_t Read(FILE *f)
Reads the MPLS label from a FILE.
int Write(gzFile gzf) const
Writes the MPLS lable to the given gzFile gzf.
std::ostream & Write(std::ostream &os) const
Writes the MPLS label to an ostream. Returns the ostream.
ssize_t Read(int fd)
Reads the MPLS label from a file descriptor.
uint8_t Exp() const
Returns the 3-bit exp portion of the label.
std::istream & Read(std::istream &is)
Reads the MPLS label from an istream. Returns the istream.
int BZRead(BZFILE *bzf)
Reads the MPLS label from the given BZFILE bzf.
MplsLabel()
Constructor. Sets all label bits to 0.
int BZWrite(BZFILE *bzf) const
Writes the MPLS lable to the given BZFILE bzf.
MplsLabel(const std::string &s)
Construct from a string of the form 'label:exp:s:ttl'.
uint32_t Label(uint32_t label)
Sets and returns the 20-bit label portion of the label.
uint8_t Ttl(uint8_t ttl)
Sets and returns the TTL portion of the label.
int Read(gzFile gzf)
Reads the MPLS label from the given gzFile gzf.
friend std::istream & operator>>(std::istream &is, MplsLabel &label)
Reads from an istream in 'label:exp:s:ttl' format.
uint8_t Exp(uint8_t exp)
Sets and returns the 3-bit exp portion of the label.
uint64_t StreamedLength() const
Returns the number of bytes that should be written if we call one of the Write() members.
uint32_t Label() const
Returns the 20-bit label portion of the label.
uint8_t Ttl() const
Returns the TTL portion of the label.