Roll src/third_party/skia 35f5576:fbcf0bd
[chromium-blink-merge.git] / ppapi / c / ppb_network_list.h
blobd7b2265d9e463ab66838bbcf95a2ad5f49993112
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 */
6 /* From ppb_network_list.idl modified Mon Sep 9 11:16:26 2013. */
8 #ifndef PPAPI_C_PPB_NETWORK_LIST_H_
9 #define PPAPI_C_PPB_NETWORK_LIST_H_
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"
18 #define PPB_NETWORKLIST_INTERFACE_1_0 "PPB_NetworkList;1.0"
19 #define PPB_NETWORKLIST_INTERFACE PPB_NETWORKLIST_INTERFACE_1_0
21 /**
22 * @file
23 * This file defines the <code>PPB_NetworkList</code> interface.
27 /**
28 * @addtogroup Enums
29 * @{
31 /**
32 * Type of a network interface.
34 typedef enum {
35 /**
36 * Type of the network interface is not known.
38 PP_NETWORKLIST_TYPE_UNKNOWN = 0,
39 /**
40 * Wired Ethernet network.
42 PP_NETWORKLIST_TYPE_ETHERNET = 1,
43 /**
44 * Wireless Wi-Fi network.
46 PP_NETWORKLIST_TYPE_WIFI = 2,
47 /**
48 * Cellular network (e.g. LTE).
50 PP_NETWORKLIST_TYPE_CELLULAR = 3
51 } PP_NetworkList_Type;
52 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkList_Type, 4);
54 /**
55 * State of a network interface.
57 typedef enum {
58 /**
59 * Network interface is down.
61 PP_NETWORKLIST_STATE_DOWN = 0,
62 /**
63 * Network interface is up.
65 PP_NETWORKLIST_STATE_UP = 1
66 } PP_NetworkList_State;
67 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkList_State, 4);
68 /**
69 * @}
72 /**
73 * @addtogroup Interfaces
74 * @{
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.
82 struct PPB_NetworkList_1_0 {
83 /**
84 * Determines if the specified <code>resource</code> is a
85 * <code>NetworkList</code> object.
87 * @param[in] resource A <code>PP_Resource</code> resource.
89 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is
90 * a <code>PPB_NetworkList</code>, <code>PP_FALSE</code>
91 * otherwise.
93 PP_Bool (*IsNetworkList)(PP_Resource resource);
94 /**
95 * Gets number of interfaces in the list.
97 * @param[in] resource A <code>PP_Resource</code> corresponding to a
98 * network list.
100 * @return Returns number of available network interfaces or 0 if
101 * the list has never been updated.
103 uint32_t (*GetCount)(PP_Resource resource);
105 * Gets name of a network interface.
107 * @param[in] resource A <code>PP_Resource</code> corresponding to a
108 * network list.
109 * @param[in] index Index of the network interface.
111 * @return Returns name for the network interface with the specified
112 * <code>index</code>.
114 struct PP_Var (*GetName)(PP_Resource resource, uint32_t index);
116 * Gets type of a network interface.
118 * @param[in] resource A <code>PP_Resource</code> corresponding to a
119 * network list.
120 * @param[in] index Index of the network interface.
122 * @return Returns type of the network interface with the specified
123 * <code>index</code>.
125 PP_NetworkList_Type (*GetType)(PP_Resource resource, uint32_t index);
127 * Gets state of a network interface.
129 * @param[in] resource A <code>PP_Resource</code> corresponding to a
130 * network list.
131 * @param[in] index Index of the network interface.
133 * @return Returns current state of the network interface with the
134 * specified <code>index</code>.
136 PP_NetworkList_State (*GetState)(PP_Resource resource, uint32_t index);
138 * Gets list of IP addresses for a network interface.
140 * @param[in] resource A <code>PP_Resource</code> corresponding to a
141 * network list.
142 * @param[in] index Index of the network interface.
143 * @param[in] output An output array which will receive
144 * <code>PPB_NetAddress</code> resources on success. Please note that the
145 * ref count of those resources has already been increased by 1 for the
146 * caller.
148 * @return An error code from <code>pp_errors.h</code>.
150 int32_t (*GetIpAddresses)(PP_Resource resource,
151 uint32_t index,
152 struct PP_ArrayOutput output);
154 * Gets display name of a network interface.
156 * @param[in] resource A <code>PP_Resource</code> corresponding to a
157 * network list.
158 * @param[in] index Index of the network interface.
160 * @return Returns display name for the network interface with the
161 * specified <code>index</code>.
163 struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index);
165 * Gets MTU (Maximum Transmission Unit) of a network interface.
167 * @param[in] resource A <code>PP_Resource</code> corresponding to a
168 * network list.
169 * @param[in] index Index of the network interface.
171 * @return Returns MTU for the network interface with the specified
172 * <code>index</code> or 0 if MTU is unknown.
174 uint32_t (*GetMTU)(PP_Resource resource, uint32_t index);
177 typedef struct PPB_NetworkList_1_0 PPB_NetworkList;
179 * @}
182 #endif /* PPAPI_C_PPB_NETWORK_LIST_H_ */