Class: Trema::QueueGetConfigRequest
- Inherits:
-
Object
- Object
- Trema::QueueGetConfigRequest
- Defined in:
- ruby/trema/queue-get-config-request.c
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ QueueGetConfigRequest
constructor
Request message to retrieve configuration about a queue port setting that quantifies a QoS.
-
#port ⇒ Number
The port the queue is attached to.
-
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
Constructor Details
#initialize(options = {}) ⇒ QueueGetConfigRequest
Request message to retrieve configuration about a queue port setting that quantifies a QoS. Each flow entry contains a queue that a flow is mapped to set constraints to define some restriction like maximum/minimum data rate.
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 |
# File 'ruby/trema/queue-get-config-request.c', line 64
static VALUE
queue_get_config_request_init( int argc, VALUE *argv, VALUE self ) {
buffer *queue_get_config_request;
Data_Get_Struct( self, buffer, queue_get_config_request );
uint32_t xid = get_transaction_id();
uint16_t port = 1;
VALUE options;
if ( rb_scan_args( argc, argv, "01", &options ) == 1 ) {
Check_Type( options, T_HASH );
VALUE xid_ruby;
if ( ( xid_ruby = rb_hash_aref( options, ID2SYM( rb_intern( "transaction_id" ) ) ) ) != Qnil ) {
if ( rb_funcall( xid_ruby, rb_intern( "unsigned_32bit?" ), 0 ) == Qfalse ) {
rb_raise( rb_eArgError, "Transaction ID must be an unsigned 32-bit integer" );
}
xid = ( uint32_t ) NUM2UINT( xid_ruby );
}
VALUE port_ruby;
if ( ( port_ruby = rb_hash_aref( options, ID2SYM( rb_intern( "port" ) ) ) ) != Qnil ) {
if ( rb_funcall( port_ruby, rb_intern( "unsigned_16bit?" ), 0 ) == Qfalse ) {
rb_raise( rb_eArgError, "Port must be an unsigned 16-bit integer" );
}
port = ( uint16_t ) NUM2UINT( port_ruby );
}
}
( ( struct ofp_header * ) ( queue_get_config_request->data ) )->xid = htonl( xid );
( ( struct ofp_queue_get_config_request * ) ( queue_get_config_request->data ) )->port = htons( port );
return self;
}
|
Instance Method Details
#port ⇒ Number
The port the queue is attached to.
115 116 117 118 119 120 121 |
# File 'ruby/trema/queue-get-config-request.c', line 115
static VALUE
queue_get_config_request_port( VALUE self ) {
buffer *queue_get_config_request;
Data_Get_Struct( self, buffer, queue_get_config_request );
uint16_t port = ntohs( ( ( struct ofp_queue_get_config_request * ) ( queue_get_config_request->data ) )->port );
return UINT2NUM( port );
}
|
#transaction_id ⇒ Number
Transaction ids, message sequence numbers matching requests to replies.
101 102 103 104 105 106 107 |
# File 'ruby/trema/queue-get-config-request.c', line 101
static VALUE
queue_get_config_request_transaction_id( VALUE self ) {
buffer *queue_get_config_request;
Data_Get_Struct( self, buffer, queue_get_config_request );
uint32_t xid = ntohl( ( ( struct ofp_header * ) ( queue_get_config_request->data ) )->xid );
return UINT2NUM( xid );
}
|