Class: Trema::Hello
- Inherits:
-
Object
- Object
- Trema::Hello
- Defined in:
- ruby/trema/hello.c
Instance Method Summary collapse
-
#initialize(*args) ⇒ Hello
constructor
Creates a Hello OpenFlow message.
-
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
Constructor Details
#initialize ⇒ Hello #initialize(transaction_id) ⇒ Hello #initialize(options) ⇒ Hello
Creates a Hello 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/hello.c', line 61
static VALUE
hello_init( int argc, VALUE *argv, VALUE self ) {
buffer *hello = NULL;
Data_Get_Struct( self, buffer, hello );
VALUE options = Qnil;
if ( rb_scan_args( argc, argv, "01", &options ) == 0 ) {
set_xid( hello, get_transaction_id() );
}
else {
if ( options == Qnil ) {
set_xid( hello, get_transaction_id() );
}
else if ( rb_obj_is_kind_of( options, rb_cInteger ) == Qtrue ) {
validate_xid( options );
set_xid( hello, ( 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( hello, ( uint32_t ) NUM2UINT( xid ) );
}
else {
set_xid( hello, get_transaction_id() );
}
}
}
return self;
}
|
Instance Method Details
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
111 112 113 114 |
# File 'ruby/trema/hello.c', line 111 static VALUE hello_transaction_id( VALUE self ) { return get_xid( self ); } |