Ejemplo n.º 1
0
 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')
Ejemplo n.º 2
0
    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]
Ejemplo n.º 3
0
 def list_registered_ports(self):
     try:
         return [str(self.ports.used)]
     except:
         raise ErrorReturn(dbus.DBUS.ERROR_FAILED, 'f**k')
Ejemplo n.º 4
0
 def unregister_port(self, ID):
     try:
         self.ports.unregister(ID)
     except:
         raise ErrorReturn(dbus.DBUS.ERROR_FILE_NOT_FOUND,
                           'Port Does Not Exist')
Ejemplo n.º 5
0
 def unregister_node(self, ID):
     try:
         self.nodes.unregister(ID)
     except:
         raise ErrorReturn(dbus.DBUS.ERROR_FILE_NOT_FOUND,
                           'Node Does Not Exist')