Class: Trema::PacketIn

Inherits:
Object
  • Object
show all
Defined in:
ruby/trema/packet-in.c

Constant Summary collapse

OFPR_NO_MATCH =
INT2NUM( OFPR_NO_MATCH )
OFPR_ACTION =
INT2NUM( OFPR_ACTION )

Instance Method Summary collapse

Instance Method Details

#arp?Boolean

Is it an ARP packet?



319
320
321
322
323
324
325
326
327
# File 'ruby/trema/packet-in.c', line 319

static VALUE
packet_in_is_arp( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ARP ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#arp_operInteger

The ARP operation code.



367
368
369
370
# File 'ruby/trema/packet-in.c', line 367

static VALUE
packet_in_arp_oper( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_ARP, UINT2NUM, arp_ar_op );
}

#arp_reply?Boolean

Is it an ARP reply packet?



351
352
353
354
355
356
357
358
359
# File 'ruby/trema/packet-in.c', line 351

static VALUE
packet_in_is_arp_reply( VALUE self ) {
  if ( packet_type_arp_reply( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#arp_request?Boolean

Is it an ARP request packet?



335
336
337
338
339
340
341
342
343
# File 'ruby/trema/packet-in.c', line 335

static VALUE
packet_in_is_arp_request( VALUE self ) {
  if ( packet_type_arp_request( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#arp_shaTrema::Mac?

The ARP source hardware address of a packet.



380
381
382
383
384
385
386
387
388
# File 'ruby/trema/packet-in.c', line 380

static VALUE
packet_in_arp_sha( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ARP ) ) {
    PACKET_IN_RETURN_MAC( arp_sha );
  }
  else {
    return Qnil;
  }
}

#arp_spaTrema::IP?

The ARP source protocol address of a packet.



398
399
400
401
402
403
404
405
406
# File 'ruby/trema/packet-in.c', line 398

static VALUE
packet_in_arp_spa( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ARP ) ) {
    PACKET_IN_RETURN_IP( arp_spa );
  }
  else {
    return Qnil;
  }
}

#arp_thaTrema::Mac

The ARP target hardware address of a packet.



416
417
418
419
420
421
422
423
424
# File 'ruby/trema/packet-in.c', line 416

static VALUE
packet_in_arp_tha( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ARP ) ) {
    PACKET_IN_RETURN_MAC( arp_tha );
  }
  else {
    return Qnil;
  }
}

#arp_tpaTrema::IP

The ARP target protocol address of a packet.



434
435
436
437
438
439
440
441
442
# File 'ruby/trema/packet-in.c', line 434

static VALUE
packet_in_arp_tpa( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ARP ) ) {
    PACKET_IN_RETURN_IP( arp_tpa );
  }
  else {
    return Qnil;
  }
}

#buffer_idNumber

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.



141
142
143
144
# File 'ruby/trema/packet-in.c', line 141

static VALUE
packet_in_buffer_id( VALUE self ) {
  return ULONG2NUM( get_packet_in( self )->buffer_id );
}

#buffered?Boolean

A buffer_id value either than UINT32_MAX marks the packet_in as buffered.



152
153
154
155
156
157
158
159
160
# File 'ruby/trema/packet-in.c', line 152

static VALUE
packet_in_is_buffered( VALUE self ) {
  if ( get_packet_in( self )->buffer_id == UINT32_MAX ) {
    return Qfalse;
  }
  else {
    return Qtrue;
  }
}

#dataString

A String that holds the entire or portion of the received frame. Length of data, total_len - 20 bytes.



191
192
193
194
195
# File 'ruby/trema/packet-in.c', line 191

static VALUE
packet_in_data( VALUE self ) {
  const buffer *buf = get_packet_in( self )->data;
  return rb_str_new( buf->data, ( long ) buf->length );
}

#datapath_idNumber

Message originator identifier.



117
118
119
120
# File 'ruby/trema/packet-in.c', line 117

static VALUE
packet_in_datapath_id( VALUE self ) {
  return ULL2NUM( get_packet_in( self )->datapath_id );
}

#eth_typeInteger

The ethernet type.



237
238
239
240
# File 'ruby/trema/packet-in.c', line 237

static VALUE
packet_in_eth_type( VALUE self ) {
  return UINT2NUM( get_packet_in_info( self )->eth_type );
}

#icmpv4?Boolean

Is it an ICMPv4 packet?



617
618
619
620
621
622
623
624
625
# File 'ruby/trema/packet-in.c', line 617

static VALUE
packet_in_is_icmpv4( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ICMPV4 ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#icmpv4_checksumInteger

The ICMPv4 message checksum.



655
656
657
658
# File 'ruby/trema/packet-in.c', line 655

static VALUE
packet_in_icmpv4_checksum( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_ICMPV4, UINT2NUM, icmpv4_checksum );
}

#icmpv4_codeInteger

The ICMPv4 message code the further qualifies the message type.



644
645
646
647
# File 'ruby/trema/packet-in.c', line 644

static VALUE
packet_in_icmpv4_code( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_ICMPV4, UINT2NUM, icmpv4_code );
}

#icmpv4_dst_unreach?Boolean

Is it an ICMPv4 destination unreachable packet?



723
724
725
726
727
728
729
730
731
# File 'ruby/trema/packet-in.c', line 723

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;
  }
}

#icmpv4_echo_reply?Boolean

Is it an ICMPv4 echo reply packet?



706
707
708
709
710
711
712
713
714
# File 'ruby/trema/packet-in.c', line 706

static VALUE
packet_in_is_icmpv4_echo_reply( VALUE self ) {
  if ( packet_type_icmpv4_echo_reply( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#icmpv4_echo_request?Boolean

Is it an ICMPv4 echo request packet?



755
756
757
758
759
760
761
762
763
# File 'ruby/trema/packet-in.c', line 755

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;
  }
}

#icmpv4_gatewayTrema::IP?

The ICMPv4 redirect message gateway IP address.



690
691
692
693
694
695
696
697
698
# File 'ruby/trema/packet-in.c', line 690

static VALUE
packet_in_icmpv4_gateway( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_ICMPV4 ) ) {
    PACKET_IN_RETURN_IP( icmpv4_gateway );
  }
  else {
    return Qnil;
  }
}

#icmpv4_idInteger

The ICMPv4 echo identifier to be used to match echo requests to echo replies.



666
667
668
669
# File 'ruby/trema/packet-in.c', line 666

static VALUE
packet_in_icmpv4_id( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_ICMPV4, UINT2NUM, icmpv4_id );
}

#icmpv4_redirect?Boolean

Is it an ICMPv4 redirect packet?



739
740
741
742
743
744
745
746
747
# File 'ruby/trema/packet-in.c', line 739

static VALUE
packet_in_is_icmpv4_redirect( VALUE self ) {
  if ( packet_type_icmpv4_redirect( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#icmpv4_seqInteger

The ICMPv4 echo sequence number.



677
678
679
680
# File 'ruby/trema/packet-in.c', line 677

static VALUE
packet_in_icmpv4_seq( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_ICMPV4, UINT2NUM, icmpv4_seq );
}

#icmpv4_typeInteger

The ICMPv4 message type, ie echo_reply, echo_request.



633
634
635
636
# File 'ruby/trema/packet-in.c', line 633

static VALUE
packet_in_icmpv4_type( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_ICMPV4, UINT2NUM, icmpv4_type );
}

#igmp?Boolean

Is it an IGMP packet?



771
772
773
774
775
776
777
778
779
# File 'ruby/trema/packet-in.c', line 771

static VALUE
packet_in_is_igmp( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_IGMP ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#igmp_checksumInteger

The IGMP checksum.



901
902
903
904
# File 'ruby/trema/packet-in.c', line 901

static VALUE
packet_in_igmp_checksum( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IGMP, UINT2NUM, igmp_checksum );
}

#igmp_groupTrema::IP?

The IGMP group address.



885
886
887
888
889
890
891
892
893
# File 'ruby/trema/packet-in.c', line 885

static VALUE
packet_in_igmp_group( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_IGMP ) ) {
    PACKET_IN_RETURN_IP( igmp_group );
  }
  else {
    return Qnil;
  }
}

