class Construqt::Flavour::Ubuntu::Firewall::ToFrom

Public Instance Methods

assign_in_out(rule) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 25
def assign_in_out(rule)
  output_only if rule.output_only?
  input_only if rule.input_only?
  self
end
bind_interface(ifname, iface, rule) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 93
def bind_interface(ifname, iface, rule)
  self.interface(iface)
  self.ifname(ifname)
  if rule.from_is_inbound?
    output_ifname_direction("-i")
    input_ifname_direction("-o")
  else
    output_ifname_direction("-o")
    input_ifname_direction("-i")
  end
end
factory!() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 123
def factory!
  get_factory.create
end
get_begin_from() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 68
def get_begin_from
  return space_before(@begin_from) if @begin_from
  return space_before(@begin)
end
get_begin_to() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 63
def get_begin_to
  return space_before(@begin_to) if @begin_to
  return space_before(@begin)
end
get_end_from() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 88
def get_end_from
  return space_before(@end_from) if @end_from
  return space_before(@end)
end
get_end_to() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 83
def get_end_to
  return space_before(@end_to) if @end_to
  return space_before(@end)
end
get_middle_from() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 78
def get_middle_from
  return space_before(@middle_from) if @middle_from
  return space_before(@middle)
end
get_middle_to() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 73
def get_middle_to
  return space_before(@middle_to) if @middle_to
  return space_before(@middle)
end
has_from?() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 119
def has_from?
  @begin || @begin_from || @middle || @middle_from || @end || @end_from
end
has_to?() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 115
def has_to?
  @begin || @begin_to || @middle || @middle_to || @end || @end_to
end
input_ifname() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 110
def input_ifname
  return space_before("#{@input_ifname_direction} #{@ifname}") if @ifname
  return ""
end
output_ifname() click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 105
def output_ifname
  return space_before("#{@output_ifname_direction} #{@ifname}") if @ifname
  return ""
end
push_begin_from(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 43
def push_begin_from(str)
  begin_from(get_begin_from + space_before(str))
end
push_begin_to(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 39
def push_begin_to(str)
  begin_to(get_begin_to + space_before(str))
end
push_end_from(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 59
def push_end_from(str)
  end_from(get_end_from + space_before(str))
end
push_end_to(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 55
def push_end_to(str)
  end_to(get_end_to + space_before(str))
end
push_middle_from(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 51
def push_middle_from(str)
  middle_from(get_middle_from + space_before(str))
end
push_middle_to(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 47
def push_middle_to(str)
  middle_to(get_middle_to + space_before(str))
end
space_before(str) click to toggle source
# File lib/construqt/flavour/ubuntu/flavour_ubuntu_firewall.rb, line 31
def space_before(str)
  if str.nil? or str.empty?
    ""
  else
    " "+str.strip
  end
end