{{+bindTo:partials.standard_nacl_api}}
<h1>pp::HostResolver Class Reference</h1>
<div id="doxygen-ref">
{{- dummy div to appease doxygen -}}
<div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<!--header-->
<div class="contents">
<!-- doxytag: class="pp::HostResolver" --><!-- doxytag: inherits="pp::Resource" --><div class="dynheader">
Inheritance diagram for pp::HostResolver:</div>
<div class="dyncontent">
<div class="center"><img src="classpp_1_1_host_resolver__inherit__graph.png" border="0" usemap="#pp_1_1_host_resolver_inherit__map" alt="Inheritance graph" /></div>
<map name="pp_1_1_host_resolver_inherit__map" id="pp_1_1_host_resolver_inherit__map">
<area shape="rect" id="node2" href="classpp_1_1_resource.html" title="A reference counted module resource." alt="" coords="17,5,121,32"></area></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<p><a href="classpp_1_1_host_resolver-members.html">List of all members.</a></p>
<h2>
Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#a98885c5eb6ba873ee54cbb657f9e43f5">HostResolver</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#aea32a40269f4ad3dc9d9cbadc89bea4f">HostResolver</a> (const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> &instance)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#adc4f2b44c8281920fbce2c4b93eddce2">HostResolver</a> (<a class="el" href="namespacepp.html#a339083c1beec620267bf8b3c55decaa5">PassRef</a>, PP_Resource resource)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#a74ea3a85ad41ded8128b188c821cdb28">HostResolver</a> (const <a class="el" href="classpp_1_1_host_resolver.html">HostResolver</a> &other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#ad4d39f4e863917bc881fc98c236c9f84">~HostResolver</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_host_resolver.html">HostResolver</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#ab773cb42d3130d6973a8743bc7aba7bd">operator=</a> (const <a class="el" href="classpp_1_1_host_resolver.html">HostResolver</a> &other)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98">Resolve</a> (const char *host, uint16_t port, const PP_HostResolver_Hint &hint, const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> &callback)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_var.html">Var</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#aaa2e0834d48b8356f8f3185bc615611d">GetCanonicalName</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#ace959e4cb6fd0a51669f6eff64e08ae3">GetNetAddressCount</a> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classpp_1_1_net_address.html">NetAddress</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#a3680cf97d53a80a536c5dc6441a4c6e7">GetNetAddress</a> (uint32_t index) const </td></tr>
</table><h2>
Static Public Member Functions</h2><table class="memberdecls">
<tr><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classpp_1_1_host_resolver.html#ad56c139fa37d665cbb7e33f4d592b421">IsAvailable</a> ()</td></tr>
</table>
<hr /><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>The <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code> class supports host name resolution. </p>
<p>Permissions: In order to run <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code>, apps permission <code>socket</code> with subrule <code>resolve-host</code> is required. For more details about network communication permissions, please see: <a href="http://developer.chrome.com/apps/app_network.html">http://developer.chrome.com/apps/app_network.html</a> </p>
</div><hr /><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a98885c5eb6ba873ee54cbb657f9e43f5"></a><!-- doxytag: member="pp::HostResolver::HostResolver" ref="a98885c5eb6ba873ee54cbb657f9e43f5" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_host_resolver.html#a98885c5eb6ba873ee54cbb657f9e43f5">pp::HostResolver::HostResolver</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Default constructor for creating an <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code> object. </p>
</div>
</div>
<a class="anchor" id="aea32a40269f4ad3dc9d9cbadc89bea4f"></a><!-- doxytag: member="pp::HostResolver::HostResolver" ref="aea32a40269f4ad3dc9d9cbadc89bea4f" args="(const InstanceHandle &instance)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_host_resolver.html#a98885c5eb6ba873ee54cbb657f9e43f5">pp::HostResolver::HostResolver</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_instance_handle.html">InstanceHandle</a> & </td>
<td class="paramname"><em>instance</em></td><td>)</td>
<td><code> [explicit]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor used to create a <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code> object. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">instance</td><td>The instance with which this resource will be associated. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="adc4f2b44c8281920fbce2c4b93eddce2"></a><!-- doxytag: member="pp::HostResolver::HostResolver" ref="adc4f2b44c8281920fbce2c4b93eddce2" args="(PassRef, PP_Resource resource)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_host_resolver.html#a98885c5eb6ba873ee54cbb657f9e43f5">pp::HostResolver::HostResolver</a> </td>
<td>(</td>
<td class="paramtype"><a class="el" href="namespacepp.html#a339083c1beec620267bf8b3c55decaa5">PassRef</a> </td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PP_Resource </td>
<td class="paramname"><em>resource</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A constructor used when you have received a <code>PP_Resource</code> as a return value that has had 1 ref added for you. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resource</td><td>A <code>PPB_HostResolver</code> resource. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a74ea3a85ad41ded8128b188c821cdb28"></a><!-- doxytag: member="pp::HostResolver::HostResolver" ref="a74ea3a85ad41ded8128b188c821cdb28" args="(const HostResolver &other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_host_resolver.html#a98885c5eb6ba873ee54cbb657f9e43f5">pp::HostResolver::HostResolver</a> </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_host_resolver.html">HostResolver</a> & </td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The copy constructor for <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>A reference to another <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code>. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ad4d39f4e863917bc881fc98c236c9f84"></a><!-- doxytag: member="pp::HostResolver::~HostResolver" ref="ad4d39f4e863917bc881fc98c236c9f84" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">virtual <a class="el" href="classpp_1_1_host_resolver.html#ad4d39f4e863917bc881fc98c236c9f84">pp::HostResolver::~HostResolver</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The destructor. </p>
</div>
</div>
<hr /><h2>Member Function Documentation</h2>
<a class="anchor" id="aaa2e0834d48b8356f8f3185bc615611d"></a><!-- doxytag: member="pp::HostResolver::GetCanonicalName" ref="aaa2e0834d48b8356f8f3185bc615611d" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_var.html">Var</a> <a class="el" href="classpp_1_1_host_resolver.html#aaa2e0834d48b8356f8f3185bc615611d">pp::HostResolver::GetCanonicalName</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets the canonical name of the host. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>A string <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> on success, which is an empty string if <code>PP_HOSTRESOLVER_FLAG_CANONNAME</code> is not set in the hint flags when calling <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code>; an undefined <code><a class="el" href="classpp_1_1_var.html" title="A generic type used for passing data types between the module and the page.">Var</a></code> if there is a pending <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code> call or the previous <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code> call failed. </dd></dl>
</div>
</div>
<a class="anchor" id="a3680cf97d53a80a536c5dc6441a4c6e7"></a><!-- doxytag: member="pp::HostResolver::GetNetAddress" ref="a3680cf97d53a80a536c5dc6441a4c6e7" args="(uint32_t index) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_net_address.html">NetAddress</a> <a class="el" href="classpp_1_1_host_resolver.html#a3680cf97d53a80a536c5dc6441a4c6e7">pp::HostResolver::GetNetAddress</a> </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>index</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets a network address. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">index</td><td>An index indicating which address to return.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A <code><a class="el" href="classpp_1_1_net_address.html" title="The NetAddress class represents a network address.">NetAddress</a></code> object. The object will be null (i.e., <a class="el" href="classpp_1_1_resource.html#a859068e34cdc2dc0b78754c255323aa9" title="This functions determines if this resource is invalid or uninitialized.">is_null()</a> returns true) if there is a pending <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code> call or the previous <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code> call failed, or the specified index is out of range. </dd></dl>
</div>
</div>
<a class="anchor" id="ace959e4cb6fd0a51669f6eff64e08ae3"></a><!-- doxytag: member="pp::HostResolver::GetNetAddressCount" ref="ace959e4cb6fd0a51669f6eff64e08ae3" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t <a class="el" href="classpp_1_1_host_resolver.html#ace959e4cb6fd0a51669f6eff64e08ae3">pp::HostResolver::GetNetAddressCount</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Gets the number of network addresses. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of available network addresses on success; 0 if there is a pending <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code> call or the previous <code><a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98" title="Requests resolution of a host name.">Resolve()</a></code> call failed. </dd></dl>
</div>
</div>
<a class="anchor" id="ad56c139fa37d665cbb7e33f4d592b421"></a><!-- doxytag: member="pp::HostResolver::IsAvailable" ref="ad56c139fa37d665cbb7e33f4d592b421" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">static bool <a class="el" href="classpp_1_1_host_resolver.html#ad56c139fa37d665cbb7e33f4d592b421">pp::HostResolver::IsAvailable</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [static]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Static function for determining whether the browser supports the <code>PPB_HostResolver</code> interface. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the interface is available, false otherwise. </dd></dl>
</div>
</div>
<a class="anchor" id="ab773cb42d3130d6973a8743bc7aba7bd"></a><!-- doxytag: member="pp::HostResolver::operator=" ref="ab773cb42d3130d6973a8743bc7aba7bd" args="(const HostResolver &other)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classpp_1_1_host_resolver.html">HostResolver</a>& pp::HostResolver::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classpp_1_1_host_resolver.html">HostResolver</a> & </td>
<td class="paramname"><em>other</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The assignment operator for <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code>. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">other</td><td>A reference to another <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code>.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>A reference to this <code><a class="el" href="classpp_1_1_host_resolver.html" title="The HostResolver class supports host name resolution.">HostResolver</a></code> object. </dd></dl>
</div>
</div>
<a class="anchor" id="a894d4ae712b4b30e639f6d838c2f9d98"></a><!-- doxytag: member="pp::HostResolver::Resolve" ref="a894d4ae712b4b30e639f6d838c2f9d98" args="(const char *host, uint16_t port, const PP_HostResolver_Hint &hint, const CompletionCallback &callback)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t <a class="el" href="classpp_1_1_host_resolver.html#a894d4ae712b4b30e639f6d838c2f9d98">pp::HostResolver::Resolve</a> </td>
<td>(</td>
<td class="paramtype">const char * </td>
<td class="paramname"><em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const PP_HostResolver_Hint & </td>
<td class="paramname"><em>hint</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classpp_1_1_completion_callback.html">CompletionCallback</a> & </td>
<td class="paramname"><em>callback</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Requests resolution of a host name. </p>
<p>If the call completes successully, the results can be retrieved by <code><a class="el" href="classpp_1_1_host_resolver.html#aaa2e0834d48b8356f8f3185bc615611d" title="Gets the canonical name of the host.">GetCanonicalName()</a></code>, <code><a class="el" href="classpp_1_1_host_resolver.html#ace959e4cb6fd0a51669f6eff64e08ae3" title="Gets the number of network addresses.">GetNetAddressCount()</a></code> and <code><a class="el" href="classpp_1_1_host_resolver.html#a3680cf97d53a80a536c5dc6441a4c6e7" title="Gets a network address.">GetNetAddress()</a></code>.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">host</td><td>The host name (or IP address literal) to resolve. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">port</td><td>The port number to be set in the resulting network addresses. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">hint</td><td>A <code>PP_HostResolver_Hint</code> structure providing hints for host resolution. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">callback</td><td>A <code><a class="el" href="classpp_1_1_completion_callback.html" title="This API enables you to implement and receive callbacks when Pepper operations complete asynchronousl...">CompletionCallback</a></code> to be called upon completion.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>An int32_t containing an error code from <code>pp_errors.h</code>. <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have required permissions. <code>PP_ERROR_NAME_NOT_RESOLVED</code> will be returned if the host name couldn't be resolved. </dd></dl>
</div>
</div>
<hr />The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="host__resolver_8h.html">host_resolver.h</a></li>
</ul>
</div><!-- contents -->
</div>
{{/partials.standard_nacl_api}}