class Data(juice.Command): """ Sends some data for a transfer. """ arguments = [('name', juice.String()), ('chunk', juice.Integer()), (juice.BODY, juice.String())]
class AddUser(juice.Command): """ Add a user to a domain. """ commandName = "add_user" arguments = [("name", juice.String()), ("password", juice.String())] response = [] errors = {NotAllowed: "NotAllowed"}
class Verify(juice.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', juice.String()), ('peer', q2q.Q2QAddressArgument()), ('chunk', juice.Integer()), ('sha1sum', juice.String())]
class TestSwitchProto(juice.ProtocolSwitchCommand): commandName = 'Switch-Proto' arguments = [ ('name', juice.String()), ] errors = {UnknownProtocol: 'UNKNOWN'}
class CallItemMethod(juice.Command): """ Invoke a particular method of a particular item. """ commandName = 'Call-Item-Method' arguments = [('storepath', juice.Path()), ('storeid', juice.Integer()), ('method', juice.String())]
class Get(juice.Command): """ Tells the remote it should start sending me chunks of a file. """ arguments = [("name", juice.String()), ('mask', BitArrayArgument(optional=True))] response = [("size", juice.Integer())] # number of octets!!
class Introduce(juice.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. """ arguments = [('peer', q2q.Q2QAddressArgument()), ('name', juice.String())]
class PlayFile(juice.Command): commandName = "Play-File" arguments = [('cookie', juice.String()), ("filename", juice.String()), ("format", juice.String(optional=True))] response = [("done", juice.Boolean())]
class Hello(juice.Command): commandName = 'hello' arguments = [('hello', juice.String())] response = [('hello', juice.String())] errors = {UnfriendlyGreeting: 'UNFRIENDLY'}
class DTMF(juice.Command): commandName = "DTMF" arguments = [('cookie', juice.String()), ("key", juice.Integer())]
class RTPStart(juice.Command): commandName = "Start" arguments = [('cookie', juice.String()), ("targethost", juice.String()), ("targetport", juice.Integer())]
class RTPStop(juice.Command): commandName = "Stop" arguments = [('cookie', juice.String())]
class GetSDP(juice.Command): commandName = "Get-SDP" arguments = [('cookie', juice.String()), ("othersdp", juice.String())] response = [('sdp', juice.String())]
class CreateRTPSocket(juice.Command): commandName = "Create-RTPSocket" arguments = [("host", juice.String())] response = [('cookie', juice.String())]
class StopPlaying(juice.Command): commandName = "Stop-Playing" arguments = [('cookie', juice.String())]
class Put(juice.Command): """ Tells the remote end it should request a file from me. """ arguments = [("name", juice.String())]
class StopRecording(juice.Command): commandName = "Stop-Recording" arguments = [('cookie', juice.String())] response = []
class StartRecording(juice.Command): commandName = 'Start-Recording' arguments = [('cookie', juice.String()), ('filename', juice.String()), ("format", juice.String())]