I have been musing over this for a couple of days and wonder whether
anyone has any ideas for how I can tackle a problem I have with
converting the values of eDirectory User class objects' Network Address
attributes into an integer



1) I have a User class object, the user can only be logged on at one IP
address. In the example below, that IP address is 10.10.5.3 [(0A-0A-05-
03) (integer 168428803).

I want to access the value of the Network Address as an integer so that
I can compare it with IP addresses that are held elsewhere in eDirectory
as integers (for example dNIP:Start Address Number is an integer value
of syntax 1.3.6.1.4.1.1466.115.121.1.27 whereas Network Address has a
syntax of 2.16.840.1.113.719.1.1.5.1.12)




2) I have been able to convert the value of the Network Address into a
string, using jstring and b64:decode.

2a) This jstring/b64 conversion yields a string whose length is 4.

2b) I believe that this yielded string x'0A'||x'0A'||x'05'||x'03'

2c) This belief is based on the fact that the code shown below (using

 as a comparison) produces two POSITIVE trace messages.

2d) Unfortunately I have not been able to prove that the last characters
of the string are 05 and 03 because  and  are not valid. If
I had been able to test for these values, then I would have employed a
laborious conversion of each character to an integer in the range 00-255
and then multiplying them by 16777216, 65536, 256, 1 before summing the
results




3) So, I seem to have got part of the way, but am stumped with how to
proceed.

As I mention above, my goal is to use XSLT to convert the Base64 value
'CgoFAw==' into the integer '168428803', so any help would be received
gratefully




BRgds - Martyn





<<<----CODE SNIPPETS---->>>



IN MY XSLT, I START OFF BY QUERYING THE EDIRECTORY FOR THE NETWORK
ADDRESS ATTRIBUTE

<xsl:variable name="query-User-Network-Address">
<query dest-dn="{parent::modify/@src-dn}" scope="entry">
<read-attr attr-name="Network Address"/>
</query>
</xsl:variable>

<xsl:variable name="User-Network-Address_nodeset" select="query:query
($srcQueryProcessor,$query-User-Network-Address)"/>



AND I RECEIVE THE FOLLOWING INSTANCE WITH THE NETWORK ADDRESS OF
10.10.5.3 AS A BASE64 VALUE 'CgoFAw=='

<instance class-name="User" qualified-src-dn="O=ACME\OU=People
\CN=J_Doe" src-dn="\MYTREE\ACME\People\J_Doe" src-entry-id="77085">
<attr attr-name="Network Address">
<value timestamp="1143632488#1" type="structured">
<component name="netAddrType">1</component>
<component name="netAddr">CgoFAw==</component>
</value>
</attr>
</instance>



THEN I CONVERT THE VAUE USING JSRING AND B64ECODE

<xsl:variable name="networkAddress">
<xsl:value-of select="$User-Network-Address_nodeset//instance/attr
[@attr-name='Network Address']/value/component[@name='netAddr']/text
()"/>
</xsl:variable>
<xsl:variable name="decodedNetworkAddress">
<xsl:value-of select="jstring:new(b64:decode(string($networkAddr ess)),
'UTF-8')"/>
</xsl:variable>



THEN I ISOLATE THE FIRST AND SECOND CHARACTERS OF THE RESULTANT STRING

<xsl:variable name="leftmostOctet">
<xsl:value-of select="substring($decodedNetworkAddress,1,1)"/>
</xsl:variable>
<xsl:variable name="leftmiddleOctet">
<xsl:value-of select="substring($decodedNetworkAddress,2,1)"/>
</xsl:variable>



THEN I USE XSL:MESSAGE TO TELL ME THE VALUE OF THE FIRST AND SECOND
CHARACTERS

<xsl:choose>
<xsl:when test="$leftmostOctet = '&#x0A;'">
<xsl:message>POSITIVE leftmostOctet is Ampersand Hash lowercase-x zero
uppercase-A semicolon</xsl:message>
</xsl:when>
<xsltherwise>
<xsl:message>NEGATIVE leftmostOctet is not Ampersand Hash lowercase-x
zero uppercase-A semicolon</xsl:message>
</xsltherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$leftmiddleOctet = '&#x0A;'">
<xsl:message>POSITIVE leftmiddleOctet is Ampersand Hash lowercase-x
zero uppercase-A semicolon</xsl:message>
</xsl:when>
<xsltherwise>
<xsl:message>NEGATIVE leftmiddleOctet is not Ampersand Hash lowercase-
x zero uppercase-A semicolon</xsl:message>
</xsltherwise>
</xsl:choose>


AND GET THE FOLLOWING TRACE MESSAGES

12:41:28 8E41D0C0 Drvrs: WHITHER_USER ST: xsl:message -> POSITIVE
leftmostOctet is Ampersand Hash lowercase-x zero uppercase-A semicolon
12:41:28 8E41D0C0 Drvrs: WHITHER_USER ST: xsl:message -> POSITIVE
leftmiddleOctet is Ampersand Hash lowercase-x zero uppercase-A semicolon




BUT I CAN'T USE <xsl:when test="$leftmostOctet = '&#x05;'"> AS A TEST,
BECAUSE &#x05; IS NOT A VALID CHARACTER FOR A TEST