Ejemplo n.º 1
0
 def __init__(self, ip_str, port_num, handler):
     """Constructor fills in the ip and port numbers, and sets up the response handler."""
     self.SMPCentralNodeServerAddress = (ip_str, port_num)
     self.Handler = handler;
     # RQ 1
     # RQ 3
     ThreadingUDPServer.__init__(self, self.SMPCentralNodeServerAddress, self.Handler)
Ejemplo n.º 2
0
 def __init__(
     self, host="localhost", port=logging.handlers.DEFAULT_UDP_LOGGING_PORT, handler=LogRecordDatagramHandler
 ):
     ThreadingUDPServer.__init__(self, (host, port), handler)
     self.abort = 0
     self.timeout = 1
     self.logname = None
Ejemplo n.º 3
0
 def __init__(self, dns_server, disable_cache=False, host='127.0.0.1', port=53, hosts_file='/etc/hosts'):
     self.dns_server = dns_server
     self.hosts_file = hosts_file
     self.host_lines = load_hosts(hosts_file)
     self.disable_cache = disable_cache
     self.cache = {}
     ThreadingUDPServer.__init__(self, (host, port), DNSProxyHandler)
Ejemplo n.º 4
0
 def __init__(self, dns_server, disable_cache=False, host='127.0.0.1', port=53, hosts_file='/etc/hosts'):
     self.dns_server = dns_server
     self.hosts_file = hosts_file
     self.host_lines = load_hosts(hosts_file)
     self.disable_cache = disable_cache
     self.cache = {}
     ThreadingUDPServer.__init__(self, (host, port), DNSProxyHandler)
Ejemplo n.º 5
0
	def __init__(self, addr, handler, poll_interval=0.5, bind_and_activate=True):
		class DelegatingUDPRequestHandler(DatagramRequestHandler):
 
			def handle(self):
				self.server._handler(self)
		ThreadingUDPServer.__init__(self, addr, DelegatingUDPRequestHandler,
                                    bind_and_activate)
		ControlMixin.__init__(self, handler, poll_interval)
Ejemplo n.º 6
0
	def __init__(self,racelistserver):
		log(Log.INFO,"init broadcast server on port %s:%d" % (config.servername, config.broadcastport))

		StopableThread.__init__(self)
		
		self._racelistserver = racelistserver
		self.allow_reuse_address = 1
		ThreadingUDPServer.__init__(self,("",config.broadcastport),BroadCastServerRequestHandler)
Ejemplo n.º 7
0
 def __init__(self,
              host='localhost',
              port=logging.handlers.DEFAULT_UDP_LOGGING_PORT,
              handler=LogRecordDatagramHandler):
     ThreadingUDPServer.__init__(self, (host, port), handler)
     self.abort = 0
     self.timeout = 1
     self.logname = None
Ejemplo n.º 8
0
 def __init__(self, ip_str, port_num, handler):
     """Constructor fills in the ip and port numbers, and sets up the response handler."""
     self.SMPCentralNodeServerAddress = (ip_str, port_num)
     self.Handler = handler
     # RQ 1
     # RQ 3
     ThreadingUDPServer.__init__(self, self.SMPCentralNodeServerAddress,
                                 self.Handler)
Ejemplo n.º 9
0
 def __init__(self, addr, handler, poll_interval=0.5, bind_and_activate=True, iface=None):
     ThreadingUDPServer.__init__(self, ('', addr[1]),
                                 handler,
                                 bind_and_activate)
     ControlMixin.__init__(self, handler, poll_interval)
     self._multicast_address = addr
     self._listen_interfaces = iface
     self.setLoopbackMode(1)  # localhost
     self.setTTL(2)  # localhost and local network
     self.handle_membership(socket.IP_ADD_MEMBERSHIP)
Ejemplo n.º 10
0
 def __init__(self, addr, handler, poll_interval=0.5, bind_and_activate=True, interfaces=None):
     ThreadingUDPServer.__init__(self, ('', addr[1]),
                                 handler,
                                 bind_and_activate)
     ControlMixin.__init__(self, handler, poll_interval)
     self._multicast_address = addr
     self._listen_interfaces = interfaces
     self.set_loopback_mode(1)  # localhost
     self.set_ttl(2)  # localhost and local network
     self.handle_membership(socket.IP_ADD_MEMBERSHIP)
Ejemplo n.º 11
0
 def __init__(self,
              dns_server,
              disable_cache=False,
              host='127.0.0.1',
              port=53,
              hooks=None):
     self.dns_server = dns_server
     self.cache = Cache()
     self.cache.enabled = not disable_cache
     self.hooks = hooks
     ThreadingUDPServer.__init__(self, (host, port), DNSProxyHandler)
Ejemplo n.º 12
0
    def __init__(self,
                 addr,
                 handler,
                 poll_interval=0.5,
                 bind_and_activate=True):
        class DelegatingUDPRequestHandler(DatagramRequestHandler):
            def handle(self):
                self.server._handler(self)

        ThreadingUDPServer.__init__(self, addr, DelegatingUDPRequestHandler,
                                    bind_and_activate)
        ControlMixin.__init__(self, handler, poll_interval)
Ejemplo n.º 13
0
 def __init__(self,
              file_name,
              port,
              level=logging.INFO,
              format_pattern=DEFAULT_FORMAT_PATTERN):
     self.file_name = file_name
     self.level = level
     self.format_pattern = format_pattern
     ThreadingUDPServer.__init__(self, ('127.0.0.1', port),
                                 LogRecordHandler)
     self.abort = 0
     self.timeout = 1
