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.
16 #ifndef __NET_NFC_UTIL_INTERNAL_H__
17 #define __NET_NFC_UTIL_INTERNAL_H__
21 #include <netinet/in.h>
23 /* For multi-user support */
24 #include <tzplatform_config.h>
26 #include "net_nfc_typedef_internal.h"
28 #define NET_NFC_MANAGER_DATA_PATH tzplatform_mkpath(TZ_SYS_DATA, "nfc-manager-daemon")
29 #define NET_NFC_MANAGER_DATA_PATH_MESSAGE "message"
30 #define NET_NFC_MANAGER_NDEF_FILE_NAME "ndef-message.txt"
39 void net_nfc_change_log_tag();
42 /* allocation memory */
43 void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line);
44 #define _net_nfc_util_alloc_mem(mem,size) __net_nfc_util_alloc_mem((void **)&mem,size, basename(__FILE__), __LINE__)
46 /* allocation memory */
47 void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line);
48 #define _net_nfc_util_strdup(output, origin) __net_nfc_util_strdup(&output, origin, basename(__FILE__), __LINE__)
50 /* free memory, after free given memory it set NULL. Before proceed free, this function also check NULL */
51 void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line);
52 #define _net_nfc_util_free_mem(mem) __net_nfc_util_free_mem((void **)&mem, basename(__FILE__), __LINE__)
54 bool net_nfc_util_alloc_data(data_s *data, uint32_t length);
55 void net_nfc_util_free_data(data_s *data);
57 net_nfc_conn_handover_carrier_state_e net_nfc_util_get_cps(net_nfc_conn_handover_carrier_type_e carrier_type);
59 uint8_t *net_nfc_util_get_local_bt_address();
60 void net_nfc_util_enable_bluetooth(void);
62 bool net_nfc_util_strip_string(char *buffer, int buffer_length);
64 void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t *buffer, uint32_t length);
66 const char *net_nfc_util_get_schema_string(int index);
68 #endif //__NET_NFC_UTIL_INTERNAL_H__