os_ken.lib.packet.mpls.
label_from_bin
(buf)¶Converts binary representation label to integer.
Parameters: | buf -- Binary representation of label. |
---|---|
Returns: | MPLS Label and BoS bit. |
os_ken.lib.packet.mpls.
label_to_bin
(mpls_label, is_bos=True)¶Converts integer label to binary representation.
Parameters: |
|
---|---|
Returns: | Binary representation of label. |
os_ken.lib.packet.mpls.
mpls
(label=0, exp=0, bsb=1, ttl=255)¶MPLS (RFC 3032) header encoder/decoder class.
NOTE: When decoding, this implementation assumes that the inner protocol is IPv4.
An instance has the following attributes at least. Most of them are same to the on-wire counterparts but in host byte order. __init__ takes the corresponding args in this order.
Attribute | Description |
---|---|
label | Label Value |
exp | Experimental Use |
bsb | Bottom of Stack |
ttl | Time To Live |
parser
(buf)¶Decode a protocol header.
This method is used only when decoding a packet.
Decode a protocol header at offset 0 in bytearray buf. Returns the following three objects.
serialize
(payload, prev)¶Encode a protocol header.
This method is used only when encoding a packet.
Encode a protocol header. Returns a bytearray which contains the header.
payload is the rest of the packet which will immediately follow this header.
prev is a packet_base.PacketBase subclass for the outer protocol header. prev is None if the current header is the outer-most. For example, prev is ipv4 or ipv6 for tcp.serialize.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.