Example #1
0
	def broadcast(self, port, message):
		message.flags = 1
		
		stream = StreamOut(self.settings)
		self.encoder.encode(stream, message)
		
		packet = PIAPacket(self.session)
		packet.payload = stream.get()
		self.transport.broadcast(port, packet)
Example #2
0
	def handle_recv(self, pair):
		data, addr = pair
		
		station = self.session.station_mgr.find_by_address(addr)
		if not station:
			logger.warning("Received packet from unknown station: %s", addr)
			return
		
		packet = PIAPacket()
		if packet.decode(data, self.session_key):
			station.rtt_timer = packet.session_timer
			station.base_timer = self.get_session_time()
			self.packets.append((station, packet))
Example #3
0
	def send(self, station, message):
		message.flags = 1
		
		message.destination = 0
		if station.index != 0xFD:
			message.destination = 1 << station.index
			
		local_station = self.session.local_station()
		message.station_index = local_station.index
		message.station_id = local_station.id
		
		stream = StreamOut(self.settings)
		self.encoder.encode(stream, message)
		
		packet = PIAPacket(self.session)
		packet.payload = stream.get()
		self.transport.send(station, packet)
Example #4
0
	def send(self, station, message, add_mask=False):	
		message.destination = 0
		if station.index != 0xFD:
			message.destination = 1 << station.index
		message.station_key = self.session.rvcid
		message.station_index = self.session.station.index
		
		packet = PIAPacket([message])
		self.transport.send(station, packet)