1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include "nsISupports.idl"
6/**
7 * Some utility methods used by the url classifier.
8 */
9
10interface nsIURI;
11
12[scriptable, uuid(e4f0e59c-b922-48b0-a7b6-1735c1f96fed)]
13interface nsIUrlClassifierUtils : nsISupports
14{
15  /**
16   * Get the lookup string for a given URI.  This normalizes the hostname,
17   * url-decodes the string, and strips off the protocol.
18   *
19   * @param uri URI to get the lookup key for.
20   *
21   * @returns String containing the canonicalized URI.
22   */
23  ACString getKeyForURI(in nsIURI uri);
24
25  /**
26   * Get the provider by table name.
27   *
28   * @param tableName The table name that we want to lookup
29   *
30   * @returns the provider name that the given table belongs.
31   */
32  ACString getProvider(in ACString tableName);
33
34  /**
35   * Get the protocol version for the given provider.
36   *
37   * @param provider String the provider name. e.g. "google"
38   *
39   * @returns String to indicate the protocol version. e.g. "2.2"
40   */
41  ACString getProtocolVersion(in ACString provider);
42
43  /**
44   * Convert threat type to list name.
45   *
46   * @param Integer to indicate threat type.
47   *
48   * @returns The list names separated by ','. For example,
49   *          'goog-phish-proto,test-phish-proto'.
50   */
51  ACString convertThreatTypeToListNames(in uint32_t threatType);
52
53  /**
54   * Convert list name to threat type.
55   *
56   * @param The list name.
57   *
58   * @returns The threat type in integer.
59   */
60  uint32_t convertListNameToThreatType(in ACString listName);
61
62  /**
63   * Make update request for given lists and their states.
64   *
65   * @param aListNames An array of list name represented in string.
66   * @param aState An array of states (encoded in base64 format) for each list.
67   * @param aCount The array length of aList and aState.
68   *
69   * @returns A base64url encoded string.
70   */
71  ACString makeUpdateRequestV4([array, size_is(aCount)] in string aListNames,
72                               [array, size_is(aCount)] in string aStatesBase64,
73                               in uint32_t aCount);
74};
75