Pepper_47_C++_interfaces
|
#include <host_resolver.h>
Public Member Functions | |
HostResolver () | |
HostResolver (const InstanceHandle &instance) | |
HostResolver (PassRef, PP_Resource resource) | |
HostResolver (const HostResolver &other) | |
virtual | ~HostResolver () |
The destructor. More... | |
HostResolver & | operator= (const HostResolver &other) |
int32_t | Resolve (const char *host, uint16_t port, const PP_HostResolver_Hint &hint, const CompletionCallback &callback) |
Var | GetCanonicalName () const |
uint32_t | GetNetAddressCount () const |
NetAddress | GetNetAddress (uint32_t index) const |
![]() | |
Resource () | |
The default constructor. More... | |
Resource (const Resource &other) | |
virtual | ~Resource () |
Destructor. More... | |
Resource & | operator= (const Resource &other) |
bool | is_null () const |
PP_Resource | pp_resource () const |
PP_Resource | detach () |
Static Public Member Functions | |
static bool | IsAvailable () |
Additional Inherited Members | |
![]() | |
Resource (PP_Resource resource) | |
Resource (PassRef, PP_Resource resource) | |
void | PassRefFromConstructor (PP_Resource resource) |
void | Clear () |
Sets this resource to null. This releases ownership of the resource. More... | |
The HostResolver
class supports host name resolution.
Permissions: In order to run Resolve()
, apps permission socket
with subrule resolve-host
is required. For more details about network communication permissions, please see: http://developer.chrome.com/apps/app_network.html
Definition at line 26 of file host_resolver.h.
pp::HostResolver::HostResolver | ( | ) |
Default constructor for creating an is_null() HostResolver
object.
Definition at line 22 of file host_resolver.cc.
|
explicit |
A constructor used to create a HostResolver
object.
[in] | instance | The instance with which this resource will be associated. |
Definition at line 25 of file host_resolver.cc.
References pp::Resource::PassRefFromConstructor(), and pp::InstanceHandle::pp_instance().
pp::HostResolver::HostResolver | ( | PassRef | , |
PP_Resource | resource | ||
) |
A constructor used when you have received a PP_Resource
as a return value that has had 1 ref added for you.
[in] | resource | A PPB_HostResolver resource. |
Definition at line 32 of file host_resolver.cc.
pp::HostResolver::HostResolver | ( | const HostResolver & | other | ) |
The copy constructor for HostResolver
.
[in] | other | A reference to another HostResolver . |
Definition at line 36 of file host_resolver.cc.
|
virtual |
The destructor.
Definition at line 39 of file host_resolver.cc.
Var pp::HostResolver::GetCanonicalName | ( | ) | const |
Gets the canonical name of the host.
Var
on success, which is an empty string if PP_HOSTRESOLVER_FLAG_CANONNAME
is not set in the hint flags when calling Resolve()
; an undefined Var
if there is a pending Resolve()
call or the previous Resolve()
call failed. Definition at line 64 of file host_resolver.cc.
References pp::PASS_REF, pp::Resource::pp_resource(), and pp::Resource::Var.
NetAddress pp::HostResolver::GetNetAddress | ( | uint32_t | index | ) | const |
Gets a network address.
[in] | index | An index indicating which address to return. |
NetAddress
object. The object will be null (i.e., is_null() returns true) if there is a pending Resolve()
call or the previous Resolve()
call failed, or the specified index is out of range. Definition at line 83 of file host_resolver.cc.
References pp::PASS_REF, and pp::Resource::pp_resource().
uint32_t pp::HostResolver::GetNetAddressCount | ( | ) | const |
Gets the number of network addresses.
Resolve()
call or the previous Resolve()
call failed. Definition at line 74 of file host_resolver.cc.
References pp::Resource::pp_resource().
|
static |
Static function for determining whether the browser supports the PPB_HostResolver
interface.
Definition at line 48 of file host_resolver.cc.
HostResolver & pp::HostResolver::operator= | ( | const HostResolver & | other | ) |
The assignment operator for HostResolver
.
[in] | other | A reference to another HostResolver . |
HostResolver
object. Definition at line 42 of file host_resolver.cc.
References pp::Resource::operator=().
int32_t pp::HostResolver::Resolve | ( | const char * | host, |
uint16_t | port, | ||
const PP_HostResolver_Hint & | hint, | ||
const CompletionCallback & | callback | ||
) |
Requests resolution of a host name. If the call completes successully, the results can be retrieved by GetCanonicalName()
, GetNetAddressCount()
and GetNetAddress()
.
[in] | host | The host name (or IP address literal) to resolve. |
[in] | port | The port number to be set in the resulting network addresses. |
[in] | hint | A PP_HostResolver_Hint structure providing hints for host resolution. |
[in] | callback | A CompletionCallback to be called upon completion. |
pp_errors.h
. PP_ERROR_NOACCESS
will be returned if the caller doesn't have required permissions. PP_ERROR_NAME_NOT_RESOLVED
will be returned if the host name couldn't be resolved. Definition at line 52 of file host_resolver.cc.
References pp::CompletionCallback::MayForce(), pp::CompletionCallback::pp_completion_callback(), and pp::Resource::pp_resource().