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
 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(),
             }
    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
 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(),
             }
    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)
Exemple #6
0
 def filter_caps(self, caps, prefixes):
     #removes caps that the proxy overrides / does not use:
     pcaps = {}
     removed = []
     for k in caps.keys():
         if any(e for e in prefixes if bytestostr(k).startswith(e)):
             removed.append(k)
         else:
             pcaps[k] = caps[k]
     log("filtered out %s matching %s", removed, prefixes)
     #replace the network caps with the proxy's own:
     pcaps.update(flatten_dict(get_network_caps()))
     #then add the proxy info:
     updict(pcaps, "proxy", get_server_info(), flatten_dicts=True)
     pcaps["proxy"] = True
     pcaps["proxy.hostname"] = socket.gethostname()
     return pcaps
Exemple #7
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(),
     }
    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)
 def filter_caps(self, caps, prefixes):
     #removes caps that the proxy overrides / does not use:
     #(not very pythonic!)
     pcaps = {}
     removed = []
     for k in caps.keys():
         skip = len([e for e in prefixes if k.startswith(e)])
         if skip==0:
             pcaps[k] = caps[k]
         else:
             removed.append(k)
     log("filtered out %s matching %s", removed, prefixes)
     #replace the network caps with the proxy's own:
     pcaps.update(get_network_caps())
     #then add the proxy info:
     pcaps.update(get_server_info("proxy."))
     pcaps["proxy"] = True
     pcaps["proxy.hostname"] = socket.gethostname()
     return pcaps
 def filter_caps(self, caps, prefixes):
     #removes caps that the proxy overrides / does not use:
     #(not very pythonic!)
     pcaps = {}
     removed = []
     for k in caps.keys():
         skip = len([e for e in prefixes if k.startswith(e)])
         if skip == 0:
             pcaps[k] = caps[k]
         else:
             removed.append(k)
     log("filtered out %s matching %s", removed, prefixes)
     #replace the network caps with the proxy's own:
     pcaps.update(get_network_caps())
     #then add the proxy info:
     updict(pcaps, "proxy", get_server_info())
     pcaps["proxy"] = True
     pcaps["proxy.hostname"] = socket.gethostname()
     return pcaps
Exemple #11
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)
Exemple #12
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)
 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
 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
 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