NAME

     atm_accept - accept a pending connection request


SYNOPSIS

     #include <fore_atm/fore_atm_user.h>

     atm_accept(fd, fdnew, conn_id, qos, dataflow)
     int fd;
     int fdnew;
     int conn_id;
     Atm_qos *qos;
     Atm_dataflow dataflow;


DESCRIPTION

     atm_accept() is used to  accept  a  connection  request  and
     optionally connect back to the remote ATM end-point.  The fd
     argument specifies the file descriptor that  was  used  with
     atm_listen(4N).   fdnew  specifies  the  file  descriptor to
     accept the connection on.  fdnew then becomes  a  new  local
     ATM end-point to be used with atm_send(4N) and atm_recv(4N).

     fd and fdnew can differ or be equal. When  equal,  then  the
     connection  is  accepted and the file descriptor goes from a
     listening  state  to  a  connected  state.   New  connection
     requests  can  no longer be accepted using the file descrip-
     tor.

     When the file descriptors differ, then the  file  descriptor
     specified  by  fd remains in a listening state.  fd can con-
     tinue to be used with atm_listen(4N), while fdnew becomes  a
     new local ATM end-point.

     Multiple connect requests can arrive over the file  descrip-
     tor  identified  by  fd. Connect requests can be accepted in
     any order. The conn_id argument returned by atm_listen()  is
     used to match connection requests with acceptance.

     If the caller wishes to connect back to the remote ATM  end-
     point  then  the qos (Quality Of Service) argument specifies
     the caller's requested target and minimum acceptable network
     bandwidth  requirements for that connection. The ATM network
     uses this information to allocate network  bandwidth  during
     connection establishment.

     The dataflow argument specifies simplex, duplex,  or  multi-
     cast  communication. When simplex communication is selected,
     the connection is simply accepted, resulting in  a  dataflow
     from  the  remote  ATM end-point to the local ATM end-point.
     If duplex is requested then the connection is accepted and a
     connection  is  made  back  to the remote ATM end-point.  If
     multicast is specified then the connection is accepted as  a
     branch  of  a  unidirectional  multicast  tree rooted at the
     remote ATM end-point.  Applications must agree  on  simplex,
     duplex, or multicast communication beforehand.

     See atm_server(4N) for usage of atm_accept().


RETURN VALUES

     atm_accept() returns 0 on success.  On failure,  it  returns
     -1  and sets atm_errno to indicate the error.  atm_error(4N)
     can be used to print a text description of  errors  returned
     by atm_accept().


ERRORS

     DL_OUTSTATE
          No outstanding connection requests.

     DL_UNSUPPORTED
          Dataflow not simplex or duplex.

     DL_BADCORR
          Bad correlation number.  conn_id  does  not  match  any
          returned by atm_listen().

     ECONNREFUSED
          Connection failed because the destination ATM end-point
          did   not  respond.  Will  also  fail  if  the  minimum
          requested bandwidth  could  not  be  allocated  in  the
          reverse direction.

     atm_accept() can also fail with  errors  returned  from  the
     getmsg(2)  and  putmsg(2) system calls on the SunOS and IRIX
     platforms.

     On ULTRIX platforms, atm_accept() on a closed connection may
     cause  a  SIGPIPE  signal to be sent to the calling process.
     Unless caught or ignored, this terminates the process.


NOTES

     A concurrent server model is not supported in this  software
     release.   fd and fdnew must be equal. If the files descrip-
     tors are not equal then error DL_UNSUPPORTED is returned  to
     the caller.


SEE ALSO

     atm_intro(4N)