netcore-1.0.0: The NetCore compiler and runtime system for OpenFlow networks.

Safe HaskellSafe-Infered

Frenetic.NetCore.Types

Contents

Synopsis

Basic types

type Switch = Word64Source

A switch's unique identifier.

type Port = Word16Source

The number of a physical port.

type Vlan = Word16Source

VLAN tags. Only the lower 12-bits are used.

data Loc Source

Loc uniquely identifies a port at a switch.

Constructors

Loc Switch Port 

Instances

data PseudoPort Source

Logical ports.

Constructors

Physical Port 
AllPorts 

type Word48 = EthernetAddressSource

Ethernet addresses are 48-bits wide.

Actions

data Action Source

Actions to perform on packets.

data Counter Source

Constructors

CountPackets 
CountBytes 

Instances

data Modification Source

For each fields with a value Just v, modify that field to be v. If the field is Nothing then there is no modification of that field.

Basic actions

countPktsSource

Arguments

:: Int

polling interval, in milliseconds

-> IO (Chan (Switch, Integer), Action) 

Periodically polls the network to counts the number of bytes received.

Returns an Action and a channel. When the Action is used in the active Policy, the controller periodically reads the packet counters on the network. The controller returns the number of matching packets on each switch.

countBytesSource

Arguments

:: Int

polling interval, in milliseconds

-> IO (Chan (Switch, Integer), Action) 

Sends packets to the controller.

Returns an Action and a channel. When the Action is used in the active Policy, all matching packets are sent to the controller. These packets are written into the channel.

Inspecting actions

Patterns

Predicates

data Predicate Source

Predicates to match packets.

Constructors

PrPattern Pattern

Match with a simple pattern.

PrTo Switch

Match only at this switch.

PrUnion Predicate Predicate

Match either predicates.

PrIntersect Predicate Predicate

Match both predicates.

PrNegate Predicate

PrNegate P matches packets that do not match P.

exactMatch :: Packet -> PredicateSource

A predicate that exactly matches a packet's headers.

Packets

data Packet Source

Packets' headers.

Constructors

Packet 

Fields

pktDlSrc :: Word48

source ethernet address

pktDlDst :: Word48

destination ethernet address

pktDlTyp :: Word16

ethernet type code (e.g., 0x800 for IP packets)

pktDlVlan :: Maybe Vlan

VLAN tag

pktDlVlanPcp :: Word8

VLAN priority code

pktNwSrc :: Maybe Word32

source IP address for IP packets

pktNwDst :: Maybe Word32

destination IP address for IP packets

pktNwProto :: Word8

IP protocol number (e.g., 6 for TCP segments)

pktNwTos :: Word8

IP TOS field

pktTpSrc :: Maybe Word16

source port for IP packets

pktTpDst :: Maybe Word16

destination port for IP packets

pktInPort :: Port

ingress port on the switch where the packet was received

Instances

Policies

data Policy Source

Policies denote functions from (switch, packet) to packets.

Constructors

PoBottom

Performs no actions.

PoBasic Predicate Action

Performs the given action on packets matching the given predicate.

PoUnion Policy Policy

Performs the actions of both P1 and P2.

Tools

interesting :: String -> Pattern -> [String]Source

Build a list of the non-wildcarded patterns with sep between field and value

prUnIntersect :: Predicate -> [Predicate]Source

Get back all predicates in the intersection. Does not return any naked intersections.

prUnUnion :: Predicate -> [Predicate]Source

Get back all predicates in the union. Does not return any naked unions.

poUnUnion :: Policy -> [Policy]Source

Get back all basic policies in the union. Does not return any unions.

poDom :: Policy -> PredicateSource

Returns a predicate that matches the domain of the policy.

size :: Policy -> IntSource

Returns the approximate size of the policy