A Discrete-Event Network Simulator
API
ofswitch13-interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 University of Campinas (Unicamp)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Luciano Jerez Chaves <ljerezchaves@gmail.com>
18  */
19 
30 #ifndef OFSWITCH13_INTERFACE_H
31 #define OFSWITCH13_INTERFACE_H
32 
33 #include <ns3/csma-module.h>
34 #include <ns3/log.h>
35 #include <ns3/packet.h>
36 #include <ns3/simulator.h>
37 #include <ns3/socket.h>
38 
39 extern "C"
40 {
41 #include <bofuss/action_set.h>
42 #include <bofuss/datapath.h>
43 #include <bofuss/dp_actions.h>
44 #include <bofuss/dp_buffers.h>
45 #include <bofuss/dp_control.h>
46 #include <bofuss/dp_ports.h>
47 #include <bofuss/dpctl.h>
48 #include <bofuss/flow_entry.h>
49 #include <bofuss/flow_table.h>
50 #include <bofuss/group_entry.h>
51 #include <bofuss/group_table.h>
52 #include <bofuss/match_std.h>
53 #include <bofuss/meter_entry.h>
54 #include <bofuss/meter_table.h>
55 #include <bofuss/ofl-actions.h>
56 #include <bofuss/ofl-err.h>
57 #include <bofuss/ofl-messages.h>
58 #include <bofuss/ofl-print.h>
59 #include <bofuss/ofl-structs.h>
60 #include <bofuss/ofpbuf.h>
61 #include <bofuss/openflow.h>
62 #include <bofuss/oxm-match.h>
63 #include <bofuss/packet_handle_std.h>
64 #include <bofuss/packet.h>
65 #include <bofuss/pipeline.h>
66 #include <bofuss/timeval.h>
67 #include <bofuss/vlog.h>
68 }
69 
70 namespace ns3
71 {
72 
80 typedef void (*OpenFlowCallback)(Ptr<Packet> packet);
81 
93 void EnableBofussLog(bool printToFile = false,
94  std::string prefix = "",
95  bool explicitFilename = false,
96  std::string customLevels = "");
97 
108 struct ofpbuf* BufferFromPacket(Ptr<const Packet> packet,
109  size_t bodyRoom,
110  size_t headRoom = 0);
111 
121 Ptr<Packet> PacketFromMsg(struct ofl_msg_header* msg, uint32_t xid = 0);
122 
131 Ptr<Packet> PacketFromBuffer(struct ofpbuf* buffer);
132 
133 } // namespace ns3
134 #endif /* OFSWITCH13_INTERFACE_H */
Ptr< Packet > PacketFromMsg(struct ofl_msg_header *msg, uint32_t xid)
Create a new ns3::Packet from internal OFLib message.
void EnableBofussLog(bool printToFile, std::string prefix, bool explicitFilename, std::string customLevels)
Enable the logging system of the BOFUSS library.
Ptr< Packet > PacketFromBuffer(struct ofpbuf *buffer)
Create a new ns3::Packet from internal BOFUSS buffer.
struct ofpbuf * BufferFromPacket(Ptr< const Packet > packet, size_t bodyRoom, size_t headRoom)
Create an internal BOFUSS buffer from ns3::Packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void(* OpenFlowCallback)(Ptr< Packet > packet)
TracedCallback signature for sending packets from CsmaNetDevice to OpenFlow pipeline.