ldapsdk  0.0.1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
LDAPUrl Class Reference

This class is used to analyze and store LDAP-Urls as returned by a LDAP-Server as Referrals and Search References. More...

#include <LDAPUrl.h>

Public Member Functions

 LDAPUrl (const std::string &url="")
 Create a new object from a string that contains a LDAP-Url. More...
 
 ~LDAPUrl ()
 Destructor. More...
 
int getPort () const
 
void setPort (int port)
 Set the port value of the URL. More...
 
int getScope () const
 
void setScope (const std::string &scope)
 Set the Scope part of the URL. More...
 
const std::string & getURLString () const
 
void setURLString (const std::string &url)
 Set the URL member attribute. More...
 
const std::string & getHost () const
 
void setHost (const std::string &host)
 Set the Host part of the URL. More...
 
const std::string & getScheme () const
 
void setScheme (const std::string &scheme)
 Set the Protocol Scheme of the URL. More...
 
const std::string & getDN () const
 
void setDN (const std::string &dn)
 Set the DN part of the URL. More...
 
const std::string & getFilter () const
 
void setFilter (const std::string &filter)
 Set the Filter part of the URL. More...
 
const StringListgetAttrs () const
 
void setAttrs (const StringList &attrs)
 Set the Attributes part of the URL. More...
 
void setExtensions (const StringList &ext)
 
const StringListgetExtensions () const
 
void percentDecode (const std::string &src, std::string &dest)
 Percent-decode a string. More...
 
std::string & percentEncode (const std::string &src, std::string &dest, int flags=0) const
 Percent-encoded a string. More...
 

Protected Types

enum  mode {
  base, attrs, scope, filter,
  extensions
}
 

Protected Member Functions

void parseUrl ()
 Split the url string that is associated with this Object into it components. More...
 
void components2Url () const
 Generate an URL string from the components that were set with the various set...() methods (this function is mostly for internal use and gets called automatically whenever necessary) More...
 
void string2list (const std::string &src, StringList &sl, bool percentDecode=false)
 

Protected Attributes

bool regenerate
 
int m_Port
 
int m_Scope
 
std::string m_Host
 
std::string m_DN
 
std::string m_Filter
 
StringList m_Attrs
 
StringList m_Extensions
 
std::string m_urlString
 
std::string m_Scheme
 

Detailed Description

This class is used to analyze and store LDAP-Urls as returned by a LDAP-Server as Referrals and Search References.

LDAP-URLs are defined in RFC1959 and have the following format:
ldap://host:port/baseDN[?attr[?scope[?filter]]]

Member Enumeration Documentation

◆ mode

enum LDAPUrl::mode
protected
Enumerator
base 
attrs 
scope 
filter 
extensions 

Constructor & Destructor Documentation

◆ LDAPUrl()

LDAPUrl::LDAPUrl ( const std::string &  url = "")

Create a new object from a string that contains a LDAP-Url.

Parameters
urlThe URL String

References DEBUG, LDAP_DEBUG_CONSTRUCT, and LDAP_DEBUG_PARAMETER.

◆ ~LDAPUrl()

LDAPUrl::~LDAPUrl ( )

Destructor.

References DEBUG, and LDAP_DEBUG_DESTROY.

Member Function Documentation

◆ components2Url()

void LDAPUrl::components2Url ( ) const
protected

Generate an URL string from the components that were set with the various set...() methods (this function is mostly for internal use and gets called automatically whenever necessary)

References PCT_ENCFLAG_SLASH.

◆ getAttrs()

const StringList & LDAPUrl::getAttrs ( ) const
Returns
The List of attributes that was in the URL

◆ getDN()

const string & LDAPUrl::getDN ( ) const
Returns
The Base-DN part of the URL

◆ getExtensions()

const StringList & LDAPUrl::getExtensions ( ) const

◆ getFilter()

const string & LDAPUrl::getFilter ( ) const
Returns
The Filter part of the URL

◆ getHost()

const string & LDAPUrl::getHost ( ) const
Returns
The hostname or IP-Address of the destination host.

◆ getPort()

