From: h.sandeep Date: Tue, 31 May 2016 10:17:01 +0000 (+0530) Subject: DPM: Add Error code for device policy restriction. X-Git-Tag: submit/tizen/20160602.083956~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a32ca17365d4acf1332a8960fc74316b075237f1;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git DPM: Add Error code for device policy restriction. Added the Error code "BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION". Change-Id: I303860eff6a5df40dccf641df390552d2c4cdb43 Signed-off-by: h.sandeep --- diff --git a/bt-api/bt-audio.c b/bt-api/bt-audio.c index 054c7c59..254c5df6 100644 --- a/bt-api/bt-audio.c +++ b/bt-api/bt-audio.c @@ -92,13 +92,13 @@ BT_EXPORT_API int bluetooth_audio_connect(bluetooth_device_address_t *remote_add #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED && _bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use HSP / A2DP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } else if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use HSP profile"); service_function = BT_AV_CONNECT; @@ -116,7 +116,7 @@ BT_EXPORT_API int bluetooth_audio_connect(bluetooth_device_address_t *remote_add if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { BT_ERR("Reject a authorization due to MDM Policy"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } } #endif @@ -186,12 +186,12 @@ BT_EXPORT_API int bluetooth_ag_connect(bluetooth_device_address_t *remote_addres #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use HSP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { @@ -203,7 +203,7 @@ BT_EXPORT_API int bluetooth_ag_connect(bluetooth_device_address_t *remote_addres if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { BT_ERR("Reject a authorization due to MDM Policy"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } } #endif @@ -273,12 +273,12 @@ BT_EXPORT_API int bluetooth_av_connect(bluetooth_device_address_t *remote_addres #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use A2DP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { @@ -290,7 +290,7 @@ BT_EXPORT_API int bluetooth_av_connect(bluetooth_device_address_t *remote_addres if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { BT_ERR("Reject a authorization due to MDM Policy"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } } #endif @@ -329,12 +329,12 @@ BT_EXPORT_API int bluetooth_av_source_connect(bluetooth_device_address_t *remote #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_A2DP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use A2DP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -449,7 +449,7 @@ BT_EXPORT_API int bluetooth_ag_set_speaker_gain(unsigned int speaker_gain) #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use HSP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED;; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif diff --git a/bt-api/bt-avrcp.c b/bt-api/bt-avrcp.c index 2ec65360..4dc71732 100644 --- a/bt-api/bt-avrcp.c +++ b/bt-api/bt-avrcp.c @@ -75,7 +75,7 @@ BT_EXPORT_API int bluetooth_media_player_change_property( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -104,7 +104,7 @@ BT_EXPORT_API int bluetooth_media_player_set_properties( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -133,7 +133,7 @@ BT_EXPORT_API int bluetooth_media_player_change_track( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -231,12 +231,12 @@ BT_EXPORT_API int bluetooth_media_control_connect( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -303,7 +303,7 @@ BT_EXPORT_API int bluetooth_media_control_command( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -331,7 +331,7 @@ BT_EXPORT_API int bluetooth_media_control_set_property( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -363,7 +363,7 @@ BT_EXPORT_API int bluetooth_media_control_get_property( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -396,7 +396,7 @@ BT_EXPORT_API int bluetooth_media_control_get_track_info( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use AVRCP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif diff --git a/bt-api/bt-device.c b/bt-api/bt-device.c index 85701aa1..d6bf2dac 100644 --- a/bt-api/bt-device.c +++ b/bt-api/bt-device.c @@ -43,12 +43,12 @@ BT_EXPORT_API int bluetooth_bond_device(const bluetooth_device_address_t *device #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_PAIRING, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to pair the device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif diff --git a/bt-api/bt-hid.c b/bt-api/bt-hid.c index e0693f74..6616778c 100644 --- a/bt-api/bt-hid.c +++ b/bt-api/bt-hid.c @@ -77,12 +77,12 @@ BT_EXPORT_API int bluetooth_hid_connect(hid_device_address_t *device_address) #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, device_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_UUID, BT_HID_UUID) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist uuid"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif diff --git a/bt-api/bt-network.c b/bt-api/bt-network.c index 4b79358c..88af2725 100644 --- a/bt-api/bt-network.c +++ b/bt-api/bt-network.c @@ -80,7 +80,7 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de char *uuid = NULL; if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } switch (role) { @@ -100,10 +100,10 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de if (_bt_check_dpm(BT_DPM_UUID, uuid) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist uuid"); g_free(uuid); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } - if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { + if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { char address[BT_ADDRESS_STRING_SIZE] = { 0 }; bluetooth_device_class_t dev_class; @@ -112,7 +112,7 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { BT_ERR("Reject a authorization due to MDM Policy"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } } g_free(uuid); diff --git a/bt-api/bt-opp-client.c b/bt-api/bt-opp-client.c index e5b5ac54..014806f0 100644 --- a/bt-api/bt-opp-client.c +++ b/bt-api/bt-opp-client.c @@ -80,12 +80,12 @@ BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_ad #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, remote_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_OPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to send files"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { @@ -97,7 +97,7 @@ BT_EXPORT_API int bluetooth_opc_push_files(bluetooth_device_address_t *remote_ad if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { BT_ERR("Reject a authorization due to MDM Policy"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } } #endif diff --git a/bt-api/bt-rfcomm-client.c b/bt-api/bt-rfcomm-client.c index d6d7c340..abe7a65f 100644 --- a/bt-api/bt-rfcomm-client.c +++ b/bt-api/bt-rfcomm-client.c @@ -574,13 +574,13 @@ BT_EXPORT_API int bluetooth_rfcomm_connect( #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_bt_address) == BT_DPM_RESTRICTED) { BT_ERR("Blacklist device"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED || _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to connect the RFCOMM service"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { @@ -592,7 +592,7 @@ BT_EXPORT_API int bluetooth_rfcomm_connect( if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { BT_ERR("Reject a authorization due to MDM Policy"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } } #endif @@ -851,7 +851,7 @@ BT_EXPORT_API int bluetooth_rfcomm_write(int fd, const char *buf, int length) if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED || _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to write RFCOMM data"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif diff --git a/bt-api/bt-rfcomm-server.c b/bt-api/bt-rfcomm-server.c index 4d7ffeaa..b5421702 100644 --- a/bt-api/bt-rfcomm-server.c +++ b/bt-api/bt-rfcomm-server.c @@ -392,7 +392,7 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket(const char *uuid) #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use SPP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -448,7 +448,7 @@ BT_EXPORT_API int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use SPP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -683,7 +683,7 @@ BT_EXPORT_API int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pend #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use SPP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -742,7 +742,7 @@ BT_EXPORT_API int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int ma #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use SPP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -785,7 +785,7 @@ BT_EXPORT_API int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connect #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use SPP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif @@ -851,7 +851,7 @@ BT_EXPORT_API int bluetooth_rfcomm_accept_connection(int server_fd) #ifdef TIZEN_DPM_ENABLE if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED) { BT_ERR("Not allow to use SPP profile"); - return BLUETOOTH_ERROR_ACCESS_DENIED; + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; } #endif diff --git a/include/bluetooth-api.h b/include/bluetooth-api.h index 20f3a48e..f69ee09d 100644 --- a/include/bluetooth-api.h +++ b/include/bluetooth-api.h @@ -165,6 +165,9 @@ extern "C" { #define BLUETOOTH_ERROR_NOT_INITIALIZED ((int)BLUETOOTH_ERROR_BASE - 0x26) /**< Not initialized */ +#define BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION ((int)BLUETOOTH_ERROR_BASE - 0x27) + /**< Device Policy Restricted */ + /** * Device disconnect reason */ @@ -1538,7 +1541,7 @@ typedef enum { BLUETOOTH_DPM_RESULT_ACCESS_DENIED = -4, /**< DPM API result access denied. */ BLUETOOTH_DPM_RESULT_INVALID_PARAM = -3, /**< DPM API result invalid parameter. */ BLUETOOTH_DPM_RESULT_NOT_SUPPORTED = -2, /**< DPM API result not supported. */ - BLUETOOTH_DPM_RESULT_FAIL = -1, /**< DPM API result fail. */ + BLUETOOTH_DPM_RESULT_FAIL = -1, /**< DPM API result fail. */ BLUETOOTH_DPM_RESULT_SUCCESS = 0, /**< DPM API result success. */ } bt_dpm_result_t; @@ -1549,11 +1552,11 @@ typedef enum { typedef enum { BLUETOOTH_DPM_STATUS_ERROR = -1, - BLUETOOTH_DPM_ALLOWED = 0, /**< DPM Policy status allowed. */ + BLUETOOTH_DPM_ALLOWED = 0, /**< DPM Policy status allowed. */ BLUETOOTH_DPM_RESTRICTED = 1, /**< DPM Policy status restricted. */ BLUETOOTH_DPM_ENABLE = 1, /**< DPM Policy status enabled. */ - BLUETOOTH_DPM_DISABLE = 0, /**< DPM Policy status disabled. */ + BLUETOOTH_DPM_DISABLE = 0, /**< DPM Policy status disabled. */ BLUETOOTH_DPM_FALSE = 0, /**< DPM Policy status false. */ BLUETOOTH_DPM_TRUE = 1, /**< DPM Policy status true. */