summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/dev/net_address_dev.h
blob: 2abe14a7987b3ce7b9571988a2f39a1643c196ed (plain)
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
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_
#define PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_

#include "ppapi/c/dev/ppb_net_address_dev.h"
#include "ppapi/cpp/pass_ref.h"
#include "ppapi/cpp/resource.h"
#include "ppapi/cpp/var.h"

namespace pp {

class InstanceHandle;

class NetAddress_Dev : public Resource {
 public:
  NetAddress_Dev();

  NetAddress_Dev(PassRef, PP_Resource resource);

  NetAddress_Dev(const InstanceHandle& instance,
                 const PP_NetAddress_IPv4_Dev& ipv4_addr);

  NetAddress_Dev(const InstanceHandle& instance,
                 const PP_NetAddress_IPv6_Dev& ipv6_addr);

  NetAddress_Dev(const NetAddress_Dev& other);

  virtual ~NetAddress_Dev();

  NetAddress_Dev& operator=(const NetAddress_Dev& other);

  /// Static function for determining whether the browser supports the required
  /// NetAddress interface.
  ///
  /// @return true if the interface is available, false otherwise.
  static bool IsAvailable();

  PP_NetAddress_Family_Dev GetFamily() const;

  Var DescribeAsString(PP_Bool include_port) const;

  PP_Bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) const;

  PP_Bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) const;
};

}  // namespace pp

#endif  // PPAPI_CPP_DEV_NET_ADDRESS_DEV_H_