Sha256: c9d3de0eb1b2b36eb0120ff8c065eb4d4c5d831b4de7a3cdefab082e30d90da7

Contents?: true

Size: 1.22 KB

Versions: 20

Compression:

Stored size: 1.22 KB

Contents

/*
 * Copyright (C) 2008-2013 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

20 entries across 20 versions & 1 rubygems

Version Path
trema-0.4.7 ruby/trema/action-common.c
trema-0.4.6 ruby/trema/action-common.c
trema-0.4.5 ruby/trema/action-common.c
trema-0.4.4 ruby/trema/action-common.c
trema-0.4.3 ruby/trema/action-common.c
trema-0.4.2 ruby/trema/action-common.c
trema-0.4.1 ruby/trema/action-common.c
trema-0.4.0 ruby/trema/action-common.c
trema-0.3.21 ruby/trema/action-common.c
trema-0.3.20 ruby/trema/action-common.c
trema-0.3.19 ruby/trema/action-common.c
trema-0.3.18 ruby/trema/action-common.c
trema-0.3.17 ruby/trema/action-common.c
trema-0.3.16 ruby/trema/action-common.c
trema-0.3.15 ruby/trema/action-common.c
trema-0.3.14 ruby/trema/action-common.c
trema-0.3.13 ruby/trema/action-common.c
trema-0.3.12 ruby/trema/action-common.c
trema-0.3.11 ruby/trema/action-common.c
trema-0.3.10 ruby/trema/action-common.c