Esempio n. 1
0
class OneUpgrade(Command):
    """
    Upgrade a single calendar home.
    """

    arguments = [("uid", String()),
                 ("homeType", String())]
Esempio n. 2
0
class OrgConsensusBegin(Command):
    """
    # admin pubkeys, consensus requirements
    """
    arguments = [(b'name', String()),
                 (b'port', Integer())]
    response = [(b'hello', String())]
Esempio n. 3
0
class QueryStatus(Command):
    arguments = []
    response = [('fix', Boolean()), ('lat', Float()), ('lon', Float()),
                ('gps_heading', Float()), ('gps_speed', Float()),
                ('altitude', Float()), ('num_sat', Integer()),
                ('timestamp', String()), ('datestamp', String()),
                ('compass_heading', Float()), ('temperature', Float())]
Esempio n. 4
0
class AddError(Command):
    """
    Add an error.
    """
    arguments = [(b'testName', String()), (b'error', String()),
                 (b'errorClass', String()), (b'frames', ListOf(String()))]
    response = [(b'success', Boolean())]
Esempio n. 5
0
class MethodCall(Command):
    """Call a method on the object exposed by a L{MethodCallServerFactory}.

    The command arguments have the following semantics:

    - C{sequence}: An integer uniquely indentifying a the L{MethodCall}
      being issued. The name 'sequence' is a bit misleading because it's
      really a uuid, since its values in practice are not in sequential
      order, they are just random values. The name is kept just for backward
      compatibility.

    - C{method}: The name of the method to invoke on the remote object.

    - C{arguments}: A BPickled binary tuple of the form C{(args, kwargs)},
      where C{args} are the positional arguments to be passed to the method
      and C{kwargs} the keyword ones.
    """

    arguments = [(b"sequence", Integer()),
                 (b"method", String()),
                 (b"arguments", String())]

    response = [(b"result", MethodCallArgument())]

    errors = {MethodCallError: b"METHOD_CALL_ERROR"}
