Matt Ryan
and 1 contributors

NAME

Net::OpenFlow::Protocol - Protocol library for OpenFlow.

VERSION

Version 0.01

SYNOPSIS

This module allows encoding and decoding of OpenFlow messages from an OpenFlow switch.

use Net::OpenFlow::Protocol;

my $ofp = Net::OpenFlow::Protocol->new;

my $of_message = $ofp->ofpt_decode(\$of_message);

my $of_message_type = $of_message->{'ofp_header'}{'type'};

FUNCTIONS

bitfield_decode

This function will decode the bitfield specified by $bitfield into the $enum_type.

my $ret = $ofp->bitfield_decode($of_version, $enum_type, $bitfield);

bitfield_encode

This function will encode bits specified into the bitfield $enum_type.

my $ret = $ofp->bitfield_encode($of_version, $enum_type, $bits);

enum_lookup

This function will

my $ret = $ofp->enum_lookup($of_version, $enum_type, $lookup);

enum_lookup__by_value

This function will

my $ret = $ofp->enum_lookup__by_value($of_version, $enum_type, $lookup);

new

This is the constructor for the Net::OpenFlow::Protocol module.

my $ofp = Net::OpenFlow::Protocol->new;

ofpt_decode

This function decodes OpenFlow messages. The input is a reference to a scalar containing the OpenFlow message. The returned value is a hash reference containing the decoded message parameters. This always contains a ofp_header hash in the returned value which will have a type describing the message received. Based on this value the other parameters may be interpreted.

my $ret = $ofp->ofpt_decode(\$of_message);

my $of_message_type = $ret->{'ofp_header'}{'type'};

ofpt_encode

This function encodes OpenFlow messages. The inputs are the OpenFlow protocol version, the type of message to be encoded, the xid, arguements to the type of message and any message body. The struct_args are the members of the relevant OpenFlow struct. THe struct_body is any optional payload that will be attached to the message.

my $ret = $ofp->ofpt_encode($of_version, $of_type, $xid, $struct_args, $struct_body);