Home | History | Annotate | Download | only in private
      1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  */
      5 
      6 /**
      7  * This file defines the <code>PPB_HostResolver_Private</code> interface.
      8  */
      9 
     10 label Chrome {
     11   M19 = 0.1
     12 };
     13 
     14 /**
     15  * The <code>PP_HostResolver_Flags</code> is an enumeration of the
     16  * different types of flags, that can be OR-ed and passed to host
     17  * resolver.
     18  */
     19 [assert_size(4)]
     20 enum PP_HostResolver_Private_Flags {
     21   /**
     22    * AI_CANONNAME
     23    */
     24   PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0,
     25   /**
     26    * Hint to the resolver that only loopback addresses are configured.
     27    */
     28   PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1
     29 };
     30 
     31 [assert_size(8)]
     32 struct PP_HostResolver_Private_Hint {
     33   PP_NetAddressFamily_Private family;
     34   int32_t flags;
     35 };
     36 
     37 interface PPB_HostResolver_Private {
     38   /**
     39    * Allocates a Host Resolver resource.
     40    */
     41   PP_Resource Create([in] PP_Instance instance);
     42 
     43   /**
     44    * Determines if a given resource is a Host Resolver.
     45    */
     46   PP_Bool IsHostResolver([in] PP_Resource resource);
     47 
     48   /**
     49    * Creates a new request to Host Resolver. |callback| is invoked
     50    * when request is processed and a list of network addresses is
     51    * obtained. These addresses can be be used in Connect, Bind or
     52    * Listen calls to connect to a given |host| and |port|.
     53    */
     54   int32_t Resolve([in] PP_Resource host_resolver,
     55                   [in] str_t host,
     56                   [in] uint16_t port,
     57                   [in] PP_HostResolver_Private_Hint hint,
     58                   [in] PP_CompletionCallback callback);
     59 
     60   /**
     61    * Returns canonical name of host.
     62    */
     63   PP_Var GetCanonicalName([in] PP_Resource host_resolver);
     64 
     65   /**
     66    * Returns number of network addresses obtained after Resolve call.
     67    */
     68   uint32_t GetSize([in] PP_Resource host_resolver);
     69 
     70   /**
     71    * Stores in the |addr| |index|-th network address. |addr| can't be
     72    * NULL. Returns PP_TRUE if success or PP_FALSE if the given
     73    * resource is not a Host Resolver or |index| exceeds number of
     74    * available addresses.
     75   */
     76   PP_Bool GetNetAddress([in] PP_Resource host_resolver,
     77                         [in] uint32_t index,
     78                         [out] PP_NetAddress_Private addr);
     79 };
     80