- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / api / ppb_network_list.idl
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_NetworkList</code> interface.
8  */
9
10 [generate_thunk]
11
12 label Chrome {
13   M31 = 1.0
14 };
15
16 /**
17  * Type of a network interface.
18  */
19 [assert_size(4)]
20 enum PP_NetworkList_Type {
21   /**
22    * Type of the network interface is not known.
23    */
24   PP_NETWORKLIST_TYPE_UNKNOWN = 0,
25
26   /**
27    * Wired Ethernet network.
28    */
29   PP_NETWORKLIST_TYPE_ETHERNET = 1,
30
31   /**
32    * Wireless Wi-Fi network.
33    */
34   PP_NETWORKLIST_TYPE_WIFI = 2,
35
36   /**
37    * Cellular network (e.g. LTE).
38    */
39   PP_NETWORKLIST_TYPE_CELLULAR = 3
40 };
41
42 /**
43  * State of a network interface.
44  */
45 [assert_size(4)]
46 enum PP_NetworkList_State  {
47   /**
48    * Network interface is down.
49    */
50   PP_NETWORKLIST_STATE_DOWN = 0,
51
52   /**
53    * Network interface is up.
54    */
55   PP_NETWORKLIST_STATE_UP = 1
56 };
57
58 /**
59  * The <code>PPB_NetworkList</code> is used to represent a list of
60  * network interfaces and their configuration. The content of the list
61  * is immutable.  The current networks configuration can be received
62  * using the <code>PPB_NetworkMonitor</code> interface.
63  */
64 interface PPB_NetworkList {
65   /**
66    * Determines if the specified <code>resource</code> is a
67    * <code>NetworkList</code> object.
68    *
69    * @param[in] resource A <code>PP_Resource</code> resource.
70    *
71    * @return Returns <code>PP_TRUE</code> if <code>resource</code> is
72    * a <code>PPB_NetworkList</code>, <code>PP_FALSE</code>
73    * otherwise.
74    */
75   PP_Bool IsNetworkList([in] PP_Resource resource);
76
77   /**
78    * Gets number of interfaces in the list.
79    *
80    * @param[in] resource A <code>PP_Resource</code> corresponding to a
81    * network list.
82    *
83    * @return Returns number of available network interfaces or 0 if
84    * the list has never been updated.
85    */
86   uint32_t GetCount([in] PP_Resource resource);
87
88   /**
89    * Gets name of a network interface.
90    *
91    * @param[in] resource A <code>PP_Resource</code> corresponding to a
92    * network list.
93    * @param[in] index Index of the network interface.
94    *
95    * @return Returns name for the network interface with the specified
96    * <code>index</code>.
97    */
98   PP_Var GetName([in] PP_Resource resource,
99                  [in] uint32_t index);
100
101   /**
102    * Gets type of a network interface.
103    *
104    * @param[in] resource A <code>PP_Resource</code> corresponding to a
105    * network list.
106    * @param[in] index Index of the network interface.
107    *
108    * @return Returns type of the network interface with the specified
109    * <code>index</code>.
110    */
111   [on_failure=PP_NETWORKLIST_TYPE_UNKNOWN]
112   PP_NetworkList_Type GetType([in] PP_Resource resource,
113                               [in] uint32_t index);
114
115   /**
116    * Gets state of a network interface.
117    *
118    * @param[in] resource A <code>PP_Resource</code> corresponding to a
119    * network list.
120    * @param[in] index Index of the network interface.
121    *
122    * @return Returns current state of the network interface with the
123    * specified <code>index</code>.
124    */
125   [on_failure=PP_NETWORKLIST_STATE_DOWN]
126   PP_NetworkList_State GetState([in] PP_Resource resource,
127                                 [in] uint32_t index);
128
129   /**
130    * Gets list of IP addresses for a network interface.
131    *
132    * @param[in] resource A <code>PP_Resource</code> corresponding to a
133    * network list.
134    * @param[in] index Index of the network interface.
135    * @param[in] output An output array which will receive
136    * <code>PPB_NetAddress</code> resources on success. Please note that the
137    * ref count of those resources has already been increased by 1 for the
138    * caller.
139    *
140    * @return An error code from <code>pp_errors.h</code>.
141    */
142   int32_t GetIpAddresses([in] PP_Resource resource,
143                          [in] uint32_t index,
144                          [in] PP_ArrayOutput output);
145
146   /**
147    * Gets display name of a network interface.
148    *
149    * @param[in] resource A <code>PP_Resource</code> corresponding to a
150    * network list.
151    * @param[in] index Index of the network interface.
152    *
153    * @return Returns display name for the network interface with the
154    * specified <code>index</code>.
155    */
156   PP_Var GetDisplayName([in] PP_Resource resource,
157                         [in] uint32_t index);
158
159   /**
160    * Gets MTU (Maximum Transmission Unit) of a network interface.
161    *
162    * @param[in] resource A <code>PP_Resource</code> corresponding to a
163    * network list.
164    * @param[in] index Index of the network interface.
165    *
166    * @return Returns MTU for the network interface with the specified
167    * <code>index</code> or 0 if MTU is unknown.
168    */
169   uint32_t GetMTU([in] PP_Resource resource,
170                   [in] uint32_t index);
171
172 };