Esempio n. 1
0
 def get_proxy_info(self, proto):
     info = {"proxy.version" : local_version}
     def upp(d):
         updict(info, "proxy", d)
     upp(get_server_info())
     upp(get_thread_info(proto))
     info.update(self.get_encoder_info())
     return info
Esempio n. 2
0
 def get_proxy_info(self, proto):
     sinfo = {}
     sinfo.update(get_server_info())
     sinfo.update(get_thread_info(proto))
     return {"proxy" : {
                        "version"    : local_version,
                        ""           : sinfo,
                        },
             "window" : self.get_window_info(),
             }
Esempio n. 3
0
 def get_proxy_info(self, proto):
     sinfo = {}
     sinfo.update(get_server_info())
     sinfo.update(get_thread_info(proto))
     return {"proxy" : {
                        "version"    : local_version,
                        ""           : sinfo,
                        },
             "window" : self.get_window_info(),
             }
Esempio n. 4
0
    def get_proxy_info(self, proto):
        info = {"proxy.version": local_version}

        def upp(d):
            updict(info, "proxy", d)

        upp(get_server_info())
        upp(get_thread_info(proto))
        info.update(self.get_encoder_info())
        return info
Esempio n. 5
0
    def process_server_packet(self, proto, packet):
        packet_type = packet[0]
        debug("process_server_packet: %s", packet_type)
        if packet_type==Protocol.CONNECTION_LOST:
            self.stop("server connection lost", proto)
            return
        elif packet_type=="hello":
            c = typedict(packet[1])
            maxw, maxh = c.intpair("max_desktop_size", (4096, 4096))
            proto.max_packet_size = maxw*maxh*4

            caps = self.filter_server_caps(c)
            #add new encryption caps:
            if self.cipher:
                auth_caps = new_cipher_caps(self.client_protocol, self.cipher, self.encryption_key)
                caps.update(auth_caps)
            packet = ("hello", caps)
        elif packet_type=="info-response":
            #adds proxy info:
            #note: this is only seen by the client application
            #"xpra info" is a new connection, which talks to the proxy server...
            info = packet[1]
            info.update(get_server_info("proxy."))
            info.update(get_thread_info("proxy.", proto))
            info.update(self.get_encoder_info())
        elif packet_type=="lost-window":
            wid = packet[1]
            #mark it as lost so we can drop any current/pending frames
            self.lost_windows.add(wid)
            #queue it so it gets cleaned safely (for video encoders mostly):
            self.encode_queue.put(packet)
            #and fall through so tell the client immediately
        elif packet_type=="draw":
            #use encoder thread:
            self.encode_queue.put(packet)
            #which will queue the packet itself when done:
            return
        elif packet_type=="cursor":
            #packet = ["cursor", x, y, width, height, xhot, yhot, serial, pixels, name]
            #or:
            #packet = ["cursor", ""]
            if len(packet)>=9:
                pixels = packet[8]
                if len(pixels)<64:
                    packet[8] = str(pixels)
                else:
                    packet[8] = compressed_wrapper("cursor", pixels)
        self.queue_client_packet(packet)
Esempio n. 6
0
 def get_proxy_info(self, proto):
     sinfo = {}
     sinfo.update(get_server_info())
     sinfo.update(get_thread_info(proto))
     linfo = {}
     if self.client_last_ping_latency:
         linfo["client"] = int(self.client_last_ping_latency)
     if self.server_last_ping_latency:
         linfo["server"] = int(self.server_last_ping_latency)
     return {
         "proxy": {
             "version": XPRA_VERSION,
             "": sinfo,
             "latency": linfo,
         },
         "window": self.get_window_info(),
     }
Esempio n. 7
0
    def process_server_packet(self, proto, packet):
        packet_type = packet[0]
        debug("process_server_packet: %s", packet_type)
        if packet_type==Protocol.CONNECTION_LOST:
            self.stop("server connection lost", proto)
            return
        elif packet_type=="hello":
            c = typedict(packet[1])
            maxw, maxh = c.intpair("max_desktop_size", (4096, 4096))
            proto.max_packet_size = maxw*maxh*4

            caps = self.filter_server_caps(c)
            #add new encryption caps:
            if self.cipher:
                auth_caps = new_cipher_caps(self.client_protocol, self.cipher, self.encryption_key)
                caps.update(auth_caps)
            packet = ("hello", caps)
        elif packet_type=="info-response":
            #adds proxy info:
            #note: this is only seen by the client application
            #"xpra info" is a new connection, which talks to the proxy server...
            info = packet[1]
            info.update(get_server_info("proxy."))
            info.update(get_thread_info("proxy.", proto))
            info.update(self.get_encoder_info())
        elif packet_type=="lost-window":
            wid = packet[1]
            ve = self.video_encoders.get(wid)
            if ve:
                ve.clean()
                del self.video_encoders[wid]
        elif packet_type=="draw":
            self.process_draw(packet)
        elif packet_type=="cursor":
            #packet = ["cursor", x, y, width, height, xhot, yhot, serial, pixels, name]
            #or:
            #packet = ["cursor", ""]
            if len(packet)>=9:
                pixels = packet[8]
                if len(pixels)<64:
                    packet[8] = str(pixels)
                else:
                    packet[8] = compressed_wrapper("cursor", pixels)
        self.queue_client_packet(packet)
