int smttst3_init (int argc, char *argv []) { AGENT *agent; /* Handle for our agent */ THREAD *thread; /* Handle to various threads */ # include "smttst3.i" /* Include dialog interpreter */ /* Method name Event value Priority */ /* Shutdown event comes from Kernel */ method_declare (agent, "SHUTDOWN", shutdown_event, SMT_PRIORITY_MAX); /* Reply events from reverse DNS agent */ method_declare (agent, "HOST_NAME", host_event, 0); method_declare (agent, "HOST_IP", ip_event, 0); method_declare (agent, "HOST_ERROR", error_event, 0); method_declare (agent, "HOST_END", end_event, 0); method_declare (agent, "HOST_TIMEOUT", timeout_event, 0); /* Ensure that operator console is running, else start it up */ smtoper_init (); if ((thread = thread_lookup (SMT_OPERATOR, "")) != NULL) operq = thread-> queue-> qid; else return (-1); /* Ensure that socket i/o agent is running, else start it up */ smtrdns_init (); if ((thread = thread_lookup ("smtrdns", "main")) != NULL) rdnsq = thread-> queue-> qid; else return (-1); /* Create initial, unnamed thread */ if ((thread = thread_create (AGENT_NAME, "")) != NULL) { ((TCB *) thread-> tcb)-> argc = argc; ((TCB *) thread-> tcb)-> argv = argv; } /* Signal okay to caller that we initialised okay */ return (0); }
int smttst3_init (int argc, char *argv []) { AGENT *agent; /* Handle for our agent */ THREAD *thread; /* Handle to various threads */ # include "smttst3.i" /* Include dialog interpreter */ /* Shutdown event comes from Kernel */ declare_smtlib_shutdown (shutdown_event, SMT_PRIORITY_MAX); /* Reply events from reverse DNS agent */ declare_smtrdns_host_name (host_event, 0); declare_smtrdns_host_ip (ip_event, 0); declare_smtrdns_host_error (error_event, 0); declare_smtrdns_host_end (end_event, 0); declare_smtrdns_host_timeout (timeout_event, 0); /* Ensure that operator console is running, else start it up */ smtoper_init (); if ((thread = thread_lookup (SMT_OPERATOR, "")) != NULL) operq = thread-> queue-> qid; else return (-1); /* Ensure that socket i/o agent is running, else start it up */ smtrdns_init (); if ((thread = thread_lookup ("smtrdns", "main")) != NULL) rdnsq = thread-> queue-> qid; else return (-1); /* Create initial, unnamed thread */ if ((thread = thread_create (AGENT_NAME, "")) != NULL) { ((TCB *) thread-> tcb)-> argc = argc; ((TCB *) thread-> tcb)-> argv = argv; } /* Signal okay to caller that we initialised okay */ return (0); }