| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

smtupmc_init

#include "smtupm.h"
int
smtupmc_init (char *p_args, char *p_portname)

Synopsis

Initialises the SMT UPM client agent. Returns 0 if okay, -1 if there was an error. The UPM client agent allows you to pass commands to the UPM daemon. See the SMT documentation for details.

Source Code - (smtupmc.c)

{
    AGENT   *agent;                     /*  Handle for our agent             */
    THREAD  *thread;                    /*  Handle to console thread         */
#   include "smtupmc.i"                 /*  Include dialog interpreter       */

    /*  Shutdown event comes from Kernel                                     */
    method declare (agent, "SHUTDOWN", shutdown_event, SMT_PRIORITY_MAX);

    /*  Reply events from socket agent                                       */
    method declare (agent, "SOCK_INPUT_OK",  ok_event,          0);
    method declare (agent, "SOCK_OUTPUT_OK", ok_event,          0);
    method declare (agent, "SOCK_READ_OK",   ok_event,          0);
    method declare (agent, "SOCK_WRITE_OK",  ok_event,          0);
    method declare (agent, "SOCK_CLOSED",    sock_closed_event, 0);
    method declare (agent, "SOCK_ERROR",     sock_error_event,  0);
    method declare (agent, "SOCK_TIMEOUT",   sock_error_event,  0);

    /*  Reply events from transfer agent                                     */
    method declare (agent, "TRAN_GETF_OK",   ok_event,          0);
    method declare (agent, "TRAN_PUTF_OK",   SMT_NULL_EVENT,    0);
    method declare (agent, "TRAN_CLOSED",    sock_closed_event, 0);
    method declare (agent, "TRAN_ERROR",     sock_error_event,  0);

    /*  Create initial, unnamed thread                                       */
    thread create (AGENT_NAME, "");

    /*  Ensure that socket agent is running, else start it up                */
    smtsock init ();
    if ((thread = thread lookup (SMT_SOCKET, "")) != NULL)
        sockq = thread-> queue-> qid;
    else
        return (-1);

    /*  Ensure that transfer agent is running, else start it up              */
    smttran init ();
    if ((thread = thread lookup (SMT_TRANSFER, "")) != NULL)
        tranq = thread-> queue-> qid;
    else
        return (-1);

    /*  Signal okay to caller that we initialised okay                       */
    args     = p_args;                  /*  Get command-line arguments       */
    portname = p_portname;
    return (0);
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation