Class: Protocol
- Inherits:
-
Object
- Object
- Protocol
- Defined in:
- lib/sflow/lib/sflow/models/protocol.rb
Constant Summary collapse
- ICMP =
0x01- IGMP =
0x02- TCP =
0x06- UDP =
0x11- IPv6 =
0x29
Class Method Summary collapse
Class Method Details
.to_class(protocol) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sflow/lib/sflow/models/protocol.rb', line 12 def self.to_class protocol case protocol when Protocol::ICMP raise "ICMP is not supported" when Protocol::IGMP raise "IGMP is not supported" when Protocol::TCP TCPHeader when Protocol::UDP UDPHeader when Protocol::IPv6 raise "IPv6 is not supported" else raise "Protocol:"+sprintf("0x%2X",protocol)+" is not supported" end end |
.to_s(protocol) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sflow/lib/sflow/models/protocol.rb', line 29 def self.to_s protocol case protocol when Protocol::ICMP "ICMP" when Protocol::IGMP "IGMP" when Protocol::TCP "TCP" when Protocol::UDP "UDP" when Protocol::IPv6 "IPv6" else sprintf("0x%2X",protocol) end end |