Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | Friends
SRMURL Class Reference

#include <SRMURL.h>

Inheritance diagram for SRMURL:
Inheritance graph
[legend]
Collaboration diagram for SRMURL:
Collaboration graph
[legend]

List of all members.

Public Types

enum  SRM_URL_VERSION { SRM_URL_VERSION_1, SRM_URL_VERSION_2_2, SRM_URL_VERSION_UNKNOWN }
enum  Scope { base, onelevel, subtree }
 Scope for LDAP URLs. More...

Public Member Functions

 SRMURL (std::string url)
 Examples shown for functions below assume the object was initiated with srm://srm.ndgf.org/pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3.
const std::string & Endpoint (void) const
 eg /srm/managerv2
void SetSRMVersion (const std::string version)
 Possible values of version are "1" and "2.2".
const std::string & FileName (void) const
 eg pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3
std::string ContactURL (void) const
 eg httpg://srm.ndgf.org:8443/srm/managerv2
std::string BaseURL (void) const
 eg srm://srm.ndgf.org:8443/srm/managerv2?SFN=
std::string ShortURL (void) const
 eg srm://srm.ndgf.org:8443/pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3
std::string FullURL (void) const
 eg srm://srm.ndgf.org:8443/srm/managerv2?SFN=pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3
enum SRM_URL_VERSION SRMVersion ()
bool Short (void) const
void GSSAPI (bool gssapi)
bool GSSAPI (void) const
void SetPort (int portno)
bool PortDefined ()
 Was the port number given in the constructor?
 operator bool (void)
 Check if instance holds valid URL.
bool operator! (void)
const std::string & Protocol () const
 Returns the protocol of the URL.
void ChangeProtocol (const std::string &newprot)
 Changes the protocol of the URL.
bool IsSecureProtocol () const
 Indicates whether the protocol is secure or not.
const std::string & Username () const
 Returns the username of the URL.
const std::string & Passwd () const
 Returns the password of the URL.
const std::string & Host () const
 Returns the hostname of the URL.
void ChangeHost (const std::string &newhost)
 Changes the hostname of the URL.
int Port () const
 Returns the port of the URL.
void ChangePort (int newport)
 Changes the port of the URL.
const std::string & Path () const
 Returns the path of the URL.
std::string FullPath () const
 Returns the path of the URL with all options attached.
void ChangePath (const std::string &newpath)
 Changes the path of the URL.
const std::map< std::string,
std::string > & 
HTTPOptions () const
 Returns HTTP options if any.
const std::string & HTTPOption (const std::string &option, const std::string &undefined="") const
 Returns the value of an HTTP option.
const std::list< std::string > & LDAPAttributes () const
 Returns the LDAP attributes if any.
void AddLDAPAttribute (const std::string &attribute)
 Adds an LDAP attribute.
Scope LDAPScope () const
 Returns the LDAP scope.
void ChangeLDAPScope (const Scope newscope)
 Changes the LDAP scope.
const std::string & LDAPFilter () const
 Returns the LDAP filter.
void ChangeLDAPFilter (const std::string &newfilter)
 Changes the LDAP filter.
const std::map< std::string,
std::string > & 
Options () const
 Returns URL options if any.
const std::string & Option (const std::string &option, const std::string &undefined="") const
 Returns the value of a URL option.
const std::map< std::string,
std::string > & 
MetaDataOptions () const
 Returns metadata options if any.
const std::string & MetaDataOption (const std::string &option, const std::string &undefined="") const
 Returns the value of a metadata option.
void AddOption (const std::string &option, const std::string &value, bool overwrite=true)
 Adds a URL option.
const std::list< URLLocation > & Locations () const
 Returns the locations if any.
const std::map< std::string,
std::string > & 
CommonLocOptions () const
 Returns the common location options if any.
const std::string & CommonLocOption (const std::string &option, const std::string &undefined="") const
 Returns the value of a common location option.
virtual std::string str () const
 Returns a string representation of the URL.
