Class: By2::Models::Iphdr

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/by2/models/iphdr.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ip_dst(ip) ⇒ Object



19
20
21
# File 'lib/by2/models/iphdr.rb', line 19

def self.ip_dst(ip)
  where("iphdr.ip_dst = ?", int32(ip))
end

.ip_src(ip) ⇒ Object



15
16
17
# File 'lib/by2/models/iphdr.rb', line 15

def self.ip_src(ip)
  where("iphdr.ip_src = ?", int32(ip))
end

.ip_src_or_dst(ip) ⇒ Object



11
12
13
# File 'lib/by2/models/iphdr.rb', line 11

def self.ip_src_or_dst(ip)
  where("iphdr.ip_dst = ? or iphdr.ip_src = ?",  int32(ip),  int32(ip))
end

Instance Method Details

#ipaddr_dstObject



27
28
29
# File 'lib/by2/models/iphdr.rb', line 27

def ipaddr_dst
  Utils.int32_to_ip(self.ip_dst)
end

#ipaddr_srcObject



23
24
25
# File 'lib/by2/models/iphdr.rb', line 23

def ipaddr_src
  Utils.int32_to_ip(self.ip_src)
end