1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is mozilla.org code.
15 *
16 * The Initial Developer of the Original Code is
17 * Mozilla Corporation
18 * Portions created by the Initial Developer are Copyright (C) 2008
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 * Dave Camp <dcamp@mozilla.com>
23 *
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39
40 /**
41 * This interface is implemented by nsIUrlClassifierHashCompleter clients.
42 */
43 [scriptable, uuid(bbd6c954-7cb4-4447-bc55-8cefd1ceed89)]
44 interface nsIUrlClassifierHashCompleterCallback : nsISupports
45 {
46 /**
47 * A complete hash has been found that matches the partial hash.
48 * This method may be called 0-n times for a given
49 * nsIUrlClassifierCompleter::complete() call.
50 *
51 * @param hash
52 * The 128-bit hash that was discovered.
53 * @param table
54 * The name of the table that this hash belongs to.
55 * @param chunkId
56 * The database chunk that this hash belongs to.
57 * @param trusted
58 * The completion was verified with a MAC and can be cached.
59 */
60 void completion(in ACString hash,
61 in ACString table,
62 in PRUint32 chunkId,
63 in PRBool trusted);
64
65 /**
66 * The completion is complete. This method is called once per
67 * nsIUrlClassifierCompleter::complete() call, after all completion()
68 * calls are finished.
69 *
70 * @param status
71 * NS_OK if the request completed successfully, or an error code.
72 */
73 void completionFinished(in nsresult status);
74 };
75
76 /**
77 * Clients updating the url-classifier database have the option of sending
78 * partial (32-bit) hashes of URL fragments to be blacklisted. If the
79 * url-classifier encounters one of these truncated hashes, it will ask
80 * an nsIUrlClassifierCompleter instance to asynchronously provide the
81 * complete hash, along with some associated metadata.
82 */
83 [scriptable, uuid(ade9b72b-3562-44f5-aba6-e63246be53ae)]
84 interface nsIUrlClassifierHashCompleter : nsISupports
85 {
86 /**
87 * Request a completed hash.
88 *
89 * @param partialHash
90 * The 32-bit hash encountered by the url-classifier.
91 * @param callback
92 * An nsIUrlClassifierCompleterCallback instance.
93 */
94 void complete(in ACString partialHash,
95 in nsIUrlClassifierHashCompleterCallback callback);
96
97 /**
98 * Set the client and wrapped key for verified updates.
99 */
100 void setKeys(in ACString clientKey, in ACString wrappedKey);
101
102 /**
103 * The URL for the gethash request
104 */
105 attribute ACString gethashUrl;
106 };