remove common library
[platform/core/connectivity/nfc-manager-neard.git] / common / net_nfc_util_internal.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  *     http://floralicense.org/license/
9  *
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.
15  */
16 #ifndef __NET_NFC_UTIL_INTERNAL_H__
17 #define __NET_NFC_UTIL_INTERNAL_H__
18
19 #include <stdio.h>
20 #include <libgen.h>
21 #include <netinet/in.h>
22
23 #include "net_nfc_typedef_internal.h"
24
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"
28
29
30 typedef enum
31 {
32         CRC_A = 0x00,
33         CRC_B,
34 } CRC_type_e;
35
36 void net_nfc_change_log_tag();
37 void net_nfc_manager_init_log();
38 void net_nfc_manager_fini_log();
39
40 /* Memory utils */
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__)
44
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__)
48
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__)
52
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);
56
57 net_nfc_conn_handover_carrier_state_e net_nfc_util_get_cps(net_nfc_conn_handover_carrier_type_e carrier_type);
58
59 uint8_t *net_nfc_util_get_local_bt_address();
60 void net_nfc_util_enable_bluetooth(void);
61
62 bool net_nfc_util_strip_string(char *buffer, int buffer_length);
63
64 void net_nfc_util_compute_CRC(CRC_type_e CRC_type, uint8_t *buffer, uint32_t length);
65
66 const char *net_nfc_util_get_schema_string(int index);
67
68 #endif //__NET_NFC_UTIL_INTERNAL_H__