int LDAPUrl::getPort ( ) const
Returns
The part of the URL that is representing the network port

◆ getScheme()

const std::string & LDAPUrl::getScheme ( ) const
Returns
The Protocol Scheme of the URL.

◆ getScope()

int LDAPUrl::getScope ( ) const
Returns
The scope part of the URL is returned.

◆ getURLString()

const string & LDAPUrl::getURLString ( ) const
Returns
The complete URL as a string

◆ parseUrl()

void LDAPUrl::parseUrl ( )
protected

Split the url string that is associated with this Object into it components.

The compontens of the URL can be access via the get...() methods. (this function is mostly for internal use and gets called automatically whenever necessary)

References DEBUG, LDAPUrlException::INVALID_PORT, LDAPUrlException::INVALID_SCHEME, LDAPUrlException::INVALID_SCOPE, LDAPUrlException::INVALID_URL, LDAP_DEBUG_TRACE, LDAP_DEFAULT_PORT, and LDAPS_DEFAULT_PORT.

◆ percentDecode()

void LDAPUrl::percentDecode ( const std::string &  src,
std::string &  dest 
)

Percent-decode a string.

Parameters
srcThe string that is to be decoded
destThe decoded result string

References DEBUG, LDAP_DEBUG_TRACE, and LDAPUrlException::URL_DECODING_ERROR.

◆ percentEncode()

std::string & LDAPUrl::percentEncode ( const std::string &  src,
std::string &  dest,
int  flags = 0 
) const

Percent-encoded a string.

Parameters
srcThe string that is to be encoded
destThe encoded result string
flags

References PCT_ENCFLAG_COMMA, and PCT_ENCFLAG_SLASH.

◆ setAttrs()

void LDAPUrl::setAttrs ( const StringList attrs)

Set the Attributes part of the URL.

Parameters
attrsStringList constaining the List of Attributes

◆ setDN()

void LDAPUrl::setDN ( const std::string &  dn)

Set the DN part of the URL.

Parameters
dnThe new DN part

◆ setExtensions()

void LDAPUrl::setExtensions ( const StringList ext)

◆ setFilter()

void LDAPUrl::setFilter ( const std::string &  filter)

Set the Filter part of the URL.

Parameters
filterThe new Filter

◆ setHost()

void LDAPUrl::setHost ( const std::string &  host)

Set the Host part of the URL.

Parameters
hostThe new host part

◆ setPort()

void LDAPUrl::setPort ( int  port)

Set the port value of the URL.

Parameters
dnThe port value

◆ setScheme()

void LDAPUrl::setScheme ( const std::string &  scheme)

Set the Protocol Scheme of the URL.

Parameters
hostThe Protcol scheme. Allowed values are ldap,ldapi,ldaps and cldap

References LDAPUrlException::INVALID_SCHEME.

◆ setScope()

void LDAPUrl::setScope ( const std::string &  scope)

Set the Scope part of the URL.

Parameters
scopeThe new scope

References LDAPUrlException::INVALID_SCOPE.

◆ setURLString()

void LDAPUrl::setURLString ( const std::string &  url)

Set the URL member attribute.

Parameters
urlThe URL String

◆ string2list()

void LDAPUrl::string2list ( const std::string &  src,
StringList sl,
bool  percentDecode = false 
)
protected

References StringList::add().

Member Data Documentation

◆ m_Attrs

StringList LDAPUrl::m_Attrs
protected

◆ m_DN

std::string LDAPUrl::m_DN
protected

◆ m_Extensions

StringList LDAPUrl::m_Extensions
protected

◆ m_Filter

std::string LDAPUrl::m_Filter
protected

◆ m_Host

std::string LDAPUrl::m_Host
protected

◆ m_Port

int LDAPUrl::m_Port
protected

◆ m_Scheme

std::string LDAPUrl::m_Scheme
protected

◆ m_Scope

int LDAPUrl::m_Scope
protected

◆ m_urlString

std::string LDAPUrl::m_urlString
mutableprotected

◆ regenerate

bool LDAPUrl::regenerate
mutableprotected

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