Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 5 | #ifndef PPAPI_CPP_NETWORK_LIST_H_ |
| 6 | #define PPAPI_CPP_NETWORK_LIST_H_ |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 11 | #include "ppapi/c/ppb_network_list.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 12 | #include "ppapi/cpp/pass_ref.h" |
| 13 | #include "ppapi/cpp/resource.h" |
| 14 | |
| 15 | namespace pp { |
| 16 | |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 17 | class NetAddress; |
| 18 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 19 | class NetworkList : public Resource { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 20 | public: |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 21 | NetworkList(); |
| 22 | NetworkList(PassRef, PP_Resource resource); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 23 | |
| 24 | /// Returns true if the required interface is available. |
| 25 | static bool IsAvailable(); |
| 26 | |
| 27 | /// @return Returns the number of available network interfaces or 0 |
| 28 | /// if the list has never been updated. |
| 29 | uint32_t GetCount() const; |
| 30 | |
| 31 | /// @return Returns the name for the network interface with the |
| 32 | /// specified <code>index</code>. |
| 33 | std::string GetName(uint32_t index) const; |
| 34 | |
| 35 | /// @return Returns the type of the network interface with the |
| 36 | /// specified <code>index</code>. |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 37 | PP_NetworkList_Type GetType(uint32_t index) const; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 38 | |
| 39 | /// @return Returns the current state of the network interface with |
| 40 | /// the specified <code>index</code>. |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 41 | PP_NetworkList_State GetState(uint32_t index) const; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 42 | |
| 43 | /// Gets the list of IP addresses for the network interface with the |
| 44 | /// specified <code>index</code> and stores them in |
| 45 | /// <code>addresses</code>. |
Torne (Richard Coles) | 58537e2 | 2013-09-12 12:10:22 +0100 | [diff] [blame] | 46 | int32_t GetIpAddresses(uint32_t index, |
| 47 | std::vector<NetAddress>* addresses) const; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 48 | |
| 49 | /// @return Returns the display name for the network interface with |
| 50 | /// the specified <code>index</code>. |
| 51 | std::string GetDisplayName(uint32_t index) const; |
| 52 | |
| 53 | /// @return Returns the MTU for the network interface with the |
| 54 | /// specified <code>index</code>. |
| 55 | uint32_t GetMTU(uint32_t index) const; |
| 56 | }; |
| 57 | |
| 58 | } // namespace pp |
| 59 | |
Torne (Richard Coles) | 68043e1 | 2013-09-26 13:24:57 +0100 | [diff] [blame] | 60 | #endif // PPAPI_CPP_NETWORK_LIST_H_ |