Home | History | Annotate | Download | only in private
      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 private/ppb_network_list_private.idl,
      7  *   modified Thu Mar  1 16:24:33 2012.
      8  */
      9 
     10 #ifndef PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_
     11 #define PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_
     12 
     13 #include "ppapi/c/pp_bool.h"
     14 #include "ppapi/c/pp_macros.h"
     15 #include "ppapi/c/pp_resource.h"
     16 #include "ppapi/c/pp_stdint.h"
     17 #include "ppapi/c/pp_var.h"
     18 #include "ppapi/c/private/ppb_net_address_private.h"
     19 
     20 #define PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2 "PPB_NetworkList_Private;0.2"
     21 #define PPB_NETWORKLIST_PRIVATE_INTERFACE PPB_NETWORKLIST_PRIVATE_INTERFACE_0_2
     22 
     23 /**
     24  * @file
     25  * This file defines the <code>PPB_NetworkList_Private</code> interface.
     26  */
     27 
     28 
     29 /**
     30  * @addtogroup Enums
     31  * @{
     32  */
     33 /**
     34  * Type of a network interface.
     35  */
     36 typedef enum {
     37   /**
     38    * Type of the network interface is not known.
     39    */
     40   PP_NETWORKLIST_UNKNOWN = 0,
     41   /**
     42    * Wired Ethernet network.
     43    */
     44   PP_NETWORKLIST_ETHERNET = 1,
     45   /**
     46    * Wireless Wi-Fi network.
     47    */
     48   PP_NETWORKLIST_WIFI = 2,
     49   /**
     50    * Cellular network (e.g. LTE).
     51    */
     52   PP_NETWORKLIST_CELLULAR = 3
     53 } PP_NetworkListType_Private;
     54 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListType_Private, 4);
     55 
     56 /**
     57  * State of a network interface.
     58  */
     59 typedef enum {
     60   /**
     61    * Network interface is down.
     62    */
     63   PP_NETWORKLIST_DOWN = 0,
     64   /**
     65    * Network interface is up.
     66    */
     67   PP_NETWORKLIST_UP = 1
     68 } PP_NetworkListState_Private;
     69 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkListState_Private, 4);
     70 /**
     71  * @}
     72  */
     73 
     74 /**
     75  * @addtogroup Interfaces
     76  * @{
     77  */
     78 /**
     79  * The <code>PPB_NetworkList_Private</code> is used to represent a
     80  * list of network interfaces and their configuration. The content of
     81  * the list is immutable. The current networks configuration can be
     82  * received using the <code>PPB_NetworkMonitor_Private</code>
     83  * interface.
     84  */
     85 struct PPB_NetworkList_Private_0_2 {
     86   /**
     87    * Determines if the specified <code>resource</code> is a
     88    * <code>NetworkList</code> object.
     89    *
     90    * @param[in] resource A <code>PP_Resource</code> resource.
     91    *
     92    * @return Returns <code>PP_TRUE</code> if <code>resource</code> is
     93    * a <code>PPB_NetworkList_Private</code>, <code>PP_FALSE</code>
     94    * otherwise.
     95    */
     96   PP_Bool (*IsNetworkList)(PP_Resource resource);
     97   /**
     98    * @return Returns number of available network interfaces or 0 if
     99    * the list has never been updated.
    100    */
    101   uint32_t (*GetCount)(PP_Resource resource);
    102   /**
    103    * @return Returns name for the network interface with the specified
    104    * <code>index</code>.
    105    */
    106   struct PP_Var (*GetName)(PP_Resource resource, uint32_t index);
    107   /**
    108    * @return Returns type of the network interface with the specified
    109    * <code>index</code>.
    110    */
    111   PP_NetworkListType_Private (*GetType)(PP_Resource resource, uint32_t index);
    112   /**
    113    * @return Returns current state of the network interface with the
    114    * specified <code>index</code>.
    115    */
    116   PP_NetworkListState_Private (*GetState)(PP_Resource resource, uint32_t index);
    117   /**
    118    * Gets list of IP addresses for the network interface with the
    119    * specified <code>index</code> and stores them in
    120    * <code>addresses</code>. If the caller didn't allocate sufficient
    121    * space to store all addresses, then only the first
    122    * <code>count</code> addresses are filled in.
    123    *
    124    * @return Returns total number of IP addresses assigned to the
    125    * network interface or a negative error code.
    126    */
    127   int32_t (*GetIpAddresses)(PP_Resource resource,
    128                             uint32_t index,
    129                             struct PP_NetAddress_Private addresses[],
    130                             uint32_t count);
    131   /**
    132    * @return Returns display name for the network interface with the
    133    * specified <code>index</code>.
    134    */
    135   struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index);
    136   /**
    137    * @return Returns MTU for the network interface with the specified
    138    * <code>index</code> or 0 if MTU is unknown.
    139    */
    140   uint32_t (*GetMTU)(PP_Resource resource, uint32_t index);
    141 };
    142 
    143 typedef struct PPB_NetworkList_Private_0_2 PPB_NetworkList_Private;
    144 /**
    145  * @}
    146  */
    147 
    148 #endif  /* PPAPI_C_PRIVATE_PPB_NETWORK_LIST_PRIVATE_H_ */
    149 
    150