def requestRegister(self, uid): """The client sends the registration data to the server and start pings as a keepalive detection""" self.uuid = uid self.my_server = self.transport.getPeer() self.mylogin = MyUtils.getLoginName() self.hostip = NetworkUtils.get_ip_inet_address(self.transport.getPeer().host) is_host_not_user = (self.mylogin=='root') isLTSP = MyUtils.isLTSP() info_host = {'login' : self.mylogin, 'hostname' : NetworkUtils.getHostName(), 'hostip' : self.hostip, 'ltsp' : isLTSP != '', 'classname' : Configs.RootConfigs['classroomname'], 'isHostnotUser' : is_host_not_user , 'uuid' : self.uuid } if is_host_not_user : info_host['mac'] = NetworkUtils.get_inet_HwAddr(self.transport.getPeer().host) else: info_host['username'] = MyUtils.getFullUserName() info_host['ipLTSP'] = isLTSP info_host['internetEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('internet') == '1' info_host['mouseEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('mouse') == '1' info_host['soundEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('sound') == '1' info_host['messagesEnabled'] = Configs.MonitorConfigs.GetGeneralConfig('messages') == '1' info_host['photo'] = '' self.doPing() return {'result': info_host}
def __init__(self): xmlrpc.XMLRPC.__init__(self) self.classroom=None self.externalIP=NetworkUtils.get_ip_inet_address() if self.externalIP=='': self.externalIP=NetworkUtils.get_ip_inet_address('192.168.0.254') self.hostname=NetworkUtils.getHostName() pynotify.init('controlaula')
def addHost(self, host): """Add a pc to the classroom""" if not self.Hosts.has_key(host.ip): logging.getLogger().debug("The host %s has appeared" % (host.ip)) self.Hosts[host.ip] = host # intialize list of commands for this client, if is a LTSP server, it needs to be added if not self.CommandStack.has_key(host.ip): self.CommandStack[host.ip] = [] # save its mac address: Configs.MonitorConfigs.SaveMAC(host.hostname, host.mac) if host.hostname != NetworkUtils.getHostName(): # the teacher host is not added to the list when it's LTSP self.placeHostDesktop(host.ip) self.getJSONFrontend("refresh")
NetworkUtils.cleanRoutes() ltspGW=NetworkUtils.ltspGW() if ltspGW!='0': NetworkUtils.addRoute('239.255.255.0', ltspGW) else: reactor.callLater(10, prepareBroadcast) from twisted.internet import reactor # Initialise the signal handler. signal.signal(signal.SIGINT, SigHandler) HOSTNAME=NetworkUtils.getHostName() logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', filename=LOG_FILENAME) ######### Begin the application loop ####### from ControlAula import StudentLoop #vlc cache for the nobody user: if not os.path.isdir('/nonexistent'): try: