//************************************************************************* // Constructor for AttributeTypeAndValues //************************************************************************* /// <summary> </summary> public RfcAttributeTypeAndValues(RfcAttributeDescription type, Asn1SetOf vals) : base(2) { add(type); add(vals); return ; }
/// <summary> Encode an array of LdapModifications to ASN.1. /// /// </summary> /// <param name="mods">an array of LdapModification objects /// /// </param> /// <returns> an Asn1SequenceOf object containing the modifications. /// </returns> private static Asn1SequenceOf encodeModifications(LdapModification[] mods) { // Convert Java-API LdapModification[] to RFC2251 SEQUENCE OF SEQUENCE Asn1SequenceOf rfcMods = new Asn1SequenceOf(mods.Length); for (int i = 0; i < mods.Length; i++) { LdapAttribute attr = mods[i].Attribute; // place modification attribute values in Asn1SetOf Asn1SetOf vals = new Asn1SetOf(attr.size()); if (attr.size() > 0) { System.Collections.IEnumerator attrEnum = attr.ByteValues; while (attrEnum.MoveNext()) { vals.add(new RfcAttributeValue((sbyte[]) attrEnum.Current)); } } // create SEQUENCE containing mod operation and attr type and vals Asn1Sequence rfcMod = new Asn1Sequence(2); rfcMod.add(new Asn1Enumerated(mods[i].Op)); rfcMod.add(new RfcAttributeTypeAndValues(new RfcAttributeDescription(attr.Name), vals)); // place SEQUENCE into SEQUENCE OF rfcMods.add(rfcMod); } return rfcMods; }
/// <summary> Must have 1 or more Filters</summary> private Asn1SetOf parseFilterList() { Asn1SetOf set_Renamed = new Asn1SetOf(); set_Renamed.add(parseFilter()); // must have at least 1 filter while (ft.peekChar() == '(') { // check for more filters set_Renamed.add(parseFilter()); } return set_Renamed; }
/// <summary> Build the attribuite list from an LdapEntry. /// /// </summary> /// <param name="entry">The LdapEntry associated with this add request. /// </param> private static RfcAttributeList makeRfcAttrList(LdapEntry entry) { // convert Java-API LdapEntry to RFC2251 AttributeList LdapAttributeSet attrSet = entry.getAttributeSet(); RfcAttributeList attrList = new RfcAttributeList(attrSet.Count); System.Collections.IEnumerator itr = attrSet.GetEnumerator(); while (itr.MoveNext()) { LdapAttribute attr = (LdapAttribute) itr.Current; Asn1SetOf vals = new Asn1SetOf(attr.size()); System.Collections.IEnumerator attrEnum = attr.ByteValues; while (attrEnum.MoveNext()) { vals.add(new RfcAttributeValue((sbyte[]) attrEnum.Current)); } attrList.add(new RfcAttributeTypeAndValues(new RfcAttributeDescription(attr.Name), vals)); } return attrList; }