1N/A/*
1N/A *
1N/A * Copyright 13/01/98 Sun Microsystems, Inc. All Rights Reserved
1N/A * Comments:
1N/A *
1N/A */
1N/A#pragma ident "%Z%%M% %I% %E% SMI"
1N/A#include <stdio.h>
1N/A#include <ctype.h>
1N/A#include <string.h>
1N/A#include "lber.h"
1N/A#include "ldap.h"
1N/A#include "ldap-private.h"
1N/A#include "ldap-int.h"
1N/A
1N/ALDAPMessage *ldap_first_notif(LDAP *ld)
1N/A{
1N/A return ld->ld_notifs;
1N/A}
1N/A
1N/ALDAPMessage *ldap_next_notif(LDAP *ld, LDAPMessage *current)
1N/A{
1N/A if ( current == NULLMSG )
1N/A return NULLMSG;
1N/A else
1N/A return current->lm_next;
1N/A}
1N/A
1N/Aint ldap_reset_notif(LDAP *ld, int freeit)
1N/A{
1N/A LDAPMessage *L_n=NULLMSG;
1N/A LDAPMessage *L_q=NULLMSG;
1N/A
1N/A if ( freeit )
1N/A {
1N/A for (L_n=ld->ld_notifs; L_n!=NULLMSG; L_n=L_n->lm_next)
1N/A {
1N/A if ( L_n->lm_next != NULLMSG )
1N/A {
1N/A L_q = L_n->lm_next;
1N/A ldap_msgfree(L_n);
1N/A L_n = L_q;
1N/A }
1N/A else
1N/A {
1N/A ldap_msgfree(L_n);
1N/A break;
1N/A }
1N/A }
1N/A }
1N/A ld->ld_notifs = NULLMSG;
1N/A
1N/A return (LDAP_SUCCESS);
1N/A}
1N/A
1N/Aint ldap_remove_notif(LDAP *ld, LDAPMessage *notif, int freeit)
1N/A{
1N/A LDAPMessage *L_n=NULLMSG, *L_q=NULLMSG;
1N/A
1N/A for ( L_n=ld->ld_notifs; L_n!=NULLMSG; L_n=L_n->lm_next)
1N/A {
1N/A if ( L_n == notif)
1N/A {
1N/A if ( L_q == NULLMSG )
1N/A ld->ld_notifs = L_n->lm_next;
1N/A else
1N/A L_q->lm_next = L_n->lm_next;
1N/A
1N/A L_n->lm_next = NULLMSG;
1N/A if ( freeit )
1N/A ldap_msgfree(L_n);
1N/A
1N/A break;
1N/A }
1N/A L_q = L_n;
1N/A }
1N/A return (LDAP_SUCCESS);
1N/A}
1N/A
1N/A/* Add in tail */
1N/Aint ldap_add_notif(LDAP *ld, LDAPMessage *notif)
1N/A{
1N/A LDAPMessage *L_n=NULLMSG, *L_q=NULLMSG;
1N/A
1N/A for ( L_n=ld->ld_notifs; L_n!=NULLMSG; L_n=L_n->lm_next)
1N/A L_q = L_n;
1N/A
1N/A notif->lm_next = NULLMSG;
1N/A if ( L_q == NULLMSG )
1N/A ld->ld_notifs = notif;
1N/A else
1N/A L_q->lm_next = notif;
1N/A
1N/A return (LDAP_SUCCESS);
1N/A}
1N/A
1N/A/* Add in head */
1N/Aint ldap_insert_notif(LDAP *ld, LDAPMessage *notif)
1N/A{
1N/A
1N/A notif->lm_next = ld->ld_notifs;
1N/A ld->ld_notifs = notif;
1N/A
1N/A return (LDAP_SUCCESS);
1N/A}
1N/A