hep: go-hep.org/x/hep/xrootd/xrdproto Index | Files | Directories

package xrdproto

import "go-hep.org/x/hep/xrootd/xrdproto"

Package protocol contains the XRootD protocol specific types and methods to handle them, such as marshalling and unmarshalling requests.

Index

Package Files

xrdproto.go

Constants

const RequestHeaderLength = 2 + 2

RequestHeaderLength is the length of the RequestHeader in bytes.

const ResponseHeaderLength = 2 + 2 + 4

ResponseHeaderLength is the length of the ResponseHeader in bytes.

const SecurityOverrideLength = 2

SecurityOverrideLength is the length of SecurityOverride in bytes.

func Opaque Uses

func Opaque(path string) string

Opaque returns opaque data from provided path.

func ReadRequest Uses

func ReadRequest(r io.Reader) ([]byte, error)

ReadRequest reads a XRootD request from r. ReadRequest returns entire payload of the request including header. ReadRequest requires serialization since multiple ReadFull calls are made.

func ReadResponseWithReuse Uses

func ReadResponseWithReuse(r io.Reader, headerBytes []byte, header *ResponseHeader) ([]byte, error)

ReadResponseWithReuse reads a XRootD response from r. A response header is read into headerBytes and unmarshaled to header for the reusing reasons. ReadResponseWithReuse returns the response body. ReadResponseWithReuse requires serialization since multiple ReadFull calls are made.

func SetOpaque Uses

func SetOpaque(path *string, opaque string)

SetOpaque sets opaque data part in the provided path.

func WriteResponse Uses

func WriteResponse(w io.Writer, streamID StreamID, status ResponseStatus, resp Marshaler) error

WriteResponse writes a XRootD response resp to the w. The response is directed to the stream with id equal to the streamID. The status is sent as part of response header. WriteResponse writes all data to the w as single Write call, so no serialization is required.

type DataRequest Uses

type DataRequest interface {
    // PathID returns an identifier of the socket which should be used to read or write a data.
    PathID() PathID

    // SePathID sets the identifier of the socket which should be used to read or write a data.
    SetPathID(pathID PathID)

    // Direction returns the direction of the request: either reading or writing.
    Direction() DataRequestDirection

    // PathData returns the data which should be send to the data socket.
    PathData() []byte
}

DataRequest is the request that operate over 2 sockets. One socket is used for sending the request and other is used to send or receive data.

type DataRequestDirection Uses

type DataRequestDirection int

DataRequestDirection is the direction of the request: either reading or writing.

const (
    // DataRequestRead indicates that request has reading direction.
    // In other words, the request obtains a data from the server.
    DataRequestRead DataRequestDirection = iota

    // DataRequestWrite indicates that request has writing direction.
    // In other words, the request sends a data to the server.
    DataRequestWrite
)

type FilepathRequest Uses

type FilepathRequest interface {
    Opaque() string          // Opaque returns opaque data from this request.
    SetOpaque(opaque string) // SetOpaque sets opaque data for this request.
}

FilepathRequest is a request that contains file paths. This interface is used to append opaque data to the request. Opaque data is received as part of the redirect response.

type Marshaler Uses

type Marshaler interface {
    MarshalXrd(enc *xrdenc.WBuffer) error
}

Marshaler is the interface implemented by a type that can marshal itself into a binary form, following the XRootD protocol.

MarshalXrd encodes the receiver into a binary form and returns the result.

type PathID Uses

type PathID byte

PathID is the socket identifier. It may be used in read and write requests to indicate which socket should be used for a response or as a source of data.

type Request Uses

type Request interface {
    // ReqID uniquely identifies the type of a request.
    ReqID() uint16

    // ShouldSign indicates whether this request should be signed if security level is SignLikely.
    // For the list of actual examples see XRootD protocol specification v. 3.1.0, p.76.
    ShouldSign() bool

    Marshaler
    Unmarshaler
}

Request is a XRootD request issued to a server.

type RequestHeader Uses

type RequestHeader struct {
    StreamID  StreamID
    RequestID uint16
}

ResponseHeader is the header that precedes all requests (we are interested in StreamID and RequestID, actual request parameters are a part of specific request).

func (RequestHeader) MarshalXrd Uses

func (o RequestHeader) MarshalXrd(wBuffer *xrdenc.WBuffer) error

