diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 11:11:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 11:11:40 +0000 |
commit | 7731832751ab9f3c6ddeb66f186d3d7fa1934a6d (patch) | |
tree | e91015872543a59be2aad26c2fea02e41b57005d /contrib/ldapc++/src/LDAPMessage.cpp | |
parent | Initial commit. (diff) | |
download | openldap-upstream/2.4.57+dfsg.tar.xz openldap-upstream/2.4.57+dfsg.zip |
Adding upstream version 2.4.57+dfsg.upstream/2.4.57+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | contrib/ldapc++/src/LDAPMessage.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/contrib/ldapc++/src/LDAPMessage.cpp b/contrib/ldapc++/src/LDAPMessage.cpp new file mode 100644 index 0000000..2dff163 --- /dev/null +++ b/contrib/ldapc++/src/LDAPMessage.cpp @@ -0,0 +1,72 @@ +// $OpenLDAP$ +/* + * Copyright 2000-2021 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ + + +#include "LDAPMessage.h" + +#include "LDAPResult.h" +#include "LDAPExtResult.h" +#include "LDAPSaslBindResult.h" +#include "LDAPRequest.h" +#include "LDAPSearchResult.h" +#include "LDAPSearchReference.h" +#include "debug.h" +#include <iostream> + +using namespace std; + +LDAPMsg::LDAPMsg(LDAPMessage *msg){ + DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPMsg::LDAPMsg()" << endl); + msgType=ldap_msgtype(msg); + m_hasControls=false; +} + +LDAPMsg::LDAPMsg(int type, int id=0){ + DEBUG(LDAP_DEBUG_CONSTRUCT,"LDAPMsg::LDAPMsg()" << endl); + msgType = type; + msgID = id; + m_hasControls=false; +} + +LDAPMsg* LDAPMsg::create(const LDAPRequest *req, LDAPMessage *msg){ + DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::create()" << endl); + switch(ldap_msgtype(msg)){ + case SEARCH_ENTRY : + return new LDAPSearchResult(req,msg); + break; + case SEARCH_REFERENCE : + return new LDAPSearchReference(req, msg); + break; + case EXTENDED_RESPONSE : + return new LDAPExtResult(req,msg); + break; + case BIND_RESPONSE : + return new LDAPSaslBindResult(req,msg); + default : + return new LDAPResult(req, msg); + } + return 0; +} + + +int LDAPMsg::getMessageType(){ + DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMessageType()" << endl); + return msgType; +} + +int LDAPMsg::getMsgID(){ + DEBUG(LDAP_DEBUG_TRACE,"LDAPMsg::getMsgID()" << endl); + return msgID; +} + +bool LDAPMsg::hasControls() const{ + return m_hasControls; +} + +const LDAPControlSet& LDAPMsg::getSrvControls() const { + return m_srvControls; +} + |