Skip to content

Commit

Permalink
[XrdCl] Refactor XRootDChannelInfo out of XRootDTransport.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Oct 11, 2016
1 parent 0b0f806 commit c8b3067
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions src/XrdCl/XrdClXRootDChannelInfo.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* XrdClXRootDChannelInfo.hh
*
* Created on: Oct 5, 2016
* Author: simonm
*/

#ifndef SRC_XRDCL_XRDCLXROOTDCHANNELINFO_HH_
#define SRC_XRDCL_XRDCLXROOTDCHANNELINFO_HH_

#include "XrdCl/XrdClSIDManager.hh"
#include "XrdSec/XrdSecInterface.hh"
#include "XrdSec/XrdSecProtect.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdSys/XrdSysPthread.hh"

#include <vector>
#include <string>
#include <set>
#include <stdint.h>

namespace XrdCl
{
//----------------------------------------------------------------------------
//! Information holder for XRootDStreams
//----------------------------------------------------------------------------
struct XRootDStreamInfo
{
//--------------------------------------------------------------------------
// Define the stream status for the link negotiation purposes
//--------------------------------------------------------------------------
enum StreamStatus
{
Disconnected,
Broken,
HandShakeSent,
HandShakeReceived,
LoginSent,
AuthSent,
BindSent,
EndSessionSent,
Connected
};

//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
XRootDStreamInfo(): status( Disconnected ), pathId( 0 )
{
}

StreamStatus status;
uint8_t pathId;
};

//----------------------------------------------------------------------------
//! Information holder for xrootd channels
//----------------------------------------------------------------------------
struct XRootDChannelInfo
{
//--------------------------------------------------------------------------
// Constructor
//--------------------------------------------------------------------------
XRootDChannelInfo():
serverFlags(0),
protocolVersion(0),
firstLogIn(true),
sidManager(0),
authBuffer(0),
authProtocol(0),
authParams(0),
authEnv(0),
openFiles(0),
waitBarrier(0),
protection(0),
signprot(0)
{
sidManager = new SIDManager();
memset( sessionId, 0, 16 );
memset( oldSessionId, 0, 16 );

// TODO cleanup protection and signprot
}

//--------------------------------------------------------------------------
// Destructor
//--------------------------------------------------------------------------
~XRootDChannelInfo()
{
delete sidManager;
delete [] authBuffer;
}

typedef std::vector<XRootDStreamInfo> StreamInfoVector;

//--------------------------------------------------------------------------
// Data
//--------------------------------------------------------------------------
uint32_t serverFlags;
uint32_t protocolVersion;
uint8_t sessionId[16];
uint8_t oldSessionId[16];
bool firstLogIn;
SIDManager *sidManager;
char *authBuffer;
XrdSecProtocol *authProtocol;
XrdSecParameters *authParams;
XrdOucEnv *authEnv;
StreamInfoVector stream;
std::string streamName;
std::string authProtocolName;
std::set<uint16_t> sentOpens;
std::set<uint16_t> sentCloses;
uint32_t openFiles;
time_t waitBarrier;
XrdSecProtect *protection;
XrdSecProtocol *signprot;
XrdSysMutex mutex;
};

};

#endif /* SRC_XRDCL_XRDCLXROOTDCHANNELINFO_HH_ */

0 comments on commit c8b3067

Please sign in to comment.