virtual std::string fullstr () const
 Returns a string representation including options and locations.
virtual std::string ConnectionURL () const
 Returns a string representation with protocol, host and port only.
bool operator< (const URL &url) const
 Compares one URL to another.
bool operator== (const URL &url) const
 Is one URL equal to another?
 operator bool () const
 Check if instance holds valid URL.
bool operator! () const
std::map< std::string,
std::string > 
ParseOptions (const std::string &optstring, char separator)
 Parse a string of options separated by separator into an attribute->value map.

Static Public Member Functions

static std::string OptionString (const std::map< std::string, std::string > &options, char separator)
 Returns a string representation of the options given in the options map.

Static Protected Member Functions

static std::string BaseDN2Path (const std::string &)
 a private method that converts an ldap basedn to a path.
static std::string Path2BaseDN (const std::string &)
 a private method that converts an ldap path to a basedn.

Protected Attributes

std::string protocol
 the url protocol.
std::string username
 username of the url.
std::string passwd
 password of the url.
std::string host
 hostname of the url.
bool ip6addr
 if host is IPv6 numerical address notation.
int port
 portnumber of the url.
std::string path
 the url path.
std::map< std::string,
std::string > 
httpoptions
 HTTP options of the url.
std::map< std::string,
std::string > 
metadataoptions
 Meta data options.
std::list< std::string > ldapattributes
 LDAP attributes of the url.
Scope ldapscope
 LDAP scope of the url.
std::string ldapfilter
 LDAP filter of the url.
std::map< std::string,
std::string > 
urloptions
 options of the url.
std::list< URLLocation > locations
 locations for index server URLs.
std::map< std::string,
std::string > 
commonlocoptions
 common location options for index server URLs.

Private Attributes

std::string filename
bool isshort
bool valid
 flag to describe validity of URL
bool portdefined

Static Private Attributes

static std::string empty

Friends

std::ostream & operator<< (std::ostream &out, const URL &u)
 Overloaded operator << to print a URL.

Detailed Description

Definition at line 8 of file SRMURL.h.


Member Enumeration Documentation

enum Arc::URL::Scope [inherited]

Scope for LDAP URLs.

Enumerator:
base 
onelevel 
subtree 

Definition at line 88 of file URL.h.

Enumerator:
SRM_URL_VERSION_1 
SRM_URL_VERSION_2_2 
SRM_URL_VERSION_UNKNOWN 

Definition at line 11 of file SRMURL.h.


Constructor & Destructor Documentation

SRMURL::SRMURL ( std::string  url)

Examples shown for functions below assume the object was initiated with srm://srm.ndgf.org/pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3.

Definition at line 7 of file SRMURL.cpp.

                                 : URL(url) {
    portdefined = false;
    if(protocol != "srm") { 
      valid=false;
      return; 
    };
    valid=true;
    if(port <= 0) port=8443;
    else portdefined = true;
    srm_version = SRM_URL_VERSION_2_2; // v2.2 unless explicitly made otherwise
    if(HTTPOption("SFN", "") != "") {
      filename=HTTPOption("SFN");
      isshort=false;
      path = '/'+path;
      for(;path.size() > 1;) {
        if(path[1] != '/') break;
        path.erase(0,1);
      };
      if (path[path.size()-1] == '1') srm_version = SRM_URL_VERSION_1;
    }
    else {
      if(path.length() > 0) filename=path.c_str()+1; // Skip leading '/'
      path = "/srm/managerv2";
      isshort=true;
    }
  } catch (std::exception e) {
    valid=false;
  }  

Here is the call graph for this function:


Member Function Documentation

void Arc::URL::AddLDAPAttribute ( const std::string &  attribute) [inherited]

Adds an LDAP attribute.

Definition at line 577 of file URL.cpp.

                                                       {
    ldapattributes.push_back(attribute);
  }

Here is the caller graph for this function:

void Arc::URL::AddOption ( const std::string &  option,
const std::string &  value,
bool  overwrite = true 
) [inherited]

Adds a URL option.

