2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (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
8 * http://floralicense.org/license/
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.
19 #ifdef SECURITY_SERVER
20 #include "security-server.h"
23 #include "net_nfc_typedef.h"
24 #include "net_nfc_util_gdbus_internal.h"
25 #include "net_nfc_client_se.h"
26 #include "net_nfc_client.h"
27 #include "net_nfc_client_manager.h"
28 #include "net_nfc_client_tag.h"
29 #include "net_nfc_client_ndef.h"
30 #include "net_nfc_client_transceive.h"
31 #include "net_nfc_client_llcp.h"
32 #include "net_nfc_client_snep.h"
33 #include "net_nfc_client_p2p.h"
34 #include "net_nfc_client_system_handler.h"
35 #include "net_nfc_client_handover.h"
37 #ifdef SECURITY_SERVER
38 static uint8_t *cookie;
39 static size_t cookie_len;
41 static void _init_smack()
44 cookie_len = security_server_get_cookie_size();
46 cookie = g_new0(uint8_t, cookie_len);
48 if (security_server_request_cookie((char*)cookie, cookie_len) < 0) {
57 static void _deinit_smack()
66 GVariant *net_nfc_client_gdbus_get_privilege()
68 #ifdef SECURITY_SERVER
69 return net_nfc_util_gdbus_buffer_to_variant(cookie, cookie_len);
71 return net_nfc_util_gdbus_buffer_to_variant(NULL, 0);
75 void net_nfc_client_gdbus_init(void)
77 #ifdef SECURITY_SERVER
80 if (net_nfc_client_manager_init() != NET_NFC_OK)
82 if (net_nfc_client_tag_init() != NET_NFC_OK)
84 if (net_nfc_client_ndef_init() != NET_NFC_OK)
86 if (net_nfc_client_transceive_init() != NET_NFC_OK)
88 if (net_nfc_client_llcp_init() != NET_NFC_OK)
90 if (net_nfc_client_snep_init() != NET_NFC_OK)
92 if (net_nfc_client_p2p_init() != NET_NFC_OK)
94 if (net_nfc_client_sys_handler_init() != NET_NFC_OK)
96 if (net_nfc_client_se_init() != NET_NFC_OK)
98 if(net_nfc_client_handover_init() != NET_NFC_OK)
102 void net_nfc_client_gdbus_deinit(void)
104 net_nfc_client_handover_deinit();
105 net_nfc_client_se_deinit();
106 net_nfc_client_sys_handler_deinit();
107 net_nfc_client_p2p_deinit();
108 net_nfc_client_snep_deinit();
109 net_nfc_client_llcp_deinit();
110 net_nfc_client_transceive_deinit();
111 net_nfc_client_ndef_deinit();
112 net_nfc_client_tag_deinit();
113 net_nfc_client_manager_deinit();
114 #ifdef SECURITY_SERVER