package frenetic

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
exception Unparsable of string

Unparsable msg signals an error in parsing, such as when a bit sequence has been corrupted.

exception Ignored of string

Ignored msg signals the arrival of a valid OpenFlow message that the parser is not yet equipped to handle.

type 'a mask = {
  1. m_value : 'a;
  2. m_mask : 'a option;
}
val sexp_of_mask : ('a -> Ppx_sexp_conv_lib.Sexp.t) -> 'a mask -> Ppx_sexp_conv_lib.Sexp.t
val mask_of_sexp : (Ppx_sexp_conv_lib.Sexp.t -> 'a) -> Ppx_sexp_conv_lib.Sexp.t -> 'a mask
type switchId = int64
val sexp_of_switchId : switchId -> Ppx_sexp_conv_lib.Sexp.t
val switchId_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> switchId
type portId = Packet.int16
val sexp_of_portId : portId -> Ppx_sexp_conv_lib.Sexp.t
val portId_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> portId
type queueId = int32
val sexp_of_queueId : queueId -> Ppx_sexp_conv_lib.Sexp.t
val queueId_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> queueId
type pattern = {
  1. dlSrc : Packet.dlAddr option;
  2. dlDst : Packet.dlAddr option;
  3. dlTyp : Packet.dlTyp option;
  4. dlVlan : Packet.dlVlan option;
  5. dlVlanPcp : Packet.dlVlanPcp option;
  6. nwSrc : Packet.nwAddr mask option;
  7. nwDst : Packet.nwAddr mask option;
  8. nwProto : Packet.nwProto option;
  9. nwTos : Packet.nwTos option;
  10. tpSrc : Packet.tpPort option;
  11. tpDst : Packet.tpPort option;
  12. inPort : portId option;
}
val sexp_of_pattern : pattern -> Ppx_sexp_conv_lib.Sexp.t
val pattern_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> pattern
type pseudoPort =
  1. | PhysicalPort of portId
  2. | InPort
  3. | Table
  4. | Normal
  5. | Flood
  6. | AllPorts
  7. | Controller of int
  8. | Local
val sexp_of_pseudoPort : pseudoPort -> Ppx_sexp_conv_lib.Sexp.t
val pseudoPort_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> pseudoPort
type action =
  1. | Output of pseudoPort
  2. | SetDlVlan of Packet.dlVlan
  3. | SetDlVlanPcp of Packet.dlVlanPcp
  4. | SetDlSrc of Packet.dlAddr
  5. | SetDlDst of Packet.dlAddr
  6. | SetNwSrc of Packet.nwAddr
  7. | SetNwDst of Packet.nwAddr
  8. | SetNwTos of Packet.nwTos
  9. | SetTpSrc of Packet.tpPort
  10. | SetTpDst of Packet.tpPort
  11. | Enqueue of pseudoPort * queueId
val sexp_of_action : action -> Ppx_sexp_conv_lib.Sexp.t
val action_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> action
type timeout =
  1. | Permanent
  2. | ExpiresAfter of Packet.int16
val sexp_of_timeout : timeout -> Ppx_sexp_conv_lib.Sexp.t
val timeout_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> timeout
type flowModCommand =
  1. | AddFlow
  2. | ModFlow
  3. | ModStrictFlow
  4. | DeleteFlow
  5. | DeleteStrictFlow
val sexp_of_flowModCommand : flowModCommand -> Ppx_sexp_conv_lib.Sexp.t
val flowModCommand_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> flowModCommand
type flowMod = {
  1. command : flowModCommand;
  2. pattern : pattern;
  3. priority : Packet.int16;
  4. actions : action list;
  5. cookie : int64;
  6. idle_timeout : timeout;
  7. hard_timeout : timeout;
  8. notify_when_removed : bool;
  9. apply_to_packet : int32 option;
  10. out_port : pseudoPort option;
  11. check_overlap : bool;
}
val sexp_of_flowMod : flowMod -> Ppx_sexp_conv_lib.Sexp.t
val flowMod_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> flowMod
type payload =
  1. | Buffered of int32 * Cstruct.t
  2. | NotBuffered of Cstruct.t
val sexp_of_payload : payload -> Ppx_sexp_conv_lib.Sexp.t
val payload_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> payload
type packetInReason =
  1. | NoMatch
  2. | ExplicitSend
val sexp_of_packetInReason : packetInReason -> Ppx_sexp_conv_lib.Sexp.t
val packetInReason_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> packetInReason
type packetIn = {
  1. input_payload : payload;
  2. total_len : Packet.int16;
  3. port : portId;
  4. reason : packetInReason;
}
val sexp_of_packetIn : packetIn -> Ppx_sexp_conv_lib.Sexp.t
val packetIn_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> packetIn
type flowRemovedReason =
  1. | IdleTimeout
  2. | HardTimeout
  3. | Delete
val sexp_of_flowRemovedReason : flowRemovedReason -> Ppx_sexp_conv_lib.Sexp.t
val flowRemovedReason_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> flowRemovedReason
type flowRemoved = {
  1. pattern : pattern;
  2. cookie : int64;
  3. priority : Packet.int16;
  4. reason : flowRemovedReason;
  5. duration_sec : int32;
  6. duration_nsec : int32;
  7. idle_timeout : timeout;
  8. packet_count : int64;
  9. byte_count : int64;
}
val sexp_of_flowRemoved : flowRemoved -> Ppx_sexp_conv_lib.Sexp.t
val flowRemoved_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> flowRemoved
type packetOut = {
  1. output_payload : payload;
  2. port_id : portId option;
  3. apply_actions : action list;
}
val sexp_of_packetOut : packetOut -> Ppx_sexp_conv_lib.Sexp.t
val packetOut_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> packetOut
type statsReq = {
  1. sr_of_match : pattern;
  2. sr_table_id : Packet.int8;
  3. sr_out_port : pseudoPort option;
}
val sexp_of_statsReq : statsReq -> Ppx_sexp_conv_lib.Sexp.t
val statsReq_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> statsReq
type request =
  1. | DescriptionRequest
  2. | FlowTableStatsRequest
  3. | IndividualRequest of statsReq
  4. | AggregateRequest of statsReq
  5. | PortRequest of pseudoPort option
val sexp_of_request : request -> Ppx_sexp_conv_lib.Sexp.t
val request_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> request
type descriptionStats = {
  1. manufacturer : string;
  2. hardware : string;
  3. software : string;
  4. serial_number : string;
  5. datapath : string;
}
val sexp_of_descriptionStats : descriptionStats -> Ppx_sexp_conv_lib.Sexp.t
val descriptionStats_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> descriptionStats
type individualStats = {
  1. table_id : Packet.int8;
  2. of_match : pattern;
  3. duration_sec : int32;
  4. duration_nsec : int32;
  5. priority : Packet.int16;
  6. idle_timeout : Packet.int16;
  7. hard_timeout : Packet.int16;
  8. cookie : int64;
  9. packet_count : int64;
  10. byte_count : int64;
  11. actions : action list;
}
val sexp_of_individualStats : individualStats -> Ppx_sexp_conv_lib.Sexp.t
val individualStats_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> individualStats
type aggregateStats = {
  1. total_packet_count : int64;
  2. total_byte_count : int64;
  3. flow_count : int32;
}
val sexp_of_aggregateStats : aggregateStats -> Ppx_sexp_conv_lib.Sexp.t
val aggregateStats_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> aggregateStats
type portStats = {
  1. port_no : Packet.int16;
  2. rx_packets : int64;
  3. tx_packets : int64;
  4. rx_bytes : int64;
  5. tx_bytes : int64;
  6. rx_dropped : int64;
  7. tx_dropped : int64;
  8. rx_errors : int64;
  9. tx_errors : int64;
  10. rx_frame_err : int64;
  11. rx_over_err : int64;
  12. rx_crc_err : int64;
  13. collisions : int64;
}
val sexp_of_portStats : portStats -> Ppx_sexp_conv_lib.Sexp.t
val portStats_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> portStats
type reply =
  1. | DescriptionRep of descriptionStats
  2. | IndividualFlowRep of individualStats list
  3. | AggregateFlowRep of aggregateStats
  4. | PortRep of portStats list
val sexp_of_reply : reply -> Ppx_sexp_conv_lib.Sexp.t
val reply_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> reply
type wildcards = {
  1. in_port : bool;
  2. dl_vlan : bool;
  3. dl_src : bool;
  4. dl_dst : bool;
  5. dl_type : bool;
  6. nw_proto : bool;
  7. tp_src : bool;
  8. tp_dst : bool;
  9. nw_src : int;
  10. nw_dst : int;
  11. dl_vlan_pcp : bool;
  12. nw_tos : bool;
}
val sexp_of_wildcards : wildcards -> Ppx_sexp_conv_lib.Sexp.t
val wildcards_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> wildcards
type portConfig = {
  1. down : bool;
  2. no_stp : bool;
  3. no_recv : bool;
  4. no_recv_stp : bool;
  5. no_flood : bool;
  6. no_fwd : bool;
  7. no_packet_in : bool;
}
val sexp_of_portConfig : portConfig -> Ppx_sexp_conv_lib.Sexp.t
val portConfig_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> portConfig
type stpState =
  1. | Listen
  2. | Learn
  3. | Forward
  4. | Block
val sexp_of_stpState : stpState -> Ppx_sexp_conv_lib.Sexp.t
val stpState_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> stpState
type portState = {
  1. down : bool;
  2. stp_state : stpState;
}
val sexp_of_portState : portState -> Ppx_sexp_conv_lib.Sexp.t
val portState_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> portState
type portFeatures = {
  1. f_10MBHD : bool;
  2. f_10MBFD : bool;
  3. f_100MBHD : bool;
  4. f_100MBFD : bool;
  5. f_1GBHD : bool;
  6. f_1GBFD : bool;
  7. f_10GBFD : bool;
  8. copper : bool;
  9. fiber : bool;
  10. autoneg : bool;
  11. pause : bool;
  12. pause_asym : bool;
}
val sexp_of_portFeatures : portFeatures -> Ppx_sexp_conv_lib.Sexp.t
val portFeatures_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> portFeatures
type portDescription = {
  1. port_no : portId;
  2. hw_addr : Packet.dlAddr;
  3. name : string;
  4. config : portConfig;
  5. state : portState;
  6. curr : portFeatures;
  7. advertised : portFeatures;
  8. supported : portFeatures;
  9. peer : portFeatures;
}
val sexp_of_portDescription : portDescription -> Ppx_sexp_conv_lib.Sexp.t
val portDescription_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> portDescription
module Wildcards : sig ... end
module Match : sig ... end
module PseudoPort : sig ... end
module Timeout : sig ... end
module Action : sig ... end
module FlowMod : sig ... end
module FlowRemoved : sig ... end
module PacketOut : sig ... end
module PortDescription : sig ... end
module PortStatus : sig ... end
module SwitchFeatures : sig ... end

Switch features data structure. See Section 5.3.1 of the OpenFlow 1.0 specification.

module SwitchConfig : sig ... end
module StatsRequest : sig ... end
module StatsReply : sig ... end
module Error : sig ... end

An error message. See Section 5.4.4 of the OpenFlow 1.0 specification.

module Vendor : sig ... end

A VENDOR message. See Section 5.5.4 of the OpenFlow 1.0 specification.

module Message : sig ... end

A subset of the OpenFlow 1.0 messages defined in Section 5.1 of the specification.

Pretty printing

In general, each submodule contains pretty-printing functions for the types defined therein. This section defines pretty printers for top-level types.

val string_of_switchId : switchId -> string

string_of_switchId sw pretty-prints sw in hex.

val string_of_portId : portId -> string

string_of_portId p pretty-prints p.

val string_of_queueId : queueId -> string

string_of_queueId q pretty-prints q.

Parsing exceptions

These exceptions may occur when parsing OpenFlow messages.

Convenient Functions

val parse_payload : payload -> Packet.packet
val marshal_payload : int32 option -> Packet.packet -> payload

marshal_payload buf pkt serializes pkt, where buf is an optional buffer ID.

val match_all : pattern

A pattern that matches all packets. (All fields wildcarded.)

val add_flow : Packet.int16 -> pattern -> ?idle_to:timeout -> ?notify_removed:bool -> action list -> flowMod

add_flow priority pattern action_sequence creates a FlowMod.t instruction that adds a new flow table entry with the specified priority, pattern, and action_sequence.

The entry is permanent (i.e., does not timeout), its cookie is zero, etc.

val delete_flow_strict : Packet.int16 -> pattern -> pseudoPort option -> flowMod
val delete_all_flows : flowMod

Printing and Debugging

val packetIn_to_string : packetIn -> string
val reply_to_string : reply -> string
OCaml

Innovation. Community. Security.