/// <summary> Constructs an object from the responseValue which contains the bind dn. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::= /// identity OCTET STRING /// /// </summary> /// <exception> IOException The return value could not be decoded. /// </exception> public GetBindDNResponse(RfcLdapMessage rfcMessage) : base(rfcMessage) { if (ResultCode == LdapException.SUCCESS) { // parse the contents of the reply sbyte[] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); // The only parameter returned should be an octet string Asn1OctetString asn1_identity = (Asn1OctetString) decoder.decode(returnedValue); if (asn1_identity == null) throw new System.IO.IOException("Decoding error"); // Convert to normal string object identity = asn1_identity.stringValue(); if ((System.Object) identity == null) throw new System.IO.IOException("Decoding error"); } else { identity = ""; } }
protected void DataInitDone() { // We dont want the unnecessary memory to remain occupied if // this object is retained by the caller decodedData = null; decoder = null; }
public MonitorEventResponse(RfcLdapMessage message) : base(message) { sbyte[] returnedValue = Value; if (null == returnedValue) { throw new LdapException(LdapException.resultCodeToString(ResultCode), ResultCode, null); } LBERDecoder decoder = new LBERDecoder(); Asn1Sequence sequence = (Asn1Sequence) decoder.decode(returnedValue); int length = ((Asn1Integer) sequence.get_Renamed(0)).intValue(); Asn1Set sequenceSet = (Asn1Set) sequence.get_Renamed(1); specifier_list = new EdirEventSpecifier[length]; for (int i = 0; i < length; i++) { Asn1Sequence eventspecifiersequence = (Asn1Sequence) sequenceSet.get_Renamed(i); int classfication = ((Asn1Integer) eventspecifiersequence.get_Renamed(0)).intValue(); int enumtype = ((Asn1Enumerated) eventspecifiersequence.get_Renamed(1)).intValue(); specifier_list[i] = new EdirEventSpecifier((EdirEventType)classfication, (EdirEventResultType)enumtype); } }
public BaseEdirEventData(EdirEventDataType eventDataType, Asn1Object message) { event_data_type = eventDataType; byte[] byteData = SupportClass.ToByteArray(((Asn1OctetString) message).byteValue()); decodedData = new MemoryStream(byteData); decoder = new LBERDecoder(); }
private void InitBlock() { writeSemaphore = new System.Object(); encoder = new LBEREncoder(); decoder = new LBERDecoder(); stopReaderMessageID = CONTINUE_READING; messages = new MessageVector(5, 5); unsolicitedListeners = new System.Collections.ArrayList(3); }
protected Asn1Sequence getTaggedSequence(Asn1Tagged tagVal) { Asn1Object obj = tagVal.taggedValue(); byte[] dataBytes = SupportClass.ToByteArray(((Asn1OctetString) obj).byteValue()); MemoryStream decodedData = new MemoryStream(dataBytes); LBERDecoder decoder = new LBERDecoder(); return new Asn1Sequence(decoder, decodedData, dataBytes.Length); }
protected int getTaggedIntValue(Asn1Tagged tagVal) { Asn1Object obj = tagVal.taggedValue(); byte[] dataBytes = SupportClass.ToByteArray(((Asn1OctetString) obj).byteValue()); MemoryStream decodedData = new MemoryStream(dataBytes); LBERDecoder decoder = new LBERDecoder(); return ((int) decoder.decodeNumeric( decodedData, dataBytes.Length)); }
/// <summary> Constructs an object from the responseValue which contains the /// replica information. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::= /// partitionID INTEGER /// replicaState INTEGER /// modificationTime INTEGER /// purgeTime INTEGER /// localPartitionID INTEGER /// partitionDN OCTET STRING /// replicaType INTEGER /// flags INTEGER /// /// </summary> /// <exception> IOException The response value could not be decoded. /// </exception> public GetReplicaInfoResponse(RfcLdapMessage rfcMessage):base(rfcMessage) { if (ResultCode == LdapException.SUCCESS) { // parse the contents of the reply sbyte[] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); // Parse the parameters in the order System.IO.MemoryStream currentPtr = new System.IO.MemoryStream(SupportClass.ToByteArray(returnedValue)); // Parse partitionID Asn1Integer asn1_partitionID = (Asn1Integer) decoder.decode(currentPtr); if (asn1_partitionID == null) throw new System.IO.IOException("Decoding error"); partitionID = asn1_partitionID.intValue(); // Parse replicaState Asn1Integer asn1_replicaState = (Asn1Integer) decoder.decode(currentPtr); if (asn1_replicaState == null) throw new System.IO.IOException("Decoding error"); replicaState = asn1_replicaState.intValue(); // Parse modificationTime Asn1Integer asn1_modificationTime = (Asn1Integer) decoder.decode(currentPtr); if (asn1_modificationTime == null) throw new System.IO.IOException("Decoding error"); modificationTime = asn1_modificationTime.intValue(); // Parse purgeTime Asn1Integer asn1_purgeTime = (Asn1Integer) decoder.decode(currentPtr); if (asn1_purgeTime == null) throw new System.IO.IOException("Decoding error"); purgeTime = asn1_purgeTime.intValue(); // Parse localPartitionID Asn1Integer asn1_localPartitionID = (Asn1Integer) decoder.decode(currentPtr); if (asn1_localPartitionID == null) throw new System.IO.IOException("Decoding error"); localPartitionID = asn1_localPartitionID.intValue(); // Parse partitionDN Asn1OctetString asn1_partitionDN = (Asn1OctetString) decoder.decode(currentPtr); if (asn1_partitionDN == null) throw new System.IO.IOException("Decoding error"); partitionDN = asn1_partitionDN.stringValue(); if ((System.Object) partitionDN == null) throw new System.IO.IOException("Decoding error"); // Parse replicaType Asn1Integer asn1_replicaType = (Asn1Integer) decoder.decode(currentPtr); if (asn1_replicaType == null) throw new System.IO.IOException("Decoding error"); replicaType = asn1_replicaType.intValue(); // Parse flags Asn1Integer asn1_flags = (Asn1Integer) decoder.decode(currentPtr); if (asn1_flags == null) throw new System.IO.IOException("Decoding error"); flags = asn1_flags.intValue(); } else { partitionID = 0; replicaState = 0; modificationTime = 0; purgeTime = 0; localPartitionID = 0; partitionDN = ""; replicaType = 0; flags = 0; } }
public LdapVirtualListResponse(System.String oid, bool critical, sbyte[] values):base(oid, critical, values) { /* Create a decoder object */ LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); /* We should get back an ASN.1 Sequence object */ Asn1Object asnObj = decoder.decode(values); if ((asnObj == null) || (!(asnObj is Asn1Sequence))) throw new System.IO.IOException("Decoding error"); /* Else we got back a ASN.1 sequence - print it if running debug code */ /* Get the 1st element which should be an integer containing the * targetPosition (firstPosition) */ Asn1Object asn1firstPosition = ((Asn1Sequence) asnObj).get_Renamed(0); if ((asn1firstPosition != null) && (asn1firstPosition is Asn1Integer)) m_firstPosition = ((Asn1Integer) asn1firstPosition).intValue(); else throw new System.IO.IOException("Decoding error"); /* Get the 2nd element which should be an integer containing the * current estimate of the contentCount */ Asn1Object asn1ContentCount = ((Asn1Sequence) asnObj).get_Renamed(1); if ((asn1ContentCount != null) && (asn1ContentCount is Asn1Integer)) m_ContentCount = ((Asn1Integer) asn1ContentCount).intValue(); else throw new System.IO.IOException("Decoding error"); /* The 3rd element is an enum containing the errorcode */ Asn1Object asn1Enum = ((Asn1Sequence) asnObj).get_Renamed(2); if ((asn1Enum != null) && (asn1Enum is Asn1Enumerated)) m_resultCode = ((Asn1Enumerated) asn1Enum).intValue(); else throw new System.IO.IOException("Decoding error"); /* Optional 4th element could be the context string that the server * wants the client to send back with each subsequent VLV request */ if (((Asn1Sequence) asnObj).size() > 3) { Asn1Object asn1String = ((Asn1Sequence) asnObj).get_Renamed(3); if ((asn1String != null) && (asn1String is Asn1OctetString)) m_context = ((Asn1OctetString) asn1String).stringValue(); } return ; }
/// <summary> Constructs an object from the responseValue which contains the list /// of replicas. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::= /// replicaList /// SEQUENCE OF OCTET STRINGS /// /// </summary> /// <exception> IOException The responseValue could not be decoded. /// </exception> public ListReplicasResponse(RfcLdapMessage rfcMessage):base(rfcMessage) { if (ResultCode != LdapException.SUCCESS) { replicaList = new System.String[0]; } else { // parse the contents of the reply sbyte[] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); // We should get back a sequence Asn1Sequence returnedSequence = (Asn1Sequence) decoder.decode(returnedValue); if (returnedSequence == null) throw new System.IO.IOException("Decoding error"); // How many replicas were returned int len = returnedSequence.size(); replicaList = new System.String[len]; // Copy each one into our String array for (int i = 0; i < len; i++) { // Get the next Asn1Octet String in the sequence Asn1OctetString asn1_nextReplica = (Asn1OctetString) returnedSequence.get_Renamed(i); if (asn1_nextReplica == null) throw new System.IO.IOException("Decoding error"); // Convert to a string replicaList[i] = asn1_nextReplica.stringValue(); if ((System.Object) replicaList[i] == null) throw new System.IO.IOException("Decoding error"); } } }
/// <summary> Constructs an object from the responseValue which contains the effective /// privileges. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::= /// privileges INTEGER /// /// </summary> /// <exception> IOException The responseValue could not be decoded. /// </exception> public GetEffectivePrivilegesResponse(RfcLdapMessage rfcMessage) : base(rfcMessage) { if (ResultCode == LdapException.SUCCESS) { // parse the contents of the reply sbyte[] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); Asn1Integer asn1_privileges = (Asn1Integer) decoder.decode(returnedValue); if (asn1_privileges == null) throw new System.IO.IOException("Decoding error"); privileges = asn1_privileges.intValue(); } else { privileges = 0; } }
protected string getTaggedStringValue(Asn1Tagged tagvalue, GeneralEventField tagid) { Asn1Object obj = tagvalue.taggedValue(); if ((int)tagid != tagvalue.getIdentifier().Tag) { throw new IOException("Unknown Tagged Data"); } byte[] dbytes = SupportClass.ToByteArray(((Asn1OctetString) obj).byteValue()); MemoryStream data = new MemoryStream(dbytes); LBERDecoder dec = new LBERDecoder(); int length = dbytes.Length; return (string) dec.decodeCharacterString(data, length); }
public LdapEntryChangeControl(System.String oid, bool critical, sbyte[] value_Renamed) : base(oid, critical, value_Renamed) { // Create a decoder objet LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error."); // We should get a sequence initially Asn1Object asnObj = decoder.decode(value_Renamed); if ((asnObj == null) || (!(asnObj is Asn1Sequence))) throw new System.IO.IOException("Decoding error."); Asn1Sequence sequence = (Asn1Sequence) asnObj; // The first element in the sequence should be an enumerated type Asn1Object asn1Obj = sequence.get_Renamed(0); if ((asn1Obj == null) || (!(asn1Obj is Asn1Enumerated))) throw new System.IO.IOException("Decoding error."); m_changeType = ((Asn1Enumerated) asn1Obj).intValue(); //check for optional elements if ((sequence.size() > 1) && (m_changeType == 8)) //8 means modifyDN { // get the previous DN - it is encoded as an octet string asn1Obj = sequence.get_Renamed(1); if ((asn1Obj == null) || (!(asn1Obj is Asn1OctetString))) throw new System.IO.IOException("Decoding error get previous DN"); m_previousDN = ((Asn1OctetString) asn1Obj).stringValue(); } else { m_previousDN = ""; } //check for change number if (sequence.size() == 3) { asn1Obj = sequence.get_Renamed(2); if ((asn1Obj == null) || (!(asn1Obj is Asn1Integer))) throw new System.IO.IOException("Decoding error getting change number"); m_changeNumber = ((Asn1Integer) asn1Obj).intValue(); m_hasChangeNumber = true; } else m_hasChangeNumber = false; return ; }
protected void ProcessMessage(sbyte[] returnedValue) { LBERDecoder decoder = new LBERDecoder(); Asn1Sequence sequence = (Asn1Sequence) decoder.decode(returnedValue); event_type = (EdirEventType)(((Asn1Integer) sequence.get_Renamed(0)).intValue()); event_result_type = (EdirEventResultType)(((Asn1Integer) sequence.get_Renamed(1)).intValue()); if (sequence.size() > 2) { Asn1Tagged objTagged = (Asn1Tagged) sequence.get_Renamed(2); switch((EdirEventDataType)(objTagged.getIdentifier().Tag)) { case EdirEventDataType.EDIR_TAG_ENTRY_EVENT_DATA: event_response_data = new EntryEventData(EdirEventDataType.EDIR_TAG_ENTRY_EVENT_DATA, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_VALUE_EVENT_DATA: event_response_data = new ValueEventData(EdirEventDataType.EDIR_TAG_VALUE_EVENT_DATA, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_DEBUG_EVENT_DATA: event_response_data = new DebugEventData(EdirEventDataType.EDIR_TAG_DEBUG_EVENT_DATA, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_GENERAL_EVENT_DATA: event_response_data = new GeneralDSEventData(EdirEventDataType.EDIR_TAG_GENERAL_EVENT_DATA, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_SKULK_DATA: event_response_data = null; break; case EdirEventDataType.EDIR_TAG_BINDERY_EVENT_DATA: event_response_data = new BinderyObjectEventData(EdirEventDataType.EDIR_TAG_BINDERY_EVENT_DATA, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_DSESEV_INFO: event_response_data = new SecurityEquivalenceEventData(EdirEventDataType.EDIR_TAG_DSESEV_INFO, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_MODULE_STATE_DATA: event_response_data = new ModuleStateEventData(EdirEventDataType.EDIR_TAG_MODULE_STATE_DATA, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_NETWORK_ADDRESS: event_response_data = new NetworkAddressEventData(EdirEventDataType.EDIR_TAG_NETWORK_ADDRESS, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_CONNECTION_STATE: event_response_data = new ConnectionStateEventData(EdirEventDataType.EDIR_TAG_CONNECTION_STATE, objTagged.taggedValue()); break; case EdirEventDataType.EDIR_TAG_CHANGE_SERVER_ADDRESS: event_response_data = new ChangeAddressEventData(EdirEventDataType.EDIR_TAG_CHANGE_SERVER_ADDRESS, objTagged.taggedValue()); break; /* case EdirEventDataType.EDIR_TAG_CHANGE_CONFIG_PARAM : responsedata = new ChangeConfigEventData( taggedobject.taggedValue()); break; case EdirEventDataType.EDIR_TAG_STATUS_LOG : responsedata = new StatusLogEventData(taggedobject.taggedValue()); break; */ case EdirEventDataType.EDIR_TAG_NO_DATA: event_response_data = null; break; default: //unhandled data. throw new IOException(); } } else { //NO DATA event_response_data = null; } }
private String stateInfo; //Represent the state Information of data #endregion Fields #region Constructors /** * Constructs an object from the responseValue which contains the backup data. * <p>The constructor parses the responseValue which has the following * format:<br> * responseValue ::=<br> * <p>databufferLength ::= INTEGER <br> * mts(modification time stamp) ::= INTEGER<br> * revision ::= INTEGER<br> * returnedBuffer ::= OCTET STRING<br> * dataChunkSizes ::= <br> * SEQUENCE{<br> * noOfChunks INTEGER<br> * SET of [<br> * SEQUENCE of {eachChunksize INTEGER}]<br> * }</p> * * @exception IOException The responseValue could not be decoded. */ public LdapBackupResponse(RfcLdapMessage rfcMessage) : base(rfcMessage) { int modificationTime = 0; // Modifaction timestamp of the Object int revision = 0; // Revision number of the Object int chunksSize = 0; int[] chunks = null; //Holds size of each chunks returned from server //Verify if returned ID is not proper if (ID == null || !(ID.Equals(BackupRestoreConstants.NLDAP_LDAP_BACKUP_RESPONSE))) throw new IOException("LDAP Extended Operation not supported"); if (ResultCode == LdapException.SUCCESS) { // Get the contents of the reply byte[] returnedValue = SupportClass.ToByteArray(this.Value); if (returnedValue == null) throw new Exception("LDAP Operations error. No returned value."); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new Exception("Decoding error"); // Parse the parameters in the order MemoryStream currentPtr = new MemoryStream(returnedValue); // Parse bufferLength Asn1Integer asn1_bufferLength = (Asn1Integer) decoder .decode(currentPtr); if (asn1_bufferLength == null) throw new IOException("Decoding error"); bufferLength = asn1_bufferLength.intValue(); // Parse modificationTime Asn1Integer asn1_modificationTime = (Asn1Integer) decoder .decode(currentPtr); if (asn1_modificationTime == null) throw new IOException("Decoding error"); modificationTime = asn1_modificationTime.intValue(); // Parse revision Asn1Integer asn1_revision = (Asn1Integer) decoder .decode(currentPtr); if (asn1_revision == null) throw new IOException("Decoding error"); revision = asn1_revision.intValue(); //Format stateInfo to contain both modificationTime and revision this.stateInfo = modificationTime + "+" + revision; // Parse returnedBuffer Asn1OctetString asn1_returnedBuffer = (Asn1OctetString) decoder.decode(currentPtr); if (asn1_returnedBuffer == null) throw new IOException("Decoding error"); returnedBuffer = SupportClass.ToByteArray(asn1_returnedBuffer.byteValue()); /* * Parse chunks array * Chunks returned from server is encoded as shown below:: * SEQUENCE{ * chunksSize INTEGER * SET of [ * SEQUENCE of {eacChunksize INTEGER}] * } */ Asn1Sequence asn1_chunksSeq = (Asn1Sequence) decoder .decode(currentPtr); if (asn1_chunksSeq == null) throw new IOException("Decoding error"); //Get number of chunks returned from server chunksSize = ((Asn1Integer)asn1_chunksSeq.get_Renamed(0)).intValue(); //Construct chunks array chunks = new int[chunksSize]; Asn1Set asn1_chunksSet = (Asn1Set)asn1_chunksSeq.get_Renamed(1); //Iterate through asn1_chunksSet and put each size into chunks array for (int index = 0; index < chunksSize; index++) { Asn1Sequence asn1_eachSeq = (Asn1Sequence)asn1_chunksSet.get_Renamed(index); chunks[index] = ((Asn1Integer)asn1_eachSeq.get_Renamed(0)).intValue(); } //Construct a temporary StringBuffer and append chunksSize, each size //element in chunks array and actual data of eDirectoty Object System.Text.StringBuilder tempBuffer = new System.Text.StringBuilder(); tempBuffer.Append(chunksSize); tempBuffer.Append(";"); int i = 0; for (; i < (chunksSize - 1); i++) { tempBuffer.Append(chunks[i]); tempBuffer.Append(";"); } tempBuffer.Append(chunks[i]); //Assign tempBuffer to parsedString to be returned to Application this.chunkSizesString = tempBuffer.ToString(); } else { //Intialize all these if getResultCode() != LdapException.SUCCESS this.bufferLength = 0; this.stateInfo = null; this.chunkSizesString = null; this.returnedBuffer = null; } }
public LdapSortResponse(System.String oid, bool critical, sbyte[] values):base(oid, critical, values) { // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); // We should get back an enumerated type Asn1Object asnObj = decoder.decode(values); if ((asnObj == null) || (!(asnObj is Asn1Sequence))) throw new System.IO.IOException("Decoding error"); Asn1Object asn1Enum = ((Asn1Sequence) asnObj).get_Renamed(0); if ((asn1Enum != null) && (asn1Enum is Asn1Enumerated)) resultCode = ((Asn1Enumerated) asn1Enum).intValue(); // Second element is the attributeType if (((Asn1Sequence) asnObj).size() > 1) { Asn1Object asn1String = ((Asn1Sequence) asnObj).get_Renamed(1); if ((asn1String != null) && (asn1String is Asn1OctetString)) failedAttribute = ((Asn1OctetString) asn1String).stringValue(); } return ; }
/// <summary> Constructs an object from the responseValue which contains the replication /// filter. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::= /// SEQUENCE of SEQUENCE { /// classname OCTET STRING /// SEQUENCE of ATTRIBUTES /// } /// where /// ATTRIBUTES:: OCTET STRING /// /// </summary> /// <exception> IOException The responseValue could not be decoded. /// </exception> public GetReplicationFilterResponse(RfcLdapMessage rfcMessage) : base(rfcMessage) { if (ResultCode != LdapException.SUCCESS) { returnedFilter = new System.String[0][]; for (int i = 0; i < 0; i++) { returnedFilter[i] = new System.String[0]; } } else { // parse the contents of the reply sbyte[] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); // We should get back a sequence Asn1Sequence returnedSequence = (Asn1Sequence) decoder.decode(returnedValue); if (returnedSequence == null) throw new System.IO.IOException("Decoding error"); // How many sequences in this list int numberOfSequences = returnedSequence.size(); returnedFilter = new System.String[numberOfSequences][]; // Parse each returned sequence object for (int classNumber = 0; classNumber < numberOfSequences; classNumber++) { // Get the next Asn1Sequence Asn1Sequence asn1_innerSequence = (Asn1Sequence) returnedSequence.get_Renamed(classNumber); if (asn1_innerSequence == null) throw new System.IO.IOException("Decoding error"); // Get the asn1 encoded classname Asn1OctetString asn1_className = (Asn1OctetString) asn1_innerSequence.get_Renamed(0); if (asn1_className == null) return ; // Get the attribute List Asn1Sequence asn1_attributeList = (Asn1Sequence) asn1_innerSequence.get_Renamed(1); if (asn1_attributeList == null) throw new System.IO.IOException("Decoding error"); int numberOfAttributes = asn1_attributeList.size(); returnedFilter[classNumber] = new System.String[numberOfAttributes + 1]; // Get the classname returnedFilter[classNumber][0] = asn1_className.stringValue(); if ((System.Object) returnedFilter[classNumber][0] == null) throw new System.IO.IOException("Decoding error"); for (int attributeNumber = 0; attributeNumber < numberOfAttributes; attributeNumber++) { // Get the asn1 encoded attribute name Asn1OctetString asn1_attributeName = (Asn1OctetString) asn1_attributeList.get_Renamed(attributeNumber); if (asn1_attributeName == null) throw new System.IO.IOException("Decoding error"); // Get attributename string returnedFilter[classNumber][attributeNumber + 1] = asn1_attributeName.stringValue(); if ((System.Object) returnedFilter[classNumber][attributeNumber + 1] == null) throw new System.IO.IOException("Decoding error"); } } } }
/// <summary> Constructs an object from the responseValue which contains the /// entry count. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::= /// count INTEGER /// /// </summary> /// <exception> IOException The response value could not be decoded. /// </exception> public PartitionEntryCountResponse(RfcLdapMessage rfcMessage):base(rfcMessage) { if (ResultCode == LdapException.SUCCESS) { // parse the contents of the reply sbyte[] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); // Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); Asn1Integer asn1_count = (Asn1Integer) decoder.decode(returnedValue); if (asn1_count == null) throw new System.IO.IOException("Decoding error"); count = asn1_count.intValue(); } else { count = - 1; } }
public GetEffectivePrivilegesListResponse(RfcLdapMessage rfcMessage) : base(rfcMessage) { /// <summary> Constructs an object from the responseValue which contains the effective /// privileges. /// /// The constructor parses the responseValue which has the following /// format: /// responseValue ::=<br> /// <p>SEQUENCE numberofresponses ::= INTEGER <br> /// SET of [<br> /// SEQUENCES of {privileges INTEGER}]<br> /// /// </summary> /// <exception> IOException The responseValue could not be decoded. /// </exception> if (ResultCode == LdapException.SUCCESS) { // parse the contents of the reply sbyte [] returnedValue = this.Value; if (returnedValue == null) throw new System.IO.IOException("No returned value"); //Create a decoder object LBERDecoder decoder = new LBERDecoder(); if (decoder == null) throw new System.IO.IOException("Decoding error"); Asn1Sequence asn1_seq1 = (Asn1Sequence)decoder.decode(returnedValue); if (asn1_seq1 == null) throw new System.IO.IOException("Decoding error"); Asn1Sequence asn1_seq2 = (Asn1Sequence)asn1_seq1.get_Renamed(0); no_privileges = ((Asn1Integer)asn1_seq2.get_Renamed(0)).intValue(); Asn1Set set_privileg_response = null; set_privileg_response = ((Asn1Set)asn1_seq1.get_Renamed(1)); Asn1Sequence seq2 = null; privileges = new int[no_privileges]; for(int index=0; index < no_privileges; index++) { seq2 = (Asn1Sequence)set_privileg_response.get_Renamed(index); privileges[index]=((Asn1Integer)seq2.get_Renamed(0)).intValue(); } } }