NAME

     imta_init, imta_end - Initializes or terminates dialog  with
     the SIMS IMTA.


SYNOPSIS

     #include <imta.h>

     int  imta_init(const char *channel);

     void imta_end();


DESCRIPTION

     imta_init() must be called prior to calling any other  func-
     tion  in  the  MTA  management  (imta_...),  message enqueue
     (imme_...), or message dequeue (immd_...)  APIs.

     imta_init() allocates and initializes internal  data  struc-
     tures used by the SIMS IMTA. It should only be called once.

     After all processing  is  completed,  imta_end()  should  be
     called  to release any allocated memory, and ensure that any
     open files are properly closed.

     Channel programs that dequeue messages from a specific  IMTA
     queue or enqueue messages from a specific channel should set
     channel to the name of that channel.  Master  programs  that
     dequeue  from  all  channels can set channel to "*".  Subse-
     quent immd_get_message() calls will retrieve  messages  from
     any  queues. immd_get_channel() can be used to determine the
     channel from which the current message is dequeued.

     Channel master programs meant to run under  the  control  of
     the  job_controller  should  set channel to NULL.  Such pro-
     grams will dequeue messages from the IMTA queue specified by
     the job_controller.

     Programs using the  IMTA  SDK  for  reasons  other  than  to
     dequeue  or enqueue messages (for example, to check the IMTA
     counters) should set channel to NULL as well.

     In   general,   programs   should   not   repeatedly    call
     imta_init()and imta_end().  Either of these functions should
     generally be called only once per program run.

     All active message dequeue or  enqueue  contexts  should  be
     disposed by calling immd_end()or imme_end() prior to calling
     imta_end().   If  imta_end()  is  called  while  dequeue  or
     enqueue contexts are still active, then any messages associ-
     ated with active dequeue contexts will be deferred for later
     processing  and  any messages associated with active enqueue
     contexts will be deleted.


ARGUMENTS

     channel
          name of the channel run by the program.   See  descrip-
          tion above.


RETURN VALUES

     imme_init() returns IMRC_OK when successful, and a  negative
     error code otherwise.

     Common sources of error include  oversized  channel  string,
     lack  of  priviledges  to  read  the  MTA configuration, and
     mismatch between the current version of libimta.so  and  the
     site's  compiled  configuration.  In the latter case, either
     the IMTA configuration or the character set tables  need  to
     be  recompiled.  A textual explanation of the failure can be
     obtained by calling imta_error() immediately afterwards.


ATTRIBUTES

               _______________________________________
              |   Attribute Type   |  Attribute Value|
              |____________________|_________________|
              | Architecture       |  sparc, x86     |
              |____________________|_________________|
              | Availability       |  SUNWimsdk      |
              |____________________|_________________|
              | MT-Level           |  MT-Safe        |
              |____________________|_________________|
              | Interface Stability|  Stable         |
              |____________________|_________________|


SEE ALSO

     immd_get_message(3), immd_get_channel(3)