#igmp_membership_query?Boolean

Is it an IGMP membership query packet?



788
789
790
791
792
793
794
795
796
# File 'ruby/trema/packet-in.c', line 788

static VALUE
packet_in_is_igmp_membership_query( VALUE self ) {
  if ( packet_type_igmp_membership_query( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#igmp_typeInteger

The IGMP message type.



872
873
874
875
# File 'ruby/trema/packet-in.c', line 872

static VALUE
packet_in_igmp_type( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IGMP, UINT2NUM, igmp_type );
}

#igmp_v1_membership_report?Boolean

Is it an IGMP v1 membership report packet?



805
806
807
808
809
810
811
812
813
# File 'ruby/trema/packet-in.c', line 805

static VALUE
packet_in_is_igmp_v1_membership_report( VALUE self ) {
  if ( packet_type_igmp_v1_membership_report( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#igmp_v2_leave_group?Boolean

Is it an IGMP v2 leave group packet?



839
840
841
842
843
844
845
846
847
# File 'ruby/trema/packet-in.c', line 839

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;
  }
}

#igmp_v2_membership_report?Boolean

Is it an IGMP v2 membership report packet?



822
823
824
825
826
827
828
829
830
# File 'ruby/trema/packet-in.c', line 822

static VALUE
packet_in_is_igmp_v2_membership_report( VALUE self ) {
  if ( packet_type_igmp_v2_membership_report( get_packet_in( self )->data ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#igmp_v3_membership_report?Boolean

Is it an IGMP v3 membership report packet?



856
857
858
859
860
861
862
863
864
# File 'ruby/trema/packet-in.c', line 856

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;
  }
}

#in_portNumber

The port the frame was received.



168
169
170
171
# File 'ruby/trema/packet-in.c', line 168

static VALUE
packet_in_in_port( VALUE self ) {
  return UINT2NUM( get_packet_in( self )->in_port );
}

#ipv4?Boolean

Is it an IPv4 packet?



450
451
452
453
454
455
456
457
458
# File 'ruby/trema/packet-in.c', line 450

static VALUE
packet_in_is_ipv4( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_IPV4 ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#ipv4_checksumInteger

The IPv4 checksum.



554
555
556
557
# File 'ruby/trema/packet-in.c', line 554

static VALUE
packet_in_ipv4_checksum( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_checksum );
}

#ipv4_daddrTrema::IP?

The IPV4 destination IP address of a packet.



585
586
587
588
589
590
591
592
593
# File 'ruby/trema/packet-in.c', line 585

static VALUE
packet_in_ipv4_daddr( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_IPV4 ) ) {
    PACKET_IN_RETURN_IP( ipv4_daddr );
  }
  else {
    return Qnil;
  }
}

#ipv4_frag_offInteger

The IPv4 fragment offset.



521
522
523
524
# File 'ruby/trema/packet-in.c', line 521

static VALUE
packet_in_ipv4_frag_off( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_frag_off );
}

#ipv4_idInteger

The IPv4 identification.



510
511
512
513
# File 'ruby/trema/packet-in.c', line 510

static VALUE
packet_in_ipv4_id( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_id );
}

#ipv4_ihlInteger

The IPv4 internet header length (ihl).



477
478
479
480
# File 'ruby/trema/packet-in.c', line 477

static VALUE
packet_in_ipv4_ihl( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_ihl );
}

#ipv4_protocolInteger

The IPv4 protocol number.



543
544
545
546
# File 'ruby/trema/packet-in.c', line 543

static VALUE
packet_in_ipv4_protocol( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_protocol );
}

#ipv4_saddrTrema::IP?

The IPv4 source IP address of a packet.



567
568
569
570
571
572
573
574
575
# File 'ruby/trema/packet-in.c', line 567

static VALUE
packet_in_ipv4_saddr( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_IPV4 ) ) {
    PACKET_IN_RETURN_IP( ipv4_saddr );
  }
  else {
    return Qnil;
  }
}

#ipv4_tosInteger

The IPv4 type of service (tos).



488
489
490
491
# File 'ruby/trema/packet-in.c', line 488

