From: HelenMamontova <44774239+HelenMamontova@users.noreply.github.com> Date: Tue, 15 Jul 2025 12:37:18 +0000 (+0300) Subject: Radiusю (#12) X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/21ba4dfad49d2d489a9399d36d078eab8c44e0d6?ds=inline;hp=21ba4dfad49d2d489a9399d36d078eab8c44e0d6 Radiusю (#12) * Radius. Header file , added. Functions start, stop declaration changed. Class members m_thread, m_mutex added. Function Run declaration added. * Radius. Header files added. Functions Start, Stop, Run definition added. * Radius. New files server.h, server.cpp added. * Radius. Definition of functions startReceive, makeResponse, handleSend, handleReceive added. * The Run function name fixed. Definition of secret variable sdded. * The file server.cpp added to add_library command, command find_package(OpenSSL 1.0.0 Required) added, OpenSSL::Crypto added to target_link_libraries command in the block if(BUILD_MOD_RADIUS). * Parameter token added to function Run() declaration. * Radius. Method Start: variable isRunning=true removed, m_thread definition changed. Method Stop: variable isRunning=false removed, m_thread.joinable check added, isRunning check added, request_stop call added. Method Run: parameter token added, variables secret, port removed, object lock and isRunning=true added before cycle while, cycle while added, isRunning=false added after cycle while. * Radius. Hold the mutex removed,extra conditions for m_thread.join() removed in the Stop function. * Radius. Cycle while removed in function Run. * Radius. The variables isRunning, errorStr replaced by m_running, m_errorStr in class Radius. * Radius. The variable isRunning replaced by m_running in function Run. * Radius. Object name io_service changed to ioService in the function Run. * Method SetRunning declaration added to the class RADIUS. * Method SetRunning definition added. Method SetRunning call added to function Run. * Radius. Namespace STG added. * Radius. Declaration using STG::Server added. * Radius. Header file "stg/logger.h" added. RADIUS class member m_loger added. * Radius. Header file "stg/common.h" added. Initialization of m_logger added to constructor RADIUS. Output cerr replaced by logger and printfd(). * Radius. Variable except added, messages fixed in the function Run. * Radius. Thread join logic fixed in the function Stop. * Keyword const added to std::lock_guard in the function SetRunning. * Radius. Class member m_mutex moved to the top of list. * Radius. Class member m_logger put after the m_running. * Radius. Unnecessary variable except removed in the function Run. * Radius. Extra whitespace removed in the function Stop. Function IsRunning definition added. * Radius. Function IsRunning declaration changed. * Radius. Formatting fixed. * Radius. Extra symbols '//' removed. * Radius. Class member m_running initialization added to constructor RADIUS. * Radius.Header file "stg/module_settings.h" added. Class members variable m_settings and method SetSettings added to class RADIUS. * Radius. The parameters Secret, Dictionaries added, parameter Port changed, other parameters removed. * Radius. Header files added. Class RAD_SETTINGS added. Methods SetSettings, copy constructor RADIUS, assignment operator added. Method ParseSettings changed. Formatting fixed. * Radius. Parameter default changed to optional and parameters value commented out for the parameters dictionaries, port. * Radius. Description of parameters secret, port, dictionaries changed. * Radius. Copy constructor RADIUS and assignment operator declaration changed and moved to public section. * Radius. Class member m_mutex moved to the top of section private. * Radius. The m_port variable value initialization changed to 1812, m_dictionaries variable initialization added to constructor RAD_SETTINGS. * Radius. Check for missing parameters port and dictionaries removed in function ParseSettings. * Radius. The dist directory added. * Radius. The methods declaration stop and start added. * Radius. The methods stop, start definition added. Method start call added to Server constructor. * Radius. The header files "server.h", , added. The class members m_ioService, m_server added. * Radius. The header files "server", , removed. The method m_server->stop() call added to method Stop. * Radius. Header files and added. Parameter token added to constructor Server. Class member m_token added. * Radius. Parameter token and m_token class member initialization added to Server constructor definition. The check m_token.stop_requested() added to method handleSend before startReceive method call. * Radius. The m_server class member initialization removed. * Radius. The m_server->stop() call adnd m_thread.request_stop() call reodered, the m_server check added before m_server->stop call in the method Stop. Parameter token added to constructor Server in the function Run. * Radius. Header file "stg/logger.h" added. Class member m_logger added to class Server. * Radius. Header file "stg/common.h" added, header file removed. Class member m_logger initialization added to constructor Server. Object std::cout replaced by function printfd and m_logger. * Radius. Class member m_logger initialization changed in the constructor Server. Check token moved before checking the error code in the handleSend method. * Radius. Check token added to handleReceive method. * Radius. Header file replaced by , header file removed. * Radius. Parameter m_logger added to constructor Server call in the method Run. * Radius. Parameter logger added to constructor Server declaration. Class member m_logger added to class Server. * Radius. Parameter logger added to constructor Server definition. Class member m_logger initialization changed in the constructor Server. * Radius. Extra whitespace removed ib the method Run. * Radius. The order of operations changed in the method handleSend. * Radius. The order of operations changed in the method handleReceive. * Radius. Operator return removed when checking ec, operator else removed when checking packet in the handleReceive method. * Radius. Parameter token replaced by std::move(token) in the constructor Server in method Run. * Radius. Class member m_token initialization value changed to std::move(token) in the constructor Server. * Radius. The c_str() function added to message when checking error in the handleSend and handleReceive methods. * Radius. Header file added. * Radius. Header files "stg/users.h", "stg/user.h", "stg/user_property.h" added. The using statements added. The findUser, SetUsers functions declaration added. Class member m_users added. * Radius. Header files "radproto/attribute_types.h", added. The m_users class member initialization added to constructor Server. The findUser function definition added. The findUser function call added to makeResponse function. * Radius. Getting the values of login and password fixed in the function findUser. Extra functions printfd call added. * Radius. Using statements added. Method SetUsers added, variable class member m_users added to class RADIUS. * Radius. The class member variable m_users initialization added to constructor Radius. Parameter m_users added to constructor Server call in the method Run. * Radius. Parameter users added to constructir Server declaration. Function SetUsers removed fron class Server. * Radius. Parameter users added to constructor Server definition. Variable class member m_users initialization added to constructor Server. * Radius. Function c_str added to login and password in m_logger and printfd function in the function findUser. * Radius. Extra functions printfd removed. * Radius. The using declaration for UserPtr, ConstUserPtr removed. * Radius. Looking for user moved after check request type in the makeResponse function. * Radius. The using declaration for UserPtr, ConstUserPtr removed. Header files "stg/user.h", "stg/users.h", "stg/user.property.h" removed. * Radius. Header files "stg/user.h", "stg/users.h" added. * Radius. Function findUser moved to private. * Radius. Return type of function findUser changed to bool. * Radius. Return type of function findUser definition and call changed to bool. * Radius. Variables attributesEmpty, vendorSpecificEmpty added for packet ACCESS_REJECT in the function makeResponse. * Radius. Type STG::Users* replaced by Users* in parameter users in the constructor Server definition. * Radius. Condition and code order changed when packet is returned in makeResponse function. * Radius. Unnecessary variables attributeEmpty, vendorSpecificEmpty replaced by {} when ACCESS_REJECT packet is returned in makeResponse function. * Radius. Prefix STG of user object removed, user is initialized by nullptr and moved to the point before call FindByName function in the findUser function. * Radius. Extra printfd function call removed in the function findUser. * Radius. The way of initializing the object user changed in the findUser function. Error log removed in the makeResponse function. * Radius. Prefix STG of class member m_users and of parameter u in SetUsers function removed. * Radius. Prefix STG of class member m_users and of parameter users in the constructor Server declaration removed. * Radius. The messages of m_logger and printfd changed in function findUser. * Radius. Search for parameters auth and send added to the ParseSettings function. * Radius. Extra whitespace removed, unnecessary variables sendValue and sectionsParams removed in ParseSettings function. * Radius. The struct AttrValue added. * Radius. Header files , , added. Parsing attributes of field send in section auth of mod_radius.conf added to the function ParseSettings. * Radius. Filling vector of pairs attrSend added. Extra printfd function removed. * Radius. The Sign enumeration elements names changed in the struct AttrValue. * Radius. Using declaration for struct AttrValue added. Function ParseSendAttr definition added and call in the function ParseSettings added. * Radius. The enum class Sign renamed to Type, object sign renamed to type. * Radius. The enum class Sign renamed to Type, object sign renamed to type in ParseSendAttr function and ParseSettings function. * Radius. The enumerator names NOT_VALUE changed to PARAN_NAME, IS_VALUE changed to VALUE in enum Type. * Radius. Radius. The enumerator names NOT_VALUE changed to PARAM_NAME, IS_VALUE changed to VALUE in ParseSendAttr function. * Radius. The AttrValue struct moved into the RAD_SETTINGS class. * Radius. The using statement for struct AttrValue removed. The using alias for struct AttrValue added. * Radius. The vector parsedSendAttr check added to the function ParseSendAttr. * Radius. The ParseSendAttr method added, m_logger variable class member added to RAD_SETTINGS class. * Radius. ParseSendAttr function changed to method of RAD_SETTINGS class. Vector parsedSendAttr check for emptiness and check vector size added to the ParseSendAttr method. Class member m_logger initialization added to initialization list to RAD_SETTINGS constructor. * Radius. Quotes check for the ValueName added to the ParseSendAttr method. * Radius. Extra variables attrValue.value and attrValue.type removed in the ParseSendAttr method. * Radius. Extra variable attrValue removed in ParseSendAttr method. * Radius. Send attributes parsing changed in method ParseSendAttr. * Radius. Argument fieldSendAttr name changed to value and argument type changed to const std::string& in ParseSendAttr method. Vector keyValuePairs name changed to res. * Radius. Argument fieldSendAttr name changed to value and argument type changed to const std::string& in ParseSendAttr method. * Radius. Vector name parsedSendAttr changed to keyValue in ParseSendAttr method. * Radius. Functions front() and back() are used to get the first and last characters of string valueName in ParseSendAttr method. * Radius. Method declaration ParseSendAttr moved to private in class RAD_SETTINGS. * Radius. Formatting fixed. Class member m_res and public function GetRes added to class RAD_SETTINGS. * Radius. Extra variable res removed. Class member m_res definition added to ParseSendAttr function and ParseSettings function. * Radius. Vector res added, variable m_res replaced by res in ParseSendAttr function. * Radius. Function name GetRes changed to GetSendPairs, class member vaiable name m_res changed to m_sendPairs in class RAD_SETTINGS. * Radius. Class member vaiable name m_res changed to m_sendPairs in the ParseSettings function. * Radius. Parameter auth added to mod_radius.conf. * Radius. The ParseMatchAttr method declaration and m_matchPairs class member added to RAD_SETTINGS class. * Radius. The ParseMatchAttr function definition added. Match attributes parsing added to ParseSetting function. * Radius. The ParseMatchAttr method removed, the ParseSendAttr method renamed to ParseAuthAttr in the class RAD_SETTINGS. * Radius. The ParseSendAttr method definition and call renamed to ParseAuthAttr. Parameter paramName added to ParseAuthAttr method. The ParseMatchAttr method definition removed. ParseMatchAttr method call replaced by ParseAuthAttr. * Radius. Attribute for parameter auth/match changed. * Radius. Parameter autz added. * Radius. ParseAuthAttr function renamed to ParseAuthAutzAttr. * Radius. ParseAuthAttr function renamed to ParseAuthAutzAttr. The autz attributes parsing added, m_logger and printfd messages changed in the ParseAuthAutzAttr function. * Radius. ParseAuthAutzAttr function renamed to ParseSectionsAttr. The MakeKeyValuePairs function definition added. * Radius. ParseAuthAutzAttr function renamed to ParseSectionsAttr. The messages of m_logger and printfd changed in the ParseSectionsAttr function. The MakeKeyValuePairs function definition and call added. * Radius. Attributes of auth/send, autz/send, autz/match changed. * Radius. ParseSectionsAttr function name changed to ParseRyles. * Radius. ParseSectionsAttr function name definition and call changed to ParseRyles. * Radius. Extra printfd function call removed in MakeKeyValuePairs functions. * Radius. The ShowRules, GetSendPairsAuth, GetMatchPairsAuth, GetSendPairsAutz, GetMatchPairsAutz functions declaration added. The m_sendPairs, m_matchPairs class members removed. The m_sendPairsAuth, m_matchPairsAuth, m_sendPairsAutz, m_matchPairsAutz class members added. * Radius. The ShowRules function definition added and its call in MakeKeyValuePairs function added. * Radius. The strRules string creating fixed and strRules string renamed to result in the ShowRules function. * Radius. Parameter name changed to attributes and & added to parameter in the ParseRules function. * Radius. The ShowRules function definition changed. Parameter name changed to attributes and & added to parameter in the ShowRules function. * Radius. The struct ASection added. The getAuth, getAutz, parseASection function declaration added. Class member m_auth, m_autz added. Unnecessary code removed. * Radius. The using ASection for alias added. The parseASection function definition and call added, MakeKeyValuePairs function removed, ParseSettings function changed. Extra printfd function added. * Radius. The return added to parseASection function. Extra printfd functions removed. * Radius. GIT_TAG changed to 1.1.3 in the ExternalProject_Add for async-radius. * Radius. The m_ioService class member replaced by m_ioContext in class Radius. * Radius. The m_ioService class member replaced by m_ioContext in the function Run. * Radius. Parameter io_service replaced by io_context in the constructor Server. * Radius. Parameter io_service replaced by io_context in the constructor Server definition. * Radius. Parameters msg, ip commented out in the SendMessage function. * Radius. Variable 'sep' declared 'const' in ParseRules function. * Radius. Variables 'tokens', 'sp', 'tok' declared 'const' in ParseRules function. * Radius. ShowRules function declaration removed from class RAD_SETTINGS. * Radius. ShowRules function definition is made as a free function. * Radius. ShowRules function definition is placed in the anonymous namespace. * Radius. The code for determining the first element of vector changed in the function ShowRules. * Radius. Function SetUsers declaration is made as override in the class Radius. * Radius. Header file added. ---