Definition at line 611 of file URL.cpp.

                                      {
    if (!overwrite && urloptions.find(option) != urloptions.end())
      return;
    urloptions[option] = value;
  }

Here is the caller graph for this function:

std::string Arc::URL::BaseDN2Path ( const std::string &  basedn) [static, protected, inherited]

a private method that converts an ldap basedn to a path.

Definition at line 823 of file URL.cpp.

                                                    {

    std::string::size_type pos, pos2;
    // mds-vo-name=local, o=grid --> o=grid/mds-vo-name=local
    std::string newpath;

    pos = basedn.size();
    while ((pos2 = basedn.rfind(",", pos - 1)) != std::string::npos) {
      std::string tmppath = basedn.substr(pos2 + 1, pos - pos2 - 1);
      tmppath = tmppath.substr(tmppath.find_first_not_of(' '));
      newpath += tmppath + '/';
      pos = pos2;
    }

    newpath += basedn.substr(0, pos);

    return newpath;
  }
std::string SRMURL::BaseURL ( void  ) const

eg srm://srm.ndgf.org:8443/srm/managerv2?SFN=

Definition at line 59 of file SRMURL.cpp.

                                      {
    if(!valid) return empty;
    return (protocol+"://"+host+":"+Arc::tostring(port)+path+"?SFN=");
  }

Here is the call graph for this function:

void Arc::URL::ChangeHost ( const std::string &  newhost) [inherited]

Changes the hostname of the URL.

