]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_url.3
Y2k copyright update
[openldap] / doc / man / man3 / ldap_url.3
1 .TH LDAP_URL 3 "22 September 1998" "OpenLDAP LDVERSION"
2 .\" $OpenLDAP$
3 .\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
4 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
5 .SH NAME
6 ldap_is_ldap_url,
7 ldap_url_parse,
8 ldap_free_urldesc,
9 ldap_url_search,
10 ldap_url_search_s,
11 ldap_url_search_st \- LDAP Uniform Resource Locator routines
12 .SH SYNOPSIS
13 .nf
14 .ft B
15 #include <ldap.h>
16 .ft
17 .LP
18 .ft B
19 int ldap_is_ldap_url( url )
20 .ft
21 char            *url;
22 .LP
23 .ft B
24 int ldap_url_parse( url, ludpp )
25 .ft
26 char            *url;
27 LDAPURLDesc     **ludpp;
28 .LP
29 typedef struct ldap_url_desc {
30     char        *lud_host;      /* LDAP host to contact */
31     int lud_port;               /* port on host */
32     char        *lud_dn;                /* base for search */
33     char        **lud_attrs;    /* NULL-terminate list of attributes */
34     int lud_scope;      /* a valid LDAP_SCOPE_... value */
35     char        *lud_filter;    /* LDAP search filter */
36     char        *lud_string;    /* for internal use only */
37 } LDAPURLDesc;
38 .LP
39 .ft B
40 ldap_free_urldesc( ludp )
41 .ft
42 LDAPURLDesc     *ludp;
43 .LP
44 .ft B
45 int ldap_url_search( ld, url, attrsonly )
46 .ft
47 LDAP            *ld;
48 char            *url;
49 int             attrsonly;
50 .LP
51 .ft B
52 int ldap_url_search_s( ld, url, attrsonly, res )
53 .ft
54 LDAP            *ld;
55 char            *url;
56 int             attrsonly;
57 LDAPMessage     **res;
58 .LP
59 .ft B
60 int ldap_url_search_st( ld, url, attrsonly, timeout, res )
61 .ft
62 LDAP            *ld;
63 char            *url;
64 int             attrsonly;
65 struct timeval  *timeout;
66 LDAPMessage     **res;
67 .SH DESCRIPTION
68 These routines support the use of LDAP URLs (Uniform Resource Locators).
69 LDAP URLs look like this:
70 .nf
71
72   \fBldap://\fP\fIhostport\fP\fB/\fP\fIdn\fP[\fB?\fP\fIattributes\fP[\fB?\fP\fIscope\fP[\fB?\fP\fIfilter\fP]]]
73
74 where:
75   \fIhostport\fP is a host name with an optional ":portnumber"
76   \fIdn\fP is the base DN to be used for an LDAP search operation
77   \fIattributes\fP is a comma separated list of attributes to be retrieved
78   \fIscope\fP is one of these three strings:  base one sub (default=base)
79   \fIfilter\fP is LDAP search filter as used in a call to ldap_search(3)
80
81 e.g.,  ldap://ldap.itd.umich.edu/c=US?o,description?one?o=umich
82 .fi
83 .LP
84 URLs that are wrapped in angle-brackets and/or preceded by "URL:" are also
85 tolerated.
86 .LP
87 .B ldap_is_ldap_url()
88 returns a non-zero value if \fIurl\fP looks like an LDAP URL (as
89 opposed to some other kind of URL).  It can be used as a quick check
90 for an LDAP URL; the
91 .B ldap_url_parse()
92 routine should be used if a more thorough check is needed.
93 .LP
94 .B ldap_url_parse()
95 breaks down an LDAP URL passed in \fIurl\fP into its component pieces.
96 If successful, zero is returned, an LDAP URL description is
97 allocated, filled in, and \fIludpp\fP is set to point to it.  If an
98 error occurs, one of these values is returned:
99 .nf
100
101     LDAP_URL_ERR_NOTLDAP        - URL doesn't begin with "ldap://"
102     LDAP_URL_ERR_NODN   - URL has no DN (required)
103     LDAP_URL_ERR_BADSCOPE       - URL scope string is invalid
104     LDAP_URL_ERR_MEM    - can't allocate memory space
105 .fi
106 .LP
107 .B ldap_free_urldesc()
108 should be called to free an LDAP URL description that was obtained from
109 a call to
110 .B ldap_url_parse().
111 .LP
112 .B ldap_url_search()
113 initiates an asynchronous LDAP search based on the contents of the
114 \fIurl\fP string.  This routine acts just like
115 .BR ldap_search (3)
116 except that many search parameters are pulled out of the URL.
117 .LP
118 .B ldap_url_search_s()
119 performs a synchronous LDAP search based on the contents of the
120 \fIurl\fP string.  This routine acts just like
121 .BR ldap_search_s (3)
122 except that many search parameters are pulled out of the URL.
123 .LP
124 .B ldap_url_search_st()
125 performs a synchronous LDAP URL search with a specified \fItimeout\fP.
126 This routine acts just like
127 .BR ldap_search_st (3)
128 except that many search parameters are pulled out of the URL.
129 .SH SEE ALSO
130 .BR ldap (3),
131 .BR ldap_search (3)
132 .LP
133 .B An LDAP URL Format,
134 Tim Howes and Mark Smith, December 1995.  Internet Draft (work in progress).
135 Currently available at this URL:
136 .nf
137 ftp://ds.internic.net/internet-drafts/draft-ietf-asid-ldap-format-03.txt
138 .fi
139 .SH ACKNOWLEDGEMENTS
140 .B      OpenLDAP
141 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
142 .B      OpenLDAP
143 is derived from University of Michigan LDAP 3.3 Release.