Hello, everybody!

Back in 2004 we have held here, on the twsockets mailing list, a discussion
regarding a possibility of implementing a general automaton capable of
handling almost any communication protocol using its BNF description.
I started to work on this idea in a short time after the discussion, but
unfortunately had to stop it after a while, and it has been suspended for
several years. Now I've managed to resume the process, and may announce a
pre-alpha "product" BNF2TCP. If someone is interested in the project and
has a will to participate, I can share with them the source codes under
the terms of non-disclosure agreement.
Public distribution is not planned until beta stage.

The program is written in C++, using (a little bit outdated) ICS twsockets
for communications, which can be easily replaced with latest components.
The program plays a role of a BNF editor/verifier/debugger and contains
core classes bringing the "magic" into life: a LL-parser and controllers
(automaton engines). The program utilizes a kinda extreme programming style
and has a lot of legacy code (don't forget the years of the cease), so it
needs a refactoring for adherence to good design principles and extension
according to requirements and use cases which were most likely overlooked
by myself.

For testing purposes simplified versions of a POP3-client and server have
been made.
Here is how an excerpt of the BNF looks like:

  ...
<SERVER> ::= Start <WaitAckListen>
<WaitAckListen> ::= AckListen <WaitCmdConnect>
<WaitCmdConnect> ::= CmdConnect <WaitAckAccept>
<WaitAckAccept> ::= AckAccept <SessionOpt> | AckError <Stopping>
<SessionOpt> ::= <Login> | <SomehowDisconnect>
<Login> ::= CmdUser <LoginAck>
<LoginAck> ::= AckOK <PasswordOpt> | AckError <SessionOpt>
<PasswordOpt> ::= CmdPass <PassAck> | <SomehowDisconnect>
<PassAck> ::= AckOK <Transaction> | AckError <SessionOpt>
<Transaction> ::= CmdList <ListAck> | CmdStat <StatAck> | CmdRetr <RetrAck> | 
<SomehowDisconnect>
<ListAck> ::= AckListResult <Transaction> | AckError <Transaction>
<StatAck> ::= AckStatResult <Transaction> | AckError <Transaction>
<RetrAck> ::= AckRetrResult <Transaction> | AckError <Transaction>
<QuitAck> ::= AckOK <Stopping>
<SomehowDisconnect> ::= CmdQuit <QuitAck> | <Stop>
<Stopping> ::= AckDisconnect <Stop>
<Stop> ::= CmdDisconnected <Idle>
<Idle> ::= AckShutdown <Down> | AckStandBy <WaitCmdConnect>
<Down> ::= AckEnd

// =================================

<CmdList> ::= 'LIST' <OptParam> %x0D %x0A
<OptParam> ::= %x20 <%msgnum%>
<%msgnum%> ::= <number>
<number> ::= <DIGIT> <digits>
<digits> ::= <number> | _
<DIGIT> ::= %x30-%x39
+Delimiters=None
.
  ...

This is a portion of source code:

   // create automaton
   pSocketCtrl = new SocketController;

   // set some event handlers
   pSocketCtrl->OnGetSubSource = OnGetSubSourceEvent;
   pSocketCtrl->OnGetParam = OnGetCtrlParam;
   pSocketCtrl->OnSetParam = OnSetCtrlParam;
   pSocketCtrl->OnDisplay = OnCtrlDisplay;
   pSocketCtrl->OnError = OnCtrlError;

   // load BNF
   pSocketCtrl->LoadGrammar(asBNFGrammarFile);

   // run
   pSocketCtrl->Start();

I don't have a documentation yet, but can answer your questions. You can
contact me directly via e-mail, or on the list.
What I plan to do next is a BNF of IMAP client as a proof of concept.

Best wishes,
Stan
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to