The SRB 3.0 socket protocol
Making a connection
Sending a simple command that returns an integer.
Sending a simple command that returns a byte array.
Querying the server
Using the parallel IO
Closing the connection
The protocol of the earlier SRB2.0
An example case, Connecting:
(Client output)
(Server output)
Most significant byte first, except unsigned integers or if otherwise noted.
Connect to the SRB:
startup header=
"START SRB\0"
|
startup header, 10 byte string
|
port =
Disconnect and reconnect to host at new port:
user info buffer=
400
0
"testuser", '\0' (repeats 24 times)
"sdsc", '\0' (repeats 28 times)
"demomcat", '\0' (repeats 24 times)
"testuser", '\0' (repeats 24 times)
"sdsc", '\0' (repeats 28 times)
"demomcat", '\0' (repeats 24 times)
"SRB1.1.8&C", '\0' (repeats 122 times)
"53", '\0' (repeats 127 times)
"0", '\0' (repeats 127 times)
|
4 byte int, LSBF
4 byte int, LSBF
proxy user name, 32 byte string
proxy domain name, 32 byte string
proxy mcat zone, 32 byte string
client user name, 32 byte string
client domain name, 32 byte string
client mcat zone, 32 byte string
version, 128 bytes
password option, 128 bytes
execFile, 128 bytes
|
status =
Encrypt1 password =
(complicated stuff happens here to send the Encrypt1 password. SRB Server 2.1+ only accepts Encrypt1 or GSI authentication.)
(server message)
|
64 bytes
|
(SRB Server 2.1+ only accepts Encrypt1 or GSI authentication.)
status =
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
'0'
|
return length, 4 byte int
the file descriptor, 4 byte int
1 byte, the final '0'
|
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 |
100000 |
argument length, 4 byte int |
" = 'testFile'"
" = 'testuser'"
|
fixed length String array with 500 rows. qVal, where of an SQL query
2nd row, (DATA_NAME = 2), 13 byte string
7th row, (USER_NAME = 7), 13 byte string
(Inside the double quotes the spacing and single quotes must be sent exactly as shown.)
All other rows are null. Total metadata attributes * token length = 100000 bytes. |
2000 |
argument length, 4 byte int |
1 1 1 |
fixed length integer array with 500 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. 2000 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.
|
'0'
|
4 byte, the final '0', LSBF
|
Using the parallel IO
ooo, para explicar difícilmente.
for now, send me an email, iktome@sdsc.edu.
Sending a proxy command to the SRB server
Much the same as making any other call to the SRB. Except a new port must be opened and listened to for the returned data.
function buffer =
"F \0" |
start function, 3 byte string |
2011 |
function id, 4 byte int |
12 |
number of arguments, 4 byte int |
4 |
argument length, 4 byte int |
2 |
OPR_COMMAND, 4 byte int |
4 |
argument length, 4 byte int |
2 |
portal flag, PORTAL_STD_IN_OUT, 4 byte int |
4 |
argument length, 4 byte int |
35628 |
local port number, the new port number to open, 4 byte int |
4 |
argument length, 4 byte int |
0 |
nothing, 4 byte int |
4 |
argument length, 4 byte int |
0 |
nothing, 4 byte int |
5 |
argument length, 4 byte int |
"hello" |
the command, [see previous argument length] byte string |
0 |
argument length, 4 byte int |
"" |
command arguments, [see previous argument length] byte string |
0 |
argument length, 4 byte int |
"" |
host address, [see previous argument length] byte string |
12 |
argument length, 4 byte int |
"srb.sdsc.edu" |
local address, [see previous argument length] byte string |
0 |
argument length, 4 byte int |
|
nothing, 0 bytes (byte array) |
0 |
argument length, 4 byte int |
|
nothing, 0 bytes (byte array) |
0 |
argument length, 4 byte int |
|
nothing, 0 bytes (byte array) |
command status =
'V'
'G'
|
1 byte char
1 byte char
|
command return value =
/004
0
'0'
|
return length, 4 byte int
return value, 4 byte int
1 byte, the final '0'
|
Closing the SRB server
Send "X" to the server
'X'
|
1 byte, notice of last function.
|
|