static VALUE
packet_in_ipv4_tos( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_tos );
}

#ipv4_tot_lenInteger

The IPv4 total length, the length of the datagram.



499
500
501
502
# File 'ruby/trema/packet-in.c', line 499

static VALUE
packet_in_ipv4_tot_len( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_tot_len );
}

#ipv4_ttlInteger

The IPv4 time to live (ttl).



532
533
534
535
# File 'ruby/trema/packet-in.c', line 532

static VALUE
packet_in_ipv4_ttl( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_ttl );
}

#ipv4_versionInteger

The IPv4 version number (version).



466
467
468
469
# File 'ruby/trema/packet-in.c', line 466

static VALUE
packet_in_ipv4_version( VALUE self ) {
  PACKET_IN_RETURN_NUM( NW_IPV4, UINT2NUM, ipv4_version );
}

#lldp?Boolean

Is it a LLDP packet?



601
602
603
604
605
606
607
608
609
# File 'ruby/trema/packet-in.c', line 601

static VALUE
packet_in_is_lldp( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & NW_LLDP ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#macdaTrema::Mac

The destination MAC address.



226
227
228
229
# File 'ruby/trema/packet-in.c', line 226

static VALUE
packet_in_macda( VALUE self ) {
  PACKET_IN_RETURN_MAC( eth_macda );
}

#macsaTrema::Mac

The source MAC address.



214
215
216
217
# File 'ruby/trema/packet-in.c', line 214

static VALUE
packet_in_macsa( VALUE self ) {
  PACKET_IN_RETURN_MAC( eth_macsa );
}

#reasonNumber

The reason why the OFPT_PACKET_IN message was sent.



203
204
205
206
# File 'ruby/trema/packet-in.c', line 203

static VALUE
packet_in_reason( VALUE self ) {
  return UINT2NUM( ( unsigned int ) get_packet_in( self )->reason );
}

#tcp?Boolean

Is it a TCP packet?



912
913
914
915
916
917
918
919
920
# File 'ruby/trema/packet-in.c', line 912

static VALUE
packet_in_is_tcp( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & TP_TCP ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#tcp_ack_noInteger

The TCP acknowledgment number.



961
962
963
964
# File 'ruby/trema/packet-in.c', line 961

static VALUE
packet_in_tcp_ack_no( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, ULONG2NUM, tcp_ack_no );
}

#tcp_checksumInteger

The TCP checksum.



1005
1006
1007
1008
# File 'ruby/trema/packet-in.c', line 1005

static VALUE
packet_in_tcp_checksum( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_checksum );
}

#tcp_dst_portInteger

The TCP destination port.



939
940
941
942
# File 'ruby/trema/packet-in.c', line 939

static VALUE
packet_in_tcp_dst_port( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_dst_port );
}

#tcp_flagsInteger

The TCP flags.



983
984
985
986
# File 'ruby/trema/packet-in.c', line 983

static VALUE
packet_in_tcp_flags( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_flags );
}

#tcp_offsetInteger

The TCP data offset.



972
973
974
975
# File 'ruby/trema/packet-in.c', line 972

static VALUE
packet_in_tcp_offset( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_offset );
}

#tcp_seq_noInteger

The TCP sequence number.



950
951
952
953
# File 'ruby/trema/packet-in.c', line 950

static VALUE
packet_in_tcp_seq_no( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, ULONG2NUM, tcp_seq_no );
}

#tcp_src_portInteger

The TCP source port.



928
929
930
931
# File 'ruby/trema/packet-in.c', line 928

static VALUE
packet_in_tcp_src_port( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_src_port );
}

#tcp_urgentInteger

The TCP urgent pointer.



1016
1017
1018
1019
# File 'ruby/trema/packet-in.c', line 1016

static VALUE
packet_in_tcp_urgent( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_urgent );
}

#tcp_windowInteger

The TCP window.



994
995
996
997
# File 'ruby/trema/packet-in.c', line 994

static VALUE
packet_in_tcp_window( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_TCP, UINT2NUM, tcp_window );
}

#total_lenNumber

The full length of the received frame.



179
180
181
182
# File 'ruby/trema/packet-in.c', line 179

