aboutsummaryrefslogtreecommitdiff
path: root/frame2.rb
diff options
context:
space:
mode:
Diffstat (limited to 'frame2.rb')
-rw-r--r--frame2.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/frame2.rb b/frame2.rb
new file mode 100644
index 0000000..04b015a
--- /dev/null
+++ b/frame2.rb
@@ -0,0 +1,29 @@
+class Frame2
+ def initialize(iface, src, dst)
+ @iface = iface
+ @src_addr = src
+ @dst_addr = dst
+ end
+
+ attr_accessor :iface, :src_addr, :dst_addr
+
+ def description
+ "{src = #{@src_addr}, dst = #{@dst_addr}}"
+ end
+
+ def to(iface)
+ t = dup
+ t.iface = iface
+ t
+ end
+
+ def ==(oth)
+ @iface == oth.iface &&
+ @src_addr == oth.src_addr &&
+ @dst_addr == oth.dst_addr
+ end
+
+ def self.gen_addr
+ "#{rand(16).to_s(16)}:#{rand(16).to_s(16)}:#{rand(16).to_s(16)}"
+ end
+end