]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPMessage.cpp
Entry rwlock is no longer needed as concurrency is managed
[openldap] / contrib / ldapc++ / src / LDAPMessage.cpp
1 /*
2  * Copyright 2000, OpenLDAP Foundation, All Rights Reserved.
3  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
4  */
5
6
7 #include "LDAPMessage.h"
8
9 #include "LDAPResult.h"
10 #include "LDAPExtResult.h"
11 #include "LDAPRequest.h"
12 #include "LDAPSearchResult.h"
13 #include "LDAPSearchReference.h"
14 #include "debug.h"
15 #include <iostream>
16
17 using namespace std;
18
19 LDAPMsg::LDAPMsg(LDAPMessage *msg){
20     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPMsg::LDAPMsg()" << endl);
21     msgType=ldap_msgtype(msg);
22     m_hasControls=false;
23 }
24
25 LDAPMsg* LDAPMsg::create(const LDAPRequest *req, LDAPMessage *msg){
26     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::create()" << endl);
27     switch(ldap_msgtype(msg)){
28         case SEARCH_ENTRY :
29             return new LDAPSearchResult(req,msg);
30         break;
31         case SEARCH_REFERENCE :
32             return new LDAPSearchReference(req, msg);
33         break;
34         case EXTENDED_RESPONSE :
35             return new LDAPExtResult(req,msg);
36         break;
37         default :
38             return new LDAPResult(req, msg);
39     }
40     return 0;
41 }
42
43
44 int LDAPMsg::getMessageType(){
45     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMessageType()" << endl);
46     return msgType;
47 }
48
49 int LDAPMsg::getMsgID(){
50     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMsgID()" << endl);
51     return msgID;
52 }
53
54 bool LDAPMsg::hasControls() const{
55     return m_hasControls;
56 }
57
58 const LDAPControlSet& LDAPMsg::getSrvControls() const {
59     return m_srvControls;
60 }
61