ruby/trema/port-mod.c in trema-0.4.3 vs ruby/trema/port-mod.c in trema-0.4.4
- old
+ new
@@ -55,11 +55,11 @@
* the options to create a message with.
*
* @param [Number] :port_no
* an index into datapath's ports list.
*
- * @param [String,Number,Trema::Mac] :hw_addr
+ * @param [String,Number,Mac] :hw_addr
* the hardware address of a port.
* Unique for each port. Obtained from +OFPT_FEATURES_REPLY+ message.
* Can be supplied as a string, number or as a Mac object.
*
* @param [Number] :config
@@ -90,13 +90,13 @@
if ( ( hw_addr = rb_hash_aref( options, ID2SYM( rb_intern( "hw_addr" ) ) ) ) != Qnil ) {
mac = hw_addr;
if ( rb_obj_is_kind_of( hw_addr, rb_cString ) == Qtrue ||
rb_obj_is_kind_of( hw_addr, rb_cInteger ) == Qtrue ) {
- mac = rb_funcall( rb_eval_string( "Trema::Mac" ), rb_intern( "new" ), 1, hw_addr );
+ mac = rb_funcall( rb_eval_string( "Pio::Mac" ), rb_intern( "new" ), 1, hw_addr );
}
- else if ( rb_obj_is_instance_of( hw_addr, rb_eval_string( "Trema::Mac" ) ) == Qfalse ) {
+ else if ( rb_obj_is_instance_of( hw_addr, rb_eval_string( "Pio::Mac" ) ) == Qfalse ) {
rb_raise( rb_eArgError, "hw_addr must be a string or an integer or Mac object" );
}
ptr = ( uint8_t * ) dl_addr_to_a( mac, haddr );
rb_iv_set( self, "@hw_addr", mac );
}
@@ -157,11 +157,11 @@
return rb_iv_get( self, "@port_no" );
}
/*
- * Ethernet address converted and stored as a {Trema::Mac} object.
+ * Ethernet address converted and stored as a {Mac} object.
*
* @return [Mac] the value of hw_addr.
*/
static VALUE
port_mod_hw_addr( VALUE self ) {
@@ -206,9 +206,12 @@
/*
* Document-class: Trema::PortMod
*/
void
Init_port_mod() {
+ rb_require( "rubygems" );
+ rb_require( "pio" );
+
mTrema = rb_eval_string( "Trema" );
cPortMod = rb_define_class_under( mTrema, "PortMod", rb_cObject );
rb_define_alloc_func( cPortMod, port_mod_alloc );
rb_define_method( cPortMod, "initialize", port_mod_init, -1 );
rb_define_method( cPortMod, "transaction_id", port_mod_transaction_id, 0 );