Beispiel #1
0
    def _handle_recv_msg(self, conn, vns_msg):
        # demux sr-client messages and take approriate actions
        if vns_msg is None:
            #log.debug("invalid message")
            self._handle_close_msg(conn)
            return

        #log.debug('recv VNS msg: %s' % vns_msg)
        if vns_msg.get_type() == VNSAuthReply.get_type():
            self._handle_auth_reply(conn)
            return
        elif vns_msg.get_type() == VNSOpen.get_type():
            self._handle_open_msg(conn, vns_msg)
        elif vns_msg.get_type() == VNSClose.get_type():
            self._handle_close_msg(conn)
        elif vns_msg.get_type() == VNSPacket.get_type():
            self._handle_packet_msg(conn, vns_msg)
        elif vns_msg.get_type() == VNSOpenTemplate.get_type():
            # TODO: see if this is needed...
            self._handle_open_template_msg(conn, vns_msg)
Beispiel #2
0
 def handle_recv_msg(self, conn, vns_msg):
     if vns_msg is not None:
         logging.debug('recv VNS msg: %s' % vns_msg)
         if vns_msg.get_type() == VNSAuthReply.get_type():
             self.handle_auth_reply(conn, vns_msg, self.terminate_connection)
             return
         elif not conn.vns_authorized:
             logging.warning('received non-auth-reply from unauthenticated user %s: terminating the user' % conn)
             self.terminate_connection(conn, 'simulator expected authentication reply')
         # user is authenticated => any other messages are ok
         elif vns_msg.get_type() == VNSOpen.get_type():
             self.handle_open_msg(conn, vns_msg)
         elif vns_msg.get_type() == VNSClose.get_type():
             self.handle_close_msg(conn)
         elif vns_msg.get_type() == VNSPacket.get_type():
             self.handle_packet_msg(conn, vns_msg)
         elif vns_msg.get_type() == VNSOpenTemplate.get_type():
             self.handle_open_template_msg(conn, vns_msg)
         else:
             logging.debug('unexpected VNS message received: %s' % vns_msg)
Beispiel #3
0
  def _handle_recv_msg(self, conn, vns_msg):
    # demux sr-client messages and take approriate actions
    if vns_msg is None:
      log.debug("invalid message")
      self._handle_close_msg(conn)
      return

    log.debug('recv VNS msg: %s' % vns_msg)
    if vns_msg.get_type() == VNSAuthReply.get_type():
      self._handle_auth_reply(conn)
      return
    elif vns_msg.get_type() == VNSOpen.get_type():
      self._handle_open_msg(conn, vns_msg)
    elif vns_msg.get_type() == VNSClose.get_type():
      self._handle_close_msg(conn)
    elif vns_msg.get_type() == VNSPacket.get_type():
      self._handle_packet_msg(conn, vns_msg)
    elif vns_msg.get_type() == VNSOpenTemplate.get_type():
      # TODO: see if this is needed...
      self._handle_open_template_msg(conn, vns_msg)
    else:
      log.debug('unexpected VNS message received: %s' % vns_msg)