Sha256: ed33672c9085decec91e36d8306a92a7436427f999206f691391b4b7b5057540

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

/*
 * Copyright (C) 2008-2012 NEC Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */


#include <stdint.h>
#include "ruby.h"


uint32_t
nw_addr_to_i( VALUE nw_addr ) {
  return ( uint32_t ) NUM2UINT( rb_funcall( nw_addr, rb_intern( "to_i" ), 0 ) );
}


uint8_t *
dl_addr_to_a( VALUE dl_addr, uint8_t *ret_dl_addr ) {
  VALUE mac_arr = rb_funcall( dl_addr, rb_intern( "to_a" ), 0 );
  int i;

  for ( i = 0; i < RARRAY_LEN( mac_arr ); i++ ) {
    ret_dl_addr[ i ] = ( uint8_t ) ( NUM2INT( RARRAY_PTR( mac_arr )[ i ] ) );
  }
  return ret_dl_addr;
}


/*
 * Local variables:
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * End:
 */

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
trema-0.3.9 ruby/trema/action-common.c
trema-0.3.8 ruby/trema/action-common.c
trema-0.3.7 ruby/trema/action-common.c
trema-0.3.6 ruby/trema/action-common.c
trema-0.3.5 ruby/trema/action-common.c
trema-0.3.4 ruby/trema/action-common.c
trema-0.3.3 ruby/trema/action-common.c
trema-0.3.2 ruby/trema/action-common.c
trema-0.3.1 ruby/trema/action-common.c
trema-0.3.0 ruby/trema/action-common.c
trema-0.2.8 ruby/trema/action-common.c
trema-0.2.7 ruby/trema/action-common.c
trema-0.2.6 ruby/trema/action-common.c
trema-0.2.5 ruby/trema/action-common.c
trema-0.2.4 ruby/trema/action-common.c
trema-0.2.3 ruby/trema/action-common.c