Exemplo n.º 1
0
/*
 * Is it an IGMP v3 membership report packet?
 *
 * @return [Boolean] whether the packet is an IGMP v3 membership report packet
 *   or not.
 */
static VALUE
packet_in_is_igmp_v3_membership_report( VALUE self ) {
  if ( packet_type_igmp_v3_membership_report( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}
Exemplo n.º 2
0
/*
 * Is it an ICMPv4 echo request packet?
 *
 * @return [Boolean] whether the packet is an ICMPv4 echo request packet or not.
 */
static VALUE
packet_in_is_icmpv4_echo_request( VALUE self ) {
  if ( packet_type_icmpv4_echo_request( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}
Exemplo n.º 3
0
/*
 * Is it an IGMP v2 leave group packet?
 *
 * @return [Boolean] whether the packet is an IGMP v2 leave group packet
 *   or not.
 */
static VALUE
packet_in_is_igmp_v2_leave_group( VALUE self ) {
  if ( packet_type_igmp_v2_leave_group( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}
Exemplo n.º 4
0
/*
 * Is it an ARP reply packet?
 *
 * @return [Boolean] whether the packet is an ARP reply packet or not.
 */
static VALUE
packet_in_is_arp_reply( VALUE self ) {
  if ( packet_type_arp_reply( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}
Exemplo n.º 5
0
/*
 * Is it an ICMPv4 destination unreachable packet?
 *
 * @return [Boolean] whether the packet is an ICMPv4 destination
 *   unreachable packet or not.
 */
static VALUE
packet_in_is_icmpv4_dst_unreach( VALUE self ) {
  if ( packet_type_icmpv4_dst_unreach( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}
Exemplo n.º 6
0
/*
 * A buffer_id value either than +OFP_NO_BUFFER+ marks the packet_in as buffered.
 *
 * @return [true] if packet_in is buffered.
 * @return [false] if packet_in is not buffered.
 */
static VALUE
packet_in_is_buffered( VALUE self ) {
  if ( get_packet_in( self )->buffer_id == OFP_NO_BUFFER ) {
    return Qfalse;
  }
  else {
    return Qtrue;
  }
}
Exemplo n.º 7
0
/*
 * A buffer_id value either than +UINT32_MAX+ marks the packet_in as buffered.
 *
 * @return [Boolean] whether the packet_in is buffered or not.
 */
static VALUE
packet_in_is_buffered( VALUE self ) {
  if ( get_packet_in( self )->buffer_id == UINT32_MAX ) {
    return Qfalse;
  }
  else {
    return Qtrue;
  }
}
Exemplo n.º 8
0
/*
 * The reason why the +OFPT_PACKET_IN+ message was sent.
 *
 * @return [Number] the value of reason.
 */
static VALUE
packet_in_reason( VALUE self ) {
  return UINT2NUM( ( unsigned int ) get_packet_in( self )->reason );
}
Exemplo n.º 9
0
/*
 * A String that holds the entire or portion of the received frame.
 * Length of data, total_len - 20 bytes.
 *
 * @return [String] the value of data.
 */
static VALUE
packet_in_data( VALUE self ) {
  const buffer *buf = get_packet_in( self )->data;
  return rb_str_new( buf->data, ( long ) buf->length );
}
Exemplo n.º 10
0
/*
 * The full length of the received frame.
 *
 * @return [Number] the value of total_len.
 */
static VALUE
packet_in_total_len( VALUE self ) {
  return UINT2NUM( get_packet_in( self )->total_len );
}
Exemplo n.º 11
0
/*
 * The port the frame was received.
 *
 * @return [Number] the value of in_port.
 */
static VALUE
packet_in_in_port( VALUE self ) {
  return UINT2NUM( get_packet_in( self )->in_port );
}
Exemplo n.º 12
0
/*
 * Buffer id value signifies if the entire frame (packet is not buffered) or
 * portion of it (packet is buffered) is included in the data field of
 * this +OFPT_PACKET_IN+ message.
 *
 * @return [Number] the value of buffer id.
 */
static VALUE
packet_in_buffer_id( VALUE self ) {
  return ULONG2NUM( get_packet_in( self )->buffer_id );
}
Exemplo n.º 13
0
/*
 * For this asynchronous message the transaction_id is set to zero.
 *
 * @return [Number] the value of transaction_id.
 */
static VALUE
packet_in_transaction_id( VALUE self ) {
  return ULONG2NUM( get_packet_in( self )->transaction_id );
}
Exemplo n.º 14
0
/*
 * Message originator identifier.
 *
 * @return [Number] the value of datapath_id.
 */
static VALUE
packet_in_datapath_id( VALUE self ) {
  return ULL2NUM( get_packet_in( self )->datapath_id );
}
Exemplo n.º 15
0
/*
 * The MAC destination address.
 *
 * @return [Trema::Mac] macda MAC destination address.
 */
static VALUE
packet_in_macda( VALUE self ) {
    packet_in *cpacket_in = get_packet_in( self );
    VALUE macda = ULL2NUM( mac_to_uint64( packet_info( cpacket_in->data )->l2_data.eth->macda ) );
    return rb_funcall( rb_eval_string( "Trema::Mac" ), rb_intern( "new" ), 1, macda );
}
Exemplo n.º 16
0
/*
 * The reason why the +OFPT_PACKET_IN+ message was sent.
 *
 * @return [Number] the value of attribute reason.
 */
static VALUE
packet_in_reason( VALUE self ) {
    return INT2NUM( get_packet_in( self )->reason );
}