#
# Autogenerated by Thrift Compiler (0.9.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py:new_style
#

from thrift.Thrift import TType, TMessageType, TException, TApplicationException

from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class ReturnCode(object):
  OK = 0
  INVALID_IP = 1
  INVALID_TIMEOUT = 2
  ID_EXHAUST = 3
  NETLINK_ERROR = 4
  UNKNOWN_ERROR = 5
  NETLINK_HTB_ERROR = 6
  UNKNOWN_HTB_ERROR = 7
  NETLINK_NETEM_ERROR = 8
  UNKNOWN_NETEM_ERROR = 9
  NETLINK_FW_ERROR = 10
  UNKNOWN_FW_ERROR = 11
  UNKNOWN_SESSION = 12
  UNKNOWN_IP = 13
  ACCESS_DENIED = 14

  _VALUES_TO_NAMES = {
    0: "OK",
    1: "INVALID_IP",
    2: "INVALID_TIMEOUT",
    3: "ID_EXHAUST",
    4: "NETLINK_ERROR",
    5: "UNKNOWN_ERROR",
    6: "NETLINK_HTB_ERROR",
    7: "UNKNOWN_HTB_ERROR",
    8: "NETLINK_NETEM_ERROR",
    9: "UNKNOWN_NETEM_ERROR",
    10: "NETLINK_FW_ERROR",
    11: "UNKNOWN_FW_ERROR",
    12: "UNKNOWN_SESSION",
    13: "UNKNOWN_IP",
    14: "ACCESS_DENIED",
  }

  _NAMES_TO_VALUES = {
    "OK": 0,
    "INVALID_IP": 1,
    "INVALID_TIMEOUT": 2,
    "ID_EXHAUST": 3,
    "NETLINK_ERROR": 4,
    "UNKNOWN_ERROR": 5,
    "NETLINK_HTB_ERROR": 6,
    "UNKNOWN_HTB_ERROR": 7,
    "NETLINK_NETEM_ERROR": 8,
    "UNKNOWN_NETEM_ERROR": 9,
    "NETLINK_FW_ERROR": 10,
    "UNKNOWN_FW_ERROR": 11,
    "UNKNOWN_SESSION": 12,
    "UNKNOWN_IP": 13,
    "ACCESS_DENIED": 14,
  }


