This class contains helper functions for communicating with OpenFlow switches.
More...
#include <SwitchConnectionUtil.h>
This class contains helper functions for communicating with OpenFlow switches.
- Author
- Andre Kutzleb
- Date
- 18.07.2015
Attempts to perform an OpenFlow handshake over the given socket and returns the outcome.
Exchanges Hello, then a Feature-Request/Reply with the opposite side.
- Parameters
-
| socket | the connection used for the handshake. |
| ofVersion | the openFlow version used in the handshake. the handshake will fail if the switch does nto speak this version. |
- Returns
- a HandshakeResult object detailing the result of the handshake.
| static void SwitchConnectionUtil::buildPacketInTopic |
( |
MessageType & |
topic, |
|
|
of_packet_in_t *const |
packetIn, |
|
|
const uint64_t |
switchId |
|
) |
| |
|
inlinestatic |
Constructs a MessageType (topic) based on the payload of the given packetIn OpenFlow message using the libtins library to identify ethertype/protocol type.
- Parameters
-
| topic | topic to append bytes (at least ethertype) to. |
| packetIn | OpenFlow PACKET_IN message with an EthernetII frame as payload |
| switchId | for the HPMOM packet, UDP topics are appended with the id of the switch - this is not necessary normally. |
- Returns
- a MessageType depending on the payload according to the definitions in SwitchAdapter.topics
| static void SwitchConnectionUtil::buildSimplePacketInTopic |
( |
MessageType & |
topic, |
|
|
of_packet_in_t *const |
packetIn |
|
) |
| |
|
inlinestatic |
Extends to basic packetIn topic with ethertype / protocoltype (if ipv4/ipv6). Uses fixed offsets and may produce wrong results. may be faster than the libtins based topic construction.
USE AT YOUR OWN RISK.
- Parameters
-
| topic | topic to append bytes (at least ethertype) to. |
| packetIn | OpenFlow PACKET_IN message with an EthernetII frame as payload |
| static bool SwitchConnectionUtil::parseOpenFlowFromSocketToBuffer |
( |
uint8_t * |
buffer, |
|
|
Poco::Net::SocketStream & |
fromSocket |
|
) |
| |
|
inlinestatic |
Reads an OpenFlow message from the given socket into the given buffer.
- Parameters
-
| buffer | the buffer that the function will write to. |
| fromSocket | the socket from which the OpenFlow message will be read. |
- Returns
- true if the read was sucessful, or false if the underlying connection failed while reading.
| static bool SwitchConnectionUtil::writeOpenFlowToSocket |
( |
Poco::Net::SocketStream & |
toSocket, |
|
|
uint8_t * |
buffer |
|
) |
| |
|
inlinestatic |
Writes the given OpenFlow message (contained in the buffer) to the given socket.
- Parameters
-
| toSocket | the socket where the OpenFlow message will be written to. |
| buffer | the buffer containing an OpenFlow message to be written to the socket. |
- Returns
- true if the write was successful, or false if the underlying connection failed while writing.
| static bool SwitchConnectionUtil::writeOpenFlowToSocket |
( |
Poco::Net::SocketStream & |
toSocket, |
|
|
of_object_t *const |
openFlowMsg |
|
) |
| |
|
inlinestatic |
Writes the given OpenFlow message to the given socket.
- Parameters
-
| toSocket | the socket where the OpenFlow message will be written to. |
| openFlowMsg | the message to be written to the socket. |
- Returns
- true if the write was scucessful, or false if the underlying connection failed while writing.
| const int SwitchConnectionUtil::etherTypePos = 12 |
|
static |
| const int SwitchConnectionUtil::ethPayloadOffset = 14 |
|
static |
constants used for experimental topic construction
| const int SwitchConnectionUtil::ipv4 = 0x0800 |
|
static |
| const int SwitchConnectionUtil::ipv6 = 0x86DD |
|
static |
| const uint32_t SwitchConnectionUtil::OF_HEADER_LENGTH = 8 |
|
static |
length of the OpenFlow message header in bytes
The documentation for this class was generated from the following files: