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.
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
23 * This file defines the <code>PPB_NetworkList</code> interface.
32 * Type of a network interface.
36 * Type of the network interface is not known.
38 PP_NETWORKLIST_TYPE_UNKNOWN
= 0,
40 * Wired Ethernet network.
42 PP_NETWORKLIST_TYPE_ETHERNET
= 1,
44 * Wireless Wi-Fi network.
46 PP_NETWORKLIST_TYPE_WIFI
= 2,
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);
55 * State of a network interface.
59 * Network interface is down.
61 PP_NETWORKLIST_STATE_DOWN
= 0,
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);
73 * @addtogroup Interfaces
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
{
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>
93 PP_Bool (*IsNetworkList
)(PP_Resource resource
);
95 * Gets number of interfaces in the list.
97 * @param[in] resource A <code>PP_Resource</code> corresponding to a
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
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
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
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
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
148 * @return An error code from <code>pp_errors.h</code>.
150 int32_t (*GetIpAddresses
)(PP_Resource resource
,
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
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
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
;
182 #endif /* PPAPI_C_PPB_NETWORK_LIST_H_ */