The SRB socket protocol


An example case, Connecting:

(Client output)
(Server output)
Most significant byte first, unless otherwise noted.

Connect to the SRB:

startup header=
"START SRB\0"
startup header, 10 byte string
port =
23486
4 byte int

Disconnect and reconnect to host at new port:

user info buffer=
400
0
"testuser", '\0' (repeats 24 times)
"sdsc", '\0' (repeats 28 times)
"testuser", '\0' (repeats 24 times)
"sdsc", '\0' (repeats 28 times)
"0", '\0' (repeats 127 times)
"SRB1.1.8&C", '\0' (repeats 122 times)
4 byte int, LSBF
4 byte int, LSBF
proxy user name, 32 byte string
proxy domain name, 32 byte string
client user name, 32 byte string
client domain name, 32 byte string
options, 128 bytes
version, 128 bytes

status =
0
4 byte int

mdas password =
"TESTUSER", '\0' (repeats 24 times)
password, 32 byte string

status =
0
4 byte int


Using the SRB server commands, Opening a file - returns an primitive type

Send the function arguments to the server to start the command

function buffer =
"F \0"
2001
3
8
"testfile"
4
0
6
"/test/"
start function, 3 byte string
function id, 4 byte int
number of arguments, 4 byte int
argument length, 4 byte int
file name, [see previous argument length] byte string
argument length, 4 byte int
Unix type open flag, 4 byte int
argument length, 4 byte int
collection name, [see previous argument length] byte string

command status =
'V'
'G'
1 byte char
1 byte char

command return value =
/004
3
return length, 4 byte int
the file descriptor, 4 byte int


Using the SRB server commands, Reading a file - returns a byte array

Send the function arguments to the server to start the command

function buffer =
"F \0"
2003
2
4
3
4
10000
start function, 3 byte string
function id, 4 byte int
number of arguments, 4 byte int
argument length, 4 byte int
file descriptor, 4 byte int
argument length, 4 byte int
byte length to read, 4 byte int

command status =
'V'
'G'
1 byte char
1 byte char

command return value =
10000
0
(10000 bytes here)
0
return length, 4 byte int
(I don't know, perhaps the return length is really a long), 4 bytes
the file data
1 byte, the final '0'


Using the SRB server commands, listing a collection - sends SRB qval and selval arrays and returns the myresult "struct"

Send the function arguments to the server to start the command

function buffer =
"F \0"
start function, 3 byte string
2101
function id, 4 byte int
4
number of arguments, 4 byte int
4
argument length, 4 byte int
0
MDAS_CATALOG - catalog type, 4 byte int
36000
argument length, 4 byte int
" = 'testFile'"
" = 'testuser'"

fixed length String array. qVal, where of an SQL query
2nd row, (DATA_NAME = 2), 13 byte string
7th row, (USER_NAME = 7), 13 byte string
(Everything in the double quotes, including the spacing and single quotes must be sent exactly as shown.)
All other rows are null. 36000 bytes.
720
argument length, 4 byte int
1
1
1
fixed length integer array with 180 rows. selVal, Select of an SQL query
17th row, DATA_GRP_NAME, 4 byte int LSBF
18th row, SIZE, 4 byte int LSBF
35th row, DATA_OWNER, 4 byte int LSBF
All other rows equal zero. 720 bytes
4
argument length, 4 byte int
50
rows wanted, 4 byte int

command status =
'V'
'G'
1 byte char
1 byte char

command return value =
2492
buffer length, 8 byte long
3
result count, 4 byte unsigned int, LSBF
4
row count, 4 byte unsigned int, LSBF
0
continuation index, 4 byte unsigned int, LSBF
result 1
"srb.MDAS_TD_DATA_GRP\0"
tabName, null terminated string
"data_grp_name\0"
attName, null terminated string
"/home/testuser.sdsc/SRB4J-Test", '\0' (repeats 162 times)
"windows ntfs file system", '\0' (repeats 184 times)
value, the total value string length is 400 bytes,
but data_grp_name lists the file system type at the 192nd byte.
"/home/testuser.sdsc/SRB4J-Test/test", '\0' (repeats 157 times)
"unix file system", '\0' (repeats 192 times)
value, the total value string length is 400 bytes,
but data_grp_name lists the file system type at the 192nd byte.
result 2
"srb.MDAS_AD_REPL\0"
tabName, null terminated string
"data_size\0"
attName, null terminated string
3798, '\0' (repeats 392 times)
value, (the data size) 400 bytes, fixed length.
92, '\0' (repeats 392 times)
value, (the data size) 400 bytes, fixed length.
result 3
"srb.MDAS_CD_OWNER_USER\0"
tabName, null terminated string
"user_name\0"
attName, null terminated string
"testuser", '\0' (repeats 392 times)
value, (the data owner) 400 bytes, fixed length.
"testuser", '\0' (repeats 392 times)
value, (the data owner) 400 bytes, fixed length.


Closing the SRB server

Send "X" to the server

'X'
1 byte, notice of last function.