|
| iMatix home page | << | < | > | >> |
SMTVersion 2.81 |
#include "smtupm.h" int smtupmc_init (char *p_args, char *p_portname)
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.
{
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);
}
| | << | < | > | >> |
|