Listing 2 (msg_out.c)

/******************************************************
 * NAME:  message_in
 * DESCRIPTION:  Text ........
 ******************************************************/

#include "que.h"

extern struct g_queue in_que;

void message_in()
{
  unsigned char new_msg,temp;
  int      i, state;
  
  while (true)
  {
    new_msg = true;
    i = 1;
    state = 0;
    /*  now look at each character if the character is
           a DLE then the next character is ingored */
    while (new_msg)
    {
       temp = remove_one(&in_que);
       /*
        *  implement a state machine to
        *  format the incoming message
        *  to a form suitable for your application
        */
    }
    /*
     *  calculate the crc
     */
    /*  determine the address */
    /*
     *  determine the type of message
     *  and send a reply
     */
  }
}