blob: 63e20bec785d992f6be0ce5cdf4930ac7ecda01c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <assert.h>
#include <stdlib.h>
#include <syslog.h>
#include "audio_thread.h"
#include "cras_apm_list.h"
#include "cras_bt_log.h"
#include "cras_config.h"
#include "cras_dsp.h"
#include "cras_iodev.h"
#include "cras_iodev_list.h"
#include "cras_messages.h"
#include "cras_observer.h"
#include "cras_rclient.h"
#include "cras_rstream.h"
#include "cras_server_metrics.h"
#include "cras_system_state.h"
#include "cras_types.h"
#include "cras_util.h"
#include "stream_list.h"
#include "utlist.h"
/* Removes all streams that the client owns and destroys it. */
void cras_rclient_destroy(struct cras_rclient *client)
{
client->ops->destroy(client);
}
/* Entry point for handling a message from the client. Called from the main
* server context. */
int cras_rclient_buffer_from_client(struct cras_rclient *client,
const uint8_t *buf, size_t buf_len, int fd)
{
struct cras_server_message *msg = (struct cras_server_message *)buf;
if (buf_len < sizeof(*msg))
return -EINVAL;
if (msg->length != buf_len)
return -EINVAL;
client->ops->handle_message_from_client(client, msg, fd);
return 0;
}
/* Sends a message to the client. */
int cras_rclient_send_message(const struct cras_rclient *client,
const struct cras_client_message *msg, int *fds,
unsigned int num_fds)
{
return client->ops->send_message_to_client(client, msg, fds, num_fds);
}
|