MarshalXrd implements Marshaler.

func (*RequestHeader) UnmarshalXrd Uses

func (o *RequestHeader) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

UnmarshalXrd implements Unmarshaler.

type RequestLevel Uses

type RequestLevel byte

RequestLevel is the security requirement that the associated request is to have.

const (
    SignNone   RequestLevel = 0 // SignNone indicates that the request need not to be signed.
    SignLikely RequestLevel = 1 // SignLikely indicates that the request must be signed if it modifies data.
    SignNeeded RequestLevel = 2 // SignNeeded indicates that the request mush be signed.
)

type Response Uses

type Response interface {
    RespID() uint16
    Marshaler
    Unmarshaler
}

Response is a XRootD response returned by the server

type ResponseHeader Uses

type ResponseHeader struct {
    StreamID   StreamID
    Status     ResponseStatus
    DataLength int32
}

ResponseHeader is the header that precedes all responses (see xrootd protocol specification).

func ReadResponse Uses

func ReadResponse(r io.Reader) (ResponseHeader, []byte, error)

ReadResponse reads a XRootD response from r. ReadResponse returns the response header and the response body. ReadResponse requires serialization since multiple ReadFull calls are made.

func (ResponseHeader) Error Uses

func (hdr ResponseHeader) Error(data []byte) error

Error returns an error received from the server or nil if request hasn't failed.

func (ResponseHeader) MarshalXrd Uses

func (o ResponseHeader) MarshalXrd(wBuffer *xrdenc.WBuffer) error

MarshalXrd implements xrdproto.Marshaler

func (*ResponseHeader) UnmarshalXrd Uses

func (o *ResponseHeader) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

UnmarshalXrd implements xrdproto.Unmarshaler

type ResponseStatus Uses

type ResponseStatus uint16

ResponseStatus is the status code indicating how the request completed.

const (
    // Ok indicates that request fully completed and no addition responses will be forthcoming.
    Ok  ResponseStatus = 0
    // OkSoFar indicates that server provides partial response and client should be prepared
    // to receive additional responses on same stream.
    OkSoFar ResponseStatus = 4000
    // Error indicates that an error occurred during request handling.
    // Error code and error message are sent as part of response (see xrootd protocol specification v3.1.0, p. 27).
    Error ResponseStatus = 4003
    // Redirect indicates that the client must re-issue the request to another server.
    Redirect ResponseStatus = 4004
    // Wait indicates that the client must wait the indicated number of seconds and retry the request.
    Wait ResponseStatus = 4005
)

type SecurityLevel Uses

type SecurityLevel byte

SecurityLevel is the predefined security level that specifies which requests should be signed. See specification for details: http://xrootd.org/doc/dev45/XRdv310.pdf, p. 75.

const (
    // NoneLevel indicates that no request needs to be signed.
    NoneLevel SecurityLevel = 0
    // Compatible indicates that only potentially destructive requests need to be signed.
    Compatible SecurityLevel = 1
    // Standard indicates that potentially destructive requests
    // as well as certain non-destructive requests need to be signed.
    Standard SecurityLevel = 2
    // Intense indicates that request that may reveal metadata or modify data need to be signed.
    Intense SecurityLevel = 3
    // Pedantic indicates that all requests need to be signed.
    Pedantic SecurityLevel = 4
)

type SecurityOverride Uses

type SecurityOverride struct {
    RequestIndex byte
    RequestLevel RequestLevel
}

SecurityOverride is an alteration needed to the specified predefined security level. It consists of the request index and the security requirement the associated request should have. Request index is calculated as:

(request code) - (request code of Auth request)

according to xrootd protocol specification.

func (SecurityOverride) MarshalXrd Uses

func (o SecurityOverride) MarshalXrd(enc *xrdenc.WBuffer) error

MarshalXrd implements xrdproto.Marshaler

func (*SecurityOverride) UnmarshalXrd Uses

func (o *SecurityOverride) UnmarshalXrd(dec *xrdenc.RBuffer) error

UnmarshalXrd implements xrdproto.Unmarshaler

type ServerError Uses

type ServerError struct {
    Code    ServerErrorCode
    Message string
}

ServerError is the error returned by the XRootD server as part of response to the request.

func (ServerError) Error Uses

func (err ServerError) Error() string

func (ServerError) MarshalXrd Uses

