Navigation


Changeset 1186:56c36d1007b4 in freeDiameter for libfdcore/sctp.c


Ignore:
Timestamp:
Jun 7, 2013, 7:48:34 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@freediameter.net>
Branch:
default
Phase:
public
Message:

Further preparation of the DTLS integration. Some cleanups in the GNUTLS handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/sctp.c

    r1175 r1186  
    10801080}
    10811081
    1082 /* Send a buffer over a specified stream */
    1083 int fd_sctp_sendstr(struct cnxctx * conn, uint16_t strid, uint8_t * buf, size_t len)
     1082/* Send a vector over a specified stream */
     1083ssize_t fd_sctp_sendstrv(struct cnxctx * conn, uint16_t strid, const struct iovec *iov, int iovcnt)
    10841084{
    10851085        struct msghdr mhdr;
    1086         struct iovec  iov;
    10871086        struct cmsghdr          *hdr;
    10881087#ifdef OLD_SCTP_SOCKET_API
     
    10961095        int timedout = 0;
    10971096       
    1098         TRACE_ENTRY("%p %hu %p %zd", conn, strid, buf, len);
    1099         CHECK_PARAMS(conn && buf && len);
     1097        TRACE_ENTRY("%p %hu %p %d", conn, strid, iov, iovcnt);
     1098        CHECK_PARAMS_DO(conn && iov && iovcnt, { errno = EINVAL; return -1; } );
    11001099       
    11011100        memset(&mhdr, 0, sizeof(mhdr));
    1102         memset(&iov,  0, sizeof(iov));
    11031101        memset(&anci, 0, sizeof(anci));
    1104        
    1105         /* IO Vector: message data */
    1106         iov.iov_base = buf;
    1107         iov.iov_len  = len;
    11081102       
    11091103        /* Anciliary data: specify SCTP stream */
     
    11241118        /* We don't use mhdr.msg_name here; it could be used to specify an address different from the primary */
    11251119       
    1126         mhdr.msg_iov    = &iov;
    1127         mhdr.msg_iovlen = 1;
     1120        mhdr.msg_iov    = (struct iovec *)iov;
     1121        mhdr.msg_iovlen = iovcnt;
    11281122       
    11291123        mhdr.msg_control    = anci;
    11301124        mhdr.msg_controllen = sizeof(anci);
    11311125       
    1132         TRACE_DEBUG(FULL, "Sending %zdb data on stream %hu of socket %d", len, strid, conn->cc_socket);
     1126        TRACE_DEBUG(FULL, "Sending %d chunks of data (first:%zdb) on stream %hu of socket %d", iovcnt, iov[0].iov_len, strid, conn->cc_socket);
    11331127again: 
    11341128        ret = sendmsg(conn->cc_socket, &mhdr, 0);
     
    11441138        }
    11451139       
    1146         CHECK_SYS( ret );
    1147         ASSERT( ret == len ); /* There should not be partial delivery with sendmsg... */
    1148        
    1149         return 0;
     1140        CHECK_SYS_DO( ret, ); /* for tracing error only */
     1141       
     1142        return ret;
    11501143}
    11511144
Note: See TracChangeset for help on using the changeset viewer.