OK, so it would be something like this:
In ProtocolMessage.c:
static gboolean SessionValidationMatrix[<number of
session type>][<number of client messages>];
void
initSessionValidationMatrix(void)
{
memset(SessionValidationMatrix,0,sizeof(gboolean)*<number
of session type>*<number of client messages>);
SessionValidationMatrix[RAMPSESSIONSTATE_ARTIST][CLIENTMESSAGECODE_ADDGENREEXAMPLE]
= 1;
SessionValidationMatrix[RAMPSESSIONSTATE_ADMIN][CLIENTMESSAGECODE_ADDGENREEXAMPLE]
= 1;
SessionValidationMatrix[RAMPSESSIONSTATE_LABEL][CLIENTMESSAGECODE_ADDGENREEXAMPLE]
= 1;
}
gboolean
isSessionValidForMessage(RampSessionState state,
ClientMessageCode msg)
{
return SessionValidationMatrix[state][msg];
}
initFunctionMaps() should probably call
initSessionValidationMatrix.
As I was looking through this I noticed that the
session hierarchy doesn't
quite make sense, at least as generated. It seems to me
that no client
will ever be in an inner node of the tree (such as the
"provider" state)
so while these are useful for inheritance, they
shouldn't end up in the
generated code, as they currently are.
So the unnecessary inner states for client types should
be prunned out of the code.
Logged In: YES
user_id=901267
For example:
typedef enum {
RAMPSESSIONSTATE_ADMIN = 1, //A client that can perform
administrative duties within the greenroom system
RAMPSESSIONSTATE_ARTIST = 2, //A client that represents
an artist to the system
RAMPSESSIONSTATE_LABEL = 3, //A client that represents a
label to the system
RAMPSESSIONSTATE_LISTENER = 4, //A client that is
capable of logging into the listener side of the system.
This type of client can listen to music, reques$
RAMPSESSIONSTATE_LOGGEDIN = 5, //A client that
facialitates calls that all logged in clients should have
RAMPSESSIONSTATE_LOGGEDOUT = 6, //Represents a client
that has connected to the server, but has yet to log in
RAMPSESSIONSTATE_PROVIDER = 7, //A client that can
provide new media to the system
RAMPSESSIONSTATE_SYSTEM = 0 //Represents a client that
has the basic facilities for caching and pinging from the server
} RampSessionState;
The last four in this list should not be generated.