Ejemplo n.º 14
0
 def __init__(self):
     log = open(DNS_LOCAL_PATH+'switch.log','w')
     log.write('This file will be clear up when restar !\nUnswitched DNS query :\n')
     log.close()
     self.hostslist = lodehosts()
     self.switchlist = loadswitchfile()
     self.servers,self.Log_all = loadconf()
     if not self.servers:
         print 'Loding ',DNS_CONFIG_FILE,' false '
         sys.exit(0)
     print 'z.DNS is running now ! \nUsing DNS : ' + self.servers[0] + '  ' + self.servers[1] 
     ThreadingUDPServer.__init__(self, ('127.0.0.1', 53), DNSProxyHandler)
Ejemplo n.º 15
0
 def __init__(
     self,
     dns_server,
     backup_server=None,
     disable_cache=False,
     host="127.0.0.1",
     port=53,
     hosts_file=DEFAULT_FILE,
 ):
     self.dns_server = dns_server
     self.backup_server = backup_server
     self.hosts_file = hosts_file
     self.host_lines = load_hosts(hosts_file)
     self.disable_cache = disable_cache
     self.cache = {}
     ThreadingUDPServer.__init__(self, (host, port), DNSProxyHandler)
Ejemplo n.º 16
0
 def __init__(self, addr, clients):
     self.clients = clients
     
     broadcast = inet_iton(clients.subnet + clients.hosts + 1)
     
     # Set static options
     self.server_opts = {
                          1 : clients.mask, # Subnet mask
                          3 : clients.addr, # Router address
                          6 : clients.addr, # Domain Name Server address
                         28 : broadcast,    # Broadcast address
                         51 : 60 * 60,      # IP address lease time
                         54 : clients.addr, # DHCP Server identifier
                         58 : 60 * 30,      # Renewal time
                         59 : 60 * 50       # Rebinding time
                         }
     
     ThreadingUDPServer.__init__(self, (addr, 67), self.handle_message)
Ejemplo n.º 17
0
 def __init__(self, disable_cache=False, host='127.0.0.1', port=53000):
     self.disable_cache = disable_cache
     self.cache = {}
     ThreadingUDPServer.__init__(self, (host, port), DNSHandler)
Ejemplo n.º 18
0
 def __init__(self, addr, handler, timeout=1):
     ThreadingUDPServer.__init__(self, addr, LogRecordDatagramHandler)
     BaseServer.__init__(self, handler, timeout)
 def __init__(self, server_address, data_store_handler, 
              RequestHandlerClass=DRRequestHandler,
              bind_and_activate=True):
     ThreadingUDPServer.__init__(self, server_address, RequestHandlerClass)
     self.data_store_handler = data_store_handler
Ejemplo n.º 20
0
	def __init__(self, server_addr, reqhandler, log_dirname):
		ThreadingUDPServer.__init__(self, server_addr, reqhandler);
		self.log_dirname = log_dirname;
Ejemplo n.º 21
0
 def __init__(self, local_server, dns_server, hosts='/ets/hosts'):
     self.local_server = local_server
     self.dns_server = dns_server
     self.hosts = Hosts(hosts)
     ThreadingUDPServer.__init__(self, local_server, DnsProxyHandler)
Ejemplo n.º 22
0
 def __init__(self, local, master, hosts):
     self.local = local
     self.master = master
     self.hosts = hosts
     ThreadingUDPServer.__init__(self, local, ProxyDnsHandler)
Ejemplo n.º 23
0
 def __init__(self, local_server, dns_server):
     self.local_server = local_server
     self.dns_server = dns_server
     ThreadingUDPServer.__init__(self, local_server, DnsProxyHandler)
Ejemplo n.º 24
0
 def __init__(self, disable_cache=False, host='127.0.0.1', port=53000):
     self.disable_cache = disable_cache
     self.cache = {}
     ThreadingUDPServer.__init__(self, (host, port), DNSHandler)
Ejemplo n.º 25
0
 def __init__(self, port):
     ThreadingUDPServer.__init__(self, ('', port), RequestHandler)
Ejemplo n.º 26
0
 def __init__(self, port_num):
     ThreadingUDPServer.__init__(self, ('',port_num), DNS_Handler_class)
     return
Ejemplo n.º 27
0
 def __init__(self, local, master, hosts):
     self.local = local
     self.master = master
     self.hosts = hosts
     ThreadingUDPServer.__init__(self, local, ProxyDnsHandler)
Ejemplo n.º 28
0
 def __init__(self, addr, handler, timeout=1):
     ThreadingUDPServer.__init__(self, addr, LogRecordDatagramHandler)
     BaseServer.__init__(self, handler, timeout)
Ejemplo n.º 29
0
 def __init__(self, local_server, dns_server, hosts='/ets/hosts'):
     self.local_server = local_server
     self.dns_server = dns_server
     self.hosts = Hosts(hosts)
     ThreadingUDPServer.__init__(self, local_server, DnsProxyHandler)
Ejemplo n.º 30
0
 def __init__(self, server, hosts, proxy_dns):
     self.hosts = hosts
     self.proxy_dns = proxy_dns
     ThreadingUDPServer.__init__(self, server, CmdHandler)
Ejemplo n.º 31
0
	def __init__( self, port,name,liveaddr, handle=handle ):
		self.name=name
		self.liveaddr=liveaddr
		UDP.__init__( self, ('', port), handle )
Ejemplo n.º 32
0
 def __init__(self, port_num):
     ThreadingUDPServer.__init__(self, ('', port_num), DNS_Handler_class)
     return