Add set/get values implementation and test file for that
[platform/core/api/asp.git] / src / include / asp-util.h
1 /*
2  * Application Service Platform(ASP)
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 /**
21  * This file declares macros for usefuls.
22  *
23  * @file        asp-util.h
24  * @author      Jiung Yu (jiung.yu.com)
25  * @version     0.1
26  */
27
28 #ifndef __ASP_UTIL_H__
29 #define __ASP_UTIL_H__
30
31 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
32 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
33 #define IP2STR(a) (a)[0], (a)[1], (a)[2], (a)[3]
34 #define IPSTR "%d.%d.%d.%d"
35 #define MAC2SECSTR(a) (a)[0], (a)[4], (a)[5]
36 #define MACSECSTR "%02x:%02x:%02x"
37 #define IP2SECSTR(a) (a)[0], (a)[3]
38 #define IPSECSTR "%d..%d"
39
40 #define MACSTR_LEN 18
41 #define MACADDR_LEN 6
42 #define IP_LEN 6
43 #define IPSTR_LEN 16
44 #define WPS_PIN_LEN 8
45
46 #define TIZEN_FEATURE_P2PS "tizen.org/feature/network.asp"
47
48 #if 0
49 #define CHECK_FEATURE_SUPPORTED(feature_name)\
50         do {\
51                 bool feature_supported = FALSE;\
52                 if (!system_info_get_platform_bool(feature_name, &feature_supported)) {\
53                         if (feature_supported == FALSE) {\
54                                 LOGE("%s feature is disabled", feature_name);\
55                                 return P2PS_ERROR_NOT_SUPPORTED;\
56                         } \
57                 } else {\
58                         LOGE("Error - Feature getting from System Info");\
59                         return P2PS_ERROR_OPERATION_FAILED;\
60                 } \
61         } while (0)
62
63 #else
64 #define CHECK_FEATURE_SUPPORTED(feature_name)
65 #endif
66
67 #endif /** __ASP_UTIL_H__ */