# Path: capirca/lib/windows.py
# CMD_PREFIX = 'netsh ipsec static add '
#   _PLATFORM = 'windows'
#   _COMMENT_FORMAT = string.Template(': $comment')
#   _ACTION_TABLE = {}
#   _PLATFORM = 'windows'
#   _DEFAULT_PROTOCOL = 'all'
#   SUFFIX = '.bat'
#   _RENDER_PREFIX = None
#   _DEFAULT_ACTION = 'block'
#   _TERM = Term
#   _GOOD_AFS = ['inet', 'inet6']
# class Term(aclgenerator.Term):
# class WindowsGenerator(aclgenerator.ACLGenerator):
#   def __init__(self, term, filter_name, filter_action, af='inet'):
#   def __str__(self):
#   def _HandleIcmpTypes(self, icmp_types, protocols):
#   def _HandlePorts(self, src_ports, dst_ports):
#   def _HandlePreRule(self, ret_str):
#   def _CartesianProduct(self, src_addr, dst_addr, protocol, icmp_types,
#                         src_ports, dst_ports, ret_str):
#   def _HandlePostRule(self, ret_str):
#   def _BuildTokens(self):
#   def _TranslatePolicy(self, pol, exp_info):
#   def __str__(self):
#   def _HandlePolicyHeader(self, header, target):
#   def _HandleTermFooter(self, header, term, target):


import string
from capirca.lib import windows
    if proto:
      if proto == 'vrrp':
        proto = '112'
      elif proto == 'ah':
        proto = '51'
      elif proto == 'hopopt':
        proto = '0'
      atoms.append(self._PROTO_ATOM.substitute(protocol=proto))

    atoms.append(self._ACTION_ATOM.substitute(
        action=self._ACTION_TABLE[action]))

    return (self.CMD_PREFIX +
            self._RULE_FORMAT.substitute(
                name=self.term_name, atoms=' '.join(atoms)))

  def _ComposePortString(self, ports):
    """Convert the list of ports tuples into a multiport range string."""
    if not ports:
      return ''

    multiports = []
    for (start, end) in ports:
      if start == end:
        multiports.append(str(start))
      else:
        multiports.append('-'.join([str(start), str(end)]))
    return ','.join(multiports)



# Path: capirca/lib/windows.py
# CMD_PREFIX = 'netsh ipsec static add '
#   _PLATFORM = 'windows'
#   _COMMENT_FORMAT = string.Template(': $comment')
#   _ACTION_TABLE = {}
#   _PLATFORM = 'windows'
#   _DEFAULT_PROTOCOL = 'all'
#   SUFFIX = '.bat'
#   _RENDER_PREFIX = None
#   _DEFAULT_ACTION = 'block'
#   _TERM = Term
#   _GOOD_AFS = ['inet', 'inet6']
# class Term(aclgenerator.Term):
# class WindowsGenerator(aclgenerator.ACLGenerator):
#   def __init__(self, term, filter_name, filter_action, af='inet'):
#   def __str__(self):
#   def _HandleIcmpTypes(self, icmp_types, protocols):
#   def _HandlePorts(self, src_ports, dst_ports):
#   def _HandlePreRule(self, ret_str):
#   def _CartesianProduct(self, src_addr, dst_addr, protocol, icmp_types,
#                         src_ports, dst_ports, ret_str):
#   def _HandlePostRule(self, ret_str):
#   def _BuildTokens(self):
#   def _TranslatePolicy(self, pol, exp_info):
#   def __str__(self):
#   def _HandlePolicyHeader(self, header, target):
#   def _HandleTermFooter(self, header, term, target):


# Path: capirca/lib/windows_advfirewall.py
import string
from capirca.lib import windows

    if proto:
      if proto == 'vrrp':
        proto = '112'
      elif proto == 'ah':
        proto = '51'
      elif proto == 'hopopt':
        proto = '0'
      atoms.append(self._PROTO_ATOM.substitute(protocol=proto))

    atoms.append(self._ACTION_ATOM.substitute(
        action=self._ACTION_TABLE[action]))

    return (self.CMD_PREFIX +
            self._RULE_FORMAT.substitute(
                name=self.term_name, atoms=' '.join(atoms)))

  def _ComposePortString(self, ports):
    """Convert the list of ports tuples into a multiport range string."""
    if not ports:
      return ''

    multiports = []
    for (start, end) in ports:
      if start == end:
        multiports.append(str(start))
      else:
        multiports.append('-'.join([str(start), str(end)]))
    return ','.join(multiports)



class WindowsAdvFirewall(windows.WindowsGenerator):