# sox::SoxCommands

    sys::Obj
      sox::SoxCommands

`public class SoxCommands`

SoxCommands processes all the sox command request/response.

tempKey

  `public static Str tempKey`

tempStr1

  `public static Str tempStr1`

tempStr2

  `public static Str tempStr2`

tempVal

  `public static Str tempVal`

addReq

  `public static void addReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1    'a'
        u1    replyNum
        u2    parentId
        u1    kitId
        u1    typeId
        str   name
        val[] configProps

  }

addRes

  `public static void addRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1    'A'
        u1    replyNum
        u2    compId

  }

deleteReq

  `public static void deleteReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1    'd'
        u1    replyNum
        u2    compId

  }

eventRes

  `public static void eventRes(SoxService service, SoxSession session, SendPacket p)`

  req {

        u1   'e'
        u1   replyNum
        u2   componentId
        compTree | compProps | compLinks
       }

fileCloseReq

  `public static void fileCloseReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1  'z'
        u1  replyNum

  }

fileCloseRes

  `public static void fileCloseRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1  'Z'
        u1  replyNum

  }

fileOpenReq

  `public static void fileOpenReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'f'
        u1   replyNum
        str  method ("g" for get, "p" for put)
        str  uri
        u4   fileSize
        u2   suggestedChunkSize  (suggested by client)
        headers[]
        {
          str  name
          str  value
        }
        u1 end of headers '\0'

  }

  On a put, the fileSize is the number of bytes that will be written. On a get, the fileSize is the maximum number of bytes to read. You can read the whole file on a get by specifying fileSize as 0. The actual number of bytes read might be less if there are not fileSize bytes available (taking into account the size of the actual file, and the potential offset).

       Supported Headers:
        Name      Value         Method      Default   Description
        ----      -----         ------      -------   -----------
        offset    int           get, put    0         Byte offset to use when reading/writing the uri
        mode      "w", "m"      put         "w"       File mode to use (see sys::File)

fileOpenRes

  `public static void fileOpenRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1   'F'
        u1   replyNum
        u4   fileSize
        u2   actualChunkSize
        headers[]
        {
          str  name
          str  value
        }
        u1 end of headers '\0'

  }

fileReceiveChunk

  `public static void fileReceiveChunk(SoxService service, SoxSession session)`

  Service a file chunk request (being put from client to me). NOTE: used by put (get uses fileSendChunk).

        client -> k -> me
        req
        {
          u1   'k'
          u1   replyNum (ignored)
          u2   chunkNum
          u2   chunkSize
          u1[chunkSize] chunk
        }

fileRenameReq

  `public static void fileRenameReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1  'b'
        u1   replyNum
        str  from
        str  to

  }

fileSendChunk

  `public static void fileSendChunk(SoxService service, SoxSession session, SendPacket res)`

  Send the client the next chunk of the file. NOTE: used by get (put uses fileReceiveChunk).

        me -> k -> client
        req
        {
          u1   'k'
          u1   replyNum (ignored)
          u2   chunkNum
          u2   chunkSize
          u1[chunkSize] chunk
        }

invokeReq

  `public static void invokeReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'i'
        u1   replyNum
        u2   componentId
        u1   slotId
        val  argument

  }

linkReq

  `public static void linkReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'l'
        u1   replyNum
        u1   'a' | 'd' (add/delete)
        u2   fromCompId
        u1   fromSlotId
        u2   toCompId
        u1   toSlotId

  }

process

  `public static void process(SoxService service, SoxSession session)`

  Process the current message just received

queryReq

  `public static void queryReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'q'
        u1   replyNum
        u1   queryType
        u1[] queryReq

  }

  queryType 's': query service req-service {

        u1  kitId
        u1  typeId

  }

queryRes

  `public static void queryRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1   'Q'
        u1   replyNum
        u1[] queryRes

  }

  queryType 's': query service res-service {

        u2[num]  compIds
        u2       0xffff end marker

  }

readCompReq

  `public static void readCompReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'c'
        u1   replyNum
        u2   componentId
        u1   what: 't', 'c', 'r', 'l' (tree, config, runtime, links)

  }

readCompRes

  `public static void readCompRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1    'C'
        u1    replyNum
        u2    componentId
        compTree | compProps | compLinks

  }

readPropReq

  `public static void readPropReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1  'r'
        u1  replyNum
        u2  compId
        u1  propId

  }

readPropRes

  `public static void readPropRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1   'R'
        u1   replyNum
        u1   any code
        var  propValue

  }

renameReq

  `public static void renameReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1    'n'
        u1    replyNum
        u2    compId
        str   newName

  }

reorderReq

  `public static void reorderReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1    'o'
        u1    replyNum
        u2    compId
        u1    numChildren
        u2[]  childrenIds

  }

send

  `public static void send(SoxService service, SoxSession session, SendPacket res)`

subscribeReq

  `public static void subscribeReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   's'
        u1   replyNum
        u1   whatMask: tree=0x01 config=0x02 rt=0x04 links=0x8 0xff all tree
        u1   size
        u2[] compIds

  }

subscribeRes

  `public static void subscribeRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1     'S'
        u1     replyNum
        u1     numSubscribed

  }

unsubscribeReq

  `public static void unsubscribeReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'u'
        u1   replyNum
        u2   componentId
        u1   whatMask: tree=0x1 config=0x2 rt=0x4 links=0x8 0xff all tree

  }

versionMoreRes

  `public static void versionMoreRes(SoxService service, SoxSession session, SendPacket res)`

  res {

        u1   'Y'
        u1   replyNum
        str  platformId
        u1   scodeFlags
        kitVersions[kitCount]
        {
          str version
        }
        u1   pairs
        pairs
        {
          str  key
          str  val
        }

  }

versionRes

  `public static void versionRes(SoxService service, SoxSession session, SendPacket res)`

  versionRes {

        u1   'V'
        u1   replyNum
        u1   kitCount
        kits[kitCount]
        {
          str name
          i4  checksum
        }

  }

writeComp

  `public static bool writeComp(SoxService service, SoxSession session, Component c, int what)`

  Write a component

       - 't': writeCompTree
       - 'c': writeCompProps
       - 'r': writeCompProps
       - 'l': writeCompLinks

writeCompLinks

  `public static bool writeCompLinks(SoxService service, SoxSession session, Component c)`

  Write component links

        compLinks
        {
          u1    'l'
          Link[] links
          u2     0xffff end marker
        }

writeCompProps

  `public static bool writeCompProps(SoxService service, SoxSession session, Component c, int what)`

  Write component props (config or runtime)

        compProps
        {
          u1     'c' or 'r' for config or runtime, 'C'/'R' if operator only
          val[]  propValues
        }

writeCompTree

  `public static bool writeCompTree(SoxService service, SoxSession session, Component c)`

  Write component tree information

        compTree
        {
          u1    't'
          u1    kitId
          u1    typeId
          str   name
          u2    parent
          u1    permissions
          u1    numKids
          u2[numKids] kidIds
        }

writeReq

  `public static void writeReq(SoxService service, SoxSession session, SendPacket res)`

  req {

        u1   'w'
        u1   replyNum
        u2   componentId
        u1   slotId
        val  value

  }