Esempio n. 6
0
class SeekGet(Command):
    """
    Grab starting at a hash and moving backwards, with an offset and object count
    Grab starting at a hash and moving forward on the list, with an offset and object count
    Grab from the latest of the list, with an offset and object count
    """
    """
    type : hash : [list]
    foos : bar : [ abc, def, ghi, jkl, mno, pqr, stu, vwx, yz ]

    GET PAST foo stu OFFSET 1 COUNT 3
    GET FUTURE foo ghi OFFSET 2 COUNT 2
    GET CURRENT foo bar OFFSET 5 COUNT 2

    """
    arguments = [
        (b'type', String()),
        (b'direction', String()),  # Forward || reverse
        (b'hash', String()),  # hash || "latest"
        (b'offset', Integer()),
        (b'count', Integer())
    ]
    response = [(b'hashes', String())]  # list of strings...
    arguments = [(b'keyspace', ObjHash()), (b'count', Integer()),
                 (b'forward', Boolean())]
    # should be providing auths
    Responses = [(b'hashes', ListOf(ObjHash()))]
    """
Esempio n. 7
0
class AddFailure(Command):
    """
    Add a failure.
    """
    arguments = [(b'testName', String()), (b'fail', String()),
                 (b'failClass', String()), (b'frames', ListOf(String()))]
    response = [(b'success', Boolean())]
Esempio n. 8
0
class PasswordChallengeResponse(Command):
    """
    Command to respond to a challenge issued in the response to a
    L{PasswordLogin} command and complete a username/password-based login
    attempt.

    @param cnonce: A randomly generated string used only in this response.
    @param response: The SHA-1 hash of the challenge, cnonce, and password.
    """
    arguments = [('cnonce', String()), ('response', String())]

    errors = {
        # Invalid username or password
        UnauthorizedLogin: '******',
        # No IBoxReceiver avatar
        NotImplementedError: 'NOT_IMPLEMENTED_ERROR'
    }

    @classmethod
    def determineFrom(cls, challenge, password):
        """
        Create a nonce and use it, along with the given challenge and password,
        to generate the parameters for a response.

        @return: A C{dict} suitable to be used as the keyword arguments when
            calling this command.
        """
        nonce = secureRandom(16)
        response = _calcResponse(challenge, nonce, password)
        return dict(cnonce=nonce, response=response)
Esempio n. 9
0
class AddExpectedFailure(Command):
    """
    Add an expected failure.
    """
    arguments = [(b'testName', String()), (b'error', String()),
                 (b'todo', String())]
    response = [(b'success', Boolean())]
Esempio n. 10
0
class Configure(Command):
    """
    Configure the upgrade helper process.
    """

    arguments = [("filename", String()), ("appropriateStoreClass", String()),
                 ("merge", Boolean())]
Esempio n. 11
0
class Data(Command):
    """
    Sends some data for a transfer.
    """
    requiresAnswer = False

    arguments = [('name', String()), ('chunk', Integer()), ('body', String())]
Esempio n. 12
0
class JMAnnounceOffers(JMCommand):
    """Send list (actually dict) of offers
    to the daemon, along with new announcement
    and cancellation lists (deltas).
    """
    arguments = [('to_announce', String()), ('to_cancel', String()),
                 ('offerlist', String())]
Esempio n. 13
0
class PasswordLogin(Command):
    """
    Command to initiate a username/password-based login attempt.  The response
    to this command is a challenge which must be responded to based on the
    correct password associated with the username given to this command.
    """
    arguments = [('username', String())]
    response = [('challenge', String())]
Esempio n. 14
0
class JMAuthReceived(JMCommand):
    """Return the commitment and revelation
    provided in !fill, !auth by the TAKER,
    allowing the MAKER to verify against btc library
    before setting up encryption and continuing.
    """
    arguments = [('nick', String()), ('offer', String()),
                 ('commitment', String()), ('revelation', String()),
                 ('amount', Integer()), ('kphex', String())]
Esempio n. 15
0
class JMInit(JMCommand):
    """Communicates the client's required setup
    configuration.
    Blockchain source is communicated only as a naming
    tag for messagechannels (currently IRC 'realname' field).
    """
    arguments = [('bcsource', String()), ('network', String()),
                 ('irc_configs', String()), ('minmakers', Integer()),
                 ('maker_timeout_sec', Integer())]
    errors = {DaemonNotReady: 'daemon is not ready'}
Esempio n. 16
0
class AddUser(Command):
    """
    Add a user to a domain.
    """
    commandName = "add_user"

    arguments = [("name", String()), ("password", String())]

    response = []

    errors = {NotAllowed: "NotAllowed"}
Esempio n. 17
0
class Verify(Command):
    """
    Verify that the checksum of the given chunk is correct.

    Errors:

      - chunk checksum incorrect
      - host hasn't computed checksum for that chunk yet.
    """

    arguments = [('name', String()), ('peer', q2q.Q2QAddressArgument()),
                 ('chunk', Integer()), ('sha1sum', String())]
Esempio n. 18
0
class RegisterUser(Command):
    arguments = [('username', Unicode()),
                 ('publickey', String())]

    response = [('uid', Integer())]

    errors = {UsernameUnavailable: 'username-unavailable'}
Esempio n. 19
0
class JMTXBroadcast(JMCommand):
    """ Accept a bitcoin transaction
    sent over the wire by a counterparty
    and relay it to the client for network
    broadcast.
    """
    arguments = [(b'tx', String())]
Esempio n. 20
0
class NodeStateCommand(Command):
    """
    Used by a convergence agent to update the control service about the
    status of a particular node.
    """
    arguments = [('hostname', String()), ('node_state', NodeStateArgument())]
    response = []
Esempio n. 21
0
class Write(Command):
    """
    Write the given bytes to a multiplexed virtual connection.
    """
    commandName = 'write'
    arguments = [('id', Integer()), ('body', String())]
    requiresAnswer = False
Esempio n. 22
0
class Configure(Command):
    """
    Configure this worker process with the text of an XML property list.
    """
    arguments = [("plist", String())]
    # Pass OSError exceptions through, presenting the exception message to the user.
    errors = {OSError: 'OSError'}
Esempio n. 23
0
class Get(Command):
    """
    Tells the remote it should start sending me chunks of a file.
    """

    arguments = [("name", String()), ('mask', BitArrayArgument(optional=True))]

    response = [("size", Integer())]  # number of octets!!
Esempio n. 24
0
class StoreGet(Command):
    """
    Geting a key (permissioned, recursive)
    Geting a key (permissionless, non-recursive)
    """
    """
    MONITOR TYPE foobar HASH hash READER reader SIGNATURE sig
    [ Results[], 2016-10-11 20:10:10, signature ]
    SUBSCRIBE TYPE foobar HASH hash READER reader SIGNATURE sig
    [ Results[], 2016-10-11 20:10:10, signature ]
    """

    arguments = [
        (b'reader', String()),
        # permissioned + recursive || permissionless + unrecursive
        (b'authority', Boolean()),
        (b'hash', String()),
        (b'signature', String()),
        (b'object', String()),
        (b'type', String())
    ]
    response = [(b'lifetime', DateTime()), (b'signature', String())]
    arguments = [(b'hash', ObjHash()), (b'type', String())]
    # should be providing auths
    Responses = [(b'blob', ObjBlob()), (b'ttl', DateTime())]
    """
