Encapsulates an MPLS label. More...
#include <DwmMplsLabel.hh>
Public Member Functions | |
| MplsLabel () | |
| Constructor. Sets all label bits to 0. | |
| MplsLabel (const std::string &s) | |
| Construct from a string of the form 'label:exp:s:ttl'. | |
| uint32_t | Label () const |
| Returns the 20-bit label portion of the label. | |
| uint32_t | Label (uint32_t label) |
| Sets and returns the 20-bit label portion of the label. | |
| uint8_t | Exp () const |
| Returns the 3-bit exp portion of the label. | |
| uint8_t | Exp (uint8_t exp) |
| Sets and returns the 3-bit exp portion of the label. | |
| bool | S () const |
| Returns true if the S (bottom-of-stack) bit is set. | |
| bool | S (bool s) |
| Sets the S bit. | |
| uint8_t | Ttl () const |
| Returns the TTL portion of the label. | |
| uint8_t | Ttl (uint8_t ttl) |
| Sets and returns the TTL portion of the label. | |
| bool | operator== (const MplsLabel &label) const |
| operator == | |
| std::istream & | Read (std::istream &is) |
| Reads the MPLS label from an istream. Returns the istream. | |
| 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. | |
| ssize_t | Write (int fd) const |
| Writes the MPLS label to a file descriptor. | |
| size_t | Read (FILE *f) |
| Reads the MPLS label from a FILE. | |
| size_t | Write (FILE *f) const |
| Writes the MPLS label to a FILE. | |
| int | Read (gzFile gzf) |
Reads the MPLS label from the given gzFile gzf. | |
| int | Write (gzFile gzf) const |
Writes the MPLS lable to the given gzFile gzf. | |
| int | BZRead (BZFILE *bzf) |
Reads the MPLS label from the given BZFILE bzf. | |
| int | BZWrite (BZFILE *bzf) const |
Writes the MPLS lable to the given BZFILE bzf. | |
| uint64_t | StreamedLength () const |
| Returns the number of bytes that should be written if we call one of the Write() members. | |
Protected Attributes | |
| uint32_t | _data |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const MplsLabel &label) |
| Prints to an ostream in 'label:exp:s:ttl' format. | |
| std::istream & | operator>> (std::istream &is, MplsLabel &label) |
| Reads from an istream in 'label:exp:s:ttl' format. | |
Encapsulates an MPLS label.
| int Dwm::MplsLabel::BZRead | ( | BZFILE * | bzf | ) |
Reads the MPLS label from the given BZFILE bzf.
Return the number of bytes read on success, -1 on failure.
| int Dwm::MplsLabel::BZWrite | ( | BZFILE * | bzf | ) | const |
Writes the MPLS lable to the given BZFILE bzf.
Returns the number of bytes written on success, -1 on failure.
| size_t Dwm::MplsLabel::Read | ( | FILE * | f | ) |
Reads the MPLS label from a FILE.
Returns 1 on success, 0 on failure (fread() semantics).
| int Dwm::MplsLabel::Read | ( | gzFile | gzf | ) |
Reads the MPLS label from the given gzFile gzf.
Return the number of bytes read on success, -1 on failure.
| ssize_t Dwm::MplsLabel::Read | ( | int | fd | ) |
Reads the MPLS label from a file descriptor.
Returns the number of bytes read on success (should be 4), -1 on failure.
| uint64_t Dwm::MplsLabel::StreamedLength | ( | ) | const |
Returns the number of bytes that should be written if we call one of the Write() members.
Should always return 4.
| size_t Dwm::MplsLabel::Write | ( | FILE * | f | ) | const |
Writes the MPLS label to a FILE.
Returns 1 on success, 0 on failure (fwrite() semantics).
| int Dwm::MplsLabel::Write | ( | gzFile | gzf | ) | const |
Writes the MPLS lable to the given gzFile gzf.
Returns the number of bytes written on success, -1 on failure.
| ssize_t Dwm::MplsLabel::Write | ( | int | fd | ) | const |
Writes the MPLS label to a file descriptor.
Returns the number of bytes written on success (should be 4), -1 on failure.