99 constexpr
operator Value()
const
105 explicit operator bool()
const =
delete;
339 constexpr
operator Value()
const
345 explicit operator bool()
const =
delete;
411 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
465 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
467 return internalTryGet(
this, method, result);
502 return m_Asn1Record->getTotalLength();
516 std::unique_ptr<Asn1Record> m_Asn1Record;
518 LdapLayer(std::unique_ptr<Asn1Record> asn1Record, uint8_t* data,
size_t dataLen,
Layer* prevLayer,
521 void init(uint16_t messageId,
LdapOperationType operationType,
const std::vector<Asn1Record*>& messageRecords,
522 const std::vector<LdapControl>& controls);
523 virtual std::string getExtendedInfoString()
const
528 static constexpr
int messageIdIndex = 0;
529 static constexpr
int operationTypeIndex = 1;
530 static constexpr
int controlsIndex = 2;
532 static constexpr
int controlTypeIndex = 0;
533 static constexpr
int controlValueIndex = 1;
535 template <
typename LdapClass,
typename Method,
typename ResultType>
536 bool internalTryGet(LdapClass* thisPtr, Method method, ResultType& result)
540 result = std::mem_fn(method)(thisPtr);
582 static constexpr
int resultCodeIndex = 0;
583 static constexpr
int matchedDNIndex = 1;
584 static constexpr
int diagnotsticsMessageIndex = 2;
585 static constexpr
int referralIndex = 3;
587 static constexpr uint8_t referralTagType = 3;
590 LdapResponseLayer(std::unique_ptr<Asn1Record> asn1Record, uint8_t* data,
size_t dataLen,
Layer* prevLayer,
592 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
596 const std::string& matchedDN,
const std::string& diagnosticMessage,
597 const std::vector<std::string>& referral = std::vector<std::string>(),
598 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
601 const std::string& matchedDN,
const std::string& diagnosticMessage,
602 const std::vector<std::string>& referral = std::vector<std::string>(),
603 const std::vector<Asn1Record*>& additionalRecords = std::vector<Asn1Record*>(),
604 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
606 std::string getExtendedInfoString()
const override;
671 const std::string& simpleAuthentication,
672 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
685 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
714 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
716 return internalTryGet(
this, method, result);
724 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
727 std::string getExtendedInfoString()
const override;
730 static constexpr
int versionIndex = 0;
731 static constexpr
int nameIndex = 1;
732 static constexpr
int credentialIndex = 2;
734 static constexpr
int saslMechanismIndex = 0;
735 static constexpr
int saslCredentialsIndex = 1;
760 const std::string& diagnosticMessage,
761 const std::vector<std::string>& referral = std::vector<std::string>(),
762 const std::vector<uint8_t>& serverSaslCredentials = std::vector<uint8_t>(),
763 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
773 static constexpr
int serverSaslCredentialsTagType = 7;
795 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
805 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
807 return internalTryGet(
this, method, result);
813 LdapUnbindRequestLayer(std::unique_ptr<Asn1Record> asn1Record, uint8_t* data,
size_t dataLen, Layer* prevLayer,
815 : LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
888 constexpr
operator Value()
const
894 explicit operator bool()
const =
delete;
948 constexpr
operator Value()
const
954 explicit operator bool()
const =
delete;
982 DerefAliases derefAliases, uint8_t sizeLimit, uint8_t timeLimit,
bool typesOnly,
983 Asn1Record* filterRecord,
const std::vector<std::string>& attributes,
984 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
1030 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
1032 return internalTryGet(
this, method, result);
1038 static constexpr
int baseObjectIndex = 0;
1039 static constexpr
int scopeIndex = 1;
1040 static constexpr
int derefAliasIndex = 2;
1041 static constexpr
int sizeLimitIndex = 3;
1042 static constexpr
int timeLimitIndex = 4;
1043 static constexpr
int typesOnlyIndex = 5;
1044 static constexpr
int filterIndex = 6;
1045 static constexpr
int attributesIndex = 7;
1049 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
1052 std::string getExtendedInfoString()
const override;
1071 const std::vector<LdapAttribute>& attributes,
1072 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
1084 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
1086 return internalTryGet(
this, method, result);
1092 static constexpr
int objectNameIndex = 0;
1093 static constexpr
int attributesIndex = 1;
1094 static constexpr
int attributeTypeIndex = 0;
1095 static constexpr
int attributeValueIndex = 1;
1099 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
1124 const std::string& diagnosticMessage,
1125 const std::vector<std::string>& referral = std::vector<std::string>(),
1126 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1128 diagnosticMessage, referral, controls)
1161 const std::string& diagnosticMessage,
1162 const std::vector<std::string>& referral = std::vector<std::string>(),
1163 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1198 const std::string& diagnosticMessage,
1199 const std::vector<std::string>& referral = std::vector<std::string>(),
1200 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1235 const std::string& diagnosticMessage,
1236 const std::vector<std::string>& referral = std::vector<std::string>(),
1237 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1272 const std::string& diagnosticMessage,
1273 const std::vector<std::string>& referral = std::vector<std::string>(),
1274 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1276 diagnosticMessage, referral, controls)
1309 const std::string& diagnosticMessage,
1310 const std::vector<std::string>& referral = std::vector<std::string>(),
1311 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1326 inline std::ostream& operator<<(std::ostream& os,
const pcpp::LdapControl& control)
1334 os <<
"{" << attr.
type <<
", {";
1336 std::string separator;
1337 for (
const auto& value : attr.
values)
1339 os << separator << value;
1340 if (separator.empty())
1350 inline std::ostream& operator<<(std::ostream& os,
1353 os <<
"{" << saslAuthentication.
mechanism <<
", {";
1355 std::string separator;
1356 for (
const auto& value : saslAuthentication.
credentials)
1358 os << separator <<
"0x" << std::hex << static_cast<int>(value) << std::dec;
1359 if (separator.empty())
Definition: Asn1Codec.h:298
Definition: Asn1Codec.h:123
Definition: Asn1Codec.h:366
Definition: LdapLayer.h:1182
LdapAddResponseLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1197
Definition: LdapLayer.h:614
AuthenticationType getAuthenticationType() const
std::string getSimpleAuthentication() const
uint32_t getVersion() const
LdapBindRequestLayer(uint16_t messageId, uint8_t version, const std::string &name, const SaslAuthentication &saslAuthentication, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
SaslAuthentication getSaslAuthentication() const
AuthenticationType
Definition: LdapLayer.h:620
@ Simple
Simple authentication.
@ Sasl
SASL authentication.
@ NotApplicable
Unknown / not application authentication type.
std::string getName() const
LdapBindRequestLayer(uint16_t messageId, uint8_t version, const std::string &name, const std::string &simpleAuthentication, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:743
std::vector< uint8_t > getServerSaslCredentials() const
LdapBindResponseLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< uint8_t > &serverSaslCredentials=std::vector< uint8_t >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1293
LdapCompareResponseLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1308
Definition: LdapLayer.h:1219
LdapDeleteResponseLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1234
Definition: LdapLayer.h:400
std::string toString() const override
void parseNextLayer() override
bool tryGet(Method method, ResultType &result)
Definition: LdapLayer.h:465
virtual LdapOperationType getLdapOperationType() const
std::vector< LdapControl > getControls() const
void computeCalculateFields() override
Definition: LdapLayer.h:505
Asn1ConstructedRecord * getLdapOperationAsn1Record() const
static LdapLayer * parseLdapMessage(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
Asn1SequenceRecord * getRootAsn1Record() const
uint16_t getMessageID() const
OsiModelLayer getOsiModelLayer() const override
Definition: LdapLayer.h:508
size_t getHeaderLen() const override
Definition: LdapLayer.h:500
static bool isLdapPort(uint16_t port)
Definition: LdapLayer.h:475
LdapLayer(uint16_t messageId, LdapOperationType operationType, const std::vector< Asn1Record * > &messageRecords, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1256
LdapModifyDNResponseLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1271
Definition: LdapLayer.h:1145
LdapModifyResponseLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1160
An enum wrapper class for LDAP operation types.
Definition: LdapLayer.h:22
constexpr LdapOperationType(Value value)
Definition: LdapLayer.h:82
Value
Definition: LdapLayer.h:28
@ ModifyResponse
Modify Response.
Definition: LdapLayer.h:44
@ AddResponse
Add Response.
Definition: LdapLayer.h:48
@ BindRequest
Bind Request.
Definition: LdapLayer.h:30
@ SearchResultReference
Search Result Reference.
Definition: LdapLayer.h:64
@ SearchResultEntry
Search Result Entry.
Definition: LdapLayer.h:38
@ ExtendedRequest
Extended Request.
Definition: LdapLayer.h:66
@ ModifyDNRequest
Modify DN (Distinguished Name) Request.
Definition: LdapLayer.h:54
@ DeleteResponse
Delete Response.
Definition: LdapLayer.h:52
@ CompareRequest
Compare Request.
Definition: LdapLayer.h:58
@ BindResponse
Bind Response.
Definition: LdapLayer.h:32
@ SearchRequest
Search Request.
Definition: LdapLayer.h:36
@ ModifyDNResponse
Modify DN (Distinguished Name) Response.
Definition: LdapLayer.h:56
@ ExtendedResponse
Extended Response.
Definition: LdapLayer.h:68
@ IntermediateResponse
Intermediate Response.
Definition: LdapLayer.h:70
@ ModifyRequest
Modify Request.
Definition: LdapLayer.h:42
@ CompareResponse
Compare Response.
Definition: LdapLayer.h:60
@ AddRequest
Add Request.
Definition: LdapLayer.h:46
@ AbandonRequest
Abandon Request.
Definition: LdapLayer.h:62
@ Unknown
Unknown operation type.
Definition: LdapLayer.h:72
@ DeleteRequest
Delete Request.
Definition: LdapLayer.h:50
@ SearchResultDone
Search Result Done.
Definition: LdapLayer.h:40
@ UnbindRequest
Unbind Request.
Definition: LdapLayer.h:34
std::string toString() const
static LdapOperationType fromUintValue(uint8_t value)
Definition: LdapLayer.h:556
std::string getDiagnosticMessage() const
LdapResultCode getResultCode() const
std::string getMatchedDN() const
std::vector< std::string > getReferral() const
An enum wrapper class for LDAP result codes.
Definition: LdapLayer.h:116
Value
Definition: LdapLayer.h:122
@ InsufficientAccessRights
Definition: LdapLayer.h:251
@ InvalidAttributeSyntax
Definition: LdapLayer.h:219
@ AuthMethodNotSupported
Definition: LdapLayer.h:160
@ NotAllowedOnRDN
Definition: LdapLayer.h:289
@ EntryAlreadyExists
Definition: LdapLayer.h:294
@ StrongerAuthRequired
Definition: LdapLayer.h:164
@ InvalidDNSyntax
Definition: LdapLayer.h:231
@ InappropriateAuthentication
Definition: LdapLayer.h:241
@ ObjectClassViolation
Definition: LdapLayer.h:279
@ ConfidentialityRequired
Definition: LdapLayer.h:184
@ AliasProblem
Definition: LdapLayer.h:227
@ Busy
Definition: LdapLayer.h:255
@ ProtocolError
Definition: LdapLayer.h:134
@ Unavailable
Definition: LdapLayer.h:259
@ SaslBindInProgress
Definition: LdapLayer.h:189
@ InappropriateMatching
Definition: LdapLayer.h:203
@ CompareFalse
Definition: LdapLayer.h:150
@ AttributeOrValueExists
Definition: LdapLayer.h:213
@ AliasDereferencingProblem
Definition: LdapLayer.h:236
@ AdminLimitExceeded
Definition: LdapLayer.h:173
@ Referral
Definition: LdapLayer.h:169
@ SizeLimitExceeded
Definition: LdapLayer.h:145
@ UnwillingToPerform
Definition: LdapLayer.h:263
@ ConstraintViolation
Definition: LdapLayer.h:208
@ NamingViolation
Definition: LdapLayer.h:273
@ UnavailableCriticalExtension
Definition: LdapLayer.h:178
@ ObjectClassModsProhibited
Definition: LdapLayer.h:299
@ Unknown
Definition: LdapLayer.h:312
@ Other
Definition: LdapLayer.h:308
@ NoSuchAttribute
Definition: LdapLayer.h:193
@ CompareTrue
Definition: LdapLayer.h:155
@ UndefinedAttributeType
Definition: LdapLayer.h:198
@ NoSuchObject
Definition: LdapLayer.h:223
@ LoopDetect
Definition: LdapLayer.h:268
@ NotAllowedOnNonLeaf
Definition: LdapLayer.h:284
@ TimeLimitExceeded
Definition: LdapLayer.h:139
@ AffectsMultipleDSAs
Definition: LdapLayer.h:304
@ InvalidCredentials
Definition: LdapLayer.h:246
@ OperationsError
Definition: LdapLayer.h:130
@ Success
Definition: LdapLayer.h:126
std::string toString() const
constexpr LdapResultCode(Value value)
Definition: LdapLayer.h:322
static LdapResultCode fromUintValue(uint8_t value)
Definition: LdapLayer.h:905
static DerefAliases fromUintValue(uint8_t value)
Value
Definition: LdapLayer.h:911
@ DerefInSearching
Dereferences aliases only after name resolution.
Definition: LdapLayer.h:915
@ DerefFindingBaseObj
Dereferences aliases only during name resolution.
Definition: LdapLayer.h:917
@ Unknown
Unknown value.
Definition: LdapLayer.h:921
@ DerefAlways
Always dereference aliases.
Definition: LdapLayer.h:919
@ NeverDerefAliases
Never dereferences aliases.
Definition: LdapLayer.h:913
std::string toString() const
constexpr DerefAliases(Value value)
Definition: LdapLayer.h:931
Definition: LdapLayer.h:831
Value
Definition: LdapLayer.h:837
@ subordinateSubtree
Definition: LdapLayer.h:857
@ WholeSubtree
Definition: LdapLayer.h:851
@ BaseObject
Definition: LdapLayer.h:841
@ SingleLevel
Definition: LdapLayer.h:846
@ Unknown
Definition: LdapLayer.h:861
constexpr SearchRequestScope(Value value)
Definition: LdapLayer.h:871
std::string toString() const
static SearchRequestScope fromUintValue(uint8_t value)
Definition: LdapLayer.h:824
std::string getBaseObject() const
SearchRequestScope getScope() const
LdapSearchRequestLayer(uint16_t messageId, const std::string &baseObject, SearchRequestScope scope, DerefAliases derefAliases, uint8_t sizeLimit, uint8_t timeLimit, bool typesOnly, Asn1Record *filterRecord, const std::vector< std::string > &attributes, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
DerefAliases getDerefAlias() const
uint8_t getSizeLimit() const
uint8_t getTimeLimit() const
Asn1Record * getFilter() const
std::vector< std::string > getAttributes() const
bool getTypesOnly() const
Definition: LdapLayer.h:1108
LdapSearchResultDoneLayer(uint16_t messageId, LdapResultCode resultCode, const std::string &matchedDN, const std::string &diagnosticMessage, const std::vector< std::string > &referral=std::vector< std::string >(), const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1123
Definition: LdapLayer.h:1060
std::string getObjectName() const
std::vector< LdapAttribute > getAttributes() const
LdapSearchResultEntryLayer(uint16_t messageId, const std::string &objectName, const std::vector< LdapAttribute > &attributes, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:786
LdapOperationType getLdapOperationType() const override
Definition: LdapLayer.h:800
LdapUnbindRequestLayer(uint16_t messageId, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelApplicationLayer
Definition: ProtocolType.h:368
Definition: LdapLayer.h:378
std::string type
Attribute description.
Definition: LdapLayer.h:380
bool operator==(const LdapAttribute &other) const
Definition: LdapLayer.h:389
std::vector< std::string > values
A list of attribute values (zero or more)
Definition: LdapLayer.h:382
Definition: LdapLayer.h:634
std::vector< uint8_t > credentials
Encoded SASL credentials.
Definition: LdapLayer.h:638
std::string mechanism
The SASL mechanism.
Definition: LdapLayer.h:636
bool operator!=(const SaslAuthentication &other) const
Definition: LdapLayer.h:655
bool operator==(const SaslAuthentication &other) const
Definition: LdapLayer.h:645
Definition: LdapLayer.h:356
std::string controlType
LDAP control type.
Definition: LdapLayer.h:358
bool operator==(const LdapControl &other) const
Definition: LdapLayer.h:367
std::string controlValue
LDAP control value.
Definition: LdapLayer.h:360