[PATCH] State machine rewrite of dbus-auth.c
krh at bitplanet.net
Tue May 18 06:45:16 PDT 2004
I have a patch here that rearranges the auth protocol code to work more
like a state machine, as suggested by the TODO. The basic idea is to
implement each state as a function that does a
and handles the various commands in the protocol according to the
current state. A state is represented as a struct:
const char *name; /**< Name of the state */
DBusAuthStateFunction handler; /**< State function for this state */
and the DBusAuth object has a DBusAuthStateData pointer to remember the
current state. The function goto_state() goes to a new state by
updating the pointer and logs the transition.
The actual states and transitions implemented are as described in my
and the behaviour is mostly the same as the existing code.
I would like to hear what people think of the alternate specification
and the rewrite. The intention is that the specification should be
clear and unambiguous, and that the structure and functionality of the
implementation should be close to the specification.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 36623 bytes
Desc: not available
Url : http://freedesktop.org/pipermail/dbus/attachments/20040518/8d0c5874/state-machine-0001.bin
More information about the dbus