xref: /netbsd-src/external/bsd/openldap/dist/contrib/ldapc++/src/LDAPMessageQueue.h (revision 76c7fc5f6b13ed0b1508e6b313e88e59977ed78e)
1 /*	$NetBSD: LDAPMessageQueue.h,v 1.1.1.6 2019/08/08 13:31:09 christos Exp $	*/
2 
3 // $OpenLDAP$
4 /*
5  * Copyright 2000-2019 The 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 
18 class LDAPAsynConnection;
19 class LDAPRequest;
20 class LDAPSearchRequest;
21 class LDAPUrl;
22 typedef std::stack<LDAPRequest*> LDAPRequestStack;
23 typedef 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  */
29 class 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