xrootd/{client,protocol}: add protocol request
Created by: EgorMatirov
Add Protocol request which queries for such info as:
- Protocol version
- Server type
- Security version
- Security options
- Security level
- Security overrides, that customize predefined security level
Information about security level and security overrides will further be used for signing requests when it's required by the server.
Client clean-up in the mock test is a bit awful due to not decided (yet) way of closing. Response parsing is a bit awful too, since it copies data twice - from slice to the structs and then assembles these structs in more complicated response.
I want to make a generator of Marshal
\Unmarshal
functions and handle bit-wise encoding and support of nested structs, slice length and so on.
Something like:
type ProtocolInfo struct {
BinaryProtocolVersion int32 `order 0`
ServerType protocol.ServerType // Haven't come up with idea for enums yet.
IsManager bool `order 4 bit 0x00000002`
IsServer bool `order 4 bit 0x00000001`
IsMeta bool `order 4 bit 0x00000100`
IsProxy bool `order 4 bit 0x00000200`
IsSupervisor bool `order 4 bit 0x00000400`
SecurityVersion byte `order 10 optional` // Note that it is 10 due to 2 preceeding fields of int32 (4+4) and two reserved fields of byte (1+1)
ForceSecurity bool `order 11 bit 0x02 optional`
SecurityLevel byte `order 12 optional`
SecurityOverridesSize byte `order 13 optional`
SecurityOverrides []protocolRequest.SecurityOverride `order 14 size SecurityOverridesSize`
}
Since I'm unsure that it is worth keeping a runtime-based Marshal\Unmarshal after generator will be written, I haven't added these features in it as part of that PR (or before that PR).
Regarding implementing the generator - I would like to deal with few complicated request before that to have better idea about possible features, if it is ok.