NAME

     atm_recv, atm_recvfrom, atm_send_null - receive data from an
     established ATM connection


SYNOPSIS

     #include <fore_atm/fore_atm_user.h>

     atm_recv(fd, buf, len)
     int fd;
     caddr_t buf;
     int len;

     atm_recvfrom(fd, buf, len, vpvc)
     int fd;
     caddr_t buf;
     int len;
     Vpvc *vpvc;

     atm_recv_null(fd, buf, len, hdr)
     int fd;
     caddr_t buf;
     int len;
     Atm_hdr *hdr;


DESCRIPTION

     The atm_recv() family of functions is used to  receive  data
     from an established ATM connection.  atm_recv() is used with
     switched virtual circuits (SVCs) and may be used  with  per-
     manent virtual circuits (PVCs) only if fd is associated with
     a single PVC (see atm_connect_pvc(4N)), while atm_recvfrom()
     may  only be used with PVCs.  If vpvc is not a NULL pointer,
     the VPI/VCI of the connection the data was received  on  may
     be  filled  in.   For  a  given atm_recvfrom() call, VPI/VCI
     information is only returned if the data  returned  by  that
     call  is  from the start of a message.  Otherwise, the loca-
     tion pointed to by vpvc is not changed.

     fd identifies the connection  (or  connections  when  fd  is
     associated  with  multiple  incoming  PVCs)  from  which  to
     receive the data.  buf identifies the  buffer  to  hold  the
     data  to  be  received.  len specifies the maximum amount of
     data to be received.  This length must not  be  larger  than
     the size of buf.

     It is important to note that the amount of data received may
     be  less than len.  Therefore, it may be necessary to invoke
     atm_recv() multiple times to read all data.  If the  connec-
     tion  uses  AAL type aal_null, it is possible to control the
     amount of data that is buffered in  the  driver  before  the
     atm_recv()   family   returns.    See  atm_setbatchsize(4N),
     atm_getbatchsize(4N), and atm_connect(4N) for details.

     When receiving data on a 100 series adapter over connections
     with an AAL type of aal_null, atm_recv() and  atm_recvfrom()
     must be used.  Each message will contain some number of  ATM
     cells  presented  in  FORE's  intermediate  cell format (see
     atm_intro(4N) for details on cell formats).  Therefore  each
     message will always be a multiple of 56 bytes long.

     When receiving data on a 200 series adapter over connections
     with  an AAL type of aal_null, atm_recv_null() must be used.
     Each message will contain some number of complete cell  pay-
     loads,  all  received with the same ATM cell header.  There-
     fore, each message will be a multiple of 48 bytes long.   If
     hdr  is  not a NULL pointer, the first four bytes of the ATM
     header may be returned.  For a given  atm_recv_null()  call,
     header  information is only returned if the data returned by
     that call is from the start of a  message.   Otherwise,  the
     location  pointed  to  by hdr is not changed.  Note that any
     change in a received cell header for a given connection will
     cause  the  atm_recv()  family to return all previously buf-
     fered payloads immediately, independent of the batch size in
     effect at the time.


RETURN VALUES

     The atm_recv() family returns the number of  bytes  received
     on success.  On failure, they return -1 and set atm_errno to
     indicate the error. atm_error(4N) can be  used  to  print  a
     text description of errors.


ERRORS

     The atm_recv() family can also  fail  with  errors  returned
     from the read(2) and readv(2) system calls.


SEE ALSO

     atm_connect(4N), atm_error(4N), atm_intro(4N),  atm_pvc(4N),
     atm_getbatchsize(4N),     atm_setbatchsize(4N),     read(2),
     readv(2)