Class: Trema::PortStatsRequest
- Inherits:
-
StatsRequest
- Object
- StatsRequest
- Trema::PortStatsRequest
- Defined in:
- ruby/trema/stats-request.c
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PortStatsRequest
constructor
A PortStatsRequest object instance to request port statistics.
-
#port_no ⇒ Number
Restrict port statistics to a specific port_no or to all ports.
Methods inherited from StatsRequest
Constructor Details
#initialize(options = {}) ⇒ PortStatsRequest
A Trema::PortStatsRequest object instance to request port statistics. Request port statistics.
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'ruby/trema/stats-request.c', line 483
static VALUE
port_stats_request_init( int argc, VALUE *argv, VALUE self ) {
VALUE options;
if ( !rb_scan_args( argc, argv, "01", &options ) ) {
options = rb_hash_new();
}
rb_call_super( 1, &options );
VALUE port_no = rb_hash_aref( options, ID2SYM( rb_intern( "port_no" ) ) );
if ( port_no == Qnil ) {
port_no = UINT2NUM( OFPP_NONE );
}
rb_iv_set( self, "@port_no", port_no );
buffer *message;
Data_Get_Struct( self, buffer, message );
( ( struct ofp_header * ) ( message->data ) )->xid = htonl( get_stats_request_num2uint( self, "@transaction_id" ) );
struct ofp_stats_request *stats_request;
stats_request = ( struct ofp_stats_request * ) message->data;
stats_request->flags = htons ( get_stats_request_num2uint16( self, "@flags" ) );
struct ofp_port_stats_request *port_stats_request = ( struct ofp_port_stats_request * ) stats_request->body;
port_stats_request->port_no = htons( get_stats_request_num2uint16( self, "@port_no" ) );
return self;
}
|
Instance Method Details
#port_no ⇒ Number
Restrict port statistics to a specific port_no or to all ports.
237 238 239 240 |
# File 'ruby/trema/stats-request.c', line 237 static VALUE stats_port_no( VALUE self ) { return rb_iv_get( self, "@port_no" ); } |