Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-13110
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Nov 13, 2023
1 parent 66ec774 commit c3ccfe4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/RADIUS_Destination.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ namespace OpenWifi {
auto SerialNumber = P.ExtractSerialNumberFromProxyState();
if (!SerialNumber.empty()) {
poco_debug(Logger_,
fmt::format("{}: {} Received {} bytes.", SerialNumber,
P.PacketType(), NumberOfReceivedBytes));
fmt::format("{}: {}:{} Received {} bytes.", SerialNumber,
P.PacketType(),
P.PacketTypeToString(),
NumberOfReceivedBytes));
AP_WS_Server()->SendRadiusAuthenticationData(SerialNumber, Buffer,
NumberOfReceivedBytes);
} else if(P.IsStatusMessageReply(ReplySource)) {
Expand All @@ -136,8 +138,9 @@ namespace OpenWifi {
auto SerialNumber = P.ExtractSerialNumberFromProxyState();
if (!SerialNumber.empty()) {
poco_debug(Logger_,
fmt::format("{}: {} Received {} bytes.", SerialNumber,
P.PacketType(), NumberOfReceivedBytes));
fmt::format("{}: {}:{} Received {} bytes.", SerialNumber,
P.PacketType(),
P.PacketTypeToString(), NumberOfReceivedBytes));
AP_WS_Server()->SendRadiusAccountingData(SerialNumber, Buffer,
NumberOfReceivedBytes);
} else {
Expand All @@ -147,8 +150,9 @@ namespace OpenWifi {
auto SerialNumber = P.ExtractSerialNumberTIP();
if (!SerialNumber.empty()) {
poco_debug(Logger_,
fmt::format("{}: {} Received {} bytes.", SerialNumber,
P.PacketType(), NumberOfReceivedBytes));
fmt::format("{}: {}:{} Received {} bytes.", SerialNumber,
P.PacketType(),
P.PacketTypeToString(), NumberOfReceivedBytes));
AP_WS_Server()->SendRadiusCoAData(SerialNumber, Buffer,
NumberOfReceivedBytes);
} else {
Expand Down
9 changes: 9 additions & 0 deletions src/RADIUS_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,15 @@ namespace OpenWifi::RADIUS {

friend std::ostream &operator<<(std::ostream &os, RadiusPacket const &P);

[[nodiscard]] inline std::string PacketTypeToString() const {

for(auto const &Name:radius_command_values) {
if(Name.cmd == P_.code)
return Name.name;
}
return "Unknown";
}

inline bool IsAuthentication() {
return (P_.code == RADIUS::Access_Request || P_.code == RADIUS::Access_Accept ||
P_.code == RADIUS::Access_Challenge || P_.code == RADIUS::Access_Reject ||
Expand Down

0 comments on commit c3ccfe4

Please sign in to comment.