summaryrefslogtreecommitdiff
path: root/src/broker.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 21:49:37 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-11 21:49:37 +0200
commitbc946633e0bcae5fe63528ad743bcc67de7e347d (patch)
tree7a3d127148c13d84e92f38c319fb5aad1e88a6cb /src/broker.cc
parent3ea7edf8c9bf7583c426178d4aaff4fb5b736bd2 (diff)
created a Parser class
Diffstat (limited to 'src/broker.cc')
-rw-r--r--src/broker.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/broker.cc b/src/broker.cc
index 4fa9ec8..3270702 100644
--- a/src/broker.cc
+++ b/src/broker.cc
@@ -8,21 +8,18 @@
#include "broker.h"
#include "convert.h"
-#include "operators.h"
-#include "recursivedescent.h"
-#include "session.h"
-
-#include <map>
-#include <string>
using namespace Binc;
using std::string;
BrokerFactory::BrokerFactory()
{
- brokers[Session::State::NONAUTHENTICATED] = new Broker();
- brokers[Session::State::AUTHENTICATED] = new Broker();
- brokers[Session::State::SELECTED] = new Broker();
+ auto &session = Session::getInstance();
+ Parser p(session);
+
+ brokers[Session::State::NONAUTHENTICATED] = new Broker(p);
+ brokers[Session::State::AUTHENTICATED] = new Broker(p);
+ brokers[Session::State::SELECTED] = new Broker(p);
}
BrokerFactory::~BrokerFactory()
@@ -102,7 +99,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
string tag;
string cmd;
- switch (expectTag(tag)) {
+ switch (parser.expectTag(tag)) {
case ACCEPT:
break;
case REJECT:
@@ -114,7 +111,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
return TIMEOUT;
}
- switch (expectSPACE()) {
+ switch (parser.expectSPACE()) {
case ACCEPT:
break;
case REJECT:
@@ -126,7 +123,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
return TIMEOUT;
}
- switch (expectAstring(cmd)) {
+ switch (parser.expectAstring(cmd)) {
case ACCEPT:
break;
case REJECT:
@@ -143,7 +140,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
if (cmd == "UID") {
command.setUidMode();
- switch (expectSPACE()) {
+ switch (parser.expectSPACE()) {
case ACCEPT:
break;
case REJECT:
@@ -155,7 +152,7 @@ Parser::ParseResult Broker::parseStub(Request &command)
return TIMEOUT;
}
- switch (expectAstring(cmd)) {
+ switch (parser.expectAstring(cmd)) {
case ACCEPT:
break;
case REJECT: