]> git.sur5r.net Git - openldap/blob - doc/man/man3/ldap_url.3
239f75d89b1eb18bda9a70ebf8445ae21ab2e20d
[openldap] / doc / man / man3 / ldap_url.3
1 .TH LDAP_URL 3 "23 July 2001" "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( const char *url )
20 .LP
21 .ft B
22 int ldap_url_parse( const char *url, LDAPURLDesc **ludpp )
23 .LP
24 typedef struct ldap_url_desc {
25     char *      lud_scheme;     /* URI scheme */
26     char        lud_host;       /* LDAP host to contact */
27     int         lud_port;       /* port on host */
28     char *      lud_dn;         /* base for search */
29     char **     lud_attrs;      /* list of attributes */
30     int         lud_scope;      /* a LDAP_SCOPE_... value */
31     char *      lud_filter;     /* LDAP search filter */
32     char **     lud_exts;       /* LDAP extensions */
33     int         lud_crit_exts;  /* true if any extension is critical */
34     /* may contain additional fields for internal use */
35 } LDAPURLDesc;
36 .LP
37 .ft B
38 ldap_free_urldesc( LDAPURLDesc *ludp )
39 .LP
40 .ft B
41 int ldap_url_search( ld, url, attrsonly )
42 .ft
43 LDAP            *ld;
44 char            *url;
45 int             attrsonly;
46 .LP
47 .ft B
48 int ldap_url_search_s( ld, url, attrsonly, res )
49 .ft
50 LDAP            *ld;
51 char            *url;
52 int             attrsonly;
53 LDAPMessage     **res;
54 .LP
55 .ft B
56 int ldap_url_search_st( ld, url, attrsonly, timeout, res )
57 .ft
58 LDAP            *ld;
59 char            *url;
60 int             attrsonly;
61 struct timeval  *timeout;
62 LDAPMessage     **res;
63 .SH DESCRIPTION
64 These routines support the use of LDAP URLs (Uniform Resource Locators)
65 as detailed in RFC 2255.  LDAP URLs look like this:
66 .nf
67
68   \fBldap://\fP\fIhostport\fP\fB/\fP\fIdn\fP[\fB?\fP\fIattrs\fP[\fB?\fP\fIscope\fP[\fB?\fP\fIfilter\fP[\fB?\fP\fIexts\fP]]]]
69
70 where:
71   \fIhostport\fP is a host name with an optional ":portnumber"
72   \fIdn\fP is the search base
73   \fIattrs\fP is a comma separated list of attributes to request
74   \fIscope\fP is one of these three strings:
75     base one sub (default=base)
76   \fIfilter\fP is filter
77   \fIexts\fP are recognized set of LDAP and/or API extensions.
78
79 Example:
80   ldap://ldap.example.net/dc=example,dc=net?cn,sn?sub?(cn=*)
81
82 .fi
83 .LP
84 URLs that are wrapped in angle-brackets and/or preceded by "URL:" are also
85 tolerated.  Alternative schemes such as ldaps:// and ldapi:// may be
86 parsed using the below routines as well.
87 .LP
88 .B ldap_is_ldap_url()
89 returns a non-zero value if \fIurl\fP looks like an LDAP URL (as
90 opposed to some other kind of URL).  It can be used as a quick check
91 for an LDAP URL; the
92 .B ldap_url_parse()
93 routine should be used if a more thorough check is needed.
94 .LP
95 .B ldap_url_parse()
96 breaks down an LDAP URL passed in \fIurl\fP into its component pieces.
97 If successful, zero is returned, an LDAP URL description is
98 allocated, filled in, and \fIludpp\fP is set to point to it.  If an
99 error occurs, a non-zero URL error code is returned.
100 .LP
101 .B ldap_free_urldesc()
102 should be called to free an LDAP URL description that was obtained from
103 a call to
104 .B ldap_url_parse().
105 .LP
106 .B ldap_url_search()
107 initiates an asynchronous LDAP search based on the contents of the
108 \fIurl\fP string.  This routine acts just like
109 .BR ldap_search (3)
110 except that many search parameters are pulled out of the URL.
111 .LP
112 .B ldap_url_search_s()
113 performs a synchronous LDAP search based on the contents of the
114 \fIurl\fP string.  This routine acts just like
115 .BR ldap_search_s (3)
116 except that many search parameters are pulled out of the URL.
117 .LP
118 .B ldap_url_search_st()
119 performs a synchronous LDAP URL search with a specified \fItimeout\fP.
120 This routine acts just like
121 .BR ldap_search_st (3)
122 except that many search parameters are pulled out of the URL.
123 .SH SEE ALSO
124 .BR ldap (3),
125 .BR ldap_search (3)
126 .LP
127 .B The LDAP URL Format, RFC 2255,
128 Tim Howes and Mark Smith, December 1997.
129 .SH ACKNOWLEDGEMENTS
130 .B OpenLDAP
131 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
132 .B OpenLDAP
133 is derived from University of Michigan LDAP 3.3 Release.