Esempio n. 8
0
    def process_server_packet(self, proto, packet):
        packet_type = packet[0]
        debug("process_server_packet: %s", packet_type)
        if packet_type == Protocol.CONNECTION_LOST:
            self.stop("server connection lost", proto)
            return
        elif packet_type == "hello":
            c = typedict(packet[1])
            maxw, maxh = c.intpair("max_desktop_size", (4096, 4096))
            proto.max_packet_size = maxw * maxh * 4

            caps = self.filter_server_caps(c)
            #add new encryption caps:
            if self.cipher:
                auth_caps = new_cipher_caps(self.client_protocol, self.cipher,
                                            self.encryption_key)
                caps.update(auth_caps)
            packet = ("hello", caps)
        elif packet_type == "info-response":
            #adds proxy info:
            info = packet[1]
            info.update(get_server_info("proxy."))
            info.update(get_thread_info("proxy.", proto))
        elif packet_type == "draw":
            #packet = ["draw", wid, x, y, outw, outh, coding, data, self._damage_packet_sequence, outstride, client_options]
            #ensure we don't try to re-compress the pixel data in the network layer:
            #(re-add the "compressed" marker that gets lost when we re-assemble packets)
            coding = packet[6]
            if coding != "mmap":
                data = packet[7]
                packet[7] = Compressed("%s pixels" % coding, data)
        elif packet_type == "cursor":
            #packet = ["cursor", x, y, width, height, xhot, yhot, serial, pixels, name]
            #or:
            #packet = ["cursor", ""]
            if len(packet) >= 9:
                pixels = packet[8]
                if len(pixels) < 64:
                    packet[8] = str(pixels)
                else:
                    packet[8] = compressed_wrapper("cursor", pixels)
        self.queue_client_packet(packet)
Esempio n. 9
0
    def process_server_packet(self, proto, packet):
        packet_type = packet[0]
        debug("process_server_packet: %s", packet_type)
        if packet_type==Protocol.CONNECTION_LOST:
            self.stop("server connection lost", proto)
            return
        elif packet_type=="hello":
            c = typedict(packet[1])
            maxw, maxh = c.intpair("max_desktop_size", (4096, 4096))
            proto.max_packet_size = maxw*maxh*4

            caps = self.filter_server_caps(c)
            #add new encryption caps:
            if self.cipher:
                auth_caps = new_cipher_caps(self.client_protocol, self.cipher, self.encryption_key)
                caps.update(auth_caps)
            packet = ("hello", caps)
        elif packet_type=="info-response":
            #adds proxy info:
            info = packet[1]
            info.update(get_server_info("proxy."))
            info.update(get_thread_info("proxy.", proto))
        elif packet_type=="draw":
            #packet = ["draw", wid, x, y, outw, outh, coding, data, self._damage_packet_sequence, outstride, client_options]
            #ensure we don't try to re-compress the pixel data in the network layer:
            #(re-add the "compressed" marker that gets lost when we re-assemble packets)
            coding = packet[6]
            if coding!="mmap":
                data = packet[7]
                packet[7] = Compressed("%s pixels" % coding, data)
        elif packet_type=="cursor":
            #packet = ["cursor", x, y, width, height, xhot, yhot, serial, pixels, name]
            #or:
            #packet = ["cursor", ""]
            if len(packet)>=9:
                pixels = packet[8]
                if len(pixels)<64:
                    packet[8] = str(pixels)
                else:
                    packet[8] = compressed_wrapper("cursor", pixels)
        self.queue_client_packet(packet)
Esempio n. 10
0
 def get_thread_info(self, proto):
     return get_thread_info(proto, tuple(self._server_sources.keys()))
Esempio n. 11
0
 def get_proxy_info(self, proto):
     info = {"proxy.version" : local_version}
     info.update(get_server_info("proxy"))
     info.update(get_thread_info("proxy", proto))
     info.update(self.get_encoder_info())
     return info
Esempio n. 12
0
 def get_proxy_info(self, proto):
     info = {}
     info.update(get_server_info("proxy."))
     info.update(get_thread_info("proxy.", proto))
     info.update(self.get_encoder_info())
     return info
Esempio n. 13
0
 def get_proxy_info(self, proto):
     info = {"proxy.version": local_version}
     info.update(get_server_info("proxy"))
     info.update(get_thread_info("proxy", proto))
     info.update(self.get_encoder_info())
     return info