Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
Arc::ClientTCP Class Reference

Class for setting up a MCC chain for TCP communication. More...

#include <ClientInterface.h>

Inheritance diagram for Arc::ClientTCP:
Inheritance graph
[legend]
Collaboration diagram for Arc::ClientTCP:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ClientTCP ()
 ClientTCP (const BaseConfig &cfg, const std::string &host, int port, SecurityLayer sec, int timeout=-1, bool no_delay=false)
virtual ~ClientTCP ()
MCC_Status process (PayloadRawInterface *request, PayloadStreamInterface **response, bool tls)
MCCGetEntry ()
virtual bool Load ()
void AddSecHandler (XMLNode handlercfg, SecurityLayer sec, const std::string &libanme="", const std::string &libpath="")
void Overlay (XMLNode cfg)
const ConfigGetConfig () const
MessageContextGetContext ()

Static Protected Member Functions

static void AddSecHandler (XMLNode mcccfg, XMLNode handlercfg)
static void AddPlugin (XMLNode mcccfg, const std::string &libname, const std::string &libpath="")

Protected Attributes

MCCtcp_entry
MCCtls_entry
Config xmlcfg
XMLNode overlay
MCCLoaderloader
MessageContext context

Static Protected Attributes

static Logger logger

Detailed Description

Class for setting up a MCC chain for TCP communication.

The ClientTCP class is a specialization of the ClientInterface which sets up a client MCC chain for TCP communication, and optionally with a security layer on top which can be either TLS, GSI or SSL3.

Definition at line 66 of file ClientInterface.h.


Constructor & Destructor Documentation

Definition at line 69 of file ClientInterface.h.

      : tcp_entry(NULL),
        tls_entry(NULL) {}
Arc::ClientTCP::ClientTCP ( const BaseConfig cfg,
const std::string &  host,
int  port,
SecurityLayer  sec,
int  timeout = -1,
bool  no_delay = false 
)

Definition at line 129 of file ClientInterface.cpp.

    : ClientInterface(cfg),
      tcp_entry(NULL),
      tls_entry(NULL) {
    XMLNode comp = ConfigMakeComponent(xmlcfg["Chain"], "tcp.client", "tcp");
    comp.NewAttribute("entry") = "tcp";
    comp = comp.NewChild("Connect");
    comp.NewChild("Host") = host;
    comp.NewChild("Port") = tostring(port);
    if(timeout >=  0) comp.NewChild("Timeout") = tostring(timeout);
    if(no_delay) comp.NewChild("NoDelay") = "true";

    if ((sec == TLSSec) || (sec == SSL3Sec)) {
      comp = ConfigMakeComponent(xmlcfg["Chain"], "tls.client", "tls", "tcp");
      if (!cfg.key.empty())
        comp.NewChild("KeyPath") = cfg.key;
      if (!cfg.cert.empty())
        comp.NewChild("CertificatePath") = cfg.cert;
      if (!cfg.proxy.empty())
        comp.NewChild("ProxyPath") = cfg.proxy;
      if (!cfg.cafile.empty())
        comp.NewChild("CACertificatePath") = cfg.cafile;
      if (!cfg.cadir.empty())
        comp.NewChild("CACertificatesDir") = cfg.cadir;
      comp.NewAttribute("entry") = "tls";
      if (sec == SSL3Sec) 
        comp.NewChild("Handshake") = "SSLv3";
    }
    else if (sec == GSISec) {
      comp = ConfigMakeComponent(xmlcfg["Chain"], "gsi.client", "gsi", "tcp");
      if (!cfg.key.empty())
        comp.NewChild("KeyPath") = cfg.key;
      if (!cfg.cert.empty())
        comp.NewChild("CertificatePath") = cfg.cert;
      if (!cfg.proxy.empty())
        comp.NewChild("ProxyPath") = cfg.proxy;
      if (!cfg.cafile.empty())
        comp.NewChild("CACertificatePath") = cfg.cafile;
      if (!cfg.cadir.empty())
        comp.NewChild("CACertificatesDir") = cfg.cadir;
      comp.NewAttribute("entry") = "gsi";
    }
  }

Here is the call graph for this function:

Definition at line 174 of file ClientInterface.cpp.

{}

Member Function Documentation

void Arc::ClientInterface::AddPlugin ( XMLNode  mcccfg,
const std::string &  libname,
const std::string &  libpath = "" 
) [static, protected, inherited]

