Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: ppapi/c/ppb_network_list.h

Issue 23450012: Make NetworkList and NetworkMonitor APIs public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 /* From ppb_network_list.idl modified Thu Aug 29 18:00:54 2013. */
7
8 #ifndef PPAPI_C_PPB_NETWORK_LIST_H_
9 #define PPAPI_C_PPB_NETWORK_LIST_H_
10
11 #include "ppapi/c/pp_array_output.h"
12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_resource.h"
15 #include "ppapi/c/pp_stdint.h"
16 #include "ppapi/c/pp_var.h"
17
18 #define PPB_NETWORKLIST_INTERFACE_1_0 "PPB_NetworkList;1.0"
19 #define PPB_NETWORKLIST_INTERFACE PPB_NETWORKLIST_INTERFACE_1_0
20
21 /**
22 * @file
23 * This file defines the <code>PPB_NetworkList</code> interface.
24 */
25
26
27 /**
28 * @addtogroup Enums
29 * @{
30 */
31 /**
32 * Type of a network interface.
33 */
34 typedef enum {
35 /**
36 * Type of the network interface is not known.
37 */
38 PP_NETWORKLIST_UNKNOWN = 0,
39 /**
40 * Wired Ethernet network.
41 */
42 PP_NETWORKLIST_ETHERNET = 1,
43 /**
44 * Wireless Wi-Fi network.
45 */
46 PP_NETWORKLIST_WIFI = 2,
47 /**
48 * Cellular network (e.g. LTE).
49 */
50 PP_NETWORKLIST_CELLULAR = 3
51 } PP_NetworkListType;
52 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType, 4);
53
54 /**
55 * State of a network interface.
56 */
57 typedef enum {
58 /**
59 * Network interface is down.
60 */
61 PP_NETWORKLIST_DOWN = 0,
62 /**
63 * Network interface is up.
64 */
65 PP_NETWORKLIST_UP = 1
66 } PP_NetworkListState;
67 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState, 4);
68 /**
69 * @}
70 */
71
72 /**
73 * @addtogroup Interfaces
74 * @{
75 */
76 /**
77 * The <code>PPB_NetworkList</code> is used to represent a list of
78 * network interfaces and their configuration. The content of the list
79 * is immutable. The current networks configuration can be received
80 * using the <code>PPB_NetworkMonitor</code> interface.
81 */
82 struct PPB_NetworkList_1_0 {
83 /**
84 * Determines if the specified <code>resource</code> is a
85 * <code>NetworkList</code> object.
86 *
87 * @param[in] resource A <code>PP_Resource</code> resource.
88 *
89 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is
90 * a <code>PPB_NetworkList</code>, <code>PP_FALSE</code>
91 * otherwise.
92 */
93 PP_Bool (*IsNetworkList)(PP_Resource resource);
94 /**
95 * Gets number of interfaces in the list.
96 *
97 * @return Returns number of available network interfaces or 0 if
98 * the list has never been updated.
99 */
100 uint32_t (*GetCount)(PP_Resource resource);
101 /**
102 * Gets name 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 name for the network interface with the specified
109 * <code>index</code>.
110 */
111 struct PP_Var (*GetName)(PP_Resource resource, uint32_t index);
112 /**
113 * Gets type of a network interface.
114 *
115 * @param[in] resource A <code>PP_Resource</code> corresponding to a
116 * network list.
117 * @param[in] index Index of the network interface.
118 *
119 * @return Returns type of the network interface with the specified
120 * <code>index</code>.
121 */
122 PP_NetworkListType (*GetType)(PP_Resource resource, uint32_t index);
123 /**
124 * Gets state of a network interface.
125 *
126 * @param[in] resource A <code>PP_Resource</code> corresponding to a
127 * network list.
128 * @param[in] index Index of the network interface.
129 *
130 * @return Returns current state of the network interface with the
131 * specified <code>index</code>.
132 */
133 PP_NetworkListState (*GetState)(PP_Resource resource, uint32_t index);
134 /**
135 * Gets list of IP addresses for a network interface.
136 *
137 * @param[in] resource A <code>PP_Resource</code> corresponding to a
138 * network list.
139 * @param[in] index Index of the network interface.
140 * @param[in] output An output array which will receive
141 * <code>PPB_NetAddress</code> resources on success. Please note that the
142 * ref count of those resources has already been increased by 1 for the
143 * caller.
144 *
145 * @return An error code from <code>pp_errors.h</code>.
146 */
147 int32_t (*GetIpAddresses)(PP_Resource resource,
148 uint32_t index,
149 struct PP_ArrayOutput output);
150 /**
151 * Gets display name of a network interface.
152 *
153 * @param[in] resource A <code>PP_Resource</code> corresponding to a
154 * network list.
155 * @param[in] index Index of the network interface.
156 *
157 * @return Returns display name for the network interface with the
158 * specified <code>index</code>.
159 */
160 struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index);
161 /**
162 * Gets MTU (Maximum Transmission Unit) of a network interface.
163 *
164 * @param[in] resource A <code>PP_Resource</code> corresponding to a
165 * network list.
166 * @param[in] index Index of the network interface.
167 *
168 * @return Returns MTU for the network interface with the specified
169 * <code>index</code> or 0 if MTU is unknown.
170 */
171 uint32_t (*GetMTU)(PP_Resource resource, uint32_t index);
172 };
173
174 typedef struct PPB_NetworkList_1_0 PPB_NetworkList;
175 /**
176 * @}
177 */
178
179 #endif /* PPAPI_C_PPB_NETWORK_LIST_H_ */
180
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698