2013-10-22 02:56:48 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
|
|
*
|
2014-02-12 02:42:56 +08:00
|
|
|
* Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
|
2013-10-22 02:56:48 +08:00
|
|
|
*
|
|
|
|
*
|
2014-02-12 02:42:56 +08:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2013-10-22 02:56:48 +08:00
|
|
|
*
|
2014-02-12 02:42:56 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2013-10-22 02:56:48 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-02-12 02:42:56 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2013-10-22 02:56:48 +08:00
|
|
|
*
|
2014-02-12 02:42:56 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2013-10-22 02:56:48 +08:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-12-02 20:20:40 +08:00
|
|
|
struct ipc_handler {
|
|
|
|
void (*handler) (const void *buf, uint16_t len);
|
|
|
|
bool var_len;
|
|
|
|
size_t data_len;
|
|
|
|
};
|
2013-12-31 18:39:09 +08:00
|
|
|
|
|
|
|
struct service_handler {
|
|
|
|
const struct ipc_handler *handler;
|
|
|
|
uint8_t size;
|
|
|
|
};
|
|
|
|
|
2014-02-24 20:44:12 +08:00
|
|
|
struct ipc;
|
|
|
|
|
2014-02-18 21:05:14 +08:00
|
|
|
typedef void (*ipc_disconnect_cb) (void *data);
|
|
|
|
|
|
|
|
struct ipc *ipc_init(const char *path, size_t size, int max_service_id,
|
2014-02-18 22:53:25 +08:00
|
|
|
bool notifications,
|
2014-02-18 21:05:14 +08:00
|
|
|
ipc_disconnect_cb cb, void *cb_data);
|
2014-02-24 20:44:12 +08:00
|
|
|
void ipc_cleanup(struct ipc *ipc);
|
|
|
|
|
|
|
|
void ipc_send_rsp(struct ipc *ipc, uint8_t service_id, uint8_t opcode,
|
|
|
|
uint8_t status);
|
|
|
|
void ipc_send_rsp_full(struct ipc *ipc, uint8_t service_id, uint8_t opcode,
|
|
|
|
uint16_t len, void *param, int fd);
|
|
|
|
void ipc_send_notif(struct ipc *ipc, uint8_t service_id, uint8_t opcode,
|
|
|
|
uint16_t len, void *param);
|
|
|
|
void ipc_register(struct ipc *ipc, uint8_t service,
|
|
|
|
const struct ipc_handler *handlers, uint8_t size);
|
|
|
|
void ipc_unregister(struct ipc *ipc, uint8_t service);
|