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 #include "net_nfc_typedef_internal.h"
25 #define NET_NFC_MANAGER_DATA_PATH "/opt/data/nfc-manager-daemon"
26 #define NET_NFC_MANAGER_DATA_PATH_MESSAGE "message"
27 #define NET_NFC_MANAGER_NDEF_FILE_NAME "ndef-message.txt"
36 void net_nfc_manager_init_log();
37 void net_nfc_manager_fini_log();
40 /* allocation memory */
41 void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line);
42 #define _net_nfc_util_alloc_mem(mem,size) __net_nfc_util_alloc_mem((void **)&mem,size, basename(__FILE__), __LINE__)
44 /* allocation memory */
45 void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line);
46 #define _net_nfc_util_strdup(output, origin) __net_nfc_util_strdup(&output, origin, basename(__FILE__), __LINE__)
48 /* free memory, after free given memory it set NULL. Before proceed free, this function also check NULL */
49 void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line);
50 #define _net_nfc_util_free_mem(mem) __net_nfc_util_free_mem((void **)&mem, basename(__FILE__), __LINE__)
52 bool net_nfc_util_alloc_data(data_s *data, uint32_t length);
53 bool net_nfc_util_duplicate_data(data_s *dest, net_nfc_data_s *src);
54 void net_nfc_util_free_data(data_s *data);
56 net_nfc_conn_handover_carrier_state_e net_nfc_util_get_cps(net_nfc_conn_handover_carrier_type_e carrier_type);
58 uint8_t *net_nfc_util_get_local_bt_address();
59 void net_nfc_util_enable_bluetooth(void);
61 bool net_nfc_util_strip_string(char *buffer, int buffer_length);
63 void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t *buffer, uint32_t length);
65 const char *net_nfc_util_get_schema_string(int index);
67 #endif //__NET_NFC_UTIL_INTERNAL_H__