示例#1
0
	def __init__(self, id, hostname = "localhost", port = 7362, data_mode = "PSK500R", carrier_frequency = 1000, sideband = "USB", retries = 3, data_length = 128, tx_wait = 0.5, rx_wait = 0.1, timeout = 10., ack_timeout = 0.25, tx_hangtime = 0.25, specification = 0, extension_init = None, disable_ec = False, disable_crypto = True, allow_unsigned_packets = True, application = "DDP Example: Repeater", ignore_broadcast_packets = True, repeater_mode = True, debug_mode = False):
		self.DEBUG_MODE = debug_mode
		self.ID = int(id)
		
		self.ddp = DDP(hostname, port, data_mode, carrier_frequency, sideband, retries, data_length, tx_wait, rx_wait, timeout, ack_timeout, tx_hangtime, specification, extension_init, disable_ec, disable_crypto, allow_unsigned_packets, application, ignore_broadcast_packets, repeater_mode, debug_mode)
		self.linked_rig = None
		self.main_thread = None
		self.run_queue = True
		
		
		self.log = DanLog("RIG%d" % self.ID)
		self.log.info("Initialising...")
示例#2
0
import socket
import sys
from xml.dom import minidom


###########
# Globals #
###########
client_callsign = ""

ddp = None

listener_tcp = None
listener_tcp_alive = False
listener_tcp_thread = None
log = DanLog("HTTPProxyClient")

server_callsign = ""


#############
# Constants #
#############
ALLOW_UNSIGNED_PACKETS = False

BACKEND_DATAMODE = "PSK500R"
BACKEND_HOSTNAME = "localhost"
BACKEND_PORT = 7362

DEBUG_MODE = False
DISABLE_CRYPTO = False
示例#3
0
from danlog import DanLog
from ddp import *
import os
import sys
import threading
from xml.dom import minidom


#############
# Variables #
#############
client_callsign = ""

ddp = None

log = DanLog("FileTransfer")

server_callsign = ""


#############
# Constants #
#############
ALLOW_UNSIGNED_PACKETS = False

BACKEND_DATAMODE = "PSK500R"
BACKEND_HOSTNAME = "localhost"
BACKEND_PORT = 7362

DEBUG_MODE = False
DISABLE_CRYPTO = False
示例#4
0
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  #
#########################################################################

from danlog import DanLog
from ddp import *
import os
import sys
from xml.dom import minidom


###########
# Globals #
###########
conn = None

log = DanLog("HTTPProxyServer")


#############
# Constants #
#############
ALLOW_UNSIGNED_PACKETS = False

BACKEND_DATAMODE = "PSK500R"
BACKEND_HOSTNAME = "localhost"
BACKEND_PORT = 7362

DEBUG_MODE = False
DISABLE_CRYPTO = False

PROXY_CALLSIGN = "CHANGEME"
示例#5
0
class Rig():
	def __init__(self, id, hostname = "localhost", port = 7362, data_mode = "PSK500R", carrier_frequency = 1000, sideband = "USB", retries = 3, data_length = 128, tx_wait = 0.5, rx_wait = 0.1, timeout = 10., ack_timeout = 0.25, tx_hangtime = 0.25, specification = 0, extension_init = None, disable_ec = False, disable_crypto = True, allow_unsigned_packets = True, application = "DDP Example: Repeater", ignore_broadcast_packets = True, repeater_mode = True, debug_mode = False):
		self.DEBUG_MODE = debug_mode
		self.ID = int(id)
		
		self.ddp = DDP(hostname, port, data_mode, carrier_frequency, sideband, retries, data_length, tx_wait, rx_wait, timeout, ack_timeout, tx_hangtime, specification, extension_init, disable_ec, disable_crypto, allow_unsigned_packets, application, ignore_broadcast_packets, repeater_mode, debug_mode)
		self.linked_rig = None
		self.main_thread = None
		self.run_queue = True
		
		
		self.log = DanLog("RIG%d" % self.ID)
		self.log.info("Initialising...")
	
	def dispose(self):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		self.ddp.dispose()
	
	def mainLoop(self):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		while self.run_queue:
			packet = self.receivePacket(120.)
			
			if packet is not None:
				# Reconstruct the packet so it can be transmitted to the linked rig
				lr_ddp = self.linked_rig.ddp
				recon = lr_ddp.constructPacket(packet[lr_ddp.SECTION_SOURCE], REPEATER_CALLSIGN, packet[lr_ddp.SECTION_DESTINATION], packet[lr_ddp.SECTION_FLAGS], self.ddp.decodeData(packet[lr_ddp.SECTION_DATA], packet[lr_ddp.SECTION_FLAGS]), packet[lr_ddp.SECTION_APPLICATION_ID], packet[lr_ddp.SECTION_SIGNATURE])
				
				# Re-transmit the packet
				self.transmitPacket(recon)
	
	def receivePacket(self, timeout = 60.):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		return self.ddp.receivePacket(timeout)
	
	def setCallsign(self, callsign):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		self.ddp.setCallsign(callsign)
	
	def setLinkedRig(self, rig):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		self.linked_rig = rig
	
	def start(self):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		self.run_queue = True
		
		self.main_thread = threading.Thread(target = self.mainLoop)
		self.main_thread.setDaemon(1)
		self.main_thread.start()
	
	def stop(self):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		self.run_queue = False
	
	def transmitPacket(self, packet):
		if self.DEBUG_MODE:
			self.log.info("Running...")
		
		
		self.ddp.transmitRawPacket(packet)