/*---------------------------------------------------------------------------*
 *  smtpop.d - LIBERO dialog data definitions for smtpop.c.                  *
 *  Generated by LIBERO 2.4 on 11 Oct, 2010, 17:15.                          *
 *  Schema file used: smtschm.c.                                             *
 *---------------------------------------------------------------------------*/

/*- Symbolic constants and event numbers ------------------------------------*/

#define _LR_STOP                        0xFFFFL
#define _LR_NULL_EVENT                  -2
#define _LR_NULL_STATE                  -1
#define terminate_event                 -1
#define bad_message_id_event            0
#define badly_formed_msg_error_event    1
#define client_event                    2
#define connection_request_event        3
#define del_request_event               4
#define header_request_event            5
#define io_error_event                  6
#define master_event                    7
#define memory_error_event              8
#define message_info_request_event      9
#define message_request_event           10
#define quit_request_event              11
#define server_negative_response_event  12
#define server_positive_response_event  13
#define server_response_error_event     14
#define session_info_request_event      15
#define shutdown_event                  16
#define snprintf_error_event            17
#define sock_closed_event               18
#define sock_connect_ok_event           19
#define sock_error_event                20
#define sock_read_ok_event              21
#define sock_timeout_event              22
#define undefined_error_event           23
#define _LR_STATE_after_init            0
#define _LR_STATE_master_sleeping       1
#define _LR_STATE_connecting_socket     2
#define _LR_STATE_waiting_command_response 3
#define _LR_STATE_waiting_user_response 4
#define _LR_STATE_waiting_password_response 5
#define _LR_STATE_waiting_stat_response 6
#define _LR_STATE_waiting_client_request 7
#define _LR_STATE_waiting_message_info_request 8
#define _LR_STATE_waiting_top_response  9
#define _LR_STATE_waiting_retr_response 10
#define _LR_STATE_waiting_dele_response 11
#define _LR_STATE_waiting_quit_response 12
#define _LR_STATE_defaults              13
#define _LR_defaults_state              13


/*- Function prototypes and macros ------------------------------------------*/

#ifndef MODULE
#define MODULE  static void             /*  Libero dialog modules            */
#endif

MODULE initialise_the_thread        (THREAD *thread);
MODULE do_connect_socket            (THREAD *thread);
MODULE create_child_thread          (THREAD *thread);
MODULE get_socket_handle            (THREAD *thread);
MODULE read_repeatedly_server_response (THREAD *thread);
MODULE build_response               (THREAD *thread);
MODULE check_server_response        (THREAD *thread);
MODULE send_user_command            (THREAD *thread);
MODULE convert_chunks_to_string     (THREAD *thread);
MODULE send_error_to_client         (THREAD *thread);
MODULE release_response             (THREAD *thread);
MODULE terminate_the_thread         (THREAD *thread);
MODULE send_password_command        (THREAD *thread);
MODULE send_stat_command            (THREAD *thread);
MODULE get_message_count_and_size   (THREAD *thread);
MODULE send_connection_accepted_to_client (THREAD *thread);
MODULE send_session_info_to_client  (THREAD *thread);
MODULE store_msg_id_parameters      (THREAD *thread);
MODULE send_message_info_request    (THREAD *thread);
MODULE check_msg_id                 (THREAD *thread);
MODULE send_top_command_to_server   (THREAD *thread);
MODULE send_retr_command            (THREAD *thread);
MODULE send_dele_command_to_server  (THREAD *thread);
MODULE send_quit_command            (THREAD *thread);
MODULE send_message_info_to_client  (THREAD *thread);
MODULE convert_string_to_struct     (THREAD *thread);
MODULE send_message_header_to_client (THREAD *thread);
MODULE get_media_type_and_boundary  (THREAD *thread);
MODULE send_message_to_client       (THREAD *thread);
MODULE send_request_ok_to_client    (THREAD *thread);
MODULE send_quit_ok_to_client       (THREAD *thread);
MODULE do_close_socket              (THREAD *thread);

#define the_next_event              _the_next_event
#define the_exception_event         _the_exception_event
#define the_external_event          _the_external_event
#define exception_raised            _exception_raised
#define io_completed                _io_completed


/*- Static areas shared by all threads --------------------------------------*/

static word _LR_nextst [14][24] =
{
    { 0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,2,4,0,0,0,0,0,2,0,2,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,3,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,4,5,0,0,0,0,0,0,0,4,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,5,6,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,6,7,0,0,0,0,0,0,0,6,0,0 },
    { 0,0,0,0,11,9,0,0,0,8,10,12,0,0,0,7,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,8,7,0,0,0,0,0,0,0,8,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,9,7,0,0,0,0,0,0,0,9,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,10,7,0,0,0,0,0,0,0,10,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,11,7,0,0,0,0,0,0,0,11,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,12,12,0,0,0,0,0,0,0,12,0,0 },
    { 7,13,0,13,13,13,13,0,13,0,13,13,0,0,7,13,13,13,13,0,13,0,13
     ,13
    }
};

static word _LR_action [14][24] =
{
    { 0,0,2,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,6,0,0,0,0,0,4,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,8,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,9,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,10,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,15,13,0,0,0,12,14,16,0,0,0,11,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,17,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,18,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,19,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,7,20,0,0,0,0,0,0,0,5,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,22,21,0,0,0,0,0,0,0,5,0,0 },
    { 25,24,0,23,23,23,24,0,24,0,23,23,0,0,24,23,23,23,24,0,24,0
     ,24,23
    }
};

#if (defined (SMT_PROFILE))
static word _LR_count [31];
static long _LR_time  [31];
static word _LR_flow  [14][24];
#endif

static word _LR_offset [] =
{
    0,
    0,
    1,
    3,
    5,
    8,
    11,
    14,
    19,
    22,
    25,
    30,
    32,
    36,
    41,
    46,
    51,
    54,
    58,
    63,
    69,
    72,
    76,
    82,
    84,
    87
};

static word _LR_vector [] =
{
    _LR_STOP,
    0,_LR_STOP,
    1,_LR_STOP,
    2,3,_LR_STOP,
    4,5,_LR_STOP,
    6,3,_LR_STOP,
    7,8,9,10,_LR_STOP,
    11,3,_LR_STOP,
    12,3,_LR_STOP,
    7,13,14,9,_LR_STOP,
    15,_LR_STOP,
    16,17,3,_LR_STOP,
    16,18,19,3,_LR_STOP,
    16,18,20,3,_LR_STOP,
    16,18,21,3,_LR_STOP,
    22,3,_LR_STOP,
    7,23,9,_LR_STOP,
    7,24,25,9,_LR_STOP,
    7,24,26,27,9,_LR_STOP,
    28,9,_LR_STOP,
    29,30,10,_LR_STOP,
    7,8,9,30,10,_LR_STOP,
    10,_LR_STOP,
    8,10,_LR_STOP,
    8,9,_LR_STOP
};

static HOOK *_LR_module [31] = {
    do_connect_socket,
    create_child_thread,
    get_socket_handle,
    read_repeatedly_server_response,
    build_response,
    check_server_response,
    send_user_command,
    convert_chunks_to_string,
    send_error_to_client,
    release_response,
    terminate_the_thread,
    send_password_command,
    send_stat_command,
    get_message_count_and_size,
    send_connection_accepted_to_client,
    send_session_info_to_client,
    store_msg_id_parameters,
    send_message_info_request,
    check_msg_id,
    send_top_command_to_server,
    send_retr_command,
    send_dele_command_to_server,
    send_quit_command,
    send_message_info_to_client,
    convert_string_to_struct,
    send_message_header_to_client,
    get_media_type_and_boundary,
    send_message_to_client,
    send_request_ok_to_client,
    send_quit_ok_to_client,
    do_close_socket
};

#if (defined (DEBUG))
static char *_LR_mname [31] =
{
     "Do-Connect-Socket",
     "Create-Child-Thread",
     "Get-Socket-Handle",
     "Read-Repeatedly-Server-Response",
     "Build-Response",
     "Check-Server-Response",
     "Send-User-Command",
     "Convert-Chunks-To-String",
     "Send-Error-To-Client",
     "Release-Response",
     "Terminate-The-Thread",
     "Send-Password-Command",
     "Send-Stat-Command",
     "Get-Message-Count-And-Size",
     "Send-Connection-Accepted-To-Client",
     "Send-Session-Info-To-Client",
     "Store-Msg-Id-Parameters",
     "Send-Message-Info-Request",
     "Check-Msg-Id",
     "Send-Top-Command-To-Server",
     "Send-Retr-Command",
     "Send-Dele-Command-To-Server",
     "Send-Quit-Command",
     "Send-Message-Info-To-Client",
     "Convert-String-To-Struct",
     "Send-Message-Header-To-Client",
     "Get-Media-Type-And-Boundary",
     "Send-Message-To-Client",
     "Send-Request-Ok-To-Client",
     "Send-Quit-Ok-To-Client",
     "Do-Close-Socket"
};

static char *_LR_sname [14] =
{
     "After-Init",
     "Master-Sleeping",
     "Connecting-Socket",
     "Waiting-Command-Response",
     "Waiting-User-Response",
     "Waiting-Password-Response",
     "Waiting-Stat-Response",
     "Waiting-Client-Request",
     "Waiting-Message-Info-Request",
     "Waiting-Top-Response",
     "Waiting-Retr-Response",
     "Waiting-Dele-Response",
     "Waiting-Quit-Response",
     "Defaults"
};

static char *_LR_ename [24] =
{
     "Bad-Message-Id-Event",
     "Badly-Formed-Msg-Error-Event",
     "Client-Event",
     "Connection-Request-Event",
     "Del-Request-Event",
     "Header-Request-Event",
     "Io-Error-Event",
     "Master-Event",
     "Memory-Error-Event",
     "Message-Info-Request-Event",
     "Message-Request-Event",
     "Quit-Request-Event",
     "Server-Negative-Response-Event",
     "Server-Positive-Response-Event",
     "Server-Response-Error-Event",
     "Session-Info-Request-Event",
     "Shutdown-Event",
     "Snprintf-Error-Event",
     "Sock-Closed-Event",
     "Sock-Connect-Ok-Event",
     "Sock-Error-Event",
     "Sock-Read-Ok-Event",
     "Sock-Timeout-Event",
     "Undefined-Error-Event"
};
#else
static char *_LR_mname [31] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8",
     "9",
     "10",
     "11",
     "12",
     "13",
     "14",
     "15",
     "16",
     "17",
     "18",
     "19",
     "20",
     "21",
     "22",
     "23",
     "24",
     "25",
     "26",
     "27",
     "28",
     "29",
     "30"
};

static char *_LR_sname [14] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8",
     "9",
     "10",
     "11",
     "12",
     "13"
};

static char *_LR_ename [24] =
{
     "0",
     "1",
     "2",
     "3",
     "4",
     "5",
     "6",
     "7",
     "8",
     "9",
     "10",
     "11",
     "12",
     "13",
     "14",
     "15",
     "16",
     "17",
     "18",
     "19",
     "20",
     "21",
     "22",
     "23"
};
#endif
