Modify dbus policies
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / hardware / bt_sock.h
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef ANDROID_INCLUDE_BT_SOCK_H
18 #define ANDROID_INCLUDE_BT_SOCK_H
19
20 __BEGIN_DECLS
21
22 #define BTSOCK_FLAG_ENCRYPT 1
23 #define BTSOCK_FLAG_AUTH (1 << 1)
24
25 typedef enum {
26         BTSOCK_RFCOMM = 1,
27         BTSOCK_SCO = 2,
28         BTSOCK_L2CAP = 3
29 } btsock_type_t;
30
31 /** Represents the standard BT SOCKET interface. */
32 typedef struct {
33         short size;
34         bt_bdaddr_t bd_addr;
35         int channel;
36         int status;
37 } __attribute__((packed)) sock_connect_signal_t;
38
39 typedef struct {
40
41         /** set to size of this struct*/
42         size_t          size;
43         /**
44          * listen to a rfcomm uuid or channel. It returns the socket fd from which
45          * btsock_connect_signal can be read out when a remote device connected
46          */
47         bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags);
48         /*
49          * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which
50          * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected
51          */
52         bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags);
53
54 } btsock_interface_t;
55
56 __END_DECLS
57
58 #endif /* ANDROID_INCLUDE_BT_SOCK_H */