Class: Trema::StatsReply

Inherits:
Object
  • Object
show all
Defined in:
ruby/trema/stats-reply.c

Constant Summary collapse

OFPST_DESC =
INT2NUM( OFPST_DESC )
OFPST_FLOW =
INT2NUM( OFPST_FLOW )
OFPST_AGGREGATE =
INT2NUM( OFPST_AGGREGATE )
OFPST_TABLE =
INT2NUM( OFPST_TABLE )
OFPST_PORT =
INT2NUM( OFPST_PORT )
OFPST_QUEUE =
INT2NUM( OFPST_QUEUE )
OFPST_VENDOR =
INT2NUM( OFPST_VENDOR )

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ StatsReply

A Trema::StatsReply instance that encapsulates the header part of the OFPT_STATS_REPLY message. The body of the reply message may be an array of one or more specific reply objects designated by the type. The user would not instantiate stats. reply objects explicitly, the stats. reply handler would normally do that while parsing the message.

Examples:

StatsReply.new(
  :datapath_id => 0xabc,
  :transaction_id => 123,
  :type => OFPST_FLOW
  :flags => 0,
  :stats => [FlowStatsReply]
)

Parameters:

  • options (Hash) (defaults to: {})

    the options hash.

Options Hash (options):

  • :datapath_id (Number)

    message originator identifier.

  • :transaction_id (Number)

    transaction_id value carried over from request.

  • :type (Number)

    type id for the reply.

  • :flags (Number)

    if set to 1 more replies would follow, 0 for the last reply.

  • :stats (Array)

    an array of objects associated with the reply instance.



67
68
69
70
71
# File 'ruby/trema/stats-reply.c', line 67

static VALUE
stats_reply_init( VALUE self, VALUE options ) {
  rb_iv_set( self, "@attribute", options );
  return self;
}

Instance Method Details

#datapath_idNumber

Message originator identifier.

Returns:

  • (Number)

    the value of datapath_id.



79
80
81
82
# File 'ruby/trema/stats-reply.c', line 79

static VALUE
stats_reply_datapath_id( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "datapath_id" ) ) );
}

#flagsNumber

Flag that indicates if more reply message(s) expected to follow.

Returns:

  • (Number)

    the value of flags.



112
113
114
115
# File 'ruby/trema/stats-reply.c', line 112

static VALUE
stats_reply_flags( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "flags" ) ) );
}

#statsArray<DescStatsReply>, ...

A list of reply type objects for this message.

Returns:



136
137
138
139
# File 'ruby/trema/stats-reply.c', line 136

static VALUE
stats_reply_stats( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "stats" ) ) );
}

#transaction_idNumber

Transaction ids, message sequence numbers matching requests to replies.

Returns:

  • (Number)

    the value of transaction_id.



90
91
92
93
# File 'ruby/trema/stats-reply.c', line 90

static VALUE
stats_reply_transaction_id( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "transaction_id" ) ) );
}

#typeNumber

The type of this reply.

Returns:

  • (Number)

    the value of type.



101
102
103
104
# File 'ruby/trema/stats-reply.c', line 101

static VALUE
stats_reply_type( VALUE self ) {
  return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "type" ) ) );
}