-
Notifications
You must be signed in to change notification settings - Fork 4
Sending attributes from <auth>/send section. #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HelenMamontova
wants to merge
174
commits into
madf:master
Choose a base branch
from
HelenMamontova:radius
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
174 commits
Select commit
Hold shift + click to select a range
1e0e67c
Radius. Header file <mutex>, <jthread.hpp> added. Functions start, stop
HelenMamontova 2f28e07
Radius. Header files added. Functions Start, Stop, Run definition added.
HelenMamontova 3818eac
Radius. New files server.h, server.cpp added.
HelenMamontova 4bd3439
Radius. Definition of functions startReceive, makeResponse, handleSend,
HelenMamontova 69c2f83
The Run function name fixed. Definition of secret variable sdded.
HelenMamontova dca0d95
The file server.cpp added to add_library command, command
HelenMamontova 6a7ea1e
Parameter token added to function Run() declaration.
HelenMamontova 85a5b66
Radius. Method Start: variable isRunning=true removed, m_thread
HelenMamontova 713a4ce
Radius. Hold the mutex removed,extra conditions
HelenMamontova c8ee14f
Radius. Cycle while removed in function Run.
HelenMamontova f366de0
Radius. The variables isRunning, errorStr replaced by m_running,
HelenMamontova 98fdb4b
Radius. The variable isRunning replaced by m_running in function Run.
HelenMamontova 6623d7e
Radius. Object name io_service changed to ioService in the function Run.
HelenMamontova c940134
Method SetRunning declaration added to the class RADIUS.
HelenMamontova 759e5f2
Method SetRunning definition added. Method SetRunning call added to
HelenMamontova dbd8db4
Radius. Namespace STG added.
HelenMamontova d3491db
Radius. Declaration using STG::Server added.
HelenMamontova 6db11a3
Radius. Header file "stg/logger.h" added. RADIUS class member m_loger…
HelenMamontova fdb7811
Radius. Header file "stg/common.h" added. Initialization of m_logger
HelenMamontova d43fcaf
Radius. Variable except added, messages fixed in the function Run.
HelenMamontova 8284ccc
Radius. Thread join logic fixed in the function Stop.
HelenMamontova 65caf3d
Keyword const added to std::lock_guard in the function SetRunning.
HelenMamontova 74a2013
Radius. Class member m_mutex moved to the top of list.
HelenMamontova 9d2b564
Radius. Class member m_logger put after the m_running.
HelenMamontova fd6655c
Radius. Unnecessary variable except removed in the function Run.
HelenMamontova 8e041be
Radius. Extra whitespace removed in the function Stop. Function
HelenMamontova aef4a94
Radius. Function IsRunning declaration changed.
HelenMamontova 2692423
Radius. Formatting fixed.
HelenMamontova fc12e51
Radius. Extra symbols '//' removed.
HelenMamontova b969155
Radius. Class member m_running initialization added to constructor
HelenMamontova d430e66
Radius.Header file "stg/module_settings.h" added. Class members variable
HelenMamontova 2c11cad
Radius. The parameters Secret, Dictionaries added, parameter Port
HelenMamontova 0caf1b8
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova a79c030
Radius. Header files added. Class RAD_SETTINGS added. Methods
HelenMamontova 014c78d
Radius. Parameter default changed to optional and parameters value
HelenMamontova 1ff4563
Radius. Description of parameters secret, port, dictionaries changed.
HelenMamontova b2264e8
Radius. Copy constructor RADIUS and assignment operator declaration
HelenMamontova a4ff4c9
Radius. Class member m_mutex moved to the top of section private.
HelenMamontova f35612b
Radius. The m_port variable value initialization changed to 1812,
HelenMamontova 4c782bc
Radius. Check for missing parameters port and dictionaries removed in…
HelenMamontova 7505bfc
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova 0889076
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova b4a5568
Radius. The dist directory added.
HelenMamontova f852128
Radius. The methods declaration stop and start added.
HelenMamontova d89cd5e
Radius. The methods stop, start definition added. Method start call
HelenMamontova 22b6a97
Radius. The header files "server.h", <boost/asio.hpp>, <memory> added.
HelenMamontova b137bad
Radius. The header files "server", <boost/asio.hpp>, <string> removed.
HelenMamontova d833278
Radius. Header files <stop_token> and <jthread.hpp> added. Parameter
HelenMamontova af7b211
Radius. Parameter token and m_token class member initialization added…
HelenMamontova d1f81ba
Radius. The m_server class member initialization removed.
HelenMamontova 2961aec
Radius. The m_server->stop() call adnd m_thread.request_stop() call
HelenMamontova 881c2fd
Radius. Header file "stg/logger.h" added. Class member m_logger added to
HelenMamontova 7e273c9
Radius. Header file "stg/common.h" added, header file <iostream>
HelenMamontova dc45849
Radius. Class member m_logger initialization changed in the constructor
HelenMamontova b29a918
Radius. Check token added to handleReceive method.
HelenMamontova a69f043
Radius. Header file <stop_token> replaced by <stop_token.hpp>, header
HelenMamontova 46c4133
Radius. Parameter m_logger added to constructor Server call in the
HelenMamontova 095f460
Radius. Parameter logger added to constructor Server declaration. Class
HelenMamontova db47a07
Radius. Parameter logger added to constructor Server definition. Class
HelenMamontova 2f1a11c
Radius. Extra whitespace removed ib the method Run.
HelenMamontova a110cf6
Radius. The order of operations changed in the method handleSend.
HelenMamontova 4b86c90
Radius. The order of operations changed in the method handleReceive.
HelenMamontova 01225c4
Radius. Operator return removed when checking ec, operator else removed
HelenMamontova c2aaf5e
Radius. Parameter token replaced by std::move(token) in the construct…
HelenMamontova bb71551
Radius. Class member m_token initialization value changed to
HelenMamontova 129fc5c
Radius. The c_str() function added to message when checking error in the
HelenMamontova 7c1cc07
Radius. Header file <cstring> added.
HelenMamontova 627c306
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova 5d9d30e
Radius. Header files "stg/users.h", "stg/user.h", "stg/user_property.h"
HelenMamontova 9cce8e2
Radius. Header files "radproto/attribute_types.h", <cstdint> added.
HelenMamontova 0ff99e1
Radius. Getting the values of login and password fixed in the function
HelenMamontova 6d03d72
Radius. Using statements added. Method SetUsers added, variable class
HelenMamontova 24cf9ce
Radius. The class member variable m_users initialization added to
HelenMamontova e0d0c90
Radius. Parameter users added to constructir Server declaration.
HelenMamontova 2c18f40
Radius. Parameter users added to constructor Server definition. Variable
HelenMamontova 2ab70c7
Radius. Function c_str added to login and password in m_logger and
HelenMamontova 6f03749
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova 86af31d
Radius. Extra functions printfd removed.
HelenMamontova 42c0748
Radius. The using declaration for UserPtr, ConstUserPtr removed.
HelenMamontova 0173c0b
Radius. Looking for user moved after check request type in the
HelenMamontova 8422222
Radius. The using declaration for UserPtr, ConstUserPtr removed. Header
HelenMamontova dc85736
Radius. Header files "stg/user.h", "stg/users.h" added.
HelenMamontova 5ae59ee
Radius. Function findUser moved to private.
HelenMamontova cf4f88c
Radius. Return type of function findUser changed to bool.
HelenMamontova 52714c2
Radius. Return type of function findUser definition and call changed …
HelenMamontova e047e61
Radius. Variables attributesEmpty, vendorSpecificEmpty added for packet
HelenMamontova 84ac11e
Radius. Type STG::Users* replaced by Users* in parameter users in the
HelenMamontova 37b47b2
Radius. Condition and code order changed when packet is returned in
HelenMamontova da54173
Radius. Unnecessary variables attributeEmpty, vendorSpecificEmpty
HelenMamontova 5e03dd0
Radius. Prefix STG of user object removed, user is initialized by
HelenMamontova a12adbd
Radius. Extra printfd function call removed in the function findUser.
HelenMamontova 15ff937
Radius. The way of initializing the object user changed in the findUser
HelenMamontova 92e202f
Radius. Prefix STG of class member m_users and of parameter u in
HelenMamontova f6eb048
Radius. Prefix STG of class member m_users and of parameter users
HelenMamontova ba3ad7b
Radius. The messages of m_logger and printfd changed in function
HelenMamontova 36ecbb6
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova 3ea9d0a
Radius. Search for parameters auth and send added to the ParseSetting…
HelenMamontova 0db4900
Radius. Extra whitespace removed, unnecessary variables sendValue and
HelenMamontova e2c5027
Radius. The struct AttrValue added.
HelenMamontova ae2a068
Radius. Header files <boost/tokenizer.hpp>, <vector>, <utility> added.
HelenMamontova 967321f
Radius. Filling vector of pairs attrSend added. Extra printfd function
HelenMamontova cd918e5
Radius. The Sign enumeration elements names changed in the struct
HelenMamontova 43d4001
Radius. Using declaration for struct AttrValue added. Function ParseS…
HelenMamontova 023dbb4
Radius. The enum class Sign renamed to Type, object sign renamed to
HelenMamontova c8bd692
Radius. The enum class Sign renamed to Type, object sign renamed to type
HelenMamontova 0e1f6fe
Radius. The enumerator names NOT_VALUE changed to PARAN_NAME, IS_VALUE
HelenMamontova 218b6d7
Radius. Radius. The enumerator names NOT_VALUE changed to PARAM_NAME,…
HelenMamontova 534d79b
Radius. The AttrValue struct moved into the RAD_SETTINGS class.
HelenMamontova 3225952
Radius. The using statement for struct AttrValue removed. The using a…
HelenMamontova ce26783
Radius. The vector parsedSendAttr check added to the function
HelenMamontova 7b1bbb5
Radius. The ParseSendAttr method added, m_logger variable class member
HelenMamontova 15c5a1f
Radius. ParseSendAttr function changed to method of RAD_SETTINGS class.
HelenMamontova 154edc3
Radius. Quotes check for the ValueName added to the ParseSendAttr
HelenMamontova b5e9b4f
Radius. Extra variables attrValue.value and attrValue.type removed in
HelenMamontova 233bd64
Radius. Extra variable attrValue removed in ParseSendAttr method.
HelenMamontova f24d062
Radius. Send attributes parsing changed in method ParseSendAttr.
HelenMamontova bd30450
Radius. Argument fieldSendAttr name changed to value and argument type
HelenMamontova c07c0a7
Radius. Argument fieldSendAttr name changed to value and argument type
HelenMamontova c1f4bd7
Radius. Vector name parsedSendAttr changed to keyValue in ParseSendAttr
HelenMamontova bfcb298
Radius. Functions front() and back() are used to get the first and last
HelenMamontova e87368d
Radius. Method declaration ParseSendAttr moved to private in class
HelenMamontova 8baf9e0
Radius. Formatting fixed. Class member m_res and public function
HelenMamontova 9367195
Radius. Extra variable res removed. Class member m_res definition added
HelenMamontova 3d62827
Radius. Vector res added, variable m_res replaced by res in
HelenMamontova 85b9f0d
Radius. Function name GetRes changed to GetSendPairs, class member
HelenMamontova 44844ce
Radius. Class member vaiable name m_res changed to m_sendPairs in the
HelenMamontova ccfecf2
Radius. Parameter auth added to mod_radius.conf.
HelenMamontova 9c6ee36
Radius. The ParseMatchAttr method declaration and m_matchPairs class
HelenMamontova b2304ca
Radius. The ParseMatchAttr function definition added. Match attributes
HelenMamontova 4d6fcb7
Radius. The ParseMatchAttr method removed, the ParseSendAttr method
HelenMamontova 083c78b
Radius. The ParseSendAttr method definition and call renamed to
HelenMamontova 8509152
Radius. Attribute for parameter auth/match changed.
HelenMamontova ee9496a
Radius. Parameter autz added.
HelenMamontova 97235bb
Radius. ParseAuthAttr function renamed to ParseAuthAutzAttr.
HelenMamontova a5b0dbd
Radius. ParseAuthAttr function renamed to ParseAuthAutzAttr. The autz
HelenMamontova a132484
Radius. ParseAuthAutzAttr function renamed to ParseSectionsAttr. The …
HelenMamontova e609021
Radius. ParseAuthAutzAttr function renamed to ParseSectionsAttr. The …
HelenMamontova 91b514a
Radius. Attributes of auth/send, autz/send, autz/match changed.
HelenMamontova 63ba77a
Radius. ParseSectionsAttr function name changed to ParseRyles.
HelenMamontova c79b7c1
Radius. ParseSectionsAttr function name definition and call changed t…
HelenMamontova 92eff02
Radius. Extra printfd function call removed in MakeKeyValuePairs
HelenMamontova 9f96684
Radius. The ShowRules, GetSendPairsAuth, GetMatchPairsAuth, GetSendPa…
HelenMamontova ddcaf6f
Radius. The ShowRules function definition added and its call in
HelenMamontova 3a559a6
Radius. The strRules string creating fixed and strRules string rename…
HelenMamontova 646790b
Radius. Parameter name changed to attributes and & added to parameter in
HelenMamontova dab9c61
Radius. The ShowRules function definition changed. Parameter name cha…
HelenMamontova 3b7bc48
Radius. The struct ASection added. The getAuth, getAutz, parseASection
HelenMamontova 4078c17
Radius. The using ASection for alias added. The parseASection function
HelenMamontova d1d90e1
Radius. The return added to parseASection function. Extra printfd
HelenMamontova a744e30
Radius. GIT_TAG changed to 1.1.3 in the ExternalProject_Add for
HelenMamontova fccd8cd
Radius. The m_ioService class member replaced by m_ioContext in class
HelenMamontova b5b8299
Radius. The m_ioService class member replaced by m_ioContext in the
HelenMamontova 49f9369
Radius. Parameter io_service replaced by io_context in the constructo…
HelenMamontova 0d97b85
Radius. Parameter io_service replaced by io_context in the constructo…
HelenMamontova e51985c
Radius. Parameters msg, ip commented out in the SendMessage function.
HelenMamontova 5fdde10
Radius. Variable 'sep' declared 'const' in ParseRules function.
HelenMamontova 2981417
Radius. Variables 'tokens', 'sp', 'tok' declared 'const' in ParseRule…
HelenMamontova a650b2a
Radius. ShowRules function declaration removed from class RAD_SETTINGS.
HelenMamontova 72e22dc
Radius. ShowRules function definition is made as a free function.
HelenMamontova f26626c
Radius. ShowRules function definition is placed in the anonymous name…
HelenMamontova d31ccb3
Radius. The code for determining the first element of vector changed …
HelenMamontova 0128fa2
Radius. Function SetUsers declaration is made as override in the class
HelenMamontova 498c75a
Radius. Header file <algorithm> added.
HelenMamontova 8d1f715
Radius. The rad_settings.cpp file name added to add_library for MODULE
HelenMamontova ae4014b
Radius. Header file "rad_settings.h" added. RAD_SETTINGS class
HelenMamontova fa8aca9
Radius. Header files <boost/tokenizer.hpp>, <vector>, <iterator>,
HelenMamontova d74bb0b
Radius. The new file rad_settings.h added.
HelenMamontova 5909001
Radius. The new file rad_settings.cpp added.
HelenMamontova fbd5b1c
Radius. Header file "rad_settings.h" added. Parameter radSettings add…
HelenMamontova b5819ad
Radius. Parameter radSettings added to constructor Server definition.…
HelenMamontova 3ec586e
Radius. The attributes User-Name, Cacllback-Number added to section <…
HelenMamontova 694212f
Radius. Class User forward declaration added. Parameter radSettings
HelenMamontova b7ce5c4
Radius. Header files added. The using statement for STG User added. P…
HelenMamontova 16884a3
Merge remote-tracking branch 'madf/master' into radius
HelenMamontova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,8 @@ if ( BUILD_MOD_RADIUS ) | |
| find_package ( Boost REQUIRED ) | ||
|
|
||
| add_library ( mod_radius MODULE other/radius/radius.cpp | ||
| other/radius/server.cpp) | ||
| other/radius/server.cpp | ||
| other/radius/rad_settings.cpp) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about just |
||
| target_link_libraries ( mod_radius PRIVATE scriptexecuter logger common ) | ||
| set_target_properties ( mod_radius PROPERTIES PREFIX "" ) | ||
|
|
||
|
|
||
147 changes: 147 additions & 0 deletions
147
projects/stargazer/plugins/other/radius/rad_settings.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| #include "rad_settings.h" | ||
| #include "radproto/error.h" | ||
| #include "stg/common.h" | ||
| #include <boost/tokenizer.hpp> | ||
|
|
||
| #include <vector> | ||
| #include <utility> | ||
| #include <iterator> | ||
| #include <algorithm> | ||
| #include <iostream> | ||
|
|
||
| using STG::RAD_SETTINGS; | ||
| using AttrValue = RAD_SETTINGS::AttrValue; | ||
| using ASection = RAD_SETTINGS::ASection; | ||
|
|
||
| namespace | ||
| { | ||
| std::string ShowRules(const std::vector<std::pair<std::string, AttrValue>>& attributes) | ||
| { | ||
| std::string result; | ||
| for (const auto& at : attributes) | ||
| { | ||
| if (!result.empty()) | ||
| result += ", "; | ||
|
|
||
| if (at.second.type == AttrValue::Type::PARAM_NAME) | ||
| result.append(at.first + " = " + at.second.value); | ||
| else | ||
| result.append(at.first + " = '" + at.second.value + "'"); | ||
| } | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| std::vector<std::pair<std::string, AttrValue>> RAD_SETTINGS::ParseRules(const std::string& value, const std::string& paramName) | ||
| { | ||
| using tokenizer = boost::tokenizer<boost::char_separator<char>>; | ||
| const boost::char_separator<char> sep(","); | ||
|
|
||
| const tokenizer tokens(value, sep); | ||
|
|
||
| std::vector<std::pair<std::string, AttrValue>> res; | ||
| for (const auto& token : tokens) | ||
| { | ||
| const boost::char_separator<char> sp(" ="); | ||
| const tokenizer tok(token, sp); | ||
|
|
||
| std::vector<std::string> keyValue; | ||
| for (const auto& t : tok) | ||
| keyValue.push_back(t); | ||
|
|
||
| if (keyValue.size() != 2) | ||
| { | ||
| m_logger("The '%s' attribute specification has an incorrect format: '%s'.", paramName.c_str(), token.c_str()); | ||
| printfd(__FILE__, "The '%s' attribute specification has an incorrect format: '%s'.", paramName.c_str(), token.c_str()); | ||
| return {}; | ||
| } | ||
|
|
||
| auto type = AttrValue::Type::PARAM_NAME; | ||
| std::string valueName = keyValue[1]; | ||
| if (valueName.front() == '\'' && valueName.back() == '\'') | ||
| { | ||
| type = AttrValue::Type::VALUE; | ||
| valueName.erase(0, 1); | ||
| valueName.erase(valueName.length() - 1, 1); | ||
| } | ||
| else if ((valueName.front() == '\'' && valueName.back() != '\'') || (valueName.front() != '\'' && valueName.back() == '\'')) | ||
| { | ||
| m_logger("Error ParseRules: '%s' attribute parameter value is invalid.\n", paramName.c_str()); | ||
| printfd(__FILE__, "Error ParseRules: '%s' attribute parameter value is invalid.\n", paramName.c_str()); | ||
| return {}; | ||
| } | ||
| res.emplace_back(keyValue[0], AttrValue{valueName, type}); | ||
| } | ||
| return res; | ||
| } | ||
|
|
||
| ASection RAD_SETTINGS::parseASection(const std::vector<ParamValue>& conf) | ||
| { | ||
| ASection res; | ||
| const auto mit = std::find(conf.begin(), conf.end(), ParamValue("match", {})); | ||
| if (mit != conf.end()) | ||
| res.match = ParseRules(mit->value[0], mit->param); | ||
|
|
||
| const auto sit = std::find(conf.begin(), conf.end(), ParamValue("send", {})); | ||
| if (sit != conf.end()) | ||
| res.send = ParseRules(sit->value[0], sit->param); | ||
|
|
||
| return res; | ||
| } | ||
|
|
||
| RAD_SETTINGS::RAD_SETTINGS() | ||
| : m_port(1812), | ||
| m_dictionaries("/usr/share/freeradius/dictionary"), | ||
| m_logger(PluginLogger::get("radius")) | ||
| {} | ||
|
|
||
| int RAD_SETTINGS::ParseSettings(const ModuleSettings & s) | ||
| { | ||
| ParamValue pv; | ||
| int p; | ||
|
|
||
| pv.param = "Port"; | ||
| auto pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv); | ||
| if (pvi != s.moduleParams.end() && !pvi->value.empty()) | ||
| { | ||
| if (ParseIntInRange(pvi->value[0], 2, 65535, &p) != 0) | ||
| { | ||
| m_errorStr = "Cannot parse parameter \'Port\': " + m_errorStr; | ||
| printfd(__FILE__, "Cannot parse parameter 'Port'\n"); | ||
| return -1; | ||
| } | ||
| m_port = static_cast<uint16_t>(p); | ||
| } | ||
|
|
||
| pv.param = "Secret"; | ||
| pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv); | ||
| if (pvi == s.moduleParams.end() || pvi->value.empty()) | ||
| { | ||
| m_errorStr = "Parameter \'Secret\' not found."; | ||
| printfd(__FILE__, "Parameter 'Secret' not found\n"); | ||
| m_secret = ""; | ||
| } | ||
| else | ||
| m_secret = pvi->value[0]; | ||
|
|
||
| pv.param = "Dictionaries"; | ||
| pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv); | ||
| if (pvi != s.moduleParams.end() && !pvi->value.empty()) | ||
| m_dictionaries = pvi->value[0]; | ||
|
|
||
| const auto authIt = std::find(s.moduleParams.begin(), s.moduleParams.end(), ParamValue("auth", {})); | ||
| if (authIt != s.moduleParams.end()) | ||
| m_auth = parseASection(authIt->sections); | ||
|
|
||
| const auto autzIt = std::find(s.moduleParams.begin(), s.moduleParams.end(), ParamValue("autz", {})); | ||
| if (autzIt != s.moduleParams.end()) | ||
| m_autz = parseASection(autzIt->sections); | ||
|
|
||
| printfd(__FILE__, " auth.match = \"%s\"\n", ShowRules(m_auth.match).c_str()); | ||
| printfd(__FILE__, " auth.send = \"%s\"\n", ShowRules(m_auth.send).c_str()); | ||
| printfd(__FILE__, " autz.match = \"%s\"\n", ShowRules(m_autz.match).c_str()); | ||
| printfd(__FILE__, " autz.send = \"%s\"\n", ShowRules(m_autz.send).c_str()); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #pragma once | ||
|
|
||
| #include "stg/module_settings.h" | ||
| #include "stg/subscriptions.h" | ||
| #include "stg/logger.h" | ||
|
|
||
| #include <string> | ||
| #include <cstdint> //uint8_t, uint32_t | ||
|
|
||
| namespace STG | ||
| { | ||
| struct Settings; | ||
|
|
||
| class RAD_SETTINGS | ||
| { | ||
| public: | ||
| RAD_SETTINGS(); | ||
|
|
||
| struct AttrValue | ||
| { | ||
| enum class Type | ||
| { | ||
| PARAM_NAME, | ||
| VALUE | ||
| }; | ||
| std::string value; | ||
| Type type; | ||
| }; | ||
|
|
||
| struct ASection | ||
| { | ||
| using Pairs = std::vector<std::pair<std::string, AttrValue>>; | ||
| Pairs match; | ||
| Pairs send; | ||
| }; | ||
|
|
||
| const std::string& GetStrError() const { return m_errorStr; } | ||
| int ParseSettings(const ModuleSettings& s); | ||
|
|
||
| uint16_t GetPort() const { return m_port; } | ||
| const std::string& GetDictionaries() const { return m_dictionaries; } | ||
| const std::string& GetSecret() const { return m_secret; } | ||
| const ASection& getAuth() const { return m_auth; } | ||
| const ASection& getAutz() const { return m_autz; } | ||
|
|
||
| private: | ||
| std::vector<std::pair<std::string, AttrValue>> ParseRules(const std::string& value, const std::string& paramName); | ||
| ASection parseASection(const std::vector<ParamValue>& conf); | ||
|
|
||
| std::string m_errorStr; | ||
| uint16_t m_port; | ||
| std::string m_dictionaries; | ||
| std::string m_secret; | ||
|
|
||
| ASection m_auth; | ||
| ASection m_autz; | ||
|
|
||
| PluginLogger m_logger; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the original value. It makes more sense.