Merge the code from tizen_2.4
[platform/core/connectivity/bluetooth-frwk.git] / bt-httpproxy / bt-httpproxy.h
1 /*
2  * Bluetooth-httpproxy-service
3  *
4  * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  C S Bhargava <cs.bhargava@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *              http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __BT_HTTPPROXY_H__
23 #define __BT_HTTPPROXY_H__
24
25 #ifdef HPS_FEATURE
26
27 #define BT_HPS_LE_ADAPTER_INTERFACE     "org.bluez.Adapter1"
28 #define BT_HPS_LE_ADAPTER_PATH "/org/projectx/bt/le/adapter"
29
30 #define BT_HPS_SERVICE_NAME "org.projectx.httpproxy"
31 #define BT_HPS_OBJECT_PATH "/org/projectx/httpproxy"
32 #define BT_HPS_INTERFACE_NAME "org.projectx.httpproxy_service"
33
34 #define BT_HPS_CHAR_INTERFACE "org.bluez.GattCharacteristic1"
35 #define BT_HPS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
36
37 #define BLE_ENABLED "LeEnabled"
38 #define BLE_DISABLED "LeDisabled"
39 #define PROPERTIES_CHANGED "PropertiesChanged"
40
41 /* 512 is the max uri supported by http spec */
42 #define MAX_URI_LENGTH  512
43 /* 512 is the max Header length supported by http spec */
44 #define MAX_HEADER_LENGTH       512
45 /* 512 is the max entity body length supported by http spec */
46 #define MAX_ENTITY_LENGTH       512
47
48
49 /* HTTP Control Point Commands
50    OPTIONS, TRACE, CONNECT are not supported
51 */
52 enum {
53         HTTP_REQUEST_NONE = 0x00,
54         HTTP_GET_REQUEST = 0x01,
55         HTTP_HEAD_REQUEST = 0x02,
56         HTTP_POST_REQUEST = 0x03,
57         HTTP_PUT_REQUEST = 0x04,
58         HTTP_DELETE_REQUEST = 0x05,
59         HTTPS_GET_REQUEST = 0x06,
60         HTTPS_HEAD_REQUEST = 0x07,
61         HTTPS_POST_REQUEST = 0x08,
62         HTTPS_PUT_REQUEST = 0x09,
63         HTTPS_DELETE_REQUEST = 0x0A,
64         HTTP_REQUEST_CANCEL = 0x0B,
65         HTTP_REQUEST_MAX = HTTP_REQUEST_CANCEL
66 };
67
68 enum {
69         DS_NONE = 0x00,
70         DS_HEADER_RECEIVED = 0x01,
71         DS_HEADER_TRUNCATED = 0x02,
72         DS_BODY_RECEIVED = 0x03,
73         DS_BODY_TRUNCATED = 0x04,
74         DS_MAX = DS_BODY_TRUNCATED
75 };
76
77 typedef enum http_request_state_tag {
78         HTTP_REQ_STATE_IDLE = 0x00,
79         HTTP_REQ_STATE_EXECUTED = HTTP_REQ_STATE_IDLE,
80         HTTP_REQ_STATE_INPROGRESS = 0x01,
81 } http_request_state;
82
83
84 // Temporary UUIDs. SIG has to define the UUIDs yet.
85 #define HPS_UUID "00001900-0000-1000-8000-00805f9b34fb"
86 #define HTTP_URI_UUID "00001901-0000-1000-8000-00805f9b34fb"
87 #define HTTP_HDR_UUID "00001902-0000-1000-8000-00805f9b34fb"
88 #define HTTP_ENTITY_UUID "00001903-0000-1000-8000-00805f9b34fb"
89 #define HTTP_CP_UUID "00001904-0000-1000-8000-00805f9b34fb"
90 #define HTTP_STATUS_UUID "00001905-0000-1000-8000-00805f9b34fb"
91 /* CCC descriptor UUID is predefined by SIG */
92 #define HTTP_STATUS_CCC_DESC_UUID "2902"
93 #define HTTP_SECURITY_UUID "00001906-0000-1000-8000-00805f9b34fb"
94
95 void _bt_hps_exit(void);
96 int _bt_hps_prepare_httpproxy(void);
97 int _bt_hps_set_advertising_data(void);
98
99
100 #endif
101
102 #endif