/*---------------------------------------------------------------------------*
 *  smtrdns.d - LIBERO dialog data definitions for smtrdns.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 cancel_event                    0
#define client_event                    1
#define end_event                       2
#define error_event                     3
#define exception_event                 4
#define fatal_event                     5
#define found_event                     6
#define found_bad_event                 7
#define get_host_event                  8
#define get_ip_event                    9
#define host_name_event                 10
#define initialisation_error_event      11
#define invalid_event                   12
#define ip_value_event                  13
#define master_event                    14
#define name_server_event               15
#define name_server_ip_event            16
#define not_found_event                 17
#define ok_event                        18
#define read_more_event                 19
#define shutdown_event                  20
#define sock_closed_event               21
#define sock_error_event                22
#define sock_retry_event                23
#define sock_timeout_event              24
#define timer_event                     25
#define _LR_STATE_after_init            0
#define _LR_STATE_master_input          1
#define _LR_STATE_after_thread_search   2
#define _LR_STATE_request_type          3
#define _LR_STATE_host_name_in_cache    4
#define _LR_STATE_ip_address_in_cache   5
#define _LR_STATE_server_connection     6
#define _LR_STATE_server_connected      7
#define _LR_STATE_query_type            8
#define _LR_STATE_after_send_query      9
#define _LR_STATE_read_answer           10
#define _LR_STATE_recursive_check       11
#define _LR_STATE_get_answer            12
#define _LR_STATE_answer_for_host_request 13
#define _LR_STATE_answer_for_ip_request 14
#define _LR_STATE_after_next_request    15
#define _LR_STATE_validate_request      16
#define _LR_STATE_defaults              17
#define _LR_STATE_end_thread            18
#define _LR_defaults_state              17


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

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

MODULE initialise_the_thread        (THREAD *thread);
MODULE load_host_file_in_cache      (THREAD *thread);
MODULE load_name_server_config      (THREAD *thread);
MODULE set_refresh_cache_timer      (THREAD *thread);
MODULE prepare_client_thread        (THREAD *thread);
MODULE get_current_request_type     (THREAD *thread);
MODULE signal_error                 (THREAD *thread);
MODULE check_thread_type            (THREAD *thread);
MODULE get_host_message_value       (THREAD *thread);
MODULE search_thread_for_request    (THREAD *thread);
MODULE get_ip_message_value         (THREAD *thread);
MODULE refresh_cache                (THREAD *thread);
MODULE create_request_thread        (THREAD *thread);
MODULE add_user_data_in_client_thread (THREAD *thread);
MODULE lookup_ip_in_cache           (THREAD *thread);
MODULE check_server_address         (THREAD *thread);
MODULE lookup_host_in_cache         (THREAD *thread);
MODULE send_host_name_value         (THREAD *thread);
MODULE signal_end_of_search         (THREAD *thread);
MODULE create_timeout_alarm         (THREAD *thread);
MODULE send_ip_address_value        (THREAD *thread);
MODULE connect_to_server            (THREAD *thread);
MODULE get_socket_handle            (THREAD *thread);
MODULE get_next_request             (THREAD *thread);
MODULE make_reverse_query_buffer    (THREAD *thread);
MODULE send_query_to_server         (THREAD *thread);
MODULE make_ip_query_buffer         (THREAD *thread);
MODULE wait_for_socket_input        (THREAD *thread);
MODULE read_answer_from_server      (THREAD *thread);
MODULE check_if_answer_is_complete  (THREAD *thread);
MODULE check_recursive_value        (THREAD *thread);
MODULE get_number_of_rr             (THREAD *thread);
MODULE get_main_request_type        (THREAD *thread);
MODULE set_new_value_of_recursive   (THREAD *thread);
MODULE clean_previous_request_resource (THREAD *thread);
MODULE get_answer_result            (THREAD *thread);
MODULE add_to_cache                 (THREAD *thread);
MODULE create_host_request          (THREAD *thread);
MODULE purge_equivalent_request_from_stack (THREAD *thread);
MODULE create_ip_request            (THREAD *thread);
MODULE check_request_in_invalid_server_table (THREAD *thread);
MODULE add_bad_result_to_cache      (THREAD *thread);
MODULE signal_timeout               (THREAD *thread);
MODULE free_all_server_resources    (THREAD *thread);
MODULE terminate_the_thread         (THREAD *thread);
MODULE flush_timeout_alarm          (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 [19][26] =
{
    { 0,3,0,0,0,0,0,0,0,0,0,18,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 },
    { 0,0,0,0,0,0,1,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,4,0,0,5,0,0,6,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,18,18,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,18,18,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0 },
    { 0,0,0,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,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,8,0,0,15,15,0,15,0 },
    { 0,0,0,0,0,0,0,0,0,0,9,0,0,9,0,0,9,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,10,0,0,15,15,9,15,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,10,0,15,15,0,15,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,12,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,13,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,18,0,0,15,0,15,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,15,0,0,18,0,15,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,18,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,6,0,0,0,0,0,0,0 },
    { 18,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,0,0,17,0,18,18,18,18,18
     ,18
    },
    { 0,18,0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,0,0,0,0,0,0,0,0 }
};

static word _LR_action [19][26] =
{
    { 0,2,0,0,0,0,0,0,0,0,0,3,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,4,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 },
    { 0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,9,0,0,11,0,0,10,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,12,13,0,0,0,0,0,0,0,0,0,14,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,15,13,0,0,0,0,0,0,0,0,0,14,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,16,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,17,0,0,18,18,0,18,0 },
    { 0,0,0,0,0,0,0,0,0,0,19,0,0,20,0,0,20,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,21,0,0,18,18,22,18,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23,21,0,18,18,0,18,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,0,0,24,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,26,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,27,0,0,28,0,18,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,29,0,0,30,0,18,0,0,0,0,0,0,0,0,0,0 },
    { 0,0,32,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0 },
    { 0,0,0,0,0,0,0,0,0,0,0,0,18,0,0,0,0,0,34,0,0,0,0,0,0,0 },
    { 37,0,0,3,37,37,0,0,0,0,0,0,0,0,0,0,0,0,36,0,37,37,3,37,37,35 },
    { 0,39,0,0,0,0,0,0,0,0,0,0,0,0,38,0,0,0,0,0,0,0,0,0,0,0 }
};

#if (defined (SMT_PROFILE))
static word _LR_count [45];
static long _LR_time  [45];
static word _LR_flow  [19][26];
#endif

static word _LR_offset [] =
{
    0,
    0,
    4,
    7,
    10,
    13,
    16,
    19,
    21,
    23,
    25,
    27,
    29,
    32,
    35,
    38,
    41,
    43,
    46,
    48,
    51,
    54,
    56,
    58,
    62,
    65,
    69,
    71,
    75,
    79,
    83,
    87,
    89,
    93,
    97,
    100,
    104,
    105,
    107,
    110
};

static word _LR_vector [] =
{
    0,1,2,_LR_STOP,
    3,4,_LR_STOP,
    5,6,_LR_STOP,
    7,8,_LR_STOP,
    9,8,_LR_STOP,
    10,2,_LR_STOP,
    11,_LR_STOP,
    12,_LR_STOP,
    13,_LR_STOP,
    14,_LR_STOP,
    15,_LR_STOP,
    16,6,_LR_STOP,
    17,6,_LR_STOP,
    18,14,_LR_STOP,
    19,6,_LR_STOP,
    20,_LR_STOP,
    21,4,_LR_STOP,
    22,_LR_STOP,
    23,24,_LR_STOP,
    25,24,_LR_STOP,
    26,_LR_STOP,
    24,_LR_STOP,
    27,28,29,_LR_STOP,
    30,31,_LR_STOP,
    32,33,14,_LR_STOP,
    34,_LR_STOP,
    16,35,6,_LR_STOP,
    36,37,22,_LR_STOP,
    38,37,22,_LR_STOP,
    19,35,6,_LR_STOP,
    39,_LR_STOP,
    17,40,6,_LR_STOP,
    5,40,6,_LR_STOP,
    33,14,_LR_STOP,
    41,40,6,_LR_STOP,
    _LR_STOP,
    6,_LR_STOP,
    42,43,_LR_STOP,
    44,43,_LR_STOP
};

static HOOK *_LR_module [45] = {
    load_host_file_in_cache,
    load_name_server_config,
    set_refresh_cache_timer,
    prepare_client_thread,
    get_current_request_type,
    signal_error,
    check_thread_type,
    get_host_message_value,
    search_thread_for_request,
    get_ip_message_value,
    refresh_cache,
    create_request_thread,
    add_user_data_in_client_thread,
    lookup_ip_in_cache,
    check_server_address,
    lookup_host_in_cache,
    send_host_name_value,
    signal_end_of_search,
    create_timeout_alarm,
    send_ip_address_value,
    connect_to_server,
    get_socket_handle,
    get_next_request,
    make_reverse_query_buffer,
    send_query_to_server,
    make_ip_query_buffer,
    wait_for_socket_input,
    read_answer_from_server,
    check_if_answer_is_complete,
    check_recursive_value,
    get_number_of_rr,
    get_main_request_type,
    set_new_value_of_recursive,
    clean_previous_request_resource,
    get_answer_result,
    add_to_cache,
    create_host_request,
    purge_equivalent_request_from_stack,
    create_ip_request,
    check_request_in_invalid_server_table,
    add_bad_result_to_cache,
    signal_timeout,
    free_all_server_resources,
    terminate_the_thread,
    flush_timeout_alarm
};

#if (defined (DEBUG))
static char *_LR_mname [45] =
{
     "Load-Host-File-In-Cache",
     "Load-Name-Server-Config",
     "Set-Refresh-Cache-Timer",
     "Prepare-Client-Thread",
     "Get-Current-Request-Type",
     "Signal-Error",
     "Check-Thread-Type",
     "Get-Host-Message-Value",
     "Search-Thread-For-Request",
     "Get-Ip-Message-Value",
     "Refresh-Cache",
     "Create-Request-Thread",
     "Add-User-Data-In-Client-Thread",
     "Lookup-Ip-In-Cache",
     "Check-Server-Address",
     "Lookup-Host-In-Cache",
     "Send-Host-Name-Value",
     "Signal-End-Of-Search",
     "Create-Timeout-Alarm",
     "Send-Ip-Address-Value",
     "Connect-To-Server",
     "Get-Socket-Handle",
     "Get-Next-Request",
     "Make-Reverse-Query-Buffer",
     "Send-Query-To-Server",
     "Make-Ip-Query-Buffer",
     "Wait-For-Socket-Input",
     "Read-Answer-From-Server",
     "Check-If-Answer-Is-Complete",
     "Check-Recursive-Value",
     "Get-Number-Of-Rr",
     "Get-Main-Request-Type",
     "Set-New-Value-Of-Recursive",
     "Clean-Previous-Request-Resource",
     "Get-Answer-Result",
     "Add-To-Cache",
     "Create-Host-Request",
     "Purge-Equivalent-Request-From-Stack",
     "Create-Ip-Request",
     "Check-Request-In-Invalid-Server-Table",
     "Add-Bad-Result-To-Cache",
     "Signal-Timeout",
     "Free-All-Server-Resources",
     "Terminate-The-Thread",
     "Flush-Timeout-Alarm"
};

static char *_LR_sname [19] =
{
     "After-Init",
     "Master-Input",
     "After-Thread-Search",
     "Request-Type",
     "Host-Name-In-Cache",
     "Ip-Address-In-Cache",
     "Server-Connection",
     "Server-Connected",
     "Query-Type",
     "After-Send-Query",
     "Read-Answer",
     "Recursive-Check",
     "Get-Answer",
     "Answer-For-Host-Request",
     "Answer-For-Ip-Request",
     "After-Next-Request",
     "Validate-Request",
     "Defaults",
     "End-Thread"
};

static char *_LR_ename [26] =
{
     "Cancel-Event",
     "Client-Event",
     "End-Event",
     "Error-Event",
     "Exception-Event",
     "Fatal-Event",
     "Found-Event",
     "Found-Bad-Event",
     "Get-Host-Event",
     "Get-Ip-Event",
     "Host-Name-Event",
     "Initialisation-Error-Event",
     "Invalid-Event",
     "Ip-Value-Event",
     "Master-Event",
     "Name-Server-Event",
     "Name-Server-Ip-Event",
     "Not-Found-Event",
     "Ok-Event",
     "Read-More-Event",
     "Shutdown-Event",
     "Sock-Closed-Event",
     "Sock-Error-Event",
     "Sock-Retry-Event",
     "Sock-Timeout-Event",
     "Timer-Event"
};
#else
static char *_LR_mname [45] =
{
     "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",
     "31",
     "32",
     "33",
     "34",
     "35",
     "36",
     "37",
     "38",
     "39",
     "40",
     "41",
     "42",
     "43",
     "44"
};

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

static char *_LR_ename [26] =
{
     "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"
};
#endif
