A Discrete-Event Network Simulator
API
ns3::ofi::Stats Class Reference

OpenFlow statistics. More...

#include "openflow-interface.h"

+ Collaboration diagram for ns3::ofi::Stats:

Classes

struct  FlowStatsState
 State of the FlowStats request/reply. More...
 
struct  PortStatsState
 State of the PortStats request/reply. More...
 

Public Member Functions

 Stats (ofp_stats_types _type, size_t body_len)
 Constructor. More...
 
void DoCleanup (void *state)
 Cleans any state created by the init or dump functions. More...
 
int DoDump (Ptr< OpenFlowSwitchNetDevice > swtch, void *state, ofpbuf *buffer)
 Appends statistics for OpenFlowSwitchNetDevice to 'buffer'. More...
 
int DoInit (const void *body, int body_len, void **state)
 Prepares to dump some kind of statistics on the connected OpenFlowSwitchNetDevice. More...
 

Public Attributes

ofp_stats_types type
 Status type. More...
 

Private Member Functions

int DescStatsDump (void *state, ofpbuf *buffer)
 Dumps the stats description. More...
 
int FlowStatsInit (const void *body, int body_len, void **state)
 Initialize the stats. More...
 
int AggregateStatsInit (const void *body, int body_len, void **state)
 Initialize the stats. More...
 
int PortStatsInit (const void *body, int body_len, void **state)
 Initialize the stats. More...
 
int FlowStatsDump (Ptr< OpenFlowSwitchNetDevice > dp, FlowStatsState *state, ofpbuf *buffer)
 Dump the stats. More...
 
int AggregateStatsDump (Ptr< OpenFlowSwitchNetDevice > dp, ofp_aggregate_stats_request *state, ofpbuf *buffer)
 Dump the stats. More...
 
int TableStatsDump (Ptr< OpenFlowSwitchNetDevice > dp, void *state, ofpbuf *buffer)
 Dump the stats. More...
 
int PortStatsDump (Ptr< OpenFlowSwitchNetDevice > dp, PortStatsState *state, ofpbuf *buffer)
 Dump the stats. More...
 
int PortTableStatsDump (Ptr< OpenFlowSwitchNetDevice > dp, void *state, ofpbuf *buffer)
 Dump the stats. More...
 

Private Attributes

int(* AggregateDumpCallback )(sw_flow *flow, void *state)
 Aggregate dump callback functor. More...
 
int(* FlowDumpCallback )(sw_flow *flow, void *state)
 Flow dump callback functor. More...
 

Detailed Description

OpenFlow statistics.

Definition at line 147 of file openflow-interface.h.

Constructor & Destructor Documentation

◆ Stats()

ns3::ofi::Stats::Stats ( ofp_stats_types  _type,
size_t  body_len 
)

Constructor.

Parameters
_typeOpenFlow stats type.
body_lenStat body length.

Definition at line 30 of file openflow-interface.cc.

References max, NS_LOG_ERROR, and type.

Member Function Documentation

◆ AggregateStatsDump()

int ns3::ofi::Stats::AggregateStatsDump ( Ptr< OpenFlowSwitchNetDevice dp,
ofp_aggregate_stats_request *  state,
ofpbuf *  buffer 
)
private

Dump the stats.

Parameters
dpOpenFlow NetDevice.
stateState.
[out]bufferoutput buffer.
Returns
0 if successful

Definition at line 252 of file openflow-interface.cc.

References AggregateDumpCallback, and openflow-switch::swtch.

Referenced by DoDump().

+ Here is the caller graph for this function:

◆ AggregateStatsInit()

int ns3::ofi::Stats::AggregateStatsInit ( const void *  body,
int  body_len,
void **  state 
)
private

Initialize the stats.

Parameters
bodyBody member of the struct ofp_stats_request.
body_lenLength of the body member.
stateState information.
Returns
0 if successful, otherwise a negative error code.

Definition at line 234 of file openflow-interface.cc.

Referenced by DoInit().

+ Here is the caller graph for this function:

◆ DescStatsDump()

int ns3::ofi::Stats::DescStatsDump ( void *  state,
ofpbuf *  buffer 
)
private

Dumps the stats description.

Parameters
[in]stateThe state.
[out]bufferOutput buffer.
Returns
zero on success

Definition at line 143 of file openflow-interface.cc.

References ns3::OpenFlowSwitchNetDevice::GetHardwareDescription(), ns3::OpenFlowSwitchNetDevice::GetManufacturerDescription(), ns3::OpenFlowSwitchNetDevice::GetSerialNumber(), and ns3::OpenFlowSwitchNetDevice::GetSoftwareDescription().

Referenced by DoDump().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoCleanup()

void ns3::ofi::Stats::DoCleanup ( void *  state)

Cleans any state created by the init or dump functions.

May not be implemented if no cleanup is required.

Parameters
stateState information to clear.

Definition at line 117 of file openflow-interface.cc.

References type.

Referenced by ns3::OpenFlowSwitchNetDevice::StatsDone().

+ Here is the caller graph for this function:

◆ DoDump()

int ns3::ofi::Stats::DoDump ( Ptr< OpenFlowSwitchNetDevice swtch,
void *  state,
ofpbuf *  buffer 
)

Appends statistics for OpenFlowSwitchNetDevice to 'buffer'.

Parameters
swtchThe OpenFlowSwitchNetDevice this callback is associated with.
stateState information.
bufferBuffer to append stats reply to.
Returns
1 if it should be called again later with another buffer, 0 if it is done, or a negative errno value on failure.

