summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/replication/repl_helper.h
blob: 076710ceb3fa078d1ed735cffdce13c4f7e18b8a (plain)
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
/** BEGIN COPYRIGHT BLOCK
 * Copyright 2001 Sun Microsystems, Inc.
 * Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
 * All rights reserved.
 * END COPYRIGHT BLOCK **/
/*
 *  repl_helper.h - Helper functions (should actually be repl_utils.h)
 *
 *
 *
 */

#ifndef _REPL_HELPER_H
#define _REPL_HELPER_H

#ifdef __cplusplus
extern "C" {
#endif

#include "nspr.h"
#include "slapi-plugin.h"

/*
 * shamelessly stolen from the xp library
 *
 */

/*
  Linked list manipulation routines
 
  this is a very standard linked list structure
  used by many many programmers all over the world
 
  The lists have been modified to be doubly linked.  The
    first element in a list is always the header.  The 'next'
        pointer of the header is the first element in the list.
        The 'prev' pointer of the header is the last element in
        the list.
 
  The 'prev' pointer of the first real element in the list
    is NULL as is the 'next' pointer of the last real element
        in the list
 
 */


typedef struct _repl_genericList {
    void *object;
    struct _repl_genericList *next;
    struct _repl_genericList *prev;
} ReplGenericList;

typedef void *(ReplGenericListObjectDestroyFn)(void *obj);

ReplGenericList *ReplGenericListNew(void);
void ReplGenericListDestroy(ReplGenericList *list, ReplGenericListObjectDestroyFn destroyFn);

void ReplGenericListAddObject(ReplGenericList *list,
			      void *newObject);
ReplGenericList *ReplGenericListFindObject(ReplGenericList *list,
					   void *obj);


#ifdef __cplusplus
}
#endif

#endif