Exemplo n.º 1
0
MODULE send_time_slot_specifiers (THREAD *thread)
{
    msg_size = exdr_writed (&msg, SMT_SLOT_SPEC, "Tue 22:10-23");
    event_send (&slotq, &thread-> queue-> qid, "SPECIFY", msg_body, msg_size,
                NULL, NULL, NULL, 0);

    msg_size = exdr_writed (&msg, SMT_SLOT_SPEC, "Mon 6:50-9 12:00-15");
    event_send (&slotq, &thread-> queue-> qid, "SPECIFY", msg_body, msg_size,
                NULL, NULL, NULL, 0);

    msg_size = exdr_writed (&msg, SMT_SLOT_SPEC, "Thu 12:30-20:00");
    event_send (&slotq, &thread-> queue-> qid, "SPECIFY", msg_body, msg_size,
                NULL, NULL, NULL, 0);
}
Exemplo n.º 2
0
MODULE send_host_name_value (THREAD *thread)
{
    USER_DATA
        *next_data,
        *user_data;

    tcb = thread-> tcb;                 /*  Point to thread's context        */

    if (tcb-> ip_address == 0
    &&  tcb-> ip_value)
        tcb-> ip_address = inet_addr (tcb-> ip_value);

    tcb-> send_responce = TRUE;
    user_data = tcb-> reply.next;
    while (user_data && (void *)user_data != (void *)&tcb-> reply)
      {
        next_data = user_data-> next;
        msg_size = exdr_writed (&msg, SMT_HOST_NAME, tcb-> ip_address,
                            tcb-> host_name, user_data-> tag);

        event_send (
            &user_data-> reply_to,      /*  Send to specified queue          */
            &thread-> queue-> qid,      /*  Queue for reply                  */
            "HOST_NAME",                /*  Name of event to send            */
            msg_body, msg_size,         /*  Event body and size              */
            NULL, NULL, NULL,           /*  No response events               */
            0);                         /*  No timeout                       */
        user_data = next_data;
      }
}
Exemplo n.º 3
0
MODULE connect_to_server (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    if (dns_debug_mode)
      {
        inaddr.s_addr = tcb-> cur_request-> ns_ip;
        coprintf ("Connect to : %s (%s) port %d",
                  inet_ntoa (inaddr),
                  tcb-> cur_request-> ns_name?
                      tcb-> cur_request-> ns_name: "",
                  ntohs (tcb-> cur_request-> ns_port));
      }
    tcb-> current_ns_ip = tcb-> cur_request-> ns_ip;
    msg_size = exdr_writed (&msg, SMT_SOCK_CONNECT,
        30,                             /*  Time out of connect              */
        "udp",
        NULL,
        NULL,
        ntohs (tcb-> cur_request-> ns_port),
        ntohl (tcb-> cur_request-> ns_ip),
        0);

    event_send (
        &sockq,                        /*  Send to specified queue           */
        &thread-> queue-> qid,         /*  Queue for reply                   */
        "CONNECT",                     /*  Name of event to send             */
        msg_body, msg_size,            /*  Event body and size               */
        NULL, NULL, NULL,              /*  No response events                */
        0);                            /*  No timeout                        */
}
Exemplo n.º 4
0
MODULE wait_for_socket_input (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    if (tcb-> cur_request-> recursive == FALSE)
        msg_size = exdr_writed (&msg, SMT_SOCK_INPUT, REQUEST_TIMEOUT,
                                tcb-> handle, 0);
    else
        msg_size = exdr_writed (&msg, SMT_SOCK_INPUT, RECURSIVE_TIMEOUT,
                                tcb-> handle, 0);
    event_send (
        &sockq,                         /*  Send to specified queue          */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "INPUT",                        /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Exemplo n.º 5
0
static void
put_upm_message (THREAD *thread, dbyte ident, char *body)
{
    static byte
        upm_body [LINE_MAX];            /*  Message to UPM client agent      */
    static DESCR                        /*  Descriptor for exdr_writed       */
        upm = { LINE_MAX, upm_body };
    int
        upm_size;                       /*  Size of formatted upm_body       */

    upm_size = exdr_writed (&upm, SMT_UPM_MESSAGE, ident, body);
    msg_size = exdr_writed (&msg, SMT_TRAN_PUTB,
                            upm_socket, upm_size, upm_body, NULL);
    event_send (
        &tranq,                         /*  Send to transfer agent           */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "PUT_BLOCK",                    /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Exemplo n.º 6
0
MODULE connect_to_upm_daemon (THREAD *thread)
{
    printf ("upmc> 100- Connecting to UPM daemon...\n");
    msg_size = exdr_writed (&msg, SMT_SOCK_CONNECT, 0,
                            "TCP", "", portname, 0, (qbyte) 0, (qbyte) 0);
    event_send (
        &sockq,                         /*  Send to socket agent             */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "CONNECT",                      /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Exemplo n.º 7
0
MODULE create_timeout_alarm (THREAD *thread)
{
    /*  Ask timer to send us an event after the monitor timeout              */
    msg_size = exdr_writed (&msg, SMT_TIME_ALARM, (qbyte) 0,
                           (qbyte)QUERY_TIMEOUT * 100, 0, (void *) NULL);
    event_send (
        &timeq,                         /*  Send to timer queue              */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "ALARM",                        /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Exemplo n.º 8
0
MODULE request_ip_address (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */
    msg_size = exdr_writed (&msg, SMT_GET_HOST_IP, buffer, (qbyte) 0);

    event_send (
        &rdnsq,                         /*  Send to specified queue          */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "GET_HOST_IP",                  /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Exemplo n.º 9
0
MODULE get_daemon_message (THREAD *thread)
{
    /*  Ask the transfer agent to read a block from the socket               */
    msg_size = exdr_writed (&msg, SMT_TRAN_GETB, upm_socket, NULL);
    event_send (
        &tranq,                         /*  Send to transfer agent           */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "GET_BLOCK",                    /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */

    event_wait ();                      /*  Wait for reply event             */
}
Exemplo n.º 10
0
MODULE set_refresh_cache_timer (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    msg_size = exdr_writed (&msg, SMT_TIME_ALARM, (qbyte) 0,
                           (qbyte)REFRESH_CACHE_TIME * 100, 0, (void *) NULL);
    event_send (
        &timeq,                         /*  Send to timer queue              */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "ALARM",                        /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
}
Exemplo n.º 11
0
static void
put_control_msg (THREAD *thread, dbyte ident, char *body)
{
    static byte
        control_body [LINE_MAX];        /*  Message to SYSMAN agent          */
    static DESCR                        /*  Descriptor for exdr_writed       */
        control = { LINE_MAX, control_body };
    int
        control_size;                   /*  Size of formatted control_body   */

    control_size = exdr_writed (&control, SYSMAN_MESSAGE, ident, body);

    send_smttran_put_block (&tranq, control_socket, (dbyte)control_size,
                            (byte *)control_body, NULL);
}
Exemplo n.º 12
0
MODULE send_query_to_server (THREAD *thread)
{
    tcb = thread-> tcb;                 /*  Point to thread's context        */

    msg_size = exdr_writed (&msg, SMT_SOCK_WRITE,
        CONNECT_TIMEOUT,                /*  Timeout for request              */
        tcb-> handle,                   /*  Socket to write to               */
        tcb-> readsize,                 /*  Amount of data to write          */
        tcb-> query,                    /*  Address of data block            */
        (qbyte) 0);                     /*  No request tag                   */

    event_send (
        &sockq,                         /*  Send to specified queue          */
        &thread-> queue-> qid,          /*  Queue for reply                  */
        "WRITE",                        /*  Name of event to send            */
        msg_body, msg_size,             /*  Event body and size              */
        NULL, NULL, NULL,               /*  No response events               */
        0);                             /*  No timeout                       */
    tcb-> readsize = 0;
}