19 #ifndef __XRD_CL_STREAM_HH__
20 #define __XRD_CL_STREAM_HH__
44 class TransportHandler;
93 pTransport = transport;
109 pIncomingQueue = incomingQueue;
117 pChannelData = channelData;
125 pTaskManager = taskManager;
133 pJobManager = jobManager;
152 void Tick( time_t now );
184 std::shared_ptr<Message> msg,
185 uint32_t bytesReceived );
190 std::pair<Message *, MsgHandler *>
198 uint32_t bytesSent );
266 pOnDataConnJob = onConnJob;
285 static bool IsPartial(
Message &msg );
290 inline static bool HasNetAddr(
const XrdNetAddr &addr,
291 std::vector<XrdNetAddr> &addresses )
293 auto itr = addresses.begin();
294 for( ; itr != addresses.end() ; ++itr )
296 if( itr->Same( &addr ) )
return true;
305 class HandleIncMsgJob:
public Job
308 HandleIncMsgJob( MsgHandler *handler ): pHandler( handler ) {};
309 virtual ~HandleIncMsgJob() {};
310 virtual void Run(
void* )
316 MsgHandler *pHandler;
322 void OnFatalError( uint16_t subStream,
329 void MonitorDisconnection( XRootDStatus status );
334 XRootDStatus RequestClose( Message &resp );
336 typedef std::vector<SubStreamData*> SubStreamList;
343 std::string pStreamName;
344 TransportHandler *pTransport;
346 TaskManager *pTaskManager;
347 JobManager *pJobManager;
349 InQueue *pIncomingQueue;
350 AnyObject *pChannelData;
351 uint32_t pLastStreamError;
352 XRootDStatus pLastFatalError;
353 uint16_t pStreamErrorWindow;
354 uint16_t pConnectionCount;
355 uint16_t pConnectionRetry;
356 time_t pConnectionInitTime;
357 uint16_t pConnectionWindow;
358 SubStreamList pSubStreams;
359 std::vector<XrdNetAddr> pAddresses;
361 ChannelHandlerList pChannelEvHandlers;
367 timeval pConnectionStarted;
368 timeval pConnectionDone;
370 uint64_t pBytesReceived;
375 std::shared_ptr<Job> pOnDataConnJob;
#define XRD_WARN_UNUSED_RESULT
A synchronize queue for incoming data.
The message representation used throughout the system.
Interface for socket pollers.
XRootDStatus Send(Message *msg, MsgHandler *handler, bool stateful, time_t expires)
Queue the message for sending.
void SetTransport(TransportHandler *transport)
Set the transport.
StreamStatus
Status of the stream.
@ Disconnected
Not connected.
@ Connecting
In the process of being connected.
void SetIncomingQueue(InQueue *incomingQueue)
Set the incoming queue.
bool OnReadTimeout(uint16_t subStream) XRD_WARN_UNUSED_RESULT
On read timeout.
bool CanCollapse(const URL &url)
void SetPoller(Poller *poller)
Set the poller.
void ForceConnect()
Force connection.
void ForceError(XRootDStatus status, bool hush=false)
Force error.
void SetTaskManager(TaskManager *taskManager)
Set task manager.
void SetOnDataConnectHandler(std::shared_ptr< Job > &onConnJob)
Set the on-connect handler for data streams.
void SetJobManager(JobManager *jobManager)
Set job manager.
Status Query(uint16_t query, AnyObject &result)
Query the stream.
void Disconnect(bool force=false)
Disconnect the stream.
const std::string & GetName() const
Return stream name.
XRootDStatus EnableLink(PathID &path)
Stream(const URL *url, const URL &prefer=URL())
Constructor.
void OnConnect(uint16_t subStream)
Call back when a message has been reconstructed.
void OnConnectError(uint16_t subStream, XRootDStatus status)
On connect error.
bool OnWriteTimeout(uint16_t subStream) XRD_WARN_UNUSED_RESULT
On write timeout.
void DisableIfEmpty(uint16_t subStream)
Disables respective uplink if empty.
void RemoveEventHandler(ChannelEventHandler *handler)
Remove a channel event handler.
void OnMessageSent(uint16_t subStream, Message *msg, uint32_t bytesSent)
MsgHandler * InstallIncHandler(std::shared_ptr< Message > &msg, uint16_t stream)
void OnIncoming(uint16_t subStream, std::shared_ptr< Message > msg, uint32_t bytesReceived)
Call back when a message has been reconstructed.
void OnError(uint16_t subStream, XRootDStatus status)
On error.
const URL * GetURL() const
Get the URL.
uint16_t InspectStatusRsp(uint16_t stream, MsgHandler *&incHandler)
void SetChannelData(AnyObject *channelData)
Set the channel data.
std::pair< Message *, MsgHandler * > OnReadyToWrite(uint16_t subStream)
XRootDStatus Initialize()
Initializer.
void RegisterEventHandler(ChannelEventHandler *handler)
Register channel event handler.
Perform the handshake and the authentication for each physical stream.
Procedure execution status.