Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE task
PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-E97C2A7E-8E8F-58E6-99D4-288589385B44" xml:lang="en"><title> Querying
TLD Policy Data</title><shortdesc>This document explains how to retrieve the characters from the
Top-Level Domain Blacklists and Whitelists. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<prereq id="GUID-67B2BC51-7D62-4A5D-84A4-259F645FBF3D"><p>Before you start, you must: </p> <ul>
<li id="GUID-1EE28078-9695-5F4E-AFBA-18B2E31B4994"><p>Be familiar with the
concepts of Top-Level Domain (TLD) and International Domain Name (IDN): see <xref href="GUID-6A78F618-09A9-56A7-8C58-98C353BF0788.dita">What is the Domain Name Server</xref>. </p> </li>
</ul> </prereq>
<context id="GUID-7778FEFB-9E66-4C3F-8102-2A20F705B058"><p>The TLD policy data is composed of a list of TLDs. </p> <p>For
each of the TLDs, the Whitelist contains the trusted UTF-8 characters and
the Blacklist contains the suspect UTF-8 characters. </p> </context>
<steps id="GUID-DD346F2F-33BE-5510-866D-B8F2B9748EA6">
<step id="GUID-567ECE81-C1EF-56A0-9654-9AB1151183D2"><cmd>Create a connection
with the InetURIList server. </cmd>
<stepxmp><codeblock id="GUID-9F4059C8-89C9-5528-A75D-0F6DF59B7615" xml:space="preserve">
RInetUriList uriServer;
uriServer.OpenL();
CleanupClosePushL(uriServer);
</codeblock> </stepxmp>
</step>
<step id="GUID-D0A705EA-1A7E-56E3-A3A8-8CC6A9AA1820"><cmd>Build a <xref href="GUID-792B548A-7B80-3DA3-9008-7525C3B3A593.dita"><apiname>TPolicyQueryArgs</apiname></xref> object. </cmd>
<info>The constructor takes an URI as its first parameter, which defines which
TLD the request is made on. </info>
<substeps id="GUID-4AE60DE9-963C-5093-AF74-CB634EBA1A41">
<substep id="GUID-C83724BE-BE79-59A9-B7A2-A6434CA95F2B"><cmd/>
<info>To request a character set, pass the list type (<xref href="GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3.dita#GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3/GUID-100518D1-3FD1-34A4-BF2F-6D80BF9420F3"><apiname>InetUriList::EWhiteList</apiname></xref> or <xref href="GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3.dita#GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3/GUID-F140C173-AAF2-3078-A20B-CD2198D8FC44"><apiname>InetUriList::EBlackList</apiname></xref>)
as the second parameter, and the <xref href="GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3.dita#GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3/GUID-2C7F5445-8AA0-3487-89E4-AD1FCA8ABA44"><apiname>InetUriList::EPolicyCharSet</apiname></xref> request
type as the third parameter. </info>
<stepxmp><codeblock id="GUID-DCB3AB91-32D8-5666-8DD3-3280129A6E93" xml:space="preserve">
// The TLD is "COM"
_LIT8(KUri, "http://www.nokia.com");
// the query requests the white list character set
TPolicyQueryArgs tldArgs(KUri, InetUriList::EWhiteList, InetUriList::EPolicyCharSet);
</codeblock> </stepxmp>
</substep>
<substep id="GUID-3BCB0DC7-CE81-5978-B9DB-1BA9CF00245D"><cmd/>
<info>To check whether an URI is unsafe, only pass the <xref href="GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3.dita#GUID-FC9862A2-8C4E-3558-90A8-610B03C55FE3/GUID-017B224C-9BE2-3B60-91A1-CAE36B929223"><apiname>InetUriList::EPolicyListType</apiname></xref> request
type as the second parameter. </info>
<stepxmp><codeblock id="GUID-3AAE8443-F7EF-581F-BF6D-1F66D8B6608D" xml:space="preserve">
// The TLD is "COM"
_LIT8(KUri, "http://www.nokia.com");
// the query requests to check the URI
TPolicyQueryArgs tldArgs(KUri, InetUriList::EPolicyListType);
</codeblock> </stepxmp>
</substep>
</substeps>
</step>
<step id="GUID-A616A748-8962-5CC0-A5F9-A5E97BA30BC1"><cmd>Create a <xref href="GUID-83761AF1-B6D4-3946-88D6-DB649D554138.dita"><apiname>TQueryResults</apiname></xref> object
to store the result. </cmd>
<stepxmp><codeblock id="GUID-0C52490F-6D74-542B-89DC-B9DFD2012538" xml:space="preserve">TQueryResults tldResult;</codeblock> </stepxmp>
</step>
<step id="GUID-27E11482-72C6-5645-A381-B96843E522A6"><cmd>Call the <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita#GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2/GUID-59D3BF9F-4808-33C7-8D27-63EEE7BD70E1"><apiname>RInetUriList::QueryTldInfoL()</apiname></xref> method
with your query and result structures. </cmd>
<stepxmp><codeblock id="GUID-E7CCF168-823A-5458-AEB8-3DFFC40384FB" xml:space="preserve">RInetUriList::QueryTldInfoL(tldArgs, tldResult);
// retrieve the characters
HBufC8* policyData(NULL);
policydata = tldResult.CharSetL();</codeblock> </stepxmp>
</step>
<step id="GUID-1D67B3E0-3AC6-5829-A691-9DFA6C7B34DC"><cmd>Close the connection
with the InetURIList server. </cmd>
<stepxmp><codeblock id="GUID-A0BD5890-3D52-5A0A-B3AD-A02FD886B22C" xml:space="preserve">CleanupStack::PopAndDestroy(&uriServer);</codeblock> </stepxmp>
</step>
</steps>
<result id="GUID-F79600BE-2553-4671-996E-2CA93480C3D7"><p>The <codeph>TQueryResults</codeph> object contains the requested
TLD policy data. </p> <ul>
<li id="GUID-92BF741E-4764-59AB-81C2-8680F71EA4EF"><p>With an <codeph>EPolicyListType</codeph> request,
the results objet contains <codeph>ETrue</codeph> is the URI contains suspect
characters, <codeph>EFalse</codeph> otherwise. </p> </li>
<li id="GUID-846E962F-3AF4-5A45-8B8E-BBB7B4F8B07B"><p>An <codeph>EPolicyCharSet</codeph> request,
the results objet contains the list of characters of the requested list. </p> </li>
</ul> </result>
<example id="GUID-8D5A4D7A-C9C9-5F16-8DE0-94212B7131F3"><title>Query example</title> <p>Here
is the combination of the code snippets provided in the above steps: </p> <codeblock id="GUID-5E01A904-0BAD-571F-9DBB-486154D9DE04" xml:space="preserve">
// Open the connection
RInetUriList uriServer;
uriServer.OpenL();
CleanupClosePushL(uriServer);
// The TLD is "COM"
_LIT8(KUri, "http://www.nokia.com");
// Build a query requesting a character set
TPolicyQueryArgs tldArgs(KUri, InetUriList::EPolicyCharSet);
// Create an object for the results
TQueryResults tldResult;
// Make the query
RInetUriList::QueryTldInfoL(tldArgs, tldResult);
// retrieve the characters
HBufC8* policyData(NULL);
policydata = tldResult.CharSetL();
// [...]
// process the policy data
// Close the connection
CleanupStack::PopAndDestroy(&uriServer);</codeblock> </example>
</taskbody><related-links>
<link href="GUID-EDA831F7-7248-5C00-B6BE-B7F44097C9B6.dita"><linktext>WhiteList/BlackList
TLD Overview</linktext></link>
<link href="GUID-AC4C18D1-D6A3-5988-AB10-5A5025183950.dita"><linktext>Modifying
TLD Policy Data</linktext></link>
</related-links></task>