summaryrefslogtreecommitdiff
path: root/src/operator-authenticate.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 19:28:50 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 19:28:50 +0200
commit3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (patch)
treeae78ebf9e9d1f70da8a6fdad1504063644ee8f1e /src/operator-authenticate.cc
parent1a7c572099edf744d6bb67318cff215de3fcd897 (diff)
use some enum classes
move ParseResult to recursivedescent.h
Diffstat (limited to 'src/operator-authenticate.cc')
-rw-r--r--src/operator-authenticate.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/operator-authenticate.cc b/src/operator-authenticate.cc
index 045b008..8689b2c 100644
--- a/src/operator-authenticate.cc
+++ b/src/operator-authenticate.cc
@@ -22,6 +22,10 @@
using namespace Binc;
using std::endl;
using std::string;
+constexpr auto BAD = Operator::ProcessResult::BAD;
+constexpr auto NO = Operator::ProcessResult::NO;
+constexpr auto OK = Operator::ProcessResult::OK;
+constexpr auto NOTHING = Operator::ProcessResult::NOTHING;
AuthenticateOperator::AuthenticateOperator() {}
@@ -32,7 +36,7 @@ const string AuthenticateOperator::getName() const
return "AUTHENTICATE";
}
-int AuthenticateOperator::getState() const
+Session::State AuthenticateOperator::getState() const
{
return Session::NONAUTHENTICATED;
}
@@ -276,13 +280,15 @@ Operator::ProcessResult AuthenticateOperator::process(Depot &depot, Request &com
return NOTHING;
}
-Operator::ParseResult AuthenticateOperator::parse(Request &c_in) const
+Parser::ParseResult AuthenticateOperator::parse(Request &c_in)
{
+ constexpr auto ACCEPT = Parser::ParseResult::ACCEPT;
+
Session &session = Session::getInstance();
- if (c_in.getUidMode()) return REJECT;
+ if (c_in.getUidMode()) return Parser::ParseResult::REJECT;
- Operator::ParseResult res;
+ Parser::ParseResult res;
if ((res = expectSPACE()) != ACCEPT) {
session.setLastError("Expected single SPACE after AUTHENTICATE");
@@ -292,7 +298,7 @@ Operator::ParseResult AuthenticateOperator::parse(Request &c_in) const
string authtype;
if ((res = expectAtom(authtype)) != ACCEPT) {
session.setLastError("Expected auth_type after AUTHENTICATE SPACE");
- return ERROR;
+ return Parser::ParseResult::ERROR;
}
if ((res = expectCRLF()) != ACCEPT) {