Home | History | Annotate | Download | only in trusted
      1 /* Copyright (c) 2011 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 trusted/ppp_broker.idl modified Sat Jul 16 16:51:03 2011. */
      7 
      8 #ifndef PPAPI_C_TRUSTED_PPP_BROKER_H_
      9 #define PPAPI_C_TRUSTED_PPP_BROKER_H_
     10 
     11 #include "ppapi/c/pp_macros.h"
     12 
     13 /**
     14  * @file
     15  * This file defines functions that your module must implement to support a
     16  * broker.
     17  */
     18 
     19 
     20 // {PENDING: undefine PP_EXPORT?}
     21 
     22 #include "ppapi/c/pp_instance.h"
     23 #include "ppapi/c/pp_stdint.h"
     24 
     25 
     26 #if __GNUC__ >= 4
     27 
     28 #define PP_EXPORT __attribute__ ((visibility("default")))
     29 #elif defined(_MSC_VER)
     30 #define PP_EXPORT __declspec(dllexport)
     31 #endif
     32 
     33 
     34 
     35 /* We don't want name mangling for these external functions.  We only need
     36  * 'extern "C"' if we're compiling with a C++ compiler.
     37  */
     38 #ifdef __cplusplus
     39 extern "C" {
     40 #endif
     41 
     42 /**
     43  * @addtogroup Typedefs
     44  * @{
     45  */
     46 
     47 /**
     48  * PP_ConnectInstance_Func defines the signature that you implement to
     49  * receive notifications when a plugin instance connects to the broker.
     50  * The broker should listen on the socket before returning.
     51  *
     52  * @param[in] instance The plugin instance connecting to the broker.
     53  * @param[in] handle Handle to a socket the broker can use to communicate with
     54  * the plugin.
     55  * @return PP_OK on success. Any other value on failure.
     56  */
     57 typedef int32_t (*PP_ConnectInstance_Func)(PP_Instance instance,
     58                                            int32_t handle);
     59 /**
     60  * @}
     61  */
     62 
     63 /**
     64  * @addtogroup Functions
     65  * @{
     66  */
     67 
     68 /**
     69  * PPP_InitializeBroker() is the entry point for a broker and is
     70  * called by the browser when your module loads. Your code must implement this
     71  * function.
     72  *
     73  * Failure indicates to the browser that this broker can not be used. In this
     74  * case, the broker will be unloaded.
     75  *
     76  * @param[out] connect_instance_func A pointer to a connect instance function.
     77  * @return PP_OK on success. Any other value on failure.
     78 */
     79 PP_EXPORT int32_t PPP_InitializeBroker(
     80     PP_ConnectInstance_Func* connect_instance_func);
     81 /**
     82  * @}
     83  */
     84 
     85 /**
     86  * @addtogroup Functions
     87  * @{
     88  */
     89 
     90 /** PPP_ShutdownBroker() is called before the broker is unloaded.
     91  */
     92 PP_EXPORT void PPP_ShutdownBroker();
     93 /**
     94  * @}
     95  */
     96 
     97 #ifdef __cplusplus
     98 }  /* extern "C" */
     99 #endif
    100 
    101 #endif  /* PPAPI_C_TRUSTED_PPP_BROKER_H_ */
    102 
    103