1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
// // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIUrlClassifierUtils.idl // /// `interface nsIUrlClassifierParseFindFullHashCallback : nsISupports` /// /// ```text /// /** /// * Interface for parseFindFullHashResponseV4 callback /// */ /// ``` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUrlClassifierParseFindFullHashCallback { vtable: *const nsIUrlClassifierParseFindFullHashCallbackVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUrlClassifierParseFindFullHashCallback. unsafe impl XpCom for nsIUrlClassifierParseFindFullHashCallback { const IID: nsIID = nsID(0xfbb9684a, 0xa0aa, 0x11e6, [0x88, 0xb0, 0x08, 0x60, 0x6e, 0x45, 0x6b, 0x8a]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUrlClassifierParseFindFullHashCallback { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUrlClassifierParseFindFullHashCallback. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUrlClassifierParseFindFullHashCallbackCoerce { /// Cheaply cast a value of this type from a `nsIUrlClassifierParseFindFullHashCallback`. fn coerce_from(v: &nsIUrlClassifierParseFindFullHashCallback) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUrlClassifierParseFindFullHashCallbackCoerce for nsIUrlClassifierParseFindFullHashCallback { #[inline] fn coerce_from(v: &nsIUrlClassifierParseFindFullHashCallback) -> &Self { v } } impl nsIUrlClassifierParseFindFullHashCallback { /// Cast this `nsIUrlClassifierParseFindFullHashCallback` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUrlClassifierParseFindFullHashCallbackCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUrlClassifierParseFindFullHashCallback { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUrlClassifierParseFindFullHashCallbackCoerce for T { #[inline] fn coerce_from(v: &nsIUrlClassifierParseFindFullHashCallback) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUrlClassifierParseFindFullHashCallback // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUrlClassifierParseFindFullHashCallbackVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* void onCompleteHashFound (in ACString aCompleteHash, in ACString aTableNames, in unsigned long aPerHashCacheDuration); */ pub OnCompleteHashFound: unsafe extern "system" fn (this: *const nsIUrlClassifierParseFindFullHashCallback, aCompleteHash: &::nsstring::nsACString, aTableNames: &::nsstring::nsACString, aPerHashCacheDuration: libc::uint32_t) -> nsresult, /* void onResponseParsed (in unsigned long aMinWaitDuration, in unsigned long aNegCacheDuration); */ pub OnResponseParsed: unsafe extern "system" fn (this: *const nsIUrlClassifierParseFindFullHashCallback, aMinWaitDuration: libc::uint32_t, aNegCacheDuration: libc::uint32_t) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUrlClassifierParseFindFullHashCallback { /// ```text /// /** /// * Callback when a match is found in full hash response. This callback may be /// * called multiple times when there are more than one matches in response. /// * /// * @param aCompleteHash A 32-byte complete hash string. /// * @param aTableNames The table names that this complete hash is associated with. /// * Since the server responded with a threat type, multiple /// * list names can be returned. The caller is reponsible /// * for filtering out the unrequested table names. /// * See |convertThreatTypeToListNames| for the format. /// * @param aPerHashCacheDuration See "FindFullHashesResponse" in safebrowsing.proto. /// * /// */ /// ``` /// /// `void onCompleteHashFound (in ACString aCompleteHash, in ACString aTableNames, in unsigned long aPerHashCacheDuration);` #[inline] pub unsafe fn OnCompleteHashFound(&self, aCompleteHash: &::nsstring::nsACString, aTableNames: &::nsstring::nsACString, aPerHashCacheDuration: libc::uint32_t) -> nsresult { ((*self.vtable).OnCompleteHashFound)(self, aCompleteHash, aTableNames, aPerHashCacheDuration) } /// ```text /// /** /// * Callback when full hash response is received. /// * /// * @param aMinWaitDuration See "FindFullHashesResponse" in safebrowsing.proto. /// * @param aNegCacheDuration See "FindFullHashesResponse" in safebrowsing.proto. /// * /// */ /// ``` /// /// `void onResponseParsed (in unsigned long aMinWaitDuration, in unsigned long aNegCacheDuration);` #[inline] pub unsafe fn OnResponseParsed(&self, aMinWaitDuration: libc::uint32_t, aNegCacheDuration: libc::uint32_t) -> nsresult { ((*self.vtable).OnResponseParsed)(self, aMinWaitDuration, aNegCacheDuration) } } /// `interface nsIUrlClassifierUtils : nsISupports` /// // The actual type definition for the interface. This struct has methods // declared on it which will call through its vtable. You never want to pass // this type around by value, always pass it behind a reference. #[repr(C)] pub struct nsIUrlClassifierUtils { vtable: *const nsIUrlClassifierUtilsVTable, /// This field is a phantomdata to ensure that the VTable type and any /// struct containing it is not safe to send across threads, as XPCOM is /// generally not threadsafe. /// /// XPCOM interfaces in general are not safe to send across threads. __nosync: ::std::marker::PhantomData<::std::rc::Rc<u8>>, } // Implementing XpCom for an interface exposes its IID, which allows for easy // use of the `.query_interface<T>` helper method. This also defines that // method for nsIUrlClassifierUtils. unsafe impl XpCom for nsIUrlClassifierUtils { const IID: nsIID = nsID(0xe4f0e59c, 0xb922, 0x48b0, [0xa7, 0xb6, 0x17, 0x35, 0xc1, 0xf9, 0x6f, 0xed]); } // We need to implement the RefCounted trait so we can be used with `RefPtr`. // This trait teaches `RefPtr` how to manage our memory. unsafe impl RefCounted for nsIUrlClassifierUtils { #[inline] unsafe fn addref(&self) { self.AddRef(); } #[inline] unsafe fn release(&self) { self.Release(); } } // This trait is implemented on all types which can be coerced to from nsIUrlClassifierUtils. // It is used in the implementation of `fn coerce<T>`. We hide it from the // documentation, because it clutters it up a lot. #[doc(hidden)] pub trait nsIUrlClassifierUtilsCoerce { /// Cheaply cast a value of this type from a `nsIUrlClassifierUtils`. fn coerce_from(v: &nsIUrlClassifierUtils) -> &Self; } // The trivial implementation: We can obviously coerce ourselves to ourselves. impl nsIUrlClassifierUtilsCoerce for nsIUrlClassifierUtils { #[inline] fn coerce_from(v: &nsIUrlClassifierUtils) -> &Self { v } } impl nsIUrlClassifierUtils { /// Cast this `nsIUrlClassifierUtils` to one of its base interfaces. #[inline] pub fn coerce<T: nsIUrlClassifierUtilsCoerce>(&self) -> &T { T::coerce_from(self) } } // Every interface struct type implements `Deref` to its base interface. This // causes methods on the base interfaces to be directly avaliable on the // object. For example, you can call `.AddRef` or `.QueryInterface` directly // on any interface which inherits from `nsISupports`. impl ::std::ops::Deref for nsIUrlClassifierUtils { type Target = nsISupports; #[inline] fn deref(&self) -> &nsISupports { unsafe { ::std::mem::transmute(self) } } } // Ensure we can use .coerce() to cast to our base types as well. Any type which // our base interface can coerce from should be coercable from us as well. impl<T: nsISupportsCoerce> nsIUrlClassifierUtilsCoerce for T { #[inline] fn coerce_from(v: &nsIUrlClassifierUtils) -> &Self { T::coerce_from(v) } } // This struct represents the interface's VTable. A pointer to a statically // allocated version of this struct is at the beginning of every nsIUrlClassifierUtils // object. It contains one pointer field for each method in the interface. In // the case where we can't generate a binding for a method, we include a void // pointer. #[doc(hidden)] #[repr(C)] pub struct nsIUrlClassifierUtilsVTable { /// We need to include the members from the base interface's vtable at the start /// of the VTable definition. pub __base: nsISupportsVTable, /* ACString getKeyForURI (in nsIURI uri); */ pub GetKeyForURI: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, uri: *const nsIURI, _retval: &mut ::nsstring::nsACString) -> nsresult, /* ACString getProvider (in ACString tableName); */ pub GetProvider: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, tableName: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult, /* ACString getTelemetryProvider (in ACString tableName); */ pub GetTelemetryProvider: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, tableName: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult, /* ACString getProtocolVersion (in ACString provider); */ pub GetProtocolVersion: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, provider: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult, /* ACString convertThreatTypeToListNames (in uint32_t threatType); */ pub ConvertThreatTypeToListNames: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, threatType: uint32_t, _retval: &mut ::nsstring::nsACString) -> nsresult, /* uint32_t convertListNameToThreatType (in ACString listName); */ pub ConvertListNameToThreatType: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, listName: &::nsstring::nsACString, _retval: *mut uint32_t) -> nsresult, /* ACString makeUpdateRequestV4 ([array, size_is (aCount)] in string aListNames, [array, size_is (aCount)] in string aStatesBase64, in uint32_t aCount); */ pub MakeUpdateRequestV4: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, aListNames: *mut *const libc::c_char, aStatesBase64: *mut *const libc::c_char, aCount: uint32_t, _retval: &mut ::nsstring::nsACString) -> nsresult, /* ACString makeFindFullHashRequestV4 ([array, size_is (aListCount)] in string aListNames, [array, size_is (aListCount)] in string aListStatesBase64, [array, size_is (aPrefixCount)] in string aPrefixes, in uint32_t aListCount, in uint32_t aPrefixCount); */ pub MakeFindFullHashRequestV4: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, aListNames: *mut *const libc::c_char, aListStatesBase64: *mut *const libc::c_char, aPrefixes: *mut *const libc::c_char, aListCount: uint32_t, aPrefixCount: uint32_t, _retval: &mut ::nsstring::nsACString) -> nsresult, /* ACString makeThreatHitReport (in nsIChannel aChannel, in ACString aListName, in ACString aHashBase64); */ pub MakeThreatHitReport: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, aChannel: *const nsIChannel, aListName: &::nsstring::nsACString, aHashBase64: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult, /* void parseFindFullHashResponseV4 (in ACString aResponse, in nsIUrlClassifierParseFindFullHashCallback aCallback); */ pub ParseFindFullHashResponseV4: unsafe extern "system" fn (this: *const nsIUrlClassifierUtils, aResponse: &::nsstring::nsACString, aCallback: *const nsIUrlClassifierParseFindFullHashCallback) -> nsresult, } // The implementations of the function wrappers which are exposed to rust code. // Call these methods rather than manually calling through the VTable struct. impl nsIUrlClassifierUtils { /// ```text /// /** /// * Get the lookup string for a given URI. This normalizes the hostname, /// * url-decodes the string, and strips off the protocol. /// * /// * @param uri URI to get the lookup key for. /// * /// * @returns String containing the canonicalized URI. /// */ /// ``` /// /// `ACString getKeyForURI (in nsIURI uri);` #[inline] pub unsafe fn GetKeyForURI(&self, uri: *const nsIURI, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetKeyForURI)(self, uri, _retval) } /// ```text /// /** /// * Get the provider by table name. /// * /// * @param tableName The table name that we want to lookup /// * /// * @returns the provider name that the given table belongs. /// */ /// ``` /// /// `ACString getProvider (in ACString tableName);` #[inline] pub unsafe fn GetProvider(&self, tableName: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetProvider)(self, tableName, _retval) } /// ```text /// /** /// * Get the provider used for Telemetry. /// * Because recording Telemetry will leak user-controlled strings, /// * only built-in providers should be recorded. /// * /// * @param tableName The table name that we want to lookup /// * /// * @returns the filtered provider for telemetry. /// * /// */ /// ``` /// /// `ACString getTelemetryProvider (in ACString tableName);` #[inline] pub unsafe fn GetTelemetryProvider(&self, tableName: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetTelemetryProvider)(self, tableName, _retval) } /// ```text /// /** /// * Get the protocol version for the given provider. /// * /// * @param provider String the provider name. e.g. "google" /// * /// * @returns String to indicate the protocol version. e.g. "2.2" /// */ /// ``` /// /// `ACString getProtocolVersion (in ACString provider);` #[inline] pub unsafe fn GetProtocolVersion(&self, provider: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).GetProtocolVersion)(self, provider, _retval) } /// ```text /// /** /// * Convert threat type to list name. /// * /// * @param Integer to indicate threat type. /// * /// * @returns The list names separated by ','. For example, /// * 'goog-phish-proto,test-phish-proto'. /// */ /// ``` /// /// `ACString convertThreatTypeToListNames (in uint32_t threatType);` #[inline] pub unsafe fn ConvertThreatTypeToListNames(&self, threatType: uint32_t, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).ConvertThreatTypeToListNames)(self, threatType, _retval) } /// ```text /// /** /// * Convert list name to threat type. /// * /// * @param The list name. /// * /// * @returns The threat type in integer. /// */ /// ``` /// /// `uint32_t convertListNameToThreatType (in ACString listName);` #[inline] pub unsafe fn ConvertListNameToThreatType(&self, listName: &::nsstring::nsACString, _retval: *mut uint32_t) -> nsresult { ((*self.vtable).ConvertListNameToThreatType)(self, listName, _retval) } /// ```text /// /** /// * Make update request for given lists and their states. /// * /// * @param aListNames An array of list name represented in string. /// * @param aState An array of states (encoded in base64 format) for each list. /// * @param aCount The array length of aList and aState. /// * /// * @returns A base64url encoded string. /// */ /// ``` /// /// `ACString makeUpdateRequestV4 ([array, size_is (aCount)] in string aListNames, [array, size_is (aCount)] in string aStatesBase64, in uint32_t aCount);` #[inline] pub unsafe fn MakeUpdateRequestV4(&self, aListNames: *mut *const libc::c_char, aStatesBase64: *mut *const libc::c_char, aCount: uint32_t, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).MakeUpdateRequestV4)(self, aListNames, aStatesBase64, aCount, _retval) } /// ```text /// /** /// * Make "find full hash" request by for the given prefixes. /// * /// * @param aListNames An array of list names represented in string. /// * @param aListStatesBase64 An array of list states represented in base64. /// * @param aPrefixes An array of prefixes for which we'd like to find full hashes.. /// * @param aListCount The array length of aListNames /// * @param aPrefixCount The array length of aPrefixes /// * /// * @returns A base64url encoded string. /// */ /// ``` /// /// `ACString makeFindFullHashRequestV4 ([array, size_is (aListCount)] in string aListNames, [array, size_is (aListCount)] in string aListStatesBase64, [array, size_is (aPrefixCount)] in string aPrefixes, in uint32_t aListCount, in uint32_t aPrefixCount);` #[inline] pub unsafe fn MakeFindFullHashRequestV4(&self, aListNames: *mut *const libc::c_char, aListStatesBase64: *mut *const libc::c_char, aPrefixes: *mut *const libc::c_char, aListCount: uint32_t, aPrefixCount: uint32_t, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).MakeFindFullHashRequestV4)(self, aListNames, aListStatesBase64, aPrefixes, aListCount, aPrefixCount, _retval) } /// ```text /// /** /// * Make ThreatHit report request body. /// * /// * @param aChannel channel which encountered the threat. /// * @param aListName listname represented in string. /// * @param aHashBase64 hash-based hit represented in base64. /// * /// * @returns A base64 encoded string. /// */ /// ``` /// /// `ACString makeThreatHitReport (in nsIChannel aChannel, in ACString aListName, in ACString aHashBase64);` #[inline] pub unsafe fn MakeThreatHitReport(&self, aChannel: *const nsIChannel, aListName: &::nsstring::nsACString, aHashBase64: &::nsstring::nsACString, _retval: &mut ::nsstring::nsACString) -> nsresult { ((*self.vtable).MakeThreatHitReport)(self, aChannel, aListName, aHashBase64, _retval) } /// ```text /// /** /// * Parse V4 FindFullHash response. /// * /// * @param aResponse Byte stream from the server. /// * @param aCallback The callback function on each complete hash parsed. /// * Can be called multiple times in one parsing. /// */ /// ``` /// /// `void parseFindFullHashResponseV4 (in ACString aResponse, in nsIUrlClassifierParseFindFullHashCallback aCallback);` #[inline] pub unsafe fn ParseFindFullHashResponseV4(&self, aResponse: &::nsstring::nsACString, aCallback: *const nsIUrlClassifierParseFindFullHashCallback) -> nsresult { ((*self.vtable).ParseFindFullHashResponseV4)(self, aResponse, aCallback) } }