blob: f52cd56734916137011f842d48f93fb64417bf2b (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/*
*
* Copyright 13/01/98 Sun Microsystems, Inc. All Rights Reserved
* Comments:
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "lber.h"
#include "ldap.h"
#include "ldap-private.h"
#include "ldap-int.h"
LDAPMessage *ldap_first_notif(LDAP *ld)
{
return ld->ld_notifs;
}
LDAPMessage *ldap_next_notif(LDAP *ld, LDAPMessage *current)
{
if ( current == NULLMSG )
return NULLMSG;
else
return current->lm_next;
}
int ldap_reset_notif(LDAP *ld, int freeit)
{
LDAPMessage *L_n=NULLMSG;
LDAPMessage *L_q=NULLMSG;
if ( freeit )
{
for (L_n=ld->ld_notifs; L_n!=NULLMSG; L_n=L_n->lm_next)
{
if ( L_n->lm_next != NULLMSG )
{
L_q = L_n->lm_next;
ldap_msgfree(L_n);
L_n = L_q;
}
else
{
ldap_msgfree(L_n);
break;
}
}
}
ld->ld_notifs = NULLMSG;
return (LDAP_SUCCESS);
}
int ldap_remove_notif(LDAP *ld, LDAPMessage *notif, int freeit)
{
LDAPMessage *L_n=NULLMSG, *L_q=NULLMSG;
for ( L_n=ld->ld_notifs; L_n!=NULLMSG; L_n=L_n->lm_next)
{
if ( L_n == notif)
{
if ( L_q == NULLMSG )
ld->ld_notifs = L_n->lm_next;
else
L_q->lm_next = L_n->lm_next;
L_n->lm_next = NULLMSG;
if ( freeit )
ldap_msgfree(L_n);
break;
}
L_q = L_n;
}
return (LDAP_SUCCESS);
}
/* Add in tail */
int ldap_add_notif(LDAP *ld, LDAPMessage *notif)
{
LDAPMessage *L_n=NULLMSG, *L_q=NULLMSG;
for ( L_n=ld->ld_notifs; L_n!=NULLMSG; L_n=L_n->lm_next)
L_q = L_n;
notif->lm_next = NULLMSG;
if ( L_q == NULLMSG )
ld->ld_notifs = notif;
else
L_q->lm_next = notif;
return (LDAP_SUCCESS);
}
/* Add in head */
int ldap_insert_notif(LDAP *ld, LDAPMessage *notif)
{
notif->lm_next = ld->ld_notifs;
ld->ld_notifs = notif;
return (LDAP_SUCCESS);
}
|