struct conn_stream *cs;
struct cs_endpoint *endp;
uint32_t flags; /* QC_SF_* */
+ void *ctx; /* app-ops context */
struct {
struct eb_root frms; /* received frames ordered by their offsets */
/* QUIC application layer operations */
struct qcc_app_ops {
int (*init)(struct qcc *qcc);
+ int (*attach)(struct qcs *qcs);
int (*attach_ruqs)(struct qcs *qcs, void *ctx);
int (*decode_qcs)(struct qcs *qcs, int fin, void *ctx);
size_t (*snd_buf)(struct conn_stream *cs, struct buffer *buf, size_t count, int flags);
+ void (*detach)(struct qcs *qcs);
int (*finalize)(void *ctx);
int (*is_active)(const struct qcc *qcc, void *ctx);
void (*release)(void *ctx);
qcs->qcc = qcc;
qcs->cs = NULL;
qcs->flags = QC_SF_NONE;
+ qcs->ctx = NULL;
/* allocate transport layer stream descriptor
*
if (!qcs->stream)
goto err;
+ if (qcc->app_ops->attach) {
+ if (qcc->app_ops->attach(qcs))
+ goto err;
+ }
qcs->endp = cs_endpoint_new();
if (!qcs->endp) {
return qcs;
err:
+ if (qcs->ctx && qcc->app_ops->detach)
+ qcc->app_ops->detach(qcs);
+
if (qcs->stream)
qc_stream_desc_release(qcs->stream);
BUG_ON(!qcs->qcc->strms[qcs_id_type(qcs->id)].nb_streams);
--qcs->qcc->strms[qcs_id_type(qcs->id)].nb_streams;
+ if (qcs->ctx && qcs->qcc->app_ops->detach)
+ qcs->qcc->app_ops->detach(qcs);
+
qc_stream_desc_release(qcs->stream);
BUG_ON(qcs->endp && !(qcs->endp->flags & CS_EP_ORPHAN));