Module portus::serialize[][src]

Serialization library for communicating with libccp in the datapath.

Messages have a common CCP header:

-----------------------------------
| Msg Type | Len (B)  | Uint32    |
| (2 B)    | (2 B)    | (32 bits) |
-----------------------------------
total: 8 Bytes

Message types 0-3 are reserved for predefined message types. All other types are treated as "unknown" - the header will be parsed, and raw access to the remaining bytes is available through RawMsg::get_bytes().

A message type has 4 components, always in the following order.

  1. CCP Header
  2. u32s
  3. u64s
  4. Arbitrary bytes

For convenience, the predefined message types define a number of u32s and u64s. External message types can implement get_bytes() to pass custom types in the message payload. In these cases, there is little deserialization overhead from the u32 and u64 parts of the message.

Modules

create

Message sent from datapath to CCP when a new flow starts.

install

CCP sends this message containing a datapath program.

measure

When the datapath program specifies, the datapath sends a Report message containing measurements to CCP. Use the Scope returned from compiling the program to query the values.

update_field

CCP sends this message specifying that the datapath should set the values of the given fields to the given values.

Structs

RawMsg

A raw messge buffer with a parsed CCP header.

Enums

Msg

Message type for deserialization. Reads message type in the header of the input buffer and returns a Msg of the corresponding type. If the message type is unkown, returns a wrapper with direct access to the message bytes.

Constants

HDR_LENGTH

Traits

AsRawMsg

Types that can be serialized.

Functions

serialize

Serialize a serializable message.