예제 #1
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()))]
    """
예제 #2
0
class Add(Command):
    """
    An example of an application-defined command which should be made available
    to clients after they successfully authenticate.
    """
    arguments = [("left", Integer()), ("right", Integer())]

    response = [("sum", Integer())]
예제 #3
0
class JMRequestMsgSigVerify(JMCommand):
    """Request the client to verify a counterparty's
    message-channel layer message against the provided nick
    """
    arguments = [(b'msg', Unicode()), (b'fullmsg', Unicode()),
                 (b'sig', Unicode()), (b'pubkey', Unicode()),
                 (b'nick', Unicode()), (b'hashlen', Integer()),
                 (b'max_encoded', Integer()), (b'hostid', Unicode())]
예제 #4
0
class SyncCourierDirectoryAsk(Command):
    arguments = [(b'dir_pubkey', ListOf(ObjPubKey())),
                 (b'dir_addrs', ListOf(ObjAddress())),
                 (b'dir_ports', ListOf(Integer()))]
    response = [(b'dir_pubkey', ListOf(ObjPubKey())),
                (b'dir_addrs', ListOf(ObjAddress())),
                (b'dir_ports', ListOf(Integer()))]
    """
예제 #5
0
class Post(db.Document):
    id = Integer(primary_key=True)
    title = StringField(required=True)
    date_posted = DateTime(nullable=False, default=datetime.utcnow())
    content = StringField(Text, nullable=False)
    last_updated = DateTimeField(default=datetime.datetime.now())
    user_id = Integer(ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Post('{self.title}', '{self.date_posted}')"
예제 #6
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 = [(b'bcsource', Unicode()), (b'network', Unicode()),
                 (b'irc_configs', Unicode()), (b'minmakers', Integer()),
                 (b'maker_timeout_sec', Integer())]
    errors = {DaemonNotReady: b'daemon is not ready'}
예제 #7
0
class TestCommand(Command):
    """
    Trivial command for testing.
    """
    arguments = [
        ('argument', Integer()),
    ]
    response = [
        ('response', Integer()),
    ]
예제 #8
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 = [(b'nick_hash_length', Integer()),
                 (b'nick_max_encoded', Integer()),
                 (b'joinmarket_nick_header', Unicode()),
                 (b'joinmarket_version', Integer())]
예제 #9
0
class JMInit(JMCommand):
    """Communicates the client's required setup
    configuration.
    Blockchain source is communicated only as a naming
    tag for messagechannels (for IRC, 'realname' field).
    """
    arguments = [(b'bcsource', Unicode()), (b'network', Unicode()),
                 (b'chan_configs', JsonEncodable()), (b'minmakers', Integer()),
                 (b'maker_timeout_sec', Integer()),
                 (b'dust_threshold', Integer()),
                 (b'blacklist_location', Unicode())]
    errors = {DaemonNotReady: b'daemon is not ready'}
예제 #10
0
class SyncPeerDirectoryAsk(Command):
    # would have prefered dict capability.
    # these may need encoding...
    arguments = [(b'dir_pubkey', ListOf(ObjPubKey())),
                 (b'dir_addrs', ListOf(ObjAddress())),
                 (b'dir_ports', ListOf(Integer()))]
    response = [(b'dir_pubkey', ListOf(ObjPubKey())),
                (b'dir_addrs', ListOf(ObjAddress())),
                (b'dir_ports', ListOf(Integer()))]

    def __init__(self, commandType, *a, **kw):
        print('Command Created')
        super(SyncPeerDirectoryAsk).__init__(commandType, *a, **kw)

    """
예제 #11
0
class RequestAuth(Command):
    arguments = []
    response = [('share_password'.encode(), Unicode()),
                ('username'.encode(), Unicode()),
                ('user_password'.encode(), Unicode()),
                ('sender_ip'.encode(), Unicode()),
                ('sender_port'.encode(), Integer())]
class JMFill(JMCommand):
    """Fill an offer/order
    """
    arguments = [(b'amount', Integer()),
                 (b'commitment', Unicode()),
                 (b'revelation', Unicode()),
                 (b'filled_offers', Unicode())]
class BIP78SenderReceiveError(JMCommand):
    """ Sends a message from daemon to client
    indicating that the BIP78 receiver did not
    accept the request, or there was a network error.
    """
    arguments = [(b'errormsg', Unicode()),
                 (b'errorcode', Integer())]
예제 #14
0
파일: command.py 프로젝트: zhp1254/vertex
class Close(Command):
    """
    Close the given multiplexed virtual connetion.
    """
    commandName = 'close'
    arguments = [('id', Integer())]
    requiresAnswer = True
예제 #15
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"}
예제 #16
0
class RegisterUser(Command):
    arguments = [('username', Unicode()),
                 ('publickey', String())]

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

    errors = {UsernameUnavailable: 'username-unavailable'}
예제 #17
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())]
예제 #18
0
파일: command.py 프로젝트: zhp1254/vertex
class Choke(Command):
    """
    Flow control: ask the peer to stop sending data over this virtual channel.
    """
    commandName = 'Choke'
    arguments = [('id', Integer())]
    requiresAnswer = False
예제 #19
0
파일: sigma.py 프로젝트: zhp1254/vertex
class Data(Command):
    """
    Sends some data for a transfer.
    """
    requiresAnswer = False

    arguments = [('name', String()), ('chunk', Integer()), ('body', String())]
예제 #20
0
파일: command.py 프로젝트: zhp1254/vertex
class Unchoke(Command):
    """
    Reverse of L{Choke}; flow may resume over this virtual channel.
    """
    commandName = 'Unchoke'
    arguments = [('id', Integer())]
    requiresAnswer = False
예제 #21
0
파일: command.py 프로젝트: zhp1254/vertex
class Virtual(Command):
    """
    Initiate a virtual multiplexed connection over this TCP connection.
    """
    commandName = 'virtual'
    result = []

    arguments = [('id', Integer())]

    def makeResponse(cls, objects, proto):
        """
        Create a response dictionary using this L{Virtual} command's schema; do
        the same thing as L{Command.makeResponse}, but additionally do
        addition.

        @param objects: The dictionary of strings mapped to Python objects.

        @param proto: The AMP protocol that this command is serialized to.

        @return: A L{ConnectionStartBox} containing the serialized form of
            C{objects}.
        """
        tpt = objects.pop('__transport__')
        # XXX Using a private API
        return _objectsToStrings(objects, cls.response,
                                 ConnectionStartBox(tpt), proto)

    makeResponse = classmethod(makeResponse)
예제 #22
0
class OrgConsensusBegin(Command):
    """
    # admin pubkeys, consensus requirements
    """
    arguments = [(b'name', String()),
                 (b'port', Integer())]
    response = [(b'hello', String())]
예제 #23
0
파일: command.py 프로젝트: zhp1254/vertex
class Write(Command):
    """
    Write the given bytes to a multiplexed virtual connection.
    """
    commandName = 'write'
    arguments = [('id', Integer()), ('body', String())]
    requiresAnswer = False
예제 #24
0
파일: sigma.py 프로젝트: zhp1254/vertex
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!!
예제 #25
0
파일: remote.py 프로젝트: dequis/bravo
class MakeChunk(Command):
    arguments = [
        ("x", Integer()),
        ("z", Integer()),
        ("seed", Integer()),
        ("generators", ListOf(String())),
    ]
    response = [
        ("blocks", String()),
        ("metadata", String()),
        ("skylight", String()),
        ("blocklight", String()),
        ("heightmap", String()),
    ]
    errors = {
        Exception: "Exception",
    }
예제 #26
0
class VersionCommand(Command):
    """
    Return configuration protocol version of the control service.

    Semantic versioning: Major version changes implies incompatibility.
    """
    arguments = []
    response = [('major', Integer())]
예제 #27
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 = [(b'nick', Unicode()), (b'offer', Unicode()),
                 (b'commitment', Unicode()), (b'revelation', Unicode()),
                 (b'amount', Integer()), (b'kphex', Unicode())]
예제 #28
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())]
    """
예제 #29
0
class MethodCallChunk(Command):
    """Send a chunk of L{MethodCall} containing a portion of the arguments.

    When a the arguments of a L{MethodCall} are bigger than 64k, they get split
    in several L{MethodCallChunk}s that are buffered on the receiver side.

    The command arguments have the following semantics:

    - C{sequence}: The unique integer associated with the L{MethodCall} that
      this L{MethodCallChunk} is part of.

    - C{chunk}: A portion of the big BPickle C{arguments} string which is
      being split and buffered.
    """

    arguments = [("sequence", Integer()), ("chunk", String())]

    response = [("result", Integer())]

    errors = {MethodCallError: "METHOD_CALL_ERROR"}
예제 #30
0
파일: sigma.py 프로젝트: zhp1254/vertex
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())]