2 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 // $Id: LDAPUrl.cpp,v 1.6 2000/08/31 17:43:49 rhafer Exp $
10 #include <ac/string.h>
13 LDAPUrl::LDAPUrl(char *url){
14 DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::LDAPUrl()" << endl);
15 if (ldap_is_ldap_url(url)){
16 m_urlString = strdup(url);
17 ldap_url_parse(url, &m_urlDesc);
19 DEBUG(LDAP_DEBUG_TRACE," noUrl:" << url << endl);
23 LDAPUrl::LDAPUrl(char *host, int port, char *dn, char **attrs, int scope,
30 ldap_free_urldesc(m_urlDesc);
33 int LDAPUrl::getPort() const {
34 return m_urlDesc->lud_port;
37 int LDAPUrl::getScope() const {
38 return m_urlDesc->lud_scope;
41 char* LDAPUrl::getURLString() const {
42 return strdup(m_urlString);
45 char* LDAPUrl::getHost() const {
46 return strdup(m_urlDesc->lud_host);
49 char* LDAPUrl::getDN() const {
50 return strdup(m_urlDesc->lud_dn);
53 char* LDAPUrl::getFilter() const {
54 return strdup(m_urlDesc->lud_filter);
57 char** LDAPUrl::getAttrs() const {
59 for ( char** i=m_urlDesc->lud_attrs; *i != 0; i++){
62 char** ret=new char*[s+1];
65 for (char** i=m_urlDesc->lud_attrs; *i != 0; j++, i++){