A1 Message Handler update
[ric-app/hw.git] / src / xapp-utils / xapp_config.hpp
1 /*
2 ==================================================================================
3
4         Copyright (c) 2019-2020 AT&T Intellectual Property.
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  * xapp_config.hpp
21  * Created on: 2019
22  * Author: Ashwin Shridharan, Shraboni Jana
23  */
24
25 #ifndef SRC_XAPP_CONFIG_XAPP_CONFIG_HPP_
26 #define SRC_XAPP_CONFIG_XAPP_CONFIG_HPP_
27
28 #include <getopt.h>
29 #include <map>
30 #include <iostream>
31 #include <cstdlib>
32 #include <mdclog/mdclog.h>
33
34 #define DEFAULT_XAPP_NAME "hwxapp"
35 #define DEFAULT_PORT "4560"
36 #define DEFAULT_MSG_MAX_BUFFER "2072"
37 #define DEFAULT_THREADS "1"
38
39 #define DEFAULT_LOG_LEVEL       MDCLOG_WARN
40
41 #define ASN_BUFF_MAX_SIZE               4096
42 #define MAX_SUBSCRIPTION_ATTEMPTS       10
43 #define HELLOWORLD_POLICY_ID 2
44
45 using namespace std;
46
47 struct XappSettings{
48
49 public:
50         typedef enum{
51                   XAPP_ID,
52                   XAPP_NAME,
53                   HW_PORT,
54                   MSG_MAX_BUFFER,
55                   THREADS,
56                   LOG_LEVEL
57         }SettingName;
58
59         void loadDefaultSettings();
60         void loadCmdlineSettings(int, char **);
61         void loadEnvVarSettings();
62         void usage(char*);
63         string& operator[](const SettingName& theName);
64 private:
65         typedef map<SettingName, std::string> SettingCollection;
66         SettingCollection theSettings;
67
68 };
69
70
71
72 #endif /* SRC_XAPP_CONFIG_XAPP_CONFIG_HPP_ */