MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_notify_adaptation_layer

Function sctp_notify_adaptation_layer

freebsd/netinet/sctputil.c:3597–3642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3595}
3596
3597static void
3598sctp_notify_adaptation_layer(struct sctp_tcb *stcb)
3599{
3600 struct mbuf *m_notify;
3601 struct sctp_adaptation_event *sai;
3602 struct sctp_queued_to_read *control;
3603
3604 if ((stcb == NULL) ||
3605 sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT)) {
3606 /* event not enabled */
3607 return;
3608 }
3609
3610 m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_adaption_event), 0, M_NOWAIT, 1, MT_DATA);
3611 if (m_notify == NULL)
3612 /* no space left */
3613 return;
3614 SCTP_BUF_LEN(m_notify) = 0;
3615 sai = mtod(m_notify, struct sctp_adaptation_event *);
3616 memset(sai, 0, sizeof(struct sctp_adaptation_event));
3617 sai->sai_type = SCTP_ADAPTATION_INDICATION;
3618 sai->sai_flags = 0;
3619 sai->sai_length = sizeof(struct sctp_adaptation_event);
3620 sai->sai_adaptation_ind = stcb->asoc.peers_adaptation;
3621 sai->sai_assoc_id = sctp_get_associd(stcb);
3622
3623 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_adaptation_event);
3624 SCTP_BUF_NEXT(m_notify) = NULL;
3625
3626 /* append to socket */
3627 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3628 0, 0, stcb->asoc.context, 0, 0, 0,
3629 m_notify);
3630 if (control == NULL) {
3631 /* no memory */
3632 sctp_m_freem(m_notify);
3633 return;
3634 }
3635 control->length = SCTP_BUF_LEN(m_notify);
3636 control->spec_flags = M_NOTIFICATION;
3637 /* not that we need this */
3638 control->tail_mbuf = m_notify;
3639 sctp_add_to_readq(stcb->sctp_ep, stcb,
3640 control,
3641 &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED);
3642}
3643
3644/* This always must be called with the read-queue LOCKED in the INP */
3645static void

Callers 1

sctp_ulp_notifyFunction · 0.85

Calls 5

sctp_get_mbuf_for_msgFunction · 0.85
memsetFunction · 0.85
sctp_build_readq_entryFunction · 0.85
sctp_m_freemFunction · 0.85
sctp_add_to_readqFunction · 0.85

Tested by

no test coverage detected