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>());
464 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
466 return internalTryGet(
this, method, result);
501 return m_Asn1Record->getTotalLength();
515 std::unique_ptr<Asn1Record> m_Asn1Record;
517 LdapLayer(std::unique_ptr<Asn1Record> asn1Record, uint8_t* data,
size_t dataLen,
Layer* prevLayer,
520 void init(uint16_t messageId,
LdapOperationType operationType,
const std::vector<Asn1Record*>& messageRecords,
521 const std::vector<LdapControl>& controls);
522 virtual std::string getExtendedInfoString()
const
527 static constexpr
int messageIdIndex = 0;
528 static constexpr
int operationTypeIndex = 1;
529 static constexpr
int controlsIndex = 2;
531 static constexpr
int controlTypeIndex = 0;
532 static constexpr
int controlValueIndex = 1;
534 template <
typename LdapClass,
typename Method,
typename ResultType>
535 bool internalTryGet(LdapClass* thisPtr, Method method, ResultType& result)
539 result = std::mem_fn(method)(thisPtr);
581 static constexpr
int resultCodeIndex = 0;
582 static constexpr
int matchedDNIndex = 1;
583 static constexpr
int diagnotsticsMessageIndex = 2;
584 static constexpr
int referralIndex = 3;
586 static constexpr uint8_t referralTagType = 3;
589 LdapResponseLayer(std::unique_ptr<Asn1Record> asn1Record, uint8_t* data,
size_t dataLen,
Layer* prevLayer,
591 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
595 const std::string& matchedDN,
const std::string& diagnosticMessage,
596 const std::vector<std::string>& referral = std::vector<std::string>(),
597 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
600 const std::string& matchedDN,
const std::string& diagnosticMessage,
601 const std::vector<std::string>& referral = std::vector<std::string>(),
602 const std::vector<Asn1Record*>& additionalRecords = std::vector<Asn1Record*>(),
603 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
605 std::string getExtendedInfoString()
const override;
670 const std::string& simpleAuthentication,
671 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
684 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
713 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
715 return internalTryGet(
this, method, result);
723 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
726 std::string getExtendedInfoString()
const override;
729 static constexpr
int versionIndex = 0;
730 static constexpr
int nameIndex = 1;
731 static constexpr
int credentialIndex = 2;
733 static constexpr
int saslMechanismIndex = 0;
734 static constexpr
int saslCredentialsIndex = 1;
759 const std::string& diagnosticMessage,
760 const std::vector<std::string>& referral = std::vector<std::string>(),
761 const std::vector<uint8_t>& serverSaslCredentials = std::vector<uint8_t>(),
762 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
772 static constexpr
int serverSaslCredentialsTagType = 7;
794 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
804 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
806 return internalTryGet(
this, method, result);
812 LdapUnbindRequestLayer(std::unique_ptr<Asn1Record> asn1Record, uint8_t* data,
size_t dataLen, Layer* prevLayer,
814 : LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
887 constexpr
operator Value()
const
893 explicit operator bool()
const =
delete;
947 constexpr
operator Value()
const
953 explicit operator bool()
const =
delete;
981 DerefAliases derefAliases, uint8_t sizeLimit, uint8_t timeLimit,
bool typesOnly,
982 Asn1Record* filterRecord,
const std::vector<std::string>& attributes,
983 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
1029 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
1031 return internalTryGet(
this, method, result);
1037 static constexpr
int baseObjectIndex = 0;
1038 static constexpr
int scopeIndex = 1;
1039 static constexpr
int derefAliasIndex = 2;
1040 static constexpr
int sizeLimitIndex = 3;
1041 static constexpr
int timeLimitIndex = 4;
1042 static constexpr
int typesOnlyIndex = 5;
1043 static constexpr
int filterIndex = 6;
1044 static constexpr
int attributesIndex = 7;
1048 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
1051 std::string getExtendedInfoString()
const override;
1070 const std::vector<LdapAttribute>& attributes,
1071 const std::vector<LdapControl>& controls = std::vector<LdapControl>());
1083 template <
typename Method,
typename ResultType>
bool tryGet(Method method, ResultType& result)
1085 return internalTryGet(
this, method, result);
1091 static constexpr
int objectNameIndex = 0;
1092 static constexpr
int attributesIndex = 1;
1093 static constexpr
int attributeTypeIndex = 0;
1094 static constexpr
int attributeValueIndex = 1;
1098 :
LdapLayer(std::move(asn1Record), data, dataLen, prevLayer, packet)
1123 const std::string& diagnosticMessage,
1124 const std::vector<std::string>& referral = std::vector<std::string>(),
1125 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1127 diagnosticMessage, referral, controls)
1160 const std::string& diagnosticMessage,
1161 const std::vector<std::string>& referral = std::vector<std::string>(),
1162 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1197 const std::string& diagnosticMessage,
1198 const std::vector<std::string>& referral = std::vector<std::string>(),
1199 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1234 const std::string& diagnosticMessage,
1235 const std::vector<std::string>& referral = std::vector<std::string>(),
1236 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1271 const std::string& diagnosticMessage,
1272 const std::vector<std::string>& referral = std::vector<std::string>(),
1273 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1275 diagnosticMessage, referral, controls)
1308 const std::string& diagnosticMessage,
1309 const std::vector<std::string>& referral = std::vector<std::string>(),
1310 const std::vector<LdapControl>& controls = std::vector<LdapControl>())
1325 inline std::ostream& operator<<(std::ostream& os,
const pcpp::LdapControl& control)
1333 os <<
"{" << attr.
type <<
", {";
1335 std::string separator;
1336 for (
const auto& value : attr.
values)
1338 os << separator << value;
1339 if (separator.empty())
1349 inline std::ostream& operator<<(std::ostream& os,
1352 os <<
"{" << saslAuthentication.
mechanism <<
", {";
1354 std::string separator;
1355 for (
const auto& value : saslAuthentication.
credentials)
1357 os << separator <<
"0x" << std::hex << static_cast<int>(value) << std::dec;
1358 if (separator.empty())
Definition: Asn1Codec.h:298
Definition: Asn1Codec.h:123
Definition: Asn1Codec.h:366
Definition: LdapLayer.h:1181
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:1196
Definition: LdapLayer.h:613
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:619
@ 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:742
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:1292
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:1307
Definition: LdapLayer.h:1218
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:1233
Definition: LdapLayer.h:400
std::string toString() const override
void parseNextLayer() override
bool tryGet(Method method, ResultType &result)
Definition: LdapLayer.h:464
virtual LdapOperationType getLdapOperationType() const
std::vector< LdapControl > getControls() const
void computeCalculateFields() override
Definition: LdapLayer.h:504
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:507
size_t getHeaderLen() const override
Definition: LdapLayer.h:499
static bool isLdapPort(uint16_t port)
Definition: LdapLayer.h:474
LdapLayer(uint16_t messageId, LdapOperationType operationType, const std::vector< Asn1Record * > &messageRecords, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
Definition: LdapLayer.h:1255
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:1270
Definition: LdapLayer.h:1144
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:1159
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:555
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:904
static DerefAliases fromUintValue(uint8_t value)
Value
Definition: LdapLayer.h:910
@ DerefInSearching
Dereferences aliases only after name resolution.
Definition: LdapLayer.h:914
@ DerefFindingBaseObj
Dereferences aliases only during name resolution.
Definition: LdapLayer.h:916
@ Unknown
Unknown value.
Definition: LdapLayer.h:920
@ DerefAlways
Always dereference aliases.
Definition: LdapLayer.h:918
@ NeverDerefAliases
Never dereferences aliases.
Definition: LdapLayer.h:912
std::string toString() const
constexpr DerefAliases(Value value)
Definition: LdapLayer.h:930
Definition: LdapLayer.h:830
Value
Definition: LdapLayer.h:836
@ subordinateSubtree
Definition: LdapLayer.h:856
@ WholeSubtree
Definition: LdapLayer.h:850
@ BaseObject
Definition: LdapLayer.h:840
@ SingleLevel
Definition: LdapLayer.h:845
@ Unknown
Definition: LdapLayer.h:860
constexpr SearchRequestScope(Value value)
Definition: LdapLayer.h:870
std::string toString() const
static SearchRequestScope fromUintValue(uint8_t value)
Definition: LdapLayer.h:823
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:1107
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:1122
Definition: LdapLayer.h:1059
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:785
LdapOperationType getLdapOperationType() const override
Definition: LdapLayer.h:799
LdapUnbindRequestLayer(uint16_t messageId, const std::vector< LdapControl > &controls=std::vector< LdapControl >())
The main namespace for the PcapPlusPlus lib.
OsiModelLayer
Definition: ProtocolType.h:364
@ OsiModelApplicationLayer
Definition: ProtocolType.h:378
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:633
std::vector< uint8_t > credentials
Encoded SASL credentials.
Definition: LdapLayer.h:637
std::string mechanism
The SASL mechanism.
Definition: LdapLayer.h:635
bool operator!=(const SaslAuthentication &other) const
Definition: LdapLayer.h:654
bool operator==(const SaslAuthentication &other) const
Definition: LdapLayer.h:644
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