]> git.sur5r.net Git - openldap/blob - contrib/ldapc++/src/LDAPMessage.cpp
Initial check of the LDAP C++ SDK written by Ralf Haferkamp <rhafer@suse.de>
[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 // $Id: LDAPMessage.cpp,v 1.6 2000/08/31 17:43:48 rhafer Exp $
7
8 #include "LDAPMessage.h"
9 #include "LDAPResult.h"
10 #include "LDAPRequest.h"
11 #include "LDAPSearchResult.h"
12 #include "LDAPSearchReference.h"
13 #include "debug.h"
14 #include <iostream>
15
16 LDAPMsg::LDAPMsg(LDAPMessage *msg){
17     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::LDAPMsg()" << endl);
18         msgType=ldap_msgtype(msg);
19 }
20
21 LDAPMsg* LDAPMsg::create(LDAPRequest *req, LDAPMessage *msg){
22     DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::create()" << endl);
23         switch(ldap_msgtype(msg)){
24                 case LDAP_RES_SEARCH_ENTRY :
25                         return new LDAPSearchResult(req,msg);
26                 break;
27                 case LDAP_RES_SEARCH_REFERENCE :
28                         return new LDAPSearchReference(req, msg);
29                 break;
30                 default :
31                         return new LDAPResult(req, msg);
32         }
33         return 0;
34 }
35
36
37 int LDAPMsg::getMessageType(){
38         return msgType;
39 }
40
41 int LDAPMsg::getMsgID(){
42         return msgID;
43 }
44