


T_ACCEPT(3N)            NETWORK FUNCTIONS            T_ACCEPT(3N)



NAME
     t_accept - accept a connect request

SYNOPSIS
     #include <tiuser.h>

     int t_accept(fd, resfd, call)
     int fd;
     int resfd;
     struct t_call *call;

DESCRIPTION
     t_accept() is issued by a transport user to accept a connect
     request.   _f_d  identifies the local transport endpoint where
     the connect indication arrived, _r_e_s_f_d  specifies  the  local
     transport  endpoint  where  the  connection  is  to be esta-
     blished, and _c_a_l_l contains information required by the tran-
     sport provider to complete the connection.  _c_a_l_l points to a
     t_call structure which contains the following members:
               struct netbuf addr;
               struct netbuf opt;
               struct netbuf udata;
               int sequence;

     The _n_e_t_b_u_f structure contains the following members:

          unsigned int maxlen;
          unsigned int len;
          char *buf;

     _b_u_f points to a user input and/or output buffer.   _l_e_n  gen-
     erally  specifies  the  number  of  bytes  contained  in the
     buffer.  If the structure is used for both input and output,
     the transport function will replace the user value of _l_e_n on
     return.  _m_a_x_l_e_n generally has significance only when _b_u_f  is
     used to receive output from the transport function.  In this
     case, it specifies the physical size of the buffer, and  the
     maximum  value  of  _l_e_n that can be set by the function.  If
     _m_a_x_l_e_n is not large enough to hold the returned information,
     a  TBUFOVFLW  error will generally result.  However, certain
     functions may return part of the data and  not  generate  an
     error.   In  _c_a_l_l,  _a_d_d_r  is  the address of the caller, _o_p_t
     indicates any protocol-specific parameters  associated  with
     the connection, _u_d_a_t_a points to any user data to be returned
     to the  caller,  and  _s_e_q_u_e_n_c_e  is  the  value  returned  by
     t_listen(3N)  that  uniquely  associates the response with a
     previously received connect indication.

     A transport user may accept a connection on either the same,
     or  on a different, local transport endpoint than the one on
     which the connect indication arrived.  If the same  endpoint
     is  specified  (_r_e_s_f_d  = _f_d), the connection can be accepted



Sun Release 4.1   Last change: 21 January 1990                  1






T_ACCEPT(3N)            NETWORK FUNCTIONS            T_ACCEPT(3N)



     unless  the  following  condition  is  true:  The  user  has
     received  other  indications  on  that  endpoint but has not
     responded to them (with t_accept()  or  t_snddis(3N)).   For
     this  condition,  t_accept()  will  fail  and set t_errno to
     TBADF.

     If a different transport endpoint  is  specified  (_r_e_s_f_d  !=
     _f_d),  the  endpoint  must be bound to a protocol address and
     must be in the T_IDLE state (see t_getstate(3N)) before  the
     t_accept() is issued.

     For both types of endpoints, t_accept() will  fail  and  set
     t_errno to TLOOK if there are indications (such as a connect
     or disconnect) waiting to be received on that endpoint.

     The values of parameters specified by _o_p_t and the syntax  of
     those values are protocol specific.  The _u_d_a_t_a field enables
     the called transport user to send user data  to  the  caller
     and  the amount of user data must not exceed the limits sup-
     ported by the transport provider as returned  by  t_open(3N)
     or  t_getinfo(3N).   If  the  _l_e_n field of _u_d_a_t_a is zero, no
     data will be sent to the caller.

RETURN VALUES
     t_accept() returns:

     0    on success.

     -1   on failure and sets t_errno to indicate the error.

ERRORS
     TACCES              The user does  not  have  permission  to
                         accept  a  connection  on the responding
                         transport endpoint.

                         The user does not have permission to use
                         the specified options.

     TBADDATA            The amount of user  data  specified  was
                         not  within  the  bounds  allowed by the
                         transport provider.

     TBADF               The specified file descriptor  does  not
                         refer to a transport endpoint.

                         The user is illegally accepting  a  con-
                         nection  on  the same transport endpoint
                         on which the connect indication arrived.

     TBADOPT             The  specified  options   were   in   an
                         incorrect  format  or  contained illegal
                         information.



Sun Release 4.1   Last change: 21 January 1990                  2






T_ACCEPT(3N)            NETWORK FUNCTIONS            T_ACCEPT(3N)



     TBADSEQ             An invalid sequence  number  was  speci-
                         fied.

     TLOOK               An asynchronous event  has  occurred  on
                         the  transport endpoint referenced by _f_d
                         and requires immediate attention.

     TNOTSUPPORT         This function is not  supported  by  the
                         underlying transport provider.

     TOUTSTATE           The function was  issued  in  the  wrong
                         sequence   on   the  transport  endpoint
                         referenced by _f_d.

                         The transport endpoint  referred  to  by
                         _r_e_s_f_d is not in the T_IDLE state.

     TSYSERR             The function  failed  due  to  a  system
                         error  and  set  errno  to  indicate the
                         error.

SEE ALSO
     intro(3),   t_connect(3N),   t_getstate(3N),   t_listen(3N),
     t_open(3N), t_rcvconnect(3N)

     _N_e_t_w_o_r_k _P_r_o_g_r_a_m_m_i_n_g





























Sun Release 4.1   Last change: 21 January 1990                  3