Definition at line 107 of file ClientInterface.cpp.

                                                                                                    {
    if (!libpath.empty()) {
      XMLNode mm = mcccfg["ModuleManager"];
      if (!mm)
        mcccfg.NewChild("ModuleManager", 0);
      XMLNode mp = mm["Path"];
      for (; (bool)mp; ++mp)
        if (mp == libpath)
          break;
      if (!mp)
        mm.NewChild("Path") = libpath;
    }
    if (!libname.empty()) {
      XMLNode pl = mcccfg["Plugins"];
      for (; (bool)pl; ++pl)
        if (pl["Name"] == libname)
          break;
      if (!pl)
        mcccfg.NewChild("Plugins", 0).NewChild("Name") = libname;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::ClientInterface::AddSecHandler ( XMLNode  mcccfg,
XMLNode  handlercfg 
) [static, protected, inherited]

Definition at line 101 of file ClientInterface.cpp.

                                                                        {
    // Insert SecHandler configuration into MCC configuration block
    // Make sure namespaces and names are correct
    mcccfg.NewChild(handlercfg).Name("SecHandler");
  }

Here is the call graph for this function:

void Arc::ClientTCP::AddSecHandler ( XMLNode  handlercfg,
SecurityLayer  sec,
const std::string &  libanme = "",
const std::string &  libpath = "" 
)

Definition at line 223 of file ClientInterface.cpp.

                                                                                                                         {
    if (sec == TLSSec)
      ClientInterface::AddSecHandler(
        ConfigFindComponent(xmlcfg["Chain"], "tls.client", "tls"),
        handlercfg);
    else if (sec == GSISec)
      ClientInterface::AddSecHandler(
        ConfigFindComponent(xmlcfg["Chain"], "gsi.client", "gsi"),
        handlercfg);
    else
      ClientInterface::AddSecHandler(
        ConfigFindComponent(xmlcfg["Chain"], "tcp.client", "tcp"),
        handlercfg);
    for (XMLNode pl = handlercfg["Plugins"]; (bool)pl; ++pl)
      AddPlugin(xmlcfg, pl["Name"]);
    AddPlugin(xmlcfg, libname, libpath);
  }

Here is the call graph for this function:

const Config& Arc::ClientInterface::GetConfig ( ) const [inline, inherited]

Definition at line 39 of file ClientInterface.h.

                                    {
      return xmlcfg;
    }

Here is the caller graph for this function:

Definition at line 42 of file ClientInterface.h.

                                 {
      return context;
    }

Here is the caller graph for this function:

Reimplemented in Arc::ClientSOAP, and Arc::ClientHTTP.

Definition at line 77 of file ClientInterface.h.

                    {
      return tls_entry ? tls_entry : tcp_entry;
    }
bool Arc::ClientTCP::Load ( ) [virtual]

Reimplemented from Arc::ClientInterface.

Reimplemented in Arc::ClientSOAP, and Arc::ClientHTTP.

Definition at line 176 of file ClientInterface.cpp.

                       {
    if(!ClientInterface::Load()) return false;
    if (!tls_entry)
      tls_entry = (*loader)["tls"];
    if (!tls_entry)
      tls_entry = (*loader)["gsi"];
    if (!tcp_entry)
      tcp_entry = (*loader)["tcp"];
    if((!tls_entry) && (!tcp_entry)) return false;
    return true;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::ClientInterface::Overlay ( XMLNode  cfg) [inherited]

Definition at line 97 of file ClientInterface.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

MCC_Status Arc::ClientTCP::process ( PayloadRawInterface request,
PayloadStreamInterface **  response,
bool  tls 
)

Definition at line 188 of file ClientInterface.cpp.

                                                                             {
    *response = NULL;
    if (!Load())
      return MCC_Status();
    if (tls && !tls_entry)
      return MCC_Status();
    if (!tls && !tcp_entry)
      return MCC_Status();
    MessageAttributes attributes_req;
    MessageAttributes attributes_rep;
    Message reqmsg;
    Message repmsg;
    reqmsg.Attributes(&attributes_req);
    reqmsg.Context(&context);
    reqmsg.Payload(request);
    repmsg.Attributes(&attributes_rep);
    repmsg.Context(&context);

    MCC_Status r;
    if (tls)
      r = tls_entry->process(reqmsg, repmsg);
    else
      r = tcp_entry->process(reqmsg, repmsg);

    if (repmsg.Payload() != NULL)
      try {
        *response =
          dynamic_cast<PayloadStreamInterface*>(repmsg.Payload());
      } catch (std::exception&) {
        delete repmsg.Payload();
      }
    return r;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 50 of file ClientInterface.h.

MCCLoader* Arc::ClientInterface::loader [protected, inherited]

Definition at line 49 of file ClientInterface.h.

Logger Arc::ClientInterface::logger [static, protected, inherited]

Definition at line 51 of file ClientInterface.h.

XMLNode Arc::ClientInterface::overlay [protected, inherited]

Definition at line 48 of file ClientInterface.h.

Definition at line 83 of file ClientInterface.h.

Definition at line 84 of file ClientInterface.h.

Config Arc::ClientInterface::xmlcfg [protected, inherited]

Definition at line 47 of file ClientInterface.h.


The documentation for this class was generated from the following files: