summaryrefslogtreecommitdiff
path: root/cras/src/server/cras_capture_rclient.c
blob: 9b1f2b84d5013f944a87c333c3ada611b91d0f91 (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
/* Copyright 2019 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 <syslog.h>

#include "cras_iodev_list.h"
#include "cras_messages.h"
#include "cras_observer.h"
#include "cras_rclient.h"
#include "cras_rclient_util.h"
#include "cras_rstream.h"
#include "cras_types.h"
#include "cras_util.h"

/* Declarations of cras_rclient operators for cras_capture_rclient. */
static const struct cras_rclient_ops cras_capture_rclient_ops = {
	.handle_message_from_client = rclient_handle_message_from_client,
	.send_message_to_client = rclient_send_message_to_client,
	.destroy = rclient_destroy,
};

/*
 * Exported Functions.
 */

/* Creates a client structure and sends a message back informing the client that
 * the connection has succeeded. */
struct cras_rclient *cras_capture_rclient_create(int fd, size_t id)
{
	return rclient_generic_create(
		fd, id, &cras_capture_rclient_ops,
		cras_stream_direction_mask(CRAS_STREAM_INPUT));
}