.. hsmCommunicator.rst This file automatically generated by FSMLang ================ hsmCommunicator ================ This machine manages communications using a "stop and wait" protocol. Only one message is allowed to be outstanding. Before any message can be exchanged, however, a session must be established with the peer. Establishing a connection requires several exchanges to authenticate. The session will remain active as long as messages continue to be exchanged with a minimum frequency. The user of this machine calls run_hsmCommunicator, passing the SEND_MESSAGE event. For the first message, the machine will be IDLE, and thus needs to queue the message, start the establishSession machine, and transition to the ESTABLISHING_SESSION state. Requests to send messages received in this state will simply be queued. While the top level machine is in the ESTABLISHING_SESSION state, the establishSession machine does the establishment work. When the establishSession machine receives the STEP1_RESPONSE event, it reports to the top level machine that the session is established by returning the parent's SESSION_ESTABLISHED event. This will move the top level machine to its IN_SESSION state and cause it to send the message(s) which are enqueued. .. toctree:: :hidden: :maxdepth: 2 establishSession sendMessage .. list-table:: Machine Statistics :align: left * - Number of events: - 4 * - Events not handled: - 0 * - Events handled in one state: - 2 * - At least one event handled the same in all states? - no * - Number of states: - 3 * - Number of states with entry functions: - 0 * - Number of states with exit functions: - 0 * - States handling no events: - 0 * - States handling exactly one event: - 1 * - States with no way in: - 0 * - States with no way out: - 0 .. list-table:: State Chart :align: left :header-rows: 1 :stub-columns: 1 :class: scrollable * - - :ref:`SEND_MESSAGE ` - :ref:`SESSION_ESTABLISHED ` - :ref:`SESSION_TIMEOUT ` - :ref:`MESSAGE_RECEIVED ` * - :ref:`IDLE ` - | :ref:`startSessionEstablishment ` | transition: :ref:`ESTABLISHING_SESSION ` - - - * - :ref:`ESTABLISHING_SESSION ` - :ref:`queueMessage ` - | :ref:`completeSessionStart ` | transition: :ref:`IN_SESSION ` - - :ref:`passMessageReceived ` * - :ref:`IN_SESSION ` - :ref:`requestMessageTransmission ` - - transition: :ref:`IDLE ` - :ref:`passMessageReceived ` Events ------- .. _hsmCommunicator.SEND_MESSAGE: SEND_MESSAGE ~~~~~~~~~~~~~ This event comes from our client code, asking us to send a message. These sub-machines share this event: * sendMessage These states handle this event: * :ref:`IDLE ` * :ref:`ESTABLISHING_SESSION ` * :ref:`IN_SESSION ` This yields a state density of 100%. These actions are taken in response to this event: * :ref:`startSessionEstablishment ` * :ref:`queueMessage ` * :ref:`requestMessageTransmission ` .. _hsmCommunicator.SESSION_ESTABLISHED: SESSION_ESTABLISHED ~~~~~~~~~~~~~~~~~~~~ This event comes from our establishSession submachine, indicating that it has successfully completed its work. We then forward it to our sendMessage submachine to indicate that it may now begin to send messages. This event is handled identically in 1 states. These states handle this event: * :ref:`ESTABLISHING_SESSION ` This yields a state density of 33%. These actions are taken in response to this event: * :ref:`completeSessionStart ` .. _hsmCommunicator.SESSION_TIMEOUT: SESSION_TIMEOUT ~~~~~~~~~~~~~~~~ This event comes from our external timer, indicating that we've not tickled it in a while, and thus should close down our session. This event is handled identically in 1 states. These states handle this event: * :ref:`IN_SESSION ` This yields a state density of 33%. No actions are taken in response to this event. .. _hsmCommunicator.MESSAGE_RECEIVED: MESSAGE_RECEIVED ~~~~~~~~~~~~~~~~~ This event comes from our lower comm layers, indicating that a peer message has arrived. While we're in the ESTABLISHING_SESSION state, we forward this event to the establishSession submachine; while in the IN_SESSION state, we forward it to the sendMessage submachine. This event is handled identically in 2 states. These sub-machines share this event: * establishSession * sendMessage These states handle this event: * :ref:`ESTABLISHING_SESSION ` * :ref:`IN_SESSION ` This yields a state density of 66%. These actions are taken in response to this event: * :ref:`passMessageReceived ` States ------- .. _hsmCommunicator.IDLE: IDLE ~~~~~ The wakeup state. Also, this is the state to which the machine returns when a session times out. These events are handled in this state: * :ref:`SEND_MESSAGE ` This yields an event density of 25%. These actions are taken in this state: * :ref:`startSessionEstablishment ` These states transition into this state: * :ref:`IN_SESSION ` This state transitions into these states: * :ref:`ESTABLISHING_SESSION ` .. _hsmCommunicator.ESTABLISHING_SESSION: ESTABLISHING_SESSION ~~~~~~~~~~~~~~~~~~~~~ The machine is establishing a session. The actual work is being done by the establishSession submachine. While in this state, the MESSAGE_RECEIVED event is forwarded to that submachine. These events are handled in this state: * :ref:`SESSION_ESTABLISHED ` * :ref:`MESSAGE_RECEIVED ` * :ref:`SEND_MESSAGE ` This yields an event density of 75%. These actions are taken in this state: * :ref:`completeSessionStart ` * :ref:`passMessageReceived ` * :ref:`queueMessage ` These states transition into this state: * :ref:`IDLE ` This state transitions into these states: * :ref:`IN_SESSION ` .. _hsmCommunicator.IN_SESSION: IN_SESSION ~~~~~~~~~~~ A session has been established, and messages are being exchanged with the peer. While in this state, the MESSAGE_RECEIVED event is forwarded to the sendMessage submachine. These events are handled in this state: * :ref:`MESSAGE_RECEIVED ` * :ref:`SEND_MESSAGE ` * :ref:`SESSION_TIMEOUT ` This yields an event density of 75%. These actions are taken in this state: * :ref:`passMessageReceived ` * :ref:`requestMessageTransmission ` These states transition into this state: * :ref:`ESTABLISHING_SESSION ` This state transitions into these states: * :ref:`IDLE ` Actions -------- .. _hsmCommunicator.startSessionEstablishment: startSessionEstablishment ~~~~~~~~~~~~~~~~~~~~~~~~~~ This action returns: * :ref:`ESTABLISH_SESSION_REQUEST ` .. _hsmCommunicator.completeSessionStart: completeSessionStart ~~~~~~~~~~~~~~~~~~~~~ This action returns: * noEvent .. _hsmCommunicator.passMessageReceived: passMessageReceived ~~~~~~~~~~~~~~~~~~~~ .. _hsmCommunicator.queueMessage: queueMessage ~~~~~~~~~~~~~ This action returns: * noEvent .. _hsmCommunicator.requestMessageTransmission: requestMessageTransmission ~~~~~~~~~~~~~~~~~~~~~~~~~~~ This action returns: * noEvent