def register_as_node(self): try: node_id = self.nodes.register() return [node_id] except: raise ErrorReturn(dbus.DBUS.ERROR_LIMITS_EXCEEDED, 'Node Limit Reached')
def register_port(self, portDict): try: port = PortBase.from_type_string(portDict['type'])( ParserBase.from_type_string(portDict['protocol']), HandlerBase.from_type_string(portDict['protocol'])) port_id = self.ports.register(port) port.port_id = port_id except IndexError: raise ErrorReturn(dbus.DBUS.ERROR_LIMITS_EXCEEDED, 'Port Limit Reached') except NotImplementedError: raise ErrorReturn(dbus.DBUS.ERROR_NOT_SUPPORTED, 'Not Implemented') else: raise ErrorReturn(dbus.DBUS.ERROR_SPAWN_SETUP_FAILED, 'Bad Configuration') return [port_id]
def list_registered_ports(self): try: return [str(self.ports.used)] except: raise ErrorReturn(dbus.DBUS.ERROR_FAILED, 'f**k')
def unregister_port(self, ID): try: self.ports.unregister(ID) except: raise ErrorReturn(dbus.DBUS.ERROR_FILE_NOT_FOUND, 'Port Does Not Exist')
def unregister_node(self, ID): try: self.nodes.unregister(ID) except: raise ErrorReturn(dbus.DBUS.ERROR_FILE_NOT_FOUND, 'Node Does Not Exist')