Class: Trema::FeaturesRequest
- Inherits:
-
Object
- Object
- Trema::FeaturesRequest
- Defined in:
- ruby/trema/features-request.c
Instance Method Summary collapse
-
#initialize(*args) ⇒ FeaturesRequest
constructor
Creates a FeaturesRequest OpenFlow message.
-
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
Constructor Details
#initialize ⇒ FeaturesRequest #initialize(transaction_id) ⇒ FeaturesRequest #initialize(options) ⇒ FeaturesRequest
Creates a FeaturesRequest OpenFlow message.
61 62 63 64 65 66 67 68 69 70 71 72 73 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 |
# File 'ruby/trema/features-request.c', line 61
static VALUE
features_request_init( int argc, VALUE *argv, VALUE self ) {
buffer *features_request = NULL;
Data_Get_Struct( self, buffer, features_request );
VALUE options = Qnil;
if ( rb_scan_args( argc, argv, "01", &options ) == 0 ) {
set_xid( features_request, get_transaction_id() );
}
else {
if ( options == Qnil ) {
set_xid( features_request, get_transaction_id() );
}
else if ( rb_obj_is_kind_of( options, rb_cInteger ) == Qtrue ) {
validate_xid( options );
set_xid( features_request, ( uint32_t ) NUM2UINT( options ) );
}
else {
Check_Type( options, T_HASH );
VALUE tmp = Qnil;
VALUE xid = Qnil;
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "transaction_id" ) ) );
if ( tmp != Qnil ) {
xid = tmp;
}
tmp = rb_hash_aref( options, ID2SYM( rb_intern( "xid" ) ) );
if ( tmp != Qnil ) {
xid = tmp;
}
if ( xid != Qnil ) {
validate_xid( xid );
set_xid( features_request, ( uint32_t ) NUM2UINT( xid ) );
}
else {
set_xid( features_request, get_transaction_id() );
}
}
}
return self;
}
|
Instance Method Details
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
112 113 114 115 |
# File 'ruby/trema/features-request.c', line 112 static VALUE features_request_transaction_id( VALUE self ) { return get_xid( self ); } |