package frenetic
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=baf754df13a759c32f2c86a1b6f328da
sha512=80140900e7009ccab14b25e244fe7edab87d858676f8a4b3799b4fea16825013cf68363fe5faec71dd54ba825bb4ea2f812c2c666390948ab217ffa75d9cbd29
doc/frenetic.kernel/Frenetic_kernel/Packet/index.html
Module Frenetic_kernel.PacketSource
Library for constructing, marshaling and parsing data packets. These packets are independent of OpenFlow message information - they are mostly used for the payloads of PacketIn and PacketOut messages.
Packet types
It is possible to navigate the structure of a packet directly using the types defined here. However, using Accessors may be more convenient.
int8 is the type of 8-bit integers.
int16 is the type of 16-bit integers.
int48 is the type of 48-bit integers.
dlVlan is the type of VLAN identifiers. A value of None indicates that no 802.1Q (VLAN) header is set, which is distinct from setting the VLAN to 0.
dlVlanDei is the type of 802.1Q (VLAN) drop eligible indicator.
nwAddr is the type of IPv4 addresses.
ipv6Addr is the type of IPv6 addresses.
The type nw represents a packet at the network protocol level.
type packet = {dlSrc : dlAddr;(*Ethernet source address.
*)dlDst : dlAddr;(*Ethernet destination address.
*)dlVlan : dlVlan;(*802.1Q VLAN identifier, if any.
*)dlVlanDei : dlVlanDei;(*802.1Q VLAN Drop Eligible Indciator. Ignored if
*)dlVlanisNonedlVlanPcp : dlVlanPcp;(*802.1Q VLAN priority. Ignored if
*)dlVlanisNone.nw : nw;(*Network payload.
*)
}The type packet represents a packet at the ethernet protocol level.
Accessors
Mutators
setDlSrc pkt addr sets the ethernet source address of pkt to addr.
setDlDst pkt addr sets the ethernet destination address of pkt to addr.
setDlVlan pkt vlan sets the VLAN identifier of pkt to vlan.
setDlVlanPcp pkt pri sets the VLAN priority of pkt to pri.
setNwSrc pkt sets the source IP address of pkt if the packet carries an IP payload. Otherwise, it returns the packet unchanged.
setNwDst pkt sets the destination IP address of pkt if the packet carries an IP payload. Otherwise, it returns the packet unchanged.
setNwTos pkt sets the IPv4 type of service of pkt if the packet carries an IP payload. Otherwise, it returns the packet unchanged.
setTpSrc pkt sets the transport protocol source port of pkt if the packet carries a TCP or UDP payload. Otherwise, it returns the packet unchanged.
setTpDst pkt sets the transport protocol destination port of pkt if the packet carries a TCP or UDP payload. Otherwise, it returns the packet unchanged.
Pretty Printing
mac_of_string string converts an colon-separated ethernet address to a dlAddr *
string_of_dlTyp typ pretty-prints an ethernet frame type.
string_of_dlVlan vlan pretty-prints an 802.1Q VLAN identifier.
string_of_dlVlanPcp p pretty-prints an 802.1Q VLAN priority.
ip_of_string string converts an dot-separated IPv4 address to a nwAddr *
string_of_ipv6 t Converts a colon-separated IPv6 address to ipv6Addr. *
string_of_tpPort p pretty-prints a transport protocol port number.
bytes_of_mac mac returns a bit-string representation of mac.
mac_of_bytes str constructs a dlAddr from a bit-string representation.
Serialization
format_packet fmt pkt uses formatter fmt to format pkt.