Class: Trema::FeaturesReply
- Inherits:
-
Object
- Object
- Trema::FeaturesReply
- Defined in:
- ruby/trema/features-reply.c
Instance Method Summary collapse
-
#actions ⇒ Number
Supported actions expressed as a 32-bit bitmap.
-
#capabilities ⇒ Number
Supported capabilities expressed as a 32-bit bitmap.
-
#datapath_id ⇒ Number
Message originator identifier.
-
#initialize(options) ⇒ FeaturesReply
constructor
Creates a FeaturesReply message.
-
#n_buffers ⇒ Number
Maximum number of packets that can be buffered at once.
-
#n_tables ⇒ Number
Number of supported tables.
-
#physical_ports ⇒ Array<Port>
An array of Port objects detailing physical port description and function.
-
#ports ⇒ Array<Port>
An array of Port objects detailing port description and function.
-
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
Constructor Details
#initialize(options) ⇒ FeaturesReply
Creates a FeaturesReply message. A user would not explicitly instantiate a Trema::FeaturesReply object but would be created while parsing the OFPT_FEATURES_REPLY message.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'ruby/trema/features-reply.c', line 74
static VALUE
features_reply_init( VALUE self, VALUE options ) {
buffer *buf = NULL;
Data_Get_Struct( self, buffer, buf );
struct ofp_switch_features *features_reply = buf->data;
VALUE tmp = Qnil;
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "datapath_id" ) ) );
if ( tmp == Qnil ) {
rb_raise( rb_eArgError, ":datapath_id is a mandatory option" );
}
features_reply->datapath_id = htonll( NUM2ULL( tmp ) );
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "transaction_id" ) ) );
if ( tmp == Qnil ) {
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "xid" ) ) );
if ( tmp == Qnil ) {
rb_raise( rb_eArgError, ":transaction_id is a mandatory option" );
}
}
features_reply->header.xid = htonl( ( uint32_t ) NUM2UINT( tmp ) );
features_reply->n_buffers = 0;
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "n_buffers" ) ) );
if ( tmp != Qnil ) {
features_reply->n_buffers = htonl( ( uint32_t ) NUM2UINT( tmp ) );
}
features_reply->n_tables = 1;
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "n_tables" ) ) );
if ( tmp != Qnil ) {
features_reply->n_tables = ( uint8_t ) NUM2UINT( tmp );
}
features_reply->capabilities = 0;
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "capabilities" ) ) );
if ( tmp != Qnil ) {
features_reply->capabilities = htonl( ( uint32_t ) NUM2UINT( tmp ) );
}
features_reply->actions = htonl( 1 << OFPAT_OUTPUT );
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "actions" ) ) );
if ( tmp != Qnil ) {
features_reply->actions = htonl( ( uint32_t ) NUM2UINT( tmp ) );
}
rb_iv_set( self, "@attribute", options );
return self;
}
|
Instance Method Details
#actions ⇒ Number
Supported actions expressed as a 32-bit bitmap.
197 198 199 200 |
# File 'ruby/trema/features-reply.c', line 197 static VALUE features_reply_actions( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "actions" ) ) ); } |
#capabilities ⇒ Number
Supported capabilities expressed as a 32-bit bitmap.
186 187 188 189 |
# File 'ruby/trema/features-reply.c', line 186 static VALUE features_reply_capabilities( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "capabilities" ) ) ); } |
#datapath_id ⇒ Number
Message originator identifier.
131 132 133 134 |
# File 'ruby/trema/features-reply.c', line 131 static VALUE features_reply_datapath_id( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "datapath_id" ) ) ); } |
#n_buffers ⇒ Number
Maximum number of packets that can be buffered at once.
164 165 166 167 |
# File 'ruby/trema/features-reply.c', line 164 static VALUE features_reply_n_buffers( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "n_buffers" ) ) ); } |
#n_tables ⇒ Number
Number of supported tables.
175 176 177 178 |
# File 'ruby/trema/features-reply.c', line 175 static VALUE features_reply_n_tables( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "n_tables" ) ) ); } |
#physical_ports ⇒ Array<Port>
An array of Port objects detailing physical port description and function.
219 220 221 222 |
# File 'ruby/trema/features-reply.c', line 219 static VALUE features_reply_physical_ports( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "physical_ports" ) ) ); } |
#ports ⇒ Array<Port>
An array of Port objects detailing port description and function.
208 209 210 211 |
# File 'ruby/trema/features-reply.c', line 208 static VALUE features_reply_ports( VALUE self ) { return rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "ports" ) ) ); } |
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'ruby/trema/features-reply.c', line 142
static VALUE
features_reply_transaction_id( VALUE self ) {
VALUE xid = Qnil;
xid = rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "transaction_id" ) ) );
if ( xid != Qnil ) {
return xid;
}
xid = rb_hash_aref( rb_iv_get( self, "@attribute" ), ID2SYM( rb_intern( "xid" ) ) );
if ( xid != Qnil ) {
return xid;
}
return Qnil;
}
|