func (o ServerError) MarshalXrd(wBuffer *xrdenc.WBuffer) error

MarshalXrd implements Marshaler.

func (*ServerError) UnmarshalXrd Uses

func (o *ServerError) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

UnmarshalXrd implements Unmarshaler.

type ServerErrorCode Uses

type ServerErrorCode int32

ServerErrorCode is the code of the error returned by the XRootD server as part of response to the request.

const (
    InvalidRequest ServerErrorCode = 3006 // InvalidRequest indicates that request is invalid.
    IOError        ServerErrorCode = 3007 // IOError indicates that an IO error has occurred on the server side.
    NotAuthorized  ServerErrorCode = 3010 // NotAuthorized indicates that user was not authorized for operation.
    NotFound       ServerErrorCode = 3011 // NotFound indicates that path was not found on the remote server.
)

type ServerType Uses

type ServerType int32

ServerType is the general server type kept for compatibility with 2.0 protocol version (see xrootd protocol specification v3.1.0, p. 5).

const (
    // LoadBalancingServer indicates whether this is a load-balancing server.
    LoadBalancingServer ServerType = iota
    // DataServer indicates whether this is a data server.
    DataServer
)

type StreamID Uses

type StreamID [2]byte

StreamID is the binary identifier associated with a request stream.

type Unmarshaler Uses

type Unmarshaler interface {
    UnmarshalXrd(dec *xrdenc.RBuffer) error
}

Unmarshaler is the interface implemented by a type that can unmarshal a binary representation of itself, following the XRootD protocol.

UnmarshalXrd must be able to decode the form generated by MarshalXrd. UnmarshalXrd must copy the data if it wishes to retain the data after returning.

type WaitResponse Uses

type WaitResponse struct {
    Duration time.Duration
}

WaitResponse is the response indicating that the client must wait and retry the request. See http://xrootd.org/doc/dev45/XRdv310.pdf, p. 35 for details.

func (WaitResponse) MarshalXrd Uses

func (o WaitResponse) MarshalXrd(wBuffer *xrdenc.WBuffer) error

MarshalXrd implements Marshaler.

func (*WaitResponse) UnmarshalXrd Uses

func (o *WaitResponse) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

UnmarshalXrd implements Unmarshaler.

Directories

PathSynopsis
adminPackage admin contains the types related to the admin request.
authPackage auth contains the structures describing auth request.
auth/hostPackage host contains the implementation for the "host" security provider.
auth/krb5Package krb5 contains the implementation of krb5 (Kerberos) security provider.
auth/unixPackage unix contains the implementation of unix security provider.
bindPackage bind contains the structures describing bind request and response.
chmodPackage chmod contains the structures describing chmod request.
decryptPackage decrypt contains the types related to the decrypt request.
dirlistPackage dirlist contains the structures describing request and response for dirlist request used to obtain the contents of a directory.
endsessPackage endsess contains the types related to the endsess request.
handshakePackage handshake contains the structures describing request and response for handshake request (see XRootD specification).
locatePackage locate contains the types related to the locate request.
loginPackage login contains the structures describing request and response for login request.
mkdirPackage mkdir contains the structures describing mkdir request.
mvPackage mv contains the structures describing mv request.
openPackage open contains the structures describing request and response for open request.
pingPackage ping contains the structures describing ping request.
preparePackage prepare contains the types related to the prepare request.
protocolPackage protocol contains the structures describing request and response for protocol request (see XRootD specification).
queryPackage query contains the types related to the query request.
readPackage read contains the structures describing request and response for read request.
rmPackage rm contains the structures describing rm request.
rmdirPackage rmdir contains the structures describing rmdir request.
signingPackage signing contains implementation of a way to check if request should be signed according to XRootD protocol specification v.
sigverPackage sigver contains the structures describing sigver request.
statPackage stat contains the structures describing request and response for stat request.
statxPackage statx contains the structures describing request and response for statx request.
syncPackage sync contains the structures describing sync request.
truncatePackage truncate contains the structures describing truncate request.
verifywPackage verifyw contains the structures describing verifyw request.
writePackage write contains the structures describing write request.
xrdclosePackage xrdclose contains the structures describing request and response for close request.

Package xrdproto imports 7 packages (graph) and is imported by 18 packages. Updated 2019-01-04. Refresh now. Tools for package owners.