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_change_log_tag();
37 void net_nfc_manager_init_log();
38 void net_nfc_manager_fini_log();
41 /* allocation memory */
42 void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line);
43 #define _net_nfc_util_alloc_mem(mem,size) __net_nfc_util_alloc_mem((void **)&mem,size, basename(__FILE__), __LINE__)
45 /* allocation memory */
46 void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line);
47 #define _net_nfc_util_strdup(output, origin) __net_nfc_util_strdup(&output, origin, basename(__FILE__), __LINE__)
49 /* free memory, after free given memory it set NULL. Before proceed free, this function also check NULL */
50 void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line);
51 #define _net_nfc_util_free_mem(mem) __net_nfc_util_free_mem((void **)&mem, basename(__FILE__), __LINE__)
53 bool net_nfc_util_alloc_data(data_s *data, uint32_t length);
54 bool net_nfc_util_duplicate_data(data_s *dest, net_nfc_data_s *src);
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__