1/*	$NetBSD$	*/
2
3// OpenLDAP: pkg/ldap/contrib/ldapc++/src/LDAPMessageQueue.h,v 1.5.10.2 2008/04/14 23:09:26 quanah Exp
4/*
5 * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
6 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 */
8
9
10#ifndef LDAP_MESSAGE_QUEUE_H
11#define LDAP_MESSAGE_QUEUE_H
12
13#include <stack>
14
15#include <LDAPUrlList.h>
16#include <LDAPMessage.h>
17
18class LDAPAsynConnection;
19class LDAPRequest;
20class LDAPSearchRequest;
21class LDAPUrl;
22typedef std::stack<LDAPRequest*> LDAPRequestStack;
23typedef std::list<LDAPRequest*> LDAPRequestList;
24
25/**
26 * This class is created for the asynchronous LDAP-operations. And can be
27 * used by the client to retrieve the results of an operation.
28 */
29class LDAPMessageQueue{
30    public :
31
32        /**
33         * This creates a new LDAPMessageQueue. For a LDAP-request
34         *
35         * @param conn  The Request for that is queue can be used to get
36         *              the results.
37         */
38        LDAPMessageQueue(LDAPRequest *conn);
39        /**
40         * Destructor
41         */
42        ~LDAPMessageQueue();
43
44        /**
45         * This method reads exactly one Message from the results of a
46         * Request.
47         * @throws LDAPException
48         * @return A pointer to an object of one of the classes that were
49         *          derived from LDAPMsg. The user has to cast it to the
50         *          correct type (e.g. LDAPResult or LDAPSearchResult)
51         */
52        LDAPMsg* getNext();
53
54        /**
55         * For internat use only.
56         *
57         * The method is used to start the automatic referral chasing
58         */
59        LDAPRequest* chaseReferral(LDAPMsg* ref);
60
61        /**
62         * For internal use only
63         *
64         * The referral chasing algorithm needs this method to see the
65         * currently active requests.
66         */
67        LDAPRequestStack* getRequestStack();
68
69    private :
70        LDAPRequestStack m_activeReq;
71        LDAPRequestList m_issuedReq;
72};
73#endif //ifndef LDAP_MESSAGE_QUEUE_H
74
75