summaryrefslogtreecommitdiff
path: root/cras/src/server/cras_server.h
blob: a7dfa63960713a57652ea0287e012f85660194de (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
/* 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.
 */

/*
 * The CRAS server instance.
 */
#ifndef CRAS_SERVER_H_
#define CRAS_SERVER_H_

/*
 * Bitmask for cras_server_run() argument profile_disable_mask
 */
#define CRAS_SERVER_PROFILE_MASK_HFP (1 << 0)
#define CRAS_SERVER_PROFILE_MASK_HSP (1 << 1)
#define CRAS_SERVER_PROFILE_MASK_A2DP (1 << 2)

/* Reserver client id 0-15 for internal server usage. */
#define RESERVED_CLIENT_IDS 16
#define SERVER_STREAM_CLIENT_ID 0

struct cras_client_message;

/* Initialize some server setup. Mainly to add the select handler first
 * so that client callbacks can be registered before server start running.
 */
int cras_server_init();

/* Runs the CRAS server.  Open the main socket and begin listening for
 * connections and for messages from clients that have connected.
 */
int cras_server_run(unsigned int profile_disable_mask);

/* Send a message to all attached clients. */
void cras_server_send_to_all_clients(const struct cras_client_message *msg);

#endif /* CRAS_SERVER_H_ */