Cross Reference: notif.c
xref
: /
osnet-11
/
usr
/
src
/
lib
/
libldap4
/
common
/
notif.c
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
/*
1
N/A
*
1
N/A
* Copyright 13/01/98 Sun Microsystems, Inc. All Rights Reserved
1
N/A
* Comments:
1
N/A
*
1
N/A
*/
1
N/A
#
pragma
ident
"%Z%%M% %I% %E% SMI"
1
N/A
#
include
<
stdio.h
>
1
N/A
#
include
<
ctype.h
>
1
N/A
#
include
<
string.h
>
1
N/A
#
include
"
lber.h
"
1
N/A
#
include
"
ldap.h
"
1
N/A
#
include
"
ldap-private.h
"
1
N/A
#
include
"
ldap-int.h
"
1
N/A
1
N/A
LDAPMessage
*
ldap_first_notif
(
LDAP
*
ld
)
1
N/A
{
1
N/A
return
ld
->
ld_notifs
;
1
N/A
}
1
N/A
1
N/A
LDAPMessage
*
ldap_next_notif
(
LDAP
*
ld
,
LDAPMessage
*
current
)
1
N/A
{
1
N/A
if
(
current
==
NULLMSG
)
1
N/A
return
NULLMSG
;
1
N/A
else
1
N/A
return
current
->
lm_next
;
1
N/A
}
1
N/A
1
N/A
int
ldap_reset_notif
(
LDAP
*
ld
,
int
freeit
)
1
N/A
{
1
N/A
LDAPMessage
*
L_n
=
NULLMSG
;
1
N/A
LDAPMessage
*
L_q
=
NULLMSG
;
1
N/A
1
N/A
if
(
freeit
)
1
N/A
{
1
N/A
for
(
L_n
=
ld
->
ld_notifs
;
L_n
!=
NULLMSG
;
L_n
=
L_n
->
lm_next
)
1
N/A
{
1
N/A
if
(
L_n
->
lm_next
!=
NULLMSG
)
1
N/A
{
1
N/A
L_q
=
L_n
->
lm_next
;
1
N/A
ldap_msgfree
(
L_n
);
1
N/A
L_n
=
L_q
;
1
N/A
}
1
N/A
else
1
N/A
{
1
N/A
ldap_msgfree
(
L_n
);
1
N/A
break
;
1
N/A
}
1
N/A
}
1
N/A
}
1
N/A
ld
->
ld_notifs
=
NULLMSG
;
1
N/A
1
N/A
return
(
LDAP_SUCCESS
);
1
N/A
}
1
N/A
1
N/A
int
ldap_remove_notif
(
LDAP
*
ld
,
LDAPMessage
*
notif
,
int
freeit
)
1
N/A
{
1
N/A
LDAPMessage
*
L_n
=
NULLMSG
, *
L_q
=
NULLMSG
;
1
N/A
1
N/A
for
(
L_n
=
ld
->
ld_notifs
;
L_n
!=
NULLMSG
;
L_n
=
L_n
->
lm_next
)
1
N/A
{
1
N/A
if
(
L_n
==
notif
)
1
N/A
{
1
N/A
if
(
L_q
==
NULLMSG
)
1
N/A
ld
->
ld_notifs
=
L_n
->
lm_next
;
1
N/A
else
1
N/A
L_q
->
lm_next
=
L_n
->
lm_next
;
1
N/A
1
N/A
L_n
->
lm_next
=
NULLMSG
;
1
N/A
if
(
freeit
)
1
N/A
ldap_msgfree
(
L_n
);
1
N/A
1
N/A
break
;
1
N/A
}
1
N/A
L_q
=
L_n
;
1
N/A
}
1
N/A
return
(
LDAP_SUCCESS
);
1
N/A
}
1
N/A
1
N/A
/* Add in tail */
1
N/A
int
ldap_add_notif
(
LDAP
*
ld
,
LDAPMessage
*
notif
)
1
N/A
{
1
N/A
LDAPMessage
*
L_n
=
NULLMSG
, *
L_q
=
NULLMSG
;
1
N/A
1
N/A
for
(
L_n
=
ld
->
ld_notifs
;
L_n
!=
NULLMSG
;
L_n
=
L_n
->
lm_next
)
1
N/A
L_q
=
L_n
;
1
N/A
1
N/A
notif
->
lm_next
=
NULLMSG
;
1
N/A
if
(
L_q
==
NULLMSG
)
1
N/A
ld
->
ld_notifs
=
notif
;
1
N/A
else
1
N/A
L_q
->
lm_next
=
notif
;
1
N/A
1
N/A
return
(
LDAP_SUCCESS
);
1
N/A
}
1
N/A
1
N/A
/* Add in head */
1
N/A
int
ldap_insert_notif
(
LDAP
*
ld
,
LDAPMessage
*
notif
)
1
N/A
{
1
N/A
1
N/A
notif
->
lm_next
=
ld
->
ld_notifs
;
1
N/A
ld
->
ld_notifs
=
notif
;
1
N/A
1
N/A
return
(
LDAP_SUCCESS
);
1
N/A
}
1
N/A