Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client-side result codes #180

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 208 additions & 0 deletions LdapForNet/LdapException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,212 @@ public LdapBerConversionException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapServerDownException : LdapException
{
public LdapServerDownException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapLocalErrorException : LdapException
{
public LdapLocalErrorException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapEncodingErrorException : LdapException
{
public LdapEncodingErrorException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapDecodingErrorException : LdapException
{
public LdapDecodingErrorException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapAuthUnknownException : LdapException
{
public LdapAuthUnknownException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapFilterErrorException : LdapException
{
public LdapFilterErrorException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapUserCanceledException : LdapException
{
public LdapUserCanceledException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapNoMemoryException : LdapException
{
public LdapNoMemoryException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapConnectErrorException : LdapException
{
public LdapConnectErrorException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapControlNotFoundException : LdapException
{
public LdapControlNotFoundException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapNoResultsReturnedException : LdapException
{
public LdapNoResultsReturnedException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapMoreResultsToReturnException : LdapException
{
public LdapMoreResultsToReturnException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapClientLoopException : LdapException
{
public LdapClientLoopException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapReferralLimitExceededException : LdapException
{
public LdapReferralLimitExceededException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapInvalidResponseException : LdapException
{
public LdapInvalidResponseException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapAmbiguousResponseException : LdapException
{
public LdapAmbiguousResponseException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapTlsNotSupportedException : LdapException
{
public LdapTlsNotSupportedException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapIntermediateResponseException : LdapException
{
public LdapIntermediateResponseException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapUnknownTypeException : LdapException
{
public LdapUnknownTypeException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapCanceledException : LdapException
{
public LdapCanceledException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapNoSuchOperationException : LdapException
{
public LdapNoSuchOperationException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapTooLateException : LdapException
{
public LdapTooLateException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapCannotCancelException : LdapException
{
public LdapCannotCancelException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapAssertionFailedException : LdapException
{
public LdapAssertionFailedException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapAuthorizationDeniedException : LdapException
{
public LdapAuthorizationDeniedException(LdapExceptionData data) : base(data)
{
}
}

[Serializable]
public class LdapNoOperationException : LdapException
{
public LdapNoOperationException(LdapExceptionData data) : base(data)
{
}
}
}
29 changes: 29 additions & 0 deletions LdapForNet/Native/LdapNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,35 @@ internal LdapException ConstructException(LdapExceptionData data)
ResultCode.AffectsMultipleDsas => new LdapAffectsMultipleDsasException(data),
ResultCode.VirtualListViewError => new LdapVirtualListViewErrorException(data),
ResultCode.Other => new LdapOtherException(data),
ResultCode.ServerDown => new LdapServerDownException(data),
ResultCode.LocalError => new LdapLocalErrorException(data),
ResultCode.EncodingError => new LdapEncodingErrorException(data),
ResultCode.DecodingError => new LdapDecodingErrorException(data),
ResultCode.Timeout => new LdapTimeoutException(data),
ResultCode.AuthUnknown => new LdapAuthUnknownException(data),
ResultCode.FilterError => new LdapFilterErrorException(data),
ResultCode.UserCanceled => new LdapUserCanceledException(data),
ResultCode.ParamError => new LdapParamErrorException(data),
ResultCode.NoMemory => new LdapNoMemoryException(data),
ResultCode.ConnectError => new LdapConnectErrorException(data),
ResultCode.NotSupported => new LdapNotSupportedException(data),
ResultCode.ControlNotFound => new LdapControlNotFoundException(data),
ResultCode.NoResultsReturned => new LdapNoResultsReturnedException(data),
ResultCode.MoreResultsToReturn => new LdapMoreResultsToReturnException(data),
ResultCode.ClientLoop => new LdapClientLoopException(data),
ResultCode.ReferralLimitExceeded => new LdapReferralLimitExceededException(data),
ResultCode.InvalidResponse => new LdapInvalidResponseException(data),
ResultCode.AmbiguousResponse => new LdapAmbiguousResponseException(data),
ResultCode.TlsNotSupported => new LdapTlsNotSupportedException(data),
ResultCode.IntermediateResponse => new LdapIntermediateResponseException(data),
ResultCode.UnknownType => new LdapUnknownTypeException(data),
ResultCode.Canceled => new LdapCanceledException(data),
ResultCode.NoSuchOperation => new LdapServerDownException(data),
ResultCode.TooLate => new LdapTooLateException(data),
ResultCode.CannotCancel => new LdapCannotCancelException(data),
ResultCode.AssertionFailed => new LdapAssertionFailedException(data),
ResultCode.AuthorizationDenied => new LdapAuthorizationDeniedException(data),
ResultCode.NoOperation => new LdapNoOperationException(data),
_ => new LdapException(data)
};
}
Expand Down
31 changes: 30 additions & 1 deletion LdapForNet/Native/Native.LdapResultCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,36 @@ public enum ResultCode
ResultsTooLarge = 70,
AffectsMultipleDsas = 71,
VirtualListViewError = 76,
Other = 80
Other = 80,
ServerDown = 81,
LocalError = 82,
EncodingError = 83,
DecodingError = 84,
Timeout = 85,
AuthUnknown = 86,
FilterError = 87,
UserCanceled = 88,
ParamError = 89,
NoMemory = 90,
ConnectError = 91,
NotSupported = 92,
ControlNotFound = 93,
NoResultsReturned = 94,
MoreResultsToReturn = 95,
ClientLoop = 96,
ReferralLimitExceeded = 97,
InvalidResponse = 100,
AmbiguousResponse = 101,
TlsNotSupported = 112,
IntermediateResponse = 113,
UnknownType = 114,
Canceled = 118,
NoSuchOperation = 119,
TooLate = 120,
CannotCancel = 121,
AssertionFailed = 122,
AuthorizationDenied = 123,
NoOperation = 16654
}
}
}