Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UDR
Commits
7df3180a
Commit
7df3180a
authored
Feb 23, 2021
by
Keliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some license
parent
b98ec793
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
49 deletions
+78
-49
src/udr_app/main.cpp
src/udr_app/main.cpp
+28
-1
src/udr_app/options.cpp
src/udr_app/options.cpp
+46
-45
src/udr_app/options.hpp
src/udr_app/options.hpp
+4
-3
No files found.
src/udr_app/main.cpp
View file @
7df3180a
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the
*License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! file
brief
author Jian Yang,Fengjiao He,Hongxin Wang
date 2020
email: contact@openairinterface.org
*/
#include "logger.hpp"
#include "options.hpp"
#include "udr_config.hpp"
...
...
@@ -8,7 +36,6 @@ using namespace config;
udr_config
udr_cfg
;
int
main
(
int
argc
,
char
**
argv
)
{
if
(
!
Options
::
parse
(
argc
,
argv
))
{
std
::
cout
<<
"Options::parse() failed"
<<
std
::
endl
;
return
1
;
...
...
src/udr_app/options.cpp
View file @
7df3180a
...
...
@@ -14,12 +14,13 @@
* limitations under the License.
*/
#include "options.hpp"
#include <getopt.h>
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include
"options.hpp"
#include
<iostream>
int
Options
::
options
;
...
...
@@ -45,7 +46,6 @@ void Options::help() {
//------------------------------------------------------------------------------
bool
Options
::
parse
(
int
argc
,
char
**
argv
)
{
bool
ret
=
true
;
ret
=
parseInputOptions
(
argc
,
argv
);
...
...
@@ -72,62 +72,63 @@ bool Options::parseInputOptions(int argc, char **argv) {
// Loop on arguments
while
(
1
)
{
c
=
getopt_long
(
argc
,
argv
,
"horc:"
,
long_options
,
&
option_index
);
if
(
c
==
-
1
)
break
;
// Exit from the loop.
if
(
c
==
-
1
)
break
;
// Exit from the loop.
switch
(
c
)
{
case
'h'
:
{
help
();
exit
(
0
);
break
;
}
case
'c'
:
{
m_libconfigcfg
=
optarg
;
options
|=
libconfigcfg
;
break
;
}
case
'o'
:
{
m_log_stdout
=
true
;
options
|=
log_stdout
;
break
;
}
case
'r'
:
{
m_log_rot_file_log
=
true
;
options
|=
log_rot_file_log
;
break
;
}
case
'?'
:
{
switch
(
optopt
)
{
case
'h'
:
{
help
();
exit
(
0
);
break
;
}
case
'c'
:
{
std
::
cout
<<
"Option -l (libconfig config) requires an argument"
<<
std
::
endl
;
m_libconfigcfg
=
optarg
;
options
|=
libconfigcfg
;
break
;
}
case
'o'
:
{
std
::
cout
<<
"Option -o do not requires an argument, can be also set "
"with option -r."
<<
std
::
endl
;
m_log_stdout
=
true
;
options
|=
log_stdout
;
break
;
}
case
'r'
:
{
std
::
cout
<<
"Option -r do not requires an argument, can be also set "
"with option -o."
<<
std
::
endl
;
m_log_rot_file_log
=
true
;
options
|=
log_rot_file_log
;
break
;
}
default:
{
std
::
cout
<<
"Unrecognized option ["
<<
c
<<
"]"
<<
std
::
endl
;
case
'?'
:
{
switch
(
optopt
)
{
case
'c'
:
{
std
::
cout
<<
"Option -l (libconfig config) requires an argument"
<<
std
::
endl
;
break
;
}
case
'o'
:
{
std
::
cout
<<
"Option -o do not requires an argument, can be also set "
"with option -r."
<<
std
::
endl
;
break
;
}
case
'r'
:
{
std
::
cout
<<
"Option -r do not requires an argument, can be also set "
"with option -o."
<<
std
::
endl
;
break
;
}
default:
{
std
::
cout
<<
"Unrecognized option ["
<<
c
<<
"]"
<<
std
::
endl
;
break
;
}
}
result
=
false
;
break
;
}
default:
{
std
::
cout
<<
"Unrecognized option ["
<<
c
<<
"]"
<<
std
::
endl
;
result
=
false
;
}
result
=
false
;
break
;
}
default:
{
std
::
cout
<<
"Unrecognized option ["
<<
c
<<
"]"
<<
std
::
endl
;
result
=
false
;
}
}
}
return
result
;
...
...
src/udr_app/options.hpp
View file @
7df3180a
...
...
@@ -18,10 +18,11 @@
#define __OPTIONS_H
#include <stdint.h>
#include <string>
class
Options
{
public:
public:
static
bool
parse
(
int
argc
,
char
**
argv
);
static
bool
parseInputOptions
(
int
argc
,
char
**
argv
);
static
bool
parseJson
();
...
...
@@ -31,7 +32,7 @@ public:
static
const
bool
&
getlogRotFilelog
()
{
return
m_log_rot_file_log
;
}
static
const
bool
&
getlogStdout
()
{
return
m_log_stdout
;
}
private:
private:
enum
OptionsSelected
{
libconfigcfg
=
0x01
,
log_stdout
=
0x02
,
...
...
@@ -47,4 +48,4 @@ private:
static
std
::
string
m_libconfigcfg
;
};
#endif // #define __OPTIONS_H
#endif
// #define __OPTIONS_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment