]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPMessage.cpp
05aede6f6ea8ffb11d652f7bb02b0f291ea79a61
[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 LDAPMsg::LDAPMsg(LDAPMessage *msg){
18     DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPMsg::LDAPMsg()" << endl);
19         msgType=ldap_msgtype(msg);
20     m_hasControls=false;
21 }
22
23 LDAPMsg* LDAPMsg::create(const LDAPRequest *req, LDAPMessage *msg){
24     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::create()" << endl);
25         switch(ldap_msgtype(msg)){
26                 case SEARCH_ENTRY :
27                         return new LDAPSearchResult(req,msg);
28                 break;
29                 case SEARCH_REFERENCE :
30                         return new LDAPSearchReference(req, msg);
31                 break;
32         case EXTENDED_RESPONSE :
33             return new LDAPExtResult(req,msg);
34         break;
35                 default :
36                         return new LDAPResult(req, msg);
37         }
38         return 0;
39 }
40
41
42 int LDAPMsg::getMessageType(){
43     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMessageType()" << endl);
44         return msgType;
45 }
46
47 int LDAPMsg::getMsgID(){
48     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMsgID()" << endl);
49         return msgID;
50 }
51
52 bool LDAPMsg::hasControls() const{
53     return m_hasControls;
54 }
55
56 const LDAPControlSet& LDAPMsg::getSrvControls() const {
57     return m_srvControls;
58 }
59