|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-E97C2A7E-8E8F-58E6-99D4-288589385B44" xml:lang="en"><title> Querying |
|
13 TLD Policy Data</title><shortdesc>This document explains how to retrieve the characters from the |
|
14 Top-Level Domain Blacklists and Whitelists. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
15 <prereq id="GUID-67B2BC51-7D62-4A5D-84A4-259F645FBF3D"><p>Before you start, you must: </p> <ul> |
|
16 <li id="GUID-1EE28078-9695-5F4E-AFBA-18B2E31B4994"><p>Be familiar with the |
|
17 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> |
|
18 </ul> </prereq> |
|
19 <context id="GUID-7778FEFB-9E66-4C3F-8102-2A20F705B058"><p>The TLD policy data is composed of a list of TLDs. </p> <p>For |
|
20 each of the TLDs, the Whitelist contains the trusted UTF-8 characters and |
|
21 the Blacklist contains the suspect UTF-8 characters. </p> </context> |
|
22 <steps id="GUID-DD346F2F-33BE-5510-866D-B8F2B9748EA6"> |
|
23 <step id="GUID-567ECE81-C1EF-56A0-9654-9AB1151183D2"><cmd>Create a connection |
|
24 with the InetURIList server. </cmd> |
|
25 <stepxmp><codeblock id="GUID-9F4059C8-89C9-5528-A75D-0F6DF59B7615" xml:space="preserve"> |
|
26 RInetUriList uriServer; |
|
27 uriServer.OpenL(); |
|
28 CleanupClosePushL(uriServer); |
|
29 </codeblock> </stepxmp> |
|
30 </step> |
|
31 <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> |
|
32 <info>The constructor takes an URI as its first parameter, which defines which |
|
33 TLD the request is made on. </info> |
|
34 <substeps id="GUID-4AE60DE9-963C-5093-AF74-CB634EBA1A41"> |
|
35 <substep id="GUID-C83724BE-BE79-59A9-B7A2-A6434CA95F2B"><cmd/> |
|
36 <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>) |
|
37 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 |
|
38 type as the third parameter. </info> |
|
39 <stepxmp><codeblock id="GUID-DCB3AB91-32D8-5666-8DD3-3280129A6E93" xml:space="preserve"> |
|
40 // The TLD is "COM" |
|
41 _LIT8(KUri, "http://www.nokia.com"); |
|
42 |
|
43 // the query requests the white list character set |
|
44 TPolicyQueryArgs tldArgs(KUri, InetUriList::EWhiteList, InetUriList::EPolicyCharSet); |
|
45 </codeblock> </stepxmp> |
|
46 </substep> |
|
47 <substep id="GUID-3BCB0DC7-CE81-5978-B9DB-1BA9CF00245D"><cmd/> |
|
48 <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 |
|
49 type as the second parameter. </info> |
|
50 <stepxmp><codeblock id="GUID-3AAE8443-F7EF-581F-BF6D-1F66D8B6608D" xml:space="preserve"> |
|
51 // The TLD is "COM" |
|
52 _LIT8(KUri, "http://www.nokia.com"); |
|
53 |
|
54 // the query requests to check the URI |
|
55 TPolicyQueryArgs tldArgs(KUri, InetUriList::EPolicyListType); |
|
56 </codeblock> </stepxmp> |
|
57 </substep> |
|
58 </substeps> |
|
59 </step> |
|
60 <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 |
|
61 to store the result. </cmd> |
|
62 <stepxmp><codeblock id="GUID-0C52490F-6D74-542B-89DC-B9DFD2012538" xml:space="preserve">TQueryResults tldResult;</codeblock> </stepxmp> |
|
63 </step> |
|
64 <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 |
|
65 with your query and result structures. </cmd> |
|
66 <stepxmp><codeblock id="GUID-E7CCF168-823A-5458-AEB8-3DFFC40384FB" xml:space="preserve">RInetUriList::QueryTldInfoL(tldArgs, tldResult); |
|
67 |
|
68 // retrieve the characters |
|
69 HBufC8* policyData(NULL); |
|
70 policydata = tldResult.CharSetL();</codeblock> </stepxmp> |
|
71 </step> |
|
72 <step id="GUID-1D67B3E0-3AC6-5829-A691-9DFA6C7B34DC"><cmd>Close the connection |
|
73 with the InetURIList server. </cmd> |
|
74 <stepxmp><codeblock id="GUID-A0BD5890-3D52-5A0A-B3AD-A02FD886B22C" xml:space="preserve">CleanupStack::PopAndDestroy(&uriServer);</codeblock> </stepxmp> |
|
75 </step> |
|
76 </steps> |
|
77 <result id="GUID-F79600BE-2553-4671-996E-2CA93480C3D7"><p>The <codeph>TQueryResults</codeph> object contains the requested |
|
78 TLD policy data. </p> <ul> |
|
79 <li id="GUID-92BF741E-4764-59AB-81C2-8680F71EA4EF"><p>With an <codeph>EPolicyListType</codeph> request, |
|
80 the results objet contains <codeph>ETrue</codeph> is the URI contains suspect |
|
81 characters, <codeph>EFalse</codeph> otherwise. </p> </li> |
|
82 <li id="GUID-846E962F-3AF4-5A45-8B8E-BBB7B4F8B07B"><p>An <codeph>EPolicyCharSet</codeph> request, |
|
83 the results objet contains the list of characters of the requested list. </p> </li> |
|
84 </ul> </result> |
|
85 <example id="GUID-8D5A4D7A-C9C9-5F16-8DE0-94212B7131F3"><title>Query example</title> <p>Here |
|
86 is the combination of the code snippets provided in the above steps: </p> <codeblock id="GUID-5E01A904-0BAD-571F-9DBB-486154D9DE04" xml:space="preserve"> |
|
87 // Open the connection |
|
88 RInetUriList uriServer; |
|
89 uriServer.OpenL(); |
|
90 CleanupClosePushL(uriServer); |
|
91 |
|
92 // The TLD is "COM" |
|
93 _LIT8(KUri, "http://www.nokia.com"); |
|
94 |
|
95 // Build a query requesting a character set |
|
96 TPolicyQueryArgs tldArgs(KUri, InetUriList::EPolicyCharSet); |
|
97 |
|
98 // Create an object for the results |
|
99 TQueryResults tldResult; |
|
100 |
|
101 // Make the query |
|
102 RInetUriList::QueryTldInfoL(tldArgs, tldResult); |
|
103 |
|
104 // retrieve the characters |
|
105 HBufC8* policyData(NULL); |
|
106 policydata = tldResult.CharSetL(); |
|
107 |
|
108 // [...] |
|
109 // process the policy data |
|
110 |
|
111 // Close the connection |
|
112 CleanupStack::PopAndDestroy(&uriServer);</codeblock> </example> |
|
113 </taskbody><related-links> |
|
114 <link href="GUID-EDA831F7-7248-5C00-B6BE-B7F44097C9B6.dita"><linktext>WhiteList/BlackList |
|
115 TLD Overview</linktext></link> |
|
116 <link href="GUID-AC4C18D1-D6A3-5988-AB10-5A5025183950.dita"><linktext>Modifying |
|
117 TLD Policy Data</linktext></link> |
|
118 </related-links></task> |