class Delay(object):
  """
  Attributes:
   - delay
   - jitter
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'delay', None, None, ), # 1
    (2, TType.I32, 'jitter', None, 0, ), # 2
    (3, TType.DOUBLE, 'correlation', None, 0, ), # 3
  )

  def __init__(self, delay=None, jitter=thrift_spec[2][4], correlation=thrift_spec[3][4],):
    self.delay = delay
    self.jitter = jitter
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.delay = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.jitter = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Delay')
    if self.delay is not None:
      oprot.writeFieldBegin('delay', TType.I32, 1)
      oprot.writeI32(self.delay)
      oprot.writeFieldEnd()
    if self.jitter is not None:
      oprot.writeFieldBegin('jitter', TType.I32, 2)
      oprot.writeI32(self.jitter)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 3)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Loss(object):
  """
  Attributes:
   - percentage
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.DOUBLE, 'percentage', None, None, ), # 1
    (2, TType.DOUBLE, 'correlation', None, 0, ), # 2
  )

  def __init__(self, percentage=None, correlation=thrift_spec[2][4],):
    self.percentage = percentage
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.DOUBLE:
          self.percentage = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Loss')
    if self.percentage is not None:
      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)
      oprot.writeDouble(self.percentage)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 2)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Reorder(object):
  """
  Attributes:
   - percentage
   - gap
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.DOUBLE, 'percentage', None, None, ), # 1
    (2, TType.I32, 'gap', None, 0, ), # 2
    (3, TType.DOUBLE, 'correlation', None, 0, ), # 3
  )

  def __init__(self, percentage=None, gap=thrift_spec[2][4], correlation=thrift_spec[3][4],):
    self.percentage = percentage
    self.gap = gap
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.DOUBLE:
          self.percentage = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.gap = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Reorder')
    if self.percentage is not None:
      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)
      oprot.writeDouble(self.percentage)
      oprot.writeFieldEnd()
    if self.gap is not None:
      oprot.writeFieldBegin('gap', TType.I32, 2)
      oprot.writeI32(self.gap)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 3)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Corruption(object):
  """
  Attributes:
   - percentage
   - correlation
  """

  thrift_spec = (
    None, # 0
    (1, TType.DOUBLE, 'percentage', None, 0, ), # 1
    (2, TType.DOUBLE, 'correlation', None, 0, ), # 2
  )

  def __init__(self, percentage=thrift_spec[1][4], correlation=thrift_spec[2][4],):
    self.percentage = percentage
    self.correlation = correlation

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.DOUBLE:
          self.percentage = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.DOUBLE:
          self.correlation = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Corruption')
    if self.percentage is not None:
      oprot.writeFieldBegin('percentage', TType.DOUBLE, 1)
      oprot.writeDouble(self.percentage)
      oprot.writeFieldEnd()
    if self.correlation is not None:
      oprot.writeFieldBegin('correlation', TType.DOUBLE, 2)
      oprot.writeDouble(self.correlation)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Shaping(object):
  """
  Attributes:
   - rate
   - delay
   - loss
   - reorder
   - corruption
   - iptables_options
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'rate', None, None, ), # 1
    (2, TType.STRUCT, 'delay', (Delay, Delay.thrift_spec), Delay(**{
      "delay" : 0,
    }), ), # 2
    (3, TType.STRUCT, 'loss', (Loss, Loss.thrift_spec), Loss(**{
      "percentage" : 0,
    }), ), # 3
    (4, TType.STRUCT, 'reorder', (Reorder, Reorder.thrift_spec), Reorder(**{
      "percentage" : 0,
    }), ), # 4
    (5, TType.STRUCT, 'corruption', (Corruption, Corruption.thrift_spec), Corruption(**{
      "percentage" : 0,
    }), ), # 5
    (6, TType.LIST, 'iptables_options', (TType.STRING,None), None, ), # 6
  )

  def __init__(self, rate=None, delay=thrift_spec[2][4], loss=thrift_spec[3][4], reorder=thrift_spec[4][4], corruption=thrift_spec[5][4], iptables_options=None,):
    self.rate = rate
    if delay is self.thrift_spec[2][4]:
      delay = Delay(**{
      "delay" : 0,
    })
    self.delay = delay
    if loss is self.thrift_spec[3][4]:
      loss = Loss(**{
      "percentage" : 0,
    })
    self.loss = loss
    if reorder is self.thrift_spec[4][4]:
      reorder = Reorder(**{
      "percentage" : 0,
    })
    self.reorder = reorder
    if corruption is self.thrift_spec[5][4]:
      corruption = Corruption(**{
      "percentage" : 0,
    })
    self.corruption = corruption
    self.iptables_options = iptables_options

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.rate = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.delay = Delay()
          self.delay.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRUCT:
          self.loss = Loss()
          self.loss.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRUCT:
          self.reorder = Reorder()
          self.reorder.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRUCT:
          self.corruption = Corruption()
          self.corruption.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.LIST:
          self.iptables_options = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = iprot.readString();
            self.iptables_options.append(_elem5)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Shaping')
    if self.rate is not None:
      oprot.writeFieldBegin('rate', TType.I32, 1)
      oprot.writeI32(self.rate)
      oprot.writeFieldEnd()
    if self.delay is not None:
      oprot.writeFieldBegin('delay', TType.STRUCT, 2)
      self.delay.write(oprot)
      oprot.writeFieldEnd()
    if self.loss is not None:
      oprot.writeFieldBegin('loss', TType.STRUCT, 3)
      self.loss.write(oprot)
      oprot.writeFieldEnd()
    if self.reorder is not None:
      oprot.writeFieldBegin('reorder', TType.STRUCT, 4)
      self.reorder.write(oprot)
      oprot.writeFieldEnd()
    if self.corruption is not None:
      oprot.writeFieldBegin('corruption', TType.STRUCT, 5)
      self.corruption.write(oprot)
      oprot.writeFieldEnd()
    if self.iptables_options is not None:
      oprot.writeFieldBegin('iptables_options', TType.LIST, 6)
      oprot.writeListBegin(TType.STRING, len(self.iptables_options))
      for iter6 in self.iptables_options:
        oprot.writeString(iter6)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlSetting(object):
  """
  Attributes:
   - up
   - down
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'up', (Shaping, Shaping.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'down', (Shaping, Shaping.thrift_spec), None, ), # 2
  )

  def __init__(self, up=None, down=None,):
    self.up = up
    self.down = down

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.up = Shaping()
          self.up.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.down = Shaping()
          self.down.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlSetting')
    if self.up is not None:
      oprot.writeFieldBegin('up', TType.STRUCT, 1)
      self.up.write(oprot)
      oprot.writeFieldEnd()
    if self.down is not None:
      oprot.writeFieldBegin('down', TType.STRUCT, 2)
      self.down.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlledDevice(object):
  """
  Attributes:
   - controlledIP
   - controllingIP
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'controlledIP', None, None, ), # 1
    (2, TType.STRING, 'controllingIP', None, None, ), # 2
  )

  def __init__(self, controlledIP=None, controllingIP=None,):
    self.controlledIP = controlledIP
    self.controllingIP = controllingIP

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.controlledIP = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.controllingIP = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlledDevice')
    if self.controlledIP is not None:
      oprot.writeFieldBegin('controlledIP', TType.STRING, 1)
      oprot.writeString(self.controlledIP)
      oprot.writeFieldEnd()
    if self.controllingIP is not None:
      oprot.writeFieldBegin('controllingIP', TType.STRING, 2)
      oprot.writeString(self.controllingIP)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class RemoteControlInstance(object):
  """
  Attributes:
   - device
   - timeout
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 1
    (2, TType.I32, 'timeout', None, None, ), # 2
  )

  def __init__(self, device=None, timeout=None,):
    self.device = device
    self.timeout = timeout

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.timeout = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('RemoteControlInstance')
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 1)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    if self.timeout is not None:
      oprot.writeFieldBegin('timeout', TType.I32, 2)
      oprot.writeI32(self.timeout)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControl(object):
  """
  Attributes:
   - settings
   - device
   - timeout
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'settings', (TrafficControlSetting, TrafficControlSetting.thrift_spec), None, ), # 1
    (2, TType.STRUCT, 'device', (TrafficControlledDevice, TrafficControlledDevice.thrift_spec), None, ), # 2
    (3, TType.I32, 'timeout', None, None, ), # 3
  )

  def __init__(self, settings=None, device=None, timeout=None,):
    self.settings = settings
    self.device = device
    self.timeout = timeout

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.settings = TrafficControlSetting()
          self.settings.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.device = TrafficControlledDevice()
          self.device.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.timeout = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControl')
    if self.settings is not None:
      oprot.writeFieldBegin('settings', TType.STRUCT, 1)
      self.settings.write(oprot)
      oprot.writeFieldEnd()
    if self.device is not None:
      oprot.writeFieldBegin('device', TType.STRUCT, 2)
      self.device.write(oprot)
      oprot.writeFieldEnd()
    if self.timeout is not None:
      oprot.writeFieldBegin('timeout', TType.I32, 3)
      oprot.writeI32(self.timeout)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlRc(object):
  """
  Attributes:
   - code
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'code', None, None, ), # 1
    (2, TType.STRING, 'message', None, None, ), # 2
  )

  def __init__(self, code=None, message=None,):
    self.code = code
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.code = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlRc')
    if self.code is not None:
      oprot.writeFieldBegin('code', TType.I32, 1)
      oprot.writeI32(self.code)
      oprot.writeFieldEnd()
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 2)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class TrafficControlException(TException):
  """
  Attributes:
   - code
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'code', None, None, ), # 1
    (2, TType.STRING, 'message', None, None, ), # 2
  )

  def __init__(self, code=None, message=None,):
    self.code = code
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.code = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('TrafficControlException')
    if self.code is not None:
      oprot.writeFieldBegin('code', TType.I32, 1)
      oprot.writeI32(self.code)
      oprot.writeFieldEnd()
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 2)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PacketCaptureException(TException):
  """
  Attributes:
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'message', None, None, ), # 1
  )

  def __init__(self, message=None,):
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PacketCaptureException')
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 1)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PacketCaptureFile(object):
  """
  Attributes:
   - name
   - url
   - bytes
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'name', None, None, ), # 1
    (2, TType.STRING, 'url', None, None, ), # 2
    (3, TType.I32, 'bytes', None, 0, ), # 3
  )

  def __init__(self, name=None, url=None, bytes=thrift_spec[3][4],):
    self.name = name
    self.url = url
    self.bytes = bytes

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.name = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.url = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.bytes = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PacketCaptureFile')
    if self.name is not None:
      oprot.writeFieldBegin('name', TType.STRING, 1)
      oprot.writeString(self.name)
      oprot.writeFieldEnd()
    if self.url is not None:
      oprot.writeFieldBegin('url', TType.STRING, 2)
      oprot.writeString(self.url)
      oprot.writeFieldEnd()
    if self.bytes is not None:
      oprot.writeFieldBegin('bytes', TType.I32, 3)
      oprot.writeI32(self.bytes)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PacketCapture(object):
  """
  Attributes:
   - ip
   - start_time
   - file
   - pid
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'ip', None, None, ), # 1
    (2, TType.I32, 'start_time', None, None, ), # 2
    (3, TType.STRUCT, 'file', (PacketCaptureFile, PacketCaptureFile.thrift_spec), None, ), # 3
    (4, TType.I32, 'pid', None, 0, ), # 4
  )

  def __init__(self, ip=None, start_time=None, file=None, pid=thrift_spec[4][4],):
    self.ip = ip
    self.start_time = start_time
    self.file = file
    self.pid = pid

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.ip = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.start_time = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRUCT:
          self.file = PacketCaptureFile()
          self.file.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I32:
          self.pid = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PacketCapture')
    if self.ip is not None:
      oprot.writeFieldBegin('ip', TType.STRING, 1)
      oprot.writeString(self.ip)
      oprot.writeFieldEnd()
    if self.start_time is not None:
      oprot.writeFieldBegin('start_time', TType.I32, 2)
      oprot.writeI32(self.start_time)
      oprot.writeFieldEnd()
    if self.file is not None:
      oprot.writeFieldBegin('file', TType.STRUCT, 3)
      self.file.write(oprot)
      oprot.writeFieldEnd()
    if self.pid is not None:
      oprot.writeFieldBegin('pid', TType.I32, 4)
      oprot.writeI32(self.pid)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class AccessToken(object):
  """
  Attributes:
   - token
   - interval
   - valid_until
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'token', None, None, ), # 1
    (2, TType.I32, 'interval', None, None, ), # 2
    (3, TType.I32, 'valid_until', None, None, ), # 3
  )

  def __init__(self, token=None, interval=None, valid_until=None,):
    self.token = token
    self.interval = interval
    self.valid_until = valid_until

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.token = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.interval = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.valid_until = iprot.readI32();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('AccessToken')
    if self.token is not None:
      oprot.writeFieldBegin('token', TType.I32, 1)
      oprot.writeI32(self.token)
      oprot.writeFieldEnd()
    if self.interval is not None:
      oprot.writeFieldBegin('interval', TType.I32, 2)
      oprot.writeI32(self.interval)
      oprot.writeFieldEnd()
    if self.valid_until is not None:
      oprot.writeFieldBegin('valid_until', TType.I32, 3)
      oprot.writeI32(self.valid_until)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)