Esempio n. 25
0
class StoreSet(Command):
    """
    Adding a key (permissioned, recursive)
    Adding a key (permissionless, non-recursive)
    """
    """
    sends: object
    recieves: lifetime, signature


    PUBLISH TYPE foobar HASH abc AUTHOR author OBJECT object SIGNATURE sig
    [ 2016-10-11 20:10:10, signature ]
    sends: object
    recieves: lifetime, signature


    DEPLOY TYPE foobar HASH abc AUTHOR author OBJECT object SIGNATURE sig
    [ 2016-10-11 20:10:10, signature ]
    """
    arguments = [
        (b'author', String()),
        # permissioned + recursive || permissionless + unrecursive
        (b'authority', Boolean()),
        (b'hash', String()),
        (b'signature', String()),
        (b'object', String()),
        (b'type', String())
    ]
    response = [(b'lifetime', DateTime()), (b'signature', String())]
    arguments = [(b'blob', ObjBlob()), (b'type', String())]
    # should be providing auths
    Responses = [(b'done', Boolean()), (b'ttl', DateTime())]
    """
Esempio n. 26
0
class Introduce(Command):
    """
    Tells the remote end about another node which should have information about
    this transfer.

    Peer: the address of the peer
    Name: the name of the file given.
    """
    requiresAnswer = False
    arguments = [('peer', q2q.Q2QAddressArgument()), ('name', String())]
Esempio n. 27
0
class SearchRun(Command):
    """
    Search from content-containing objects
    """
    """
    type : hash : [list]
    foos : bar : [ abc, def, ghi, jkl, mno, pqr, stu, vwx, yz ]

    GET SEARCH foo TERM "cats" OFFSET 10 COUNT 100

    [ bar, otherbar ]

    """
    arguments = [(b'type', String()), (b'term', String()),
                 (b'offset', Integer()), (b'count', Integer())]
    # response = [(b'hashes', String())]  # list of strings...
    arguments = [(b'hash', ObjHash()), (b'type', String())]
    # should be providing auths
    responses = [(b'blob', ObjBlob()), (b'ttl', DateTime())]
    """
Esempio n. 28
0
class JMInitProto(JMCommand):
    """Pass to the client the messaging protocol parameters
    (which are defined in daemon package), required to construct
    the user nick, given the bitcoin private key used for authentication
    (that key being controlled by the client; the daemon knows nothing
    about bitcoin).
    """
    arguments = [('nick_hash_length', Integer()),
                 ('nick_max_encoded', Integer()),
                 ('joinmarket_nick_header', String()),
                 ('joinmarket_version', Integer())]
Esempio n. 29
0
class OTPLogin(Command):
    """
    Command to initiate a login attempt where a one-time pad is to be used in
    place of username/password credentials.
    """
    arguments = [('pad', String())]

    errors = {
        # Invalid username or password
        UnauthorizedLogin: '******',
        # No IBoxReceiver avatar
        NotImplementedError: 'NOT_IMPLEMENTED_ERROR'}
Esempio n. 30
0
class JMIOAuth(JMCommand):
    """Send contents of !ioauth message after
    verifying Taker's auth message
    """
    arguments = [('nick', String()), ('utxolist', String()),
                 ('pubkey', String()), ('cjaddr', String()),
                 ('changeaddr', String()), ('pubkeysig', String())]
Esempio n. 31
0
 def toString(self, arg):
     assert isinstance(arg, loaderClass), \
         ("%r not %r" % (arg, loaderClass))
     return String.toString(self, arg.dump())
Esempio n. 32
0
 def fromString(self, arg):
     return loaderClass.load(String.fromString(self, arg))