예제 #1
0
 def to_station_url(self):
     url = StationUrl()
     url.set_type_id(self.url_type)
     url["address"] = self.address.address.host
     url["port"] = self.address.address.port
     url["PID"] = self.pid
     url["CID"] = self.cid
     url["RVCID"] = self.rvcid
     url["sid"] = self.sid
     url["stream"] = self.stream_type
     url["natm"] = self.natm
     url["natf"] = self.natf
     url["type"] = self.type
     url["probeinit"] = self.probeinit
     return url
예제 #2
0
 def handle_register_result(self, call_id):
     stream = self.get_response(call_id)
     result = stream.u32()
     connection_id = stream.u32()
     public_station = StationUrl.parse(stream.string())
     logger.info("Secure.register(_ex) -> (%08X, %s)", connection_id,
                 public_station)
     return connection_id, public_station
예제 #3
0
	def initiate_probe(self, client, call_id, method_id, stream):
		#--- request ---
		url = StationUrl.parse(stream.string())
		logger.info("NATTraversal.initiate_probe: %s", url)
		
		self.callback(method_id, url)
		
		#--- response ---
		return client.init_response(self.PROTOCOL_ID, call_id, method_id)
예제 #4
0
    def get_session_urls(self, session_id):
        logger.info("MatchMaking.get_session_urls(%08X)", session_id)
        #--- request ---
        stream, call_id = self.client.init_message(
            self.PROTOCOL_ID, self.METHOD_GET_SESSION_URLS)
        stream.u32(session_id)
        self.client.send_message(stream)

        #--- response ---
        stream = self.client.get_response(call_id)
        urls = stream.list(lambda: StationUrl.parse(stream.string()))
        logger.info("MatchMaking.get_session_urls -> %s", urls)
        return urls
예제 #5
0
    def request_urls(self, cid, pid):
        logger.info("Secure.request_urls(%i, %i)", cid, pid)
        #--- request ---
        stream, call_id = self.init_message(self.PROTOCOL_ID,
                                            self.METHOD_REQUEST_URLS)
        stream.u32(cid)
        stream.u32(pid)
        self.send_message(stream)

        #--- response ---
        stream = self.get_response(call_id)
        bool = stream.bool()
        urls = stream.list(lambda: StationUrl.parse(stream.string()))
        logger.info("Secure.request_urls -> (%i, %s)", bool, urls)
        return bool, urls
예제 #6
0
    def register_urls(self, login_data=None):
        local_station = StationUrl(address=self.s.get_address(),
                                   port=self.s.get_port(),
                                   sid=15,
                                   natm=0,
                                   natf=0,
                                   upnp=0,
                                   pmp=0)

        if login_data:
            connection_id, public_station = self.register_ex([local_station],
                                                             login_data)
        else:
            connection_id, public_station = self.register([local_station])

        local_station["RVCID"] = connection_id
        public_station["RVCID"] = connection_id
        return local_station, public_station
예제 #7
0
 def decode_old(self, stream):
     self.main_station = StationUrl.parse(stream.string())
     self.unk_list = stream.list(stream.u8)
     self.unk_station = StationUrl.parse(stream.string())
예제 #8
0
 def decode_old(self, stream):
     self.station = StationUrl.parse(stream.string())
     self.connection_id = stream.u32()