Definition at line 93 of file openflow-interface.cc.

References AggregateStatsDump(), DescStatsDump(), FlowStatsDump(), PortStatsDump(), PortTableStatsDump(), openflow-switch::swtch, TableStatsDump(), and type.

Referenced by ns3::OpenFlowSwitchNetDevice::StatsDump().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoInit()

int ns3::ofi::Stats::DoInit ( const void *  body,
int  body_len,
void **  state 
)

Prepares to dump some kind of statistics on the connected OpenFlowSwitchNetDevice.

Parameters
bodyBody member of the struct ofp_stats_request.
body_lenLength of the body member.
stateState information.
Returns
0 if successful, otherwise a negative error code.

Definition at line 69 of file openflow-interface.cc.

References AggregateStatsInit(), FlowStatsInit(), PortStatsInit(), and type.

Referenced by ns3::OpenFlowSwitchNetDevice::ReceiveStatsRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FlowStatsDump()

int ns3::ofi::Stats::FlowStatsDump ( Ptr< OpenFlowSwitchNetDevice dp,
FlowStatsState state,
ofpbuf *  buffer 
)
private

Dump the stats.

Parameters
dpOpenFlow NetDevice.
stateState.
[out]bufferoutput buffer.
Returns
0 if successful

Definition at line 204 of file openflow-interface.cc.

References ns3::ofi::Stats::FlowStatsState::buffer, FlowDumpCallback, MAX_FLOW_STATS_BYTES, ns3::ofi::Stats::FlowStatsState::now, ns3::ofi::Stats::FlowStatsState::position, ns3::ofi::Stats::FlowStatsState::rq, openflow-switch::swtch, and ns3::ofi::Stats::FlowStatsState::table_idx.

Referenced by DoDump().

+ Here is the caller graph for this function:

◆ FlowStatsInit()

int ns3::ofi::Stats::FlowStatsInit ( const void *  body,
int  body_len,
void **  state 
)
private

Initialize the stats.

Parameters
bodyBody member of the struct ofp_stats_request.
body_lenLength of the body member.
stateState information.
Returns
0 if successful, otherwise a negative error code.

Definition at line 158 of file openflow-interface.cc.

Referenced by DoInit().

+ Here is the caller graph for this function:

◆ PortStatsDump()

int ns3::ofi::Stats::PortStatsDump ( Ptr< OpenFlowSwitchNetDevice dp,
PortStatsState state,
ofpbuf *  buffer 
)
private

Dump the stats.

Parameters
dpOpenFlow NetDevice.
stateState.
[out]bufferoutput buffer.
Returns
0 if successful

Definition at line 340 of file openflow-interface.cc.

References ns3::ofi::Port::mpls_ttl0_dropped, ns3::ofi::Port::netdev, NS_LOG_ERROR, ns3::ofi::Stats::PortStatsState::num_ports, port, ns3::ofi::Stats::PortStatsState::ports, ns3::ofi::Port::rx_bytes, ns3::ofi::Port::rx_packets, openflow-switch::swtch, ns3::ofi::Port::tx_bytes, ns3::ofi::Port::tx_dropped, and ns3::ofi::Port::tx_packets.

Referenced by DoDump().

+ Here is the caller graph for this function:

◆ PortStatsInit()

int ns3::ofi::Stats::PortStatsInit ( const void *  body,
int  body_len,
void **  state 
)
private

Initialize the stats.

Parameters
bodyBody member of the struct ofp_stats_request.
body_lenLength of the body member.
stateState information.
Returns
0 if successful, otherwise a negative error code.

Definition at line 326 of file openflow-interface.cc.

Referenced by DoInit().

+ Here is the caller graph for this function:

◆ PortTableStatsDump()

int ns3::ofi::Stats::PortTableStatsDump ( Ptr< OpenFlowSwitchNetDevice dp,
void *  state,
ofpbuf *  buffer 
)
private

Dump the stats.

Parameters
dpOpenFlow NetDevice.
stateState.
[out]bufferoutput buffer.
Returns
0 if successful

Definition at line 313 of file openflow-interface.cc.

References openflow-switch::swtch.

Referenced by DoDump().

+ Here is the caller graph for this function:

◆ TableStatsDump()

int ns3::ofi::Stats::TableStatsDump ( Ptr< OpenFlowSwitchNetDevice dp,
void *  state,
ofpbuf *  buffer 
)
private

Dump the stats.

Parameters
dpOpenFlow NetDevice.
stateState.
[out]bufferoutput buffer.
Returns
0 if successful

Definition at line 292 of file openflow-interface.cc.

References openflow-switch::swtch.

Referenced by DoDump().

+ Here is the caller graph for this function:

Member Data Documentation

◆ AggregateDumpCallback

int(* ns3::ofi::Stats::AggregateDumpCallback) (sw_flow *flow, void *state)
private

Aggregate dump callback functor.

Definition at line 236 of file openflow-interface.h.

Referenced by AggregateStatsDump().

◆ FlowDumpCallback

int(* ns3::ofi::Stats::FlowDumpCallback) (sw_flow *flow, void *state)
private

Flow dump callback functor.

Definition at line 234 of file openflow-interface.h.

Referenced by FlowStatsDump().

◆ type

ofp_stats_types ns3::ofi::Stats::type

Status type.

Definition at line 210 of file openflow-interface.h.

Referenced by Stats(), DoCleanup(), DoDump(), DoInit(), and ns3::OpenFlowSwitchNetDevice::StatsDump().


The documentation for this class was generated from the following files: