1 /* *****************************************************************
3 * Copyright 2017 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * *****************************************************************/
21 #ifndef SVRDBEDITOR_COMMON_H_
22 #define SVRDBEDITOR_COMMON_H_
24 #include "iotivity_config.h"
31 #include "securevirtualresourcetypes.h"
33 #define TAG "OIC_SVR_DB_EDITOR"
35 #define BOLD_BEGIN "\033[1m"
36 #define RED_BEGIN "\033[1;31m"
37 #define YELLOW_BEGIN "\033[1;33m"
38 #define CYAN_BEGIN "\033[1;36m"
39 #define GREEN_BEGIN "\033[1;92m"
40 #define COLOR_END "\033[0m"
41 #define COLOR_END_NL "\033[0m\n"
43 #define SVR_MAX_ENTITY (16)
45 #define SVR_DB_PATH_LENGTH (1024)
46 #define PRINT_ERR(fmt,...) printf(RED_BEGIN "error: " fmt COLOR_END_NL, ##__VA_ARGS__)
47 #define PRINT_WARN(fmt,...) printf(YELLOW_BEGIN "warning : " fmt COLOR_END_NL, ##__VA_ARGS__)
48 #define PRINT_INFO(fmt,...) printf(YELLOW_BEGIN fmt COLOR_END_NL, ##__VA_ARGS__)
49 #define PRINT_PROG(fmt,...) printf(BOLD_BEGIN fmt COLOR_END, ##__VA_ARGS__)
50 #define PRINT_DATA(fmt,...) printf(CYAN_BEGIN fmt COLOR_END, ##__VA_ARGS__)
51 #define PRINT_NORMAL(fmt,...) printf(fmt, ##__VA_ARGS__)
52 #define PRINT_NL() printf("\n");
54 typedef enum SubOperationType
60 SVR_EDIT_IDX_SIZE = 5,
64 void PrintUuid(const OicUuid_t *uuid);
65 void PrintIntArray(const int *array, size_t length);
66 void PrintStringArray(const char **array, size_t length);
67 void PrintInt(int value);
68 void PrintString(const char *text);
69 void PrintBuffer(const uint8_t *buf, size_t bufLen);
71 int InputNumber(const char *infoText);
72 char *InputString(const char *infoText);
73 int InputUuid(OicUuid_t *uuid);
75 #endif /* SVRDBEDITOR_COMMON_H_ */