Definition at line 471 of file URL.cpp.

                                               {
    host = lower(newhost);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::URL::ChangeLDAPFilter ( const std::string &  newfilter) [inherited]

Changes the LDAP filter.

Definition at line 593 of file URL.cpp.

                                                       {
    ldapfilter = newfilter;
  }

Here is the caller graph for this function:

void Arc::URL::ChangeLDAPScope ( const Scope  newscope) [inherited]

Changes the LDAP scope.

Definition at line 585 of file URL.cpp.

                                                {
    ldapscope = newscope;
  }

Here is the caller graph for this function:

void Arc::URL::ChangePath ( const std::string &  newpath) [inherited]

Changes the path of the URL.

Definition at line 521 of file URL.cpp.

                                               {
    path = newpath;

    // parse basedn in case of ldap-protocol
    if (protocol == "ldap") {
      if (path.find("/") != std::string::npos)
        path = Path2BaseDN(path);

    // add absolute path for relative file URLs
    } else if (protocol == "file" || protocol == "urllist") {
      if(!Glib::path_is_absolute(path)) {
        char cwd[PATH_MAX];
        if (getcwd(cwd, PATH_MAX))
          path = Glib::build_filename(cwd, path);
      }
    }

    // for generic URL just make sure path has leading /
    else if ((path[0] != '/') && (!path.empty())) {
      URLLogger.msg(WARNING, "Attempt to assign relative path to URL - making it absolute");
      path = "/" + path;
    }

  }

Here is the call graph for this function:

Here is the caller graph for this function:

void Arc::URL::ChangePort ( int  newport) [inherited]

Changes the port of the URL.

Definition at line 479 of file URL.cpp.

                                  {
    port = newport;
  }
void Arc::URL::ChangeProtocol ( const std::string &  newprot) [inherited]

Changes the protocol of the URL.

Definition at line 443 of file URL.cpp.

                                                   {
    protocol = lower(newprot);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string & Arc::URL::CommonLocOption ( const std::string &  option,
const std::string &  undefined = "" 
) const [inherited]

Returns the value of a common location option.

Parameters:
optionThe option whose value is returned.
undefinedThis value is returned if the common location option is not defined.

Definition at line 626 of file URL.cpp.

                                                                            {
    std::map<std::string, std::string>::const_iterator
    opt = commonlocoptions.find(option);
    if (opt != commonlocoptions.end())
      return opt->second;
    else
      return undefined;
  }
const std::map< std::string, std::string > & Arc::URL::CommonLocOptions ( ) const [inherited]

Returns the common location options if any.

Definition at line 622 of file URL.cpp.

                                                                  {
    return commonlocoptions;
  }

Here is the caller graph for this function:

std::string Arc::URL::ConnectionURL ( ) const [virtual, inherited]

Returns a string representation with protocol, host and port only.

Definition at line 796 of file URL.cpp.

                                     {

    std::string urlstr;
    if (!protocol.empty())
      urlstr = protocol + "://";

    if (!host.empty()) {
      if(ip6addr)
        urlstr += "[" + host + "]";
      else
        urlstr += host;
    }

    if (port != -1)
      urlstr += ':' + tostring(port);

    return urlstr;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string SRMURL::ContactURL ( void  ) const

eg httpg://srm.ndgf.org:8443/srm/managerv2

Definition at line 54 of file SRMURL.cpp.

                                         {
    if(!valid) return empty;
    return ("httpg://"+host+":"+Arc::tostring(port)+path);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& SRMURL::Endpoint ( void  ) const [inline]

eg /srm/managerv2

Definition at line 26 of file SRMURL.h.

{ return Path(); };

Here is the call graph for this function:

const std::string& SRMURL::FileName ( void  ) const [inline]

eg pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3

Definition at line 36 of file SRMURL.h.

{ if(!valid) return empty; return filename; };
std::string Arc::URL::FullPath ( ) const [inherited]

Returns the path of the URL with all options attached.

Definition at line 487 of file URL.cpp.

                                {
    std::string fullpath;

    if (!path.empty())
      fullpath += path;

    if (!httpoptions.empty())
      fullpath += '?' + OptionString(httpoptions, '&');

    if (!ldapattributes.empty() || (ldapscope != base) || !ldapfilter.empty())
      fullpath += '?' + AttributeString(ldapattributes, ',');

    if ((ldapscope != base) || !ldapfilter.empty()) {
      switch (ldapscope) {
      case base:
        fullpath += "?base";
        break;

      case onelevel:
        fullpath += "?one";
        break;

      case subtree:
        fullpath += "?sub";
        break;
      }
    }

    if (!ldapfilter.empty())
      fullpath += '?' + ldapfilter;

    return fullpath;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string Arc::URL::fullstr ( ) const [virtual, inherited]

Returns a string representation including options and locations.

Reimplemented in Arc::URLLocation.

Definition at line 636 of file URL.cpp.

                               {

    std::string urlstr;

    if (!username.empty())
      urlstr += username;

    if (!passwd.empty())
      urlstr += ':' + passwd;

    for (std::list<URLLocation>::const_iterator it = locations.begin();
         it != locations.end(); it++) {
      if (it != locations.begin())
        urlstr += '|';
      urlstr += it->fullstr();
    }

    if (!locations.empty() && !commonlocoptions.empty())
      urlstr += '|';

    if (!commonlocoptions.empty())
      urlstr += ';' + OptionString(commonlocoptions, ';');

    if (!username.empty() || !passwd.empty() || !locations.empty())
      urlstr += '@';

    if (!host.empty()) {
      if(ip6addr) 
        urlstr += "[" + host + "]";
      else
        urlstr += host;
    }

    if (port != -1)
      urlstr += ':' + tostring(port);

    if (!urloptions.empty())
      urlstr += ';' + OptionString(urloptions, ';');

    if (!protocol.empty()) {
      if (!urlstr.empty())
        urlstr = protocol + "://" + urlstr;
      else
        urlstr = protocol + ":";
    }

    // Constructor makes sure path is absolute or empty.
    // ChangePath() also makes such check.
    if ( protocol == "ldap") // Unfortunately ldap is special case
      urlstr += '/';
    urlstr += path;

    // If there is nothing at this point there is no sense
    // to add any options
    if (urlstr.empty())
      return urlstr;

    if (!httpoptions.empty())
      urlstr += '?' + OptionString(httpoptions, '&');

    if (!ldapattributes.empty() || (ldapscope != base) || !ldapfilter.empty())
      urlstr += '?' + AttributeString(ldapattributes, ',');

    if ((ldapscope != base) || !ldapfilter.empty()) {
      switch (ldapscope) {
      case base:
        urlstr += "?base";
        break;

      case onelevel:
        urlstr += "?one";
        break;

      case subtree:
        urlstr += "?sub";
        break;
      }
    }

    if (!ldapfilter.empty())
      urlstr += '?' + ldapfilter;

    if (!metadataoptions.empty())
      urlstr += ':' + OptionString(metadataoptions, ':');

    return urlstr;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string SRMURL::FullURL ( void  ) const

eg srm://srm.ndgf.org:8443/srm/managerv2?SFN=pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3

Definition at line 64 of file SRMURL.cpp.

                                      {
    if(!valid) return empty;
    return (protocol+"://"+host+":"+Arc::tostring(port)+path+"?SFN="+filename);
  }

Here is the call graph for this function:

void SRMURL::GSSAPI ( bool  gssapi)

Definition at line 73 of file SRMURL.cpp.

                                 {
    if (gssapi)
      AddOption("protocol", "gssapi", true);
    else
      AddOption("protocol", "gsi", true);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool SRMURL::GSSAPI ( void  ) const

Definition at line 80 of file SRMURL.cpp.

                                {
    try {
      const std::string proto_val = Option("protocol");
      if(proto_val == "gsi") return false;
    } catch (std::exception e) { };
    return true;
  }

Here is the call graph for this function:

const std::string & Arc::URL::Host ( ) const [inherited]

Returns the hostname of the URL.

Definition at line 467 of file URL.cpp.

                                   {
    return host;
  }
const std::string & Arc::URL::HTTPOption ( const std::string &  option,
const std::string &  undefined = "" 
) const [inherited]

Returns the value of an HTTP option.

Parameters:
optionThe option whose value is returned.
undefinedThis value is returned if the HTTP option is not defined.

Definition at line 550 of file URL.cpp.

                                                                       {
    std::map<std::string, std::string>::const_iterator
    opt = httpoptions.find(option);
    if (opt != httpoptions.end())
      return opt->second;
    else
      return undefined;
  }

Here is the caller graph for this function:

const std::map< std::string, std::string > & Arc::URL::HTTPOptions ( ) const [inherited]

Returns HTTP options if any.

Definition at line 546 of file URL.cpp.

                                                             {
    return httpoptions;
  }

Here is the caller graph for this function:

bool Arc::URL::IsSecureProtocol ( ) const [inherited]

Indicates whether the protocol is secure or not.

Definition at line 447 of file URL.cpp.

                                   {
    return protocol == "gsiftp" ||
           protocol == "https" ||
           protocol == "httpg" ||
           protocol == "rc" ||
           protocol == "rls" ||
           protocol == "srm" ||
           protocol == "arc" ||
           protocol == "fireman" ||
           protocol == "lfc";
  }

Here is the caller graph for this function:

const std::list< std::string > & Arc::URL::LDAPAttributes ( ) const [inherited]

Returns the LDAP attributes if any.

Definition at line 573 of file URL.cpp.

                                                      {
    return ldapattributes;
  }

Here is the caller graph for this function:

const std::string & Arc::URL::LDAPFilter ( ) const [inherited]

Returns the LDAP filter.

Definition at line 589 of file URL.cpp.

                                         {
    return ldapfilter;
  }

Here is the caller graph for this function:

URL::Scope Arc::URL::LDAPScope ( ) const [inherited]

Returns the LDAP scope.

Definition at line 581 of file URL.cpp.

                                {
    return ldapscope;
  }

Here is the caller graph for this function:

const std::list< URLLocation > & Arc::URL::Locations ( ) const [inherited]

Returns the locations if any.

Definition at line 618 of file URL.cpp.

                                                   {
    return locations;
  }

Here is the caller graph for this function:

const std::string & Arc::URL::MetaDataOption ( const std::string &  option,
const std::string &  undefined = "" 
) const [inherited]

Returns the value of a metadata option.

Parameters:
optionThe option whose value is returned.
undefinedThis value is returned if the metadata option is not defined.

Definition at line 564 of file URL.cpp.

                                                                           {
    std::map<std::string, std::string>::const_iterator opt = metadataoptions.find(option);
    if (opt != metadataoptions.end())
      return opt->second;
    else
      return undefined;
  }

Here is the caller graph for this function:

const std::map< std::string, std::string > & Arc::URL::MetaDataOptions ( ) const [inherited]

Returns metadata options if any.

Definition at line 560 of file URL.cpp.

                                                                 {
    return metadataoptions;
  }

Here is the caller graph for this function:

SRMURL::operator bool ( void  ) [inline]

Check if instance holds valid URL.

Reimplemented from Arc::URL.

Definition at line 65 of file SRMURL.h.

{ return valid; };
Arc::URL::operator bool ( void  ) const [inherited]

Check if instance holds valid URL.

Reimplemented in SRMURL.

Definition at line 865 of file URL.cpp.

                           {
    return valid;
  }
bool SRMURL::operator! ( void  ) [inline]

Reimplemented from Arc::URL.

Definition at line 66 of file SRMURL.h.

{ return !valid; };
bool Arc::URL::operator! ( void  ) const [inherited]

Reimplemented in SRMURL.

Definition at line 869 of file URL.cpp.

                            {
    return !valid;
  }
bool Arc::URL::operator< ( const URL url) const [inherited]

Compares one URL to another.

Definition at line 815 of file URL.cpp.

                                          {
    return (str() < url.str());
  }

Here is the call graph for this function:

bool Arc::URL::operator== ( const URL url) const [inherited]

Is one URL equal to another?

Definition at line 819 of file URL.cpp.

                                           {
    return (str() == url.str());
  }

Here is the call graph for this function:

const std::string & Arc::URL::Option ( const std::string &  option,
const std::string &  undefined = "" 
) const [inherited]

Returns the value of a URL option.

Parameters:
optionThe option whose value is returned.
undefinedThis value is returned if the URL option is not defined.

Definition at line 601 of file URL.cpp.

                                                                   {
    std::map<std::string, std::string>::const_iterator
    opt = urloptions.find(option);
    if (opt != urloptions.end())
      return opt->second;
    else
      return undefined;
  }

Here is the caller graph for this function:

const std::map< std::string, std::string > & Arc::URL::Options ( ) const [inherited]

Returns URL options if any.

Definition at line 597 of file URL.cpp.

                                                         {
    return urloptions;
  }

Here is the caller graph for this function:

std::string Arc::URL::OptionString ( const std::map< std::string, std::string > &  options,
char  separator 
) [static, inherited]

Returns a string representation of the options given in the options map.

Definition at line 873 of file URL.cpp.

                                                                                    {

    std::string optstring;

    if (options.empty())
      return optstring;

    for (std::map<std::string, std::string>::const_iterator
         it = options.begin(); it != options.end(); it++) {
      if (it != options.begin())
        optstring += separator;
      optstring += it->first + '=' + it->second;
    }
    return optstring;
  }

Here is the caller graph for this function:

std::map< std::string, std::string > Arc::URL::ParseOptions ( const std::string &  optstring,
char  separator 
) [inherited]

Parse a string of options separated by separator into an attribute->value map.

Definition at line 26 of file URL.cpp.

                                                                                           {

    std::map<std::string, std::string> options;

    if (optstring.empty())
      return options;

    std::string::size_type pos = 0;
    while (pos != std::string::npos) {

      std::string::size_type pos2 = optstring.find(separator, pos);

      std::string opt = (pos2 == std::string::npos ?
                         optstring.substr(pos) :
                         optstring.substr(pos, pos2 - pos));

      pos = pos2;
      if (pos != std::string::npos)
        pos++;

      pos2 = opt.find('=');
      std::string option_name, option_value = "";
      if (pos2 == std::string::npos) {
        option_name = opt;
      } else {
        option_name = opt.substr(0, pos2);
        option_value = opt.substr(pos2 + 1);
      }
      options[option_name] = option_value;
    }
    return options;
  }

Here is the caller graph for this function:

const std::string & Arc::URL::Passwd ( ) const [inherited]

Returns the password of the URL.

Definition at line 463 of file URL.cpp.

                                     {
    return passwd;
  }

Here is the caller graph for this function:

const std::string & Arc::URL::Path ( ) const [inherited]

Returns the path of the URL.

Definition at line 483 of file URL.cpp.

                                   {
    return path;
  }
std::string Arc::URL::Path2BaseDN ( const std::string &  newpath) [static, protected, inherited]

a private method that converts an ldap path to a basedn.

Definition at line 842 of file URL.cpp.

                                                     {

    if (newpath.empty())
      return "";

    std::string basedn;
    std::string::size_type pos, pos2;

    pos = newpath.size();
    while ((pos2 = newpath.rfind("/", pos - 1)) != std::string::npos) {
      if (pos2 == 0) break;
      basedn += newpath.substr(pos2 + 1, pos - pos2 - 1) + ", ";
      pos = pos2;
    }

    if (pos2 == std::string::npos)
      basedn += newpath.substr(0, pos);
    else
      basedn += newpath.substr(pos2 + 1, pos - pos2 - 1);

    return basedn;
  }

Here is the caller graph for this function:

int Arc::URL::Port ( ) const [inherited]

Returns the port of the URL.

Definition at line 475 of file URL.cpp.

                      {
    return port;
  }

Here is the caller graph for this function:

bool SRMURL::PortDefined ( ) [inline]

Was the port number given in the constructor?

Definition at line 64 of file SRMURL.h.

{ return portdefined; };

Here is the caller graph for this function:

const std::string & Arc::URL::Protocol ( ) const [inherited]

Returns the protocol of the URL.

Definition at line 439 of file URL.cpp.

                                       {
    return protocol;
  }
void SRMURL::SetPort ( int  portno) [inline]

Definition at line 62 of file SRMURL.h.

{ port = portno; };

Here is the caller graph for this function:

void SRMURL::SetSRMVersion ( const std::string  version)

Possible values of version are "1" and "2.2".

Definition at line 39 of file SRMURL.cpp.

                                              {
    if (version.empty()) return;
    if (version == "1") {
      srm_version = SRM_URL_VERSION_1;
      path = "/srm/managerv1";
    }
    else if (version == "2.2") {
      srm_version = SRM_URL_VERSION_2_2;
      path = "/srm/managerv2";
    }
    else {
      srm_version = SRM_URL_VERSION_UNKNOWN; 
    }
  }
bool SRMURL::Short ( void  ) const [inline]

Definition at line 59 of file SRMURL.h.

{ return isshort; };
std::string SRMURL::ShortURL ( void  ) const

eg srm://srm.ndgf.org:8443/pnfs/ndgf.org/data/atlas/disk/user/user.mlassnig.dataset.1/dummyfile3

Definition at line 69 of file SRMURL.cpp.

                                       {
    return (protocol+"://"+host+":"+Arc::tostring(port)+"/"+filename);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 58 of file SRMURL.h.

{ return srm_version; };

Here is the caller graph for this function:

std::string Arc::URL::str ( ) const [virtual, inherited]

Returns a string representation of the URL.

Reimplemented in Arc::URLLocation.

Definition at line 724 of file URL.cpp.

                           {

    std::string urlstr;

    if (!username.empty())
      urlstr += username;

    if (!passwd.empty())
      urlstr += ':' + passwd;

    if (!username.empty() || !passwd.empty())
      urlstr += '@';

    if (!host.empty()) {
      if(ip6addr)
        urlstr += "[" + host + "]";
      else
        urlstr += host;
    }

    if (port != -1)
      urlstr += ':' + tostring(port);

    if (!protocol.empty()) {
      if (!urlstr.empty())
        urlstr = protocol + "://" + urlstr;
      else
        urlstr = protocol + ":";
    }

    // Constructor makes sure path is absolute or empty.
    // ChangePath also makes such check.
    if ( protocol == "ldap") // Unfortunately ldap is special case
      urlstr += '/';
    urlstr += path;

    // If there is nothing at this point there is no sense
    // to add any options
    if (urlstr.empty())
      return urlstr;

    if (!httpoptions.empty())
      urlstr += '?' + OptionString(httpoptions, '&');

    if (!ldapattributes.empty() || (ldapscope != base) || !ldapfilter.empty())
      urlstr += '?' + AttributeString(ldapattributes, ',');

    if ((ldapscope != base) || !ldapfilter.empty()) {
      switch (ldapscope) {
      case base:
        urlstr += "?base";
        break;

      case onelevel:
        urlstr += "?one";
        break;

      case subtree:
        urlstr += "?sub";
        break;
      }
    }

    if (!ldapfilter.empty())
      urlstr += '?' + ldapfilter;

    if (!metadataoptions.empty())
      urlstr += ':' + OptionString(metadataoptions, ':');

    return urlstr;
  }

Here is the call graph for this function:

const std::string & Arc::URL::Username ( ) const [inherited]

Returns the username of the URL.

Definition at line 459 of file URL.cpp.

                                       {
    return username;
  }

Here is the caller graph for this function:


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const URL u 
) [friend, inherited]

Overloaded operator << to print a URL.

Definition at line 891 of file URL.cpp.

                                                          {
    return (out << url.str());
  }

Member Data Documentation

std::map<std::string, std::string> Arc::URL::commonlocoptions [protected, inherited]

common location options for index server URLs.

Definition at line 265 of file URL.h.

std::string SRMURL::empty [static, private]

Definition at line 66 of file SRMURL.h.

std::string SRMURL::filename [private]

Definition at line 70 of file SRMURL.h.

std::string Arc::URL::host [protected, inherited]

hostname of the url.

Definition at line 232 of file URL.h.

std::map<std::string, std::string> Arc::URL::httpoptions [protected, inherited]

HTTP options of the url.

Definition at line 244 of file URL.h.

bool Arc::URL::ip6addr [protected, inherited]

if host is IPv6 numerical address notation.

Definition at line 235 of file URL.h.

bool SRMURL::isshort [private]

Definition at line 71 of file SRMURL.h.

std::list<std::string> Arc::URL::ldapattributes [protected, inherited]

LDAP attributes of the url.

Definition at line 250 of file URL.h.

std::string Arc::URL::ldapfilter [protected, inherited]

LDAP filter of the url.

Definition at line 256 of file URL.h.

Scope Arc::URL::ldapscope [protected, inherited]

LDAP scope of the url.

Definition at line 253 of file URL.h.

std::list<URLLocation> Arc::URL::locations [protected, inherited]

locations for index server URLs.

Definition at line 262 of file URL.h.

std::map<std::string, std::string> Arc::URL::metadataoptions [protected, inherited]

Meta data options.

Definition at line 247 of file URL.h.

std::string Arc::URL::passwd [protected, inherited]

password of the url.

Definition at line 229 of file URL.h.

std::string Arc::URL::path [protected, inherited]

the url path.

Definition at line 241 of file URL.h.

int Arc::URL::port [protected, inherited]

portnumber of the url.

Definition at line 238 of file URL.h.

bool SRMURL::portdefined [private]

Definition at line 73 of file SRMURL.h.

std::string Arc::URL::protocol [protected, inherited]

the url protocol.

Definition at line 223 of file URL.h.

std::map<std::string, std::string> Arc::URL::urloptions [protected, inherited]

options of the url.

Definition at line 259 of file URL.h.

std::string Arc::URL::username [protected, inherited]

username of the url.

Definition at line 226 of file URL.h.

bool SRMURL::valid [private]

flag to describe validity of URL

Reimplemented from Arc::URL.

Definition at line 72 of file SRMURL.h.


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