File: libldapsearch.h

package info (click to toggle)
courier 0.60.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 52,288 kB
  • ctags: 12,677
  • sloc: ansic: 165,348; cpp: 24,820; sh: 16,410; perl: 6,839; makefile: 3,621; yacc: 289; sed: 16
file content (74 lines) | stat: -rw-r--r-- 1,484 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* $Id: libldapsearch.h,v 1.4 2007/09/26 01:42:40 mrsam Exp $
**
** Copyright 2006, Double Precision Inc.
**
*/

#ifndef ldapsearch_h
#define ldapsearch_h

#ifdef  __cplusplus
extern "C" {
#endif

/*
** Encapsulate interface for search address book in LDAP
*/

#include "config.h"
#if HAVE_LBER_H
#include <lber.h>
#endif
#include <ldap.h>
#include <stdio.h>

struct ldapsearch {

	LDAP *handle;

	char *base;   /* Saved base of the search */
};

/*
** Allocate and deallocate the ldapsearch struct.
*/

struct ldapsearch *l_search_alloc(const char *host,
				  int port,
				  const char *userid,
				  const char *password,
				  const char *base);
/* base - the starting point of the search in the LDAP tree */

void l_search_free(struct ldapsearch *s);

/*
** Search the address book, and invoke the callback function for each
** match found.  The callback function receives the name & address of the
** found entry.  'exact_match' is nonzero if the lookupkey matched on of the
** LDAP attributes.
**
** The callback function must return zero.   A non-zero return stops the
** search.
*/

int l_search_do(struct ldapsearch *s,
		const char *lookupkey,

		int (*callback_func)(const char *utf8_name,
				     const char *address,
				     void *callback_arg),
		void *callback_arg);

/*
** Ping the LDAP server (makes sure that host/port were valid, because
** any connection attempt is deferred).
*/

int l_search_ping(struct ldapsearch *s);

#ifdef  __cplusplus
}
#endif

#endif