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