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

Function sctp_notify_stream_reset_add

freebsd/netinet/sctputil.c:3813–3867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3811}
3812
3813void
3814sctp_notify_stream_reset_add(struct sctp_tcb *stcb, uint16_t numberin, uint16_t numberout, int flag)
3815{
3816 struct mbuf *m_notify;
3817 struct sctp_queued_to_read *control;
3818 struct sctp_stream_change_event *stradd;
3819
3820 if ((stcb == NULL) ||
3821 (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT))) {
3822 /* event not enabled */
3823 return;
3824 }
3825 if ((stcb->asoc.peer_req_out) && flag) {
3826 /* Peer made the request, don't tell the local user */
3827 stcb->asoc.peer_req_out = 0;
3828 return;
3829 }
3830 stcb->asoc.peer_req_out = 0;
3831 m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_stream_change_event), 0, M_NOWAIT, 1, MT_DATA);
3832 if (m_notify == NULL)
3833 /* no space left */
3834 return;
3835 SCTP_BUF_LEN(m_notify) = 0;
3836 stradd = mtod(m_notify, struct sctp_stream_change_event *);
3837 memset(stradd, 0, sizeof(struct sctp_stream_change_event));
3838 stradd->strchange_type = SCTP_STREAM_CHANGE_EVENT;
3839 stradd->strchange_flags = flag;
3840 stradd->strchange_length = sizeof(struct sctp_stream_change_event);
3841 stradd->strchange_assoc_id = sctp_get_associd(stcb);
3842 stradd->strchange_instrms = numberin;
3843 stradd->strchange_outstrms = numberout;
3844 SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_stream_change_event);
3845 SCTP_BUF_NEXT(m_notify) = NULL;
3846 if (sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) {
3847 /* no space */
3848 sctp_m_freem(m_notify);
3849 return;
3850 }
3851 /* append to socket */
3852 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3853 0, 0, stcb->asoc.context, 0, 0, 0,
3854 m_notify);
3855 if (control == NULL) {
3856 /* no memory */
3857 sctp_m_freem(m_notify);
3858 return;
3859 }
3860 control->length = SCTP_BUF_LEN(m_notify);
3861 control->spec_flags = M_NOTIFICATION;
3862 /* not that we need this */
3863 control->tail_mbuf = m_notify;
3864 sctp_add_to_readq(stcb->sctp_ep, stcb,
3865 control,
3866 &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED);
3867}
3868
3869void
3870sctp_notify_stream_reset_tsn(struct sctp_tcb *stcb, uint32_t sending_tsn, uint32_t recv_tsn, int flag)

Calls 5

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

Tested by

no test coverage detected