static VALUE
packet_in_total_len( VALUE self ) {
  return UINT2NUM( get_packet_in( self )->total_len );
}

#transaction_idNumber

For this asynchronous message the transaction_id is set to zero.



128
129
130
131
# File 'ruby/trema/packet-in.c', line 128

static VALUE
packet_in_transaction_id( VALUE self ) {
  return ULONG2NUM( get_packet_in( self )->transaction_id );
}

#udp?Boolean

Is it a UDP packet?



1027
1028
1029
1030
1031
1032
1033
1034
1035
# File 'ruby/trema/packet-in.c', line 1027

static VALUE
packet_in_is_udp( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & TP_UDP ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}

#udp_checksumInteger

The UDP checksum.



1089
1090
1091
1092
# File 'ruby/trema/packet-in.c', line 1089

static VALUE
packet_in_udp_checksum( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_UDP, UINT2NUM, udp_checksum );
}

#udp_dst_portInteger

The UDP destination port.



1067
1068
1069
1070
# File 'ruby/trema/packet-in.c', line 1067

static VALUE
packet_in_udp_dst_port( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_UDP, UINT2NUM, udp_dst_port );
}

#udp_lenInteger

The UDP length



1078
1079
1080
1081
# File 'ruby/trema/packet-in.c', line 1078

static VALUE
packet_in_udp_len( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_UDP, UINT2NUM, udp_len );
}

#udp_payloadString

A String that holds the UDP payload. Length of data, total_len - 20 bytes.



1044
1045
1046
1047
1048
# File 'ruby/trema/packet-in.c', line 1044

static VALUE
packet_in_udp_payload( VALUE self ) {
  packet_info *cpacket = get_packet_in_info( self );
  return rb_str_new( cpacket->l4_payload, ( long ) cpacket->l4_payload_length );
}

#udp_src_portInteger

The UDP source port.



1056
1057
1058
1059
# File 'ruby/trema/packet-in.c', line 1056

static VALUE
packet_in_udp_src_port( VALUE self ) {
  PACKET_IN_RETURN_NUM( TP_UDP, UINT2NUM, udp_src_port );
}

#vlan_cfiInteger

The vlan canonical format indicator (cfi).



297
298
299
300
# File 'ruby/trema/packet-in.c', line 297

static VALUE
packet_in_vlan_cfi( VALUE self ) {
  PACKET_IN_RETURN_NUM( ETH_8021Q, UINT2NUM, vlan_cfi );
}

#vlan_prioInteger

The vlan priority.



286
287
288
289
# File 'ruby/trema/packet-in.c', line 286

static VALUE
packet_in_vlan_prio( VALUE self ) {
  PACKET_IN_RETURN_NUM( ETH_8021Q, UINT2NUM, vlan_prio );
}

#vlan_tciInteger

The vlan tag control identifier (tci).



275
276
277
278
# File 'ruby/trema/packet-in.c', line 275

static VALUE
packet_in_vlan_tci( VALUE self ) {
  PACKET_IN_RETURN_NUM( ETH_8021Q, UINT2NUM, vlan_tci );
}

#vlan_tpidInteger

The vlan tag protocol identifier (tpid).



264
265
266
267
# File 'ruby/trema/packet-in.c', line 264

static VALUE
packet_in_vlan_tpid( VALUE self ) {
  PACKET_IN_RETURN_NUM( ETH_8021Q, UINT2NUM, vlan_tpid );
}

#vlan_vidInteger

The vlan identifier.



308
309
310
311
# File 'ruby/trema/packet-in.c', line 308

static VALUE
packet_in_vlan_vid( VALUE self ) {
  PACKET_IN_RETURN_NUM( ETH_8021Q, UINT2NUM, vlan_vid );
}

#vtag?Boolean

Is it an IEEE 802.1q packet?



248
249
250
251
252
253
254
255
256
# File 'ruby/trema/packet-in.c', line 248

static VALUE
packet_in_is_vtag( VALUE self ) {
  if ( ( get_packet_in_info( self )->format & ETH_8021Q ) ) {
    return Qtrue;
  }
  else {
    return Qfalse;
  }
}