static int sctp_write(URLContext *h, const uint8_t *buf, int size)

{

    SCTPContext *s = h->priv_data;

    int ret;



    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {

        ret = sctp_wait_fd(s->fd, 1);

        if (ret < 0)

            return ret;

    }



    if (s->max_streams) {

        /*StreamId is introduced as a 2byte code into the stream*/

        struct sctp_sndrcvinfo info = { 0 };

        info.sinfo_stream           = AV_RB16(buf);

        if (info.sinfo_stream > s->max_streams)

            abort();

        ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR);

    } else

        ret = send(s->fd, buf, size, 0);



    return ret < 0 ? ff_neterrno() : ret;

}

static int sctp_write(URLContext *h, const uint8_t *buf, int size)

{

    SCTPContext *s = h->priv_data;

    int ret;



    if (!(h->flags & AVIO_FLAG_NONBLOCK)) {

        ret = sctp_wait_fd(s->fd, 1);

        if (ret < 0)

            return ret;

    }



    if (s->max_streams) {

        

        struct sctp_sndrcvinfo info = { 0 };

        info.sinfo_stream           = AV_RB16(buf);

        if (info.sinfo_stream > s->max_streams)

            abort();

        ret = ff_sctp_send(s->fd, buf + 2, size - 2, &info, MSG_EOR);

    } else

        ret = send(s->fd, buf, size, 0);



    return ret < 0 ? ff_neterrno() : ret;

}

static int FUNC_0(URLContext *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    SCTPContext *s = VAR_0->priv_data;

    int VAR_3;



    if (!(VAR_0->flags & AVIO_FLAG_NONBLOCK)) {

        VAR_3 = sctp_wait_fd(s->fd, 1);

        if (VAR_3 < 0)

            return VAR_3;

    }



    if (s->max_streams) {

        

        struct sctp_sndrcvinfo VAR_4 = { 0 };

        VAR_4.sinfo_stream           = AV_RB16(VAR_1);

        if (VAR_4.sinfo_stream > s->max_streams)

            abort();

        VAR_3 = ff_sctp_send(s->fd, VAR_1 + 2, VAR_2 - 2, &VAR_4, MSG_EOR);

    } else

        VAR_3 = send(s->fd, VAR_1, VAR_2, 0);



    return VAR_3 < 0 ? ff_neterrno() : VAR_3;

}

static int FUNC_0(URLContext *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ SCTPContext *s = VAR_0->priv_data; int VAR_3; if (!(VAR_0->flags & AVIO_FLAG_NONBLOCK)) { VAR_3 = sctp_wait_fd(s->fd, 1); if (VAR_3 < 0)
return VAR_3; } if (s->max_streams) { struct sctp_sndrcvinfo VAR_4 = { 0 }; VAR_4.sinfo_stream           = AV_RB16(VAR_1); if (VAR_4.sinfo_stream > s->max_streams)
abort(); VAR_3 = ff_sctp_send(s->fd, VAR_1 + 2, VAR_2 - 2, &VAR_4, MSG_EOR); } else VAR_3 = send(s->fd, VAR_1, VAR_2, 0); return VAR_3 < 0 ? ff_neterrno() : VAR_3; }