33 bool explicitFilename,
34 std::string customLevels)
37 vlog_set_pattern(VLF_ANY_FACILITY,
"%d{%ss} [%c|%p] %m");
41 std::string filename = prefix;
42 if (!explicitFilename)
44 if (filename.size() && filename.back() !=
'-')
48 filename +=
"BOFUSS.log";
50 vlog_set_log_file(filename.c_str());
51 vlog_set_levels(VLM_ANY_MODULE, VLF_FILE, VLL_DBG);
55 vlog_set_levels(VLM_ANY_MODULE, VLF_CONSOLE, VLL_DBG);
58 if (customLevels.size())
60 vlog_set_levels_from_string(customLevels.c_str());
70 struct ofpbuf* buffer;
74 buffer = ofpbuf_new_with_headroom(bodyRoom, headRoom);
88 struct ofpbuf* buffer;
90 buffer = ofpbuf_new(0);
91 error = ofl_msg_pack(msg, xid, &buf, &buf_size,
nullptr);
94 ofpbuf_use(buffer, buf, buf_size);
95 ofpbuf_put_uninit(buffer, buf_size);
96 packet = Create<Packet>((uint8_t*)buffer->data, buffer->size);
97 ofpbuf_delete(buffer);
107 return Create<Packet>((uint8_t*)buffer->data, buffer->size);
172 struct ofl_msg_header* req,
173 struct ofl_msg_header** repl)
static void DpctlSendAndPrint(struct vconn *vconn, struct ofl_msg_header *msg)
Overriding BOFUSS dpctl_send_and_print and dpctl_transact_and_print weak functions from utilities/dpc...
static void DpActionsOutputPort(struct packet *pkt, uint32_t outPort, uint32_t outQueue, uint16_t maxLength, uint64_t cookie)
Overriding BOFUSS dp_actions_output_port weak function from udatapath/dp_actions.c.
static int SendOpenflowBufferToRemote(struct ofpbuf *buffer, struct remote *remote)
Overriding BOFUSS send_openflow_buffer_to_remote weak function from udatapath/datapath....
static void SendPacketToController(struct pipeline *pl, struct packet *pkt, uint8_t tableId, uint8_t reason)
Overriding BOFUSS send_packet_to_controller weak function from udatapath/pipeline....
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
static Time Now()
Return the current simulation virtual time.
int64_t GetMilliSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
int64_t ToInteger(Unit unit) const
Get the Time value expressed in a particular unit.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
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 send_packet_to_controller(struct pipeline *pl, struct packet *pkt, uint8_t table_id, uint8_t reason)
Overriding BOFUSS weak functions using static member functions.
void dpctl_transact_and_print(struct vconn *vconn, struct ofl_msg_header *req, struct ofl_msg_header **repl)
void dp_actions_output_port(struct packet *pkt, uint32_t out_port, uint32_t out_queue, uint16_t max_len, uint64_t cookie)
time_t time_now(void)
Overriding BOFUSS time_now weak function from timeval.c.
void dpctl_send_and_print(struct vconn *vconn, struct ofl_msg_header *msg)
long long int time_msec(void)
Overriding BOFUSS time_msec weak function from timeval.c.
int send_openflow_buffer_to_remote(struct ofpbuf *buffer, struct remote *remote)
uint32_t pktSize
packet size used for the simulation (in bytes)