Lines Matching +full:event +full:-
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Copyright (c) 1999-2000 Cisco, Inc.
5 * Copyright (c) 1999-2001 Motorola, Inc.
10 * These functions manipulate an sctp event. The struct ulpevent is used
15 * lksctp developers <linux-sctp@vger.kernel.org>
31 static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
33 static void sctp_ulpevent_release_data(struct sctp_ulpevent *event);
34 static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event);
37 /* Initialize an ULP event from an given skb. */
38 static void sctp_ulpevent_init(struct sctp_ulpevent *event, in sctp_ulpevent_init() argument
42 memset(event, 0, sizeof(struct sctp_ulpevent)); in sctp_ulpevent_init()
43 event->msg_flags = msg_flags; in sctp_ulpevent_init()
44 event->rmem_len = len; in sctp_ulpevent_init()
51 struct sctp_ulpevent *event; in sctp_ulpevent_new() local
58 event = sctp_skb2event(skb); in sctp_ulpevent_new()
59 sctp_ulpevent_init(event, msg_flags, skb->truesize); in sctp_ulpevent_new()
61 return event; in sctp_ulpevent_new()
68 int sctp_ulpevent_is_notification(const struct sctp_ulpevent *event) in sctp_ulpevent_is_notification() argument
70 return MSG_NOTIFICATION == (event->msg_flags & MSG_NOTIFICATION); in sctp_ulpevent_is_notification()
76 static inline void sctp_ulpevent_set_owner(struct sctp_ulpevent *event, in sctp_ulpevent_set_owner() argument
79 struct sctp_chunk *chunk = event->chunk; in sctp_ulpevent_set_owner()
86 skb = sctp_event2skb(event); in sctp_ulpevent_set_owner()
87 event->asoc = (struct sctp_association *)asoc; in sctp_ulpevent_set_owner()
88 atomic_add(event->rmem_len, &event->asoc->rmem_alloc); in sctp_ulpevent_set_owner()
89 sctp_skb_set_owner_r(skb, asoc->base.sk); in sctp_ulpevent_set_owner()
90 if (chunk && chunk->head_skb && !chunk->head_skb->sk) in sctp_ulpevent_set_owner()
91 chunk->head_skb->sk = asoc->base.sk; in sctp_ulpevent_set_owner()
95 static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event) in sctp_ulpevent_release_owner() argument
97 struct sctp_association *asoc = event->asoc; in sctp_ulpevent_release_owner()
99 atomic_sub(event->rmem_len, &asoc->rmem_alloc); in sctp_ulpevent_release_owner()
103 /* Create and initialize an SCTP_ASSOC_CHANGE event.
119 struct sctp_ulpevent *event; in sctp_ulpevent_make_assoc_change() local
130 skb = skb_copy_expand(chunk->skb, in sctp_ulpevent_make_assoc_change()
136 /* Embed the event fields inside the cloned skb. */ in sctp_ulpevent_make_assoc_change()
137 event = sctp_skb2event(skb); in sctp_ulpevent_make_assoc_change()
138 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); in sctp_ulpevent_make_assoc_change()
145 ntohs(chunk->chunk_hdr->length) - in sctp_ulpevent_make_assoc_change()
148 event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), in sctp_ulpevent_make_assoc_change()
150 if (!event) in sctp_ulpevent_make_assoc_change()
153 skb = sctp_event2skb(event); in sctp_ulpevent_make_assoc_change()
163 sac->sac_type = SCTP_ASSOC_CHANGE; in sctp_ulpevent_make_assoc_change()
170 * event that happened to the association. in sctp_ulpevent_make_assoc_change()
172 sac->sac_state = state; in sctp_ulpevent_make_assoc_change()
180 sac->sac_flags = 0; in sctp_ulpevent_make_assoc_change()
189 sac->sac_length = skb->len; in sctp_ulpevent_make_assoc_change()
201 sac->sac_error = error; in sctp_ulpevent_make_assoc_change()
212 sac->sac_outbound_streams = outbound; in sctp_ulpevent_make_assoc_change()
213 sac->sac_inbound_streams = inbound; in sctp_ulpevent_make_assoc_change()
224 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_assoc_change()
225 sac->sac_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_assoc_change()
227 return event; in sctp_ulpevent_make_assoc_change()
233 /* Create and initialize an SCTP_PEER_ADDR_CHANGE event.
235 * Socket Extensions for SCTP - draft-01
238 * When a destination address on a multi-homed peer encounters a change
239 * an interface details event is sent.
246 struct sctp_ulpevent *event; in sctp_ulpevent_make_peer_addr_change() local
250 event = sctp_ulpevent_new(sizeof(struct sctp_paddr_change), in sctp_ulpevent_make_peer_addr_change()
252 if (!event) in sctp_ulpevent_make_peer_addr_change()
255 skb = sctp_event2skb(event); in sctp_ulpevent_make_peer_addr_change()
265 spc->spc_type = SCTP_PEER_ADDR_CHANGE; in sctp_ulpevent_make_peer_addr_change()
275 spc->spc_length = sizeof(struct sctp_paddr_change); in sctp_ulpevent_make_peer_addr_change()
283 spc->spc_flags = 0; in sctp_ulpevent_make_peer_addr_change()
291 * event that happened to the address. in sctp_ulpevent_make_peer_addr_change()
293 spc->spc_state = state; in sctp_ulpevent_make_peer_addr_change()
304 spc->spc_error = error; in sctp_ulpevent_make_peer_addr_change()
315 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_peer_addr_change()
316 spc->spc_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_peer_addr_change()
326 memcpy(&spc->spc_aaddr, aaddr, sizeof(struct sockaddr_storage)); in sctp_ulpevent_make_peer_addr_change()
328 /* Map ipv4 address into v4-mapped-on-v6 address. */ in sctp_ulpevent_make_peer_addr_change()
329 sctp_get_pf_specific(asoc->base.sk->sk_family)->addr_to_user( in sctp_ulpevent_make_peer_addr_change()
330 sctp_sk(asoc->base.sk), in sctp_ulpevent_make_peer_addr_change()
331 (union sctp_addr *)&spc->spc_aaddr); in sctp_ulpevent_make_peer_addr_change()
333 return event; in sctp_ulpevent_make_peer_addr_change()
342 struct sctp_association *asoc = transport->asoc; in sctp_ulpevent_notify_peer_addr_change()
344 struct sctp_ulpevent *event; in sctp_ulpevent_notify_peer_addr_change() local
346 if (asoc->state < SCTP_STATE_ESTABLISHED) in sctp_ulpevent_notify_peer_addr_change()
350 memcpy(&addr, &transport->ipaddr, transport->af_specific->sockaddr_len); in sctp_ulpevent_notify_peer_addr_change()
352 event = sctp_ulpevent_make_peer_addr_change(asoc, &addr, 0, state, in sctp_ulpevent_notify_peer_addr_change()
354 if (event) in sctp_ulpevent_notify_peer_addr_change()
355 asoc->stream.si->enqueue_event(&asoc->ulpq, event); in sctp_ulpevent_notify_peer_addr_change()
360 * Note: This assumes that the chunk->skb->data already points to the
363 * Socket Extensions for SCTP - draft-01
369 * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
379 struct sctp_ulpevent *event; in sctp_ulpevent_make_remote_error() local
385 ch = (struct sctp_errhdr *)(chunk->skb->data); in sctp_ulpevent_make_remote_error()
386 cause = ch->cause; in sctp_ulpevent_make_remote_error()
387 elen = SCTP_PAD4(ntohs(ch->length)) - sizeof(*ch); in sctp_ulpevent_make_remote_error()
390 skb_pull(chunk->skb, sizeof(*ch)); in sctp_ulpevent_make_remote_error()
395 skb = skb_copy_expand(chunk->skb, sizeof(*sre), 0, gfp); in sctp_ulpevent_make_remote_error()
398 skb_pull(chunk->skb, elen); in sctp_ulpevent_make_remote_error()
402 /* Embed the event fields inside the cloned skb. */ in sctp_ulpevent_make_remote_error()
403 event = sctp_skb2event(skb); in sctp_ulpevent_make_remote_error()
404 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); in sctp_ulpevent_make_remote_error()
413 sre->sre_type = SCTP_REMOTE_ERROR; in sctp_ulpevent_make_remote_error()
414 sre->sre_flags = 0; in sctp_ulpevent_make_remote_error()
415 sre->sre_length = skb->len; in sctp_ulpevent_make_remote_error()
416 sre->sre_error = cause; in sctp_ulpevent_make_remote_error()
417 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_remote_error()
418 sre->sre_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_remote_error()
420 return event; in sctp_ulpevent_make_remote_error()
427 * Socket Extensions for SCTP - draft-01
434 struct sctp_ulpevent *event; in sctp_ulpevent_make_send_failed() local
439 int len = ntohs(chunk->chunk_hdr->length); in sctp_ulpevent_make_send_failed()
442 skb = skb_copy_expand(chunk->skb, in sctp_ulpevent_make_send_failed()
450 skb_pull(skb, sctp_datachk_len(&asoc->stream)); in sctp_ulpevent_make_send_failed()
451 len -= sctp_datachk_len(&asoc->stream); in sctp_ulpevent_make_send_failed()
453 /* Embed the event fields inside the cloned skb. */ in sctp_ulpevent_make_send_failed()
454 event = sctp_skb2event(skb); in sctp_ulpevent_make_send_failed()
455 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); in sctp_ulpevent_make_send_failed()
465 ssf->ssf_type = SCTP_SEND_FAILED; in sctp_ulpevent_make_send_failed()
473 * SCTP_DATA_UNSENT - Indicates that the data was never put on in sctp_ulpevent_make_send_failed()
476 * SCTP_DATA_SENT - Indicates that the data was put on the wire. in sctp_ulpevent_make_send_failed()
480 ssf->ssf_flags = flags; in sctp_ulpevent_make_send_failed()
489 ssf->ssf_length = sizeof(struct sctp_send_failed) + len; in sctp_ulpevent_make_send_failed()
490 skb_trim(skb, ssf->ssf_length); in sctp_ulpevent_make_send_failed()
500 ssf->ssf_error = error; in sctp_ulpevent_make_send_failed()
509 memcpy(&ssf->ssf_info, &chunk->sinfo, sizeof(struct sctp_sndrcvinfo)); in sctp_ulpevent_make_send_failed()
514 ssf->ssf_info.sinfo_flags = chunk->chunk_hdr->flags; in sctp_ulpevent_make_send_failed()
525 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_send_failed()
526 ssf->ssf_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_send_failed()
527 return event; in sctp_ulpevent_make_send_failed()
538 struct sctp_ulpevent *event; in sctp_ulpevent_make_send_failed_event() local
542 skb = skb_copy_expand(chunk->skb, sizeof(*ssf), 0, gfp); in sctp_ulpevent_make_send_failed_event()
546 len = ntohs(chunk->chunk_hdr->length); in sctp_ulpevent_make_send_failed_event()
547 len -= sctp_datachk_len(&asoc->stream); in sctp_ulpevent_make_send_failed_event()
549 skb_pull(skb, sctp_datachk_len(&asoc->stream)); in sctp_ulpevent_make_send_failed_event()
550 event = sctp_skb2event(skb); in sctp_ulpevent_make_send_failed_event()
551 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize); in sctp_ulpevent_make_send_failed_event()
554 ssf->ssf_type = SCTP_SEND_FAILED_EVENT; in sctp_ulpevent_make_send_failed_event()
555 ssf->ssf_flags = flags; in sctp_ulpevent_make_send_failed_event()
556 ssf->ssf_length = sizeof(*ssf) + len; in sctp_ulpevent_make_send_failed_event()
557 skb_trim(skb, ssf->ssf_length); in sctp_ulpevent_make_send_failed_event()
558 ssf->ssf_error = error; in sctp_ulpevent_make_send_failed_event()
560 ssf->ssfe_info.snd_sid = chunk->sinfo.sinfo_stream; in sctp_ulpevent_make_send_failed_event()
561 ssf->ssfe_info.snd_ppid = chunk->sinfo.sinfo_ppid; in sctp_ulpevent_make_send_failed_event()
562 ssf->ssfe_info.snd_context = chunk->sinfo.sinfo_context; in sctp_ulpevent_make_send_failed_event()
563 ssf->ssfe_info.snd_assoc_id = chunk->sinfo.sinfo_assoc_id; in sctp_ulpevent_make_send_failed_event()
564 ssf->ssfe_info.snd_flags = chunk->chunk_hdr->flags; in sctp_ulpevent_make_send_failed_event()
566 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_send_failed_event()
567 ssf->ssf_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_send_failed_event()
569 return event; in sctp_ulpevent_make_send_failed_event()
574 * Socket Extensions for SCTP - draft-01
581 struct sctp_ulpevent *event; in sctp_ulpevent_make_shutdown_event() local
585 event = sctp_ulpevent_new(sizeof(struct sctp_shutdown_event), in sctp_ulpevent_make_shutdown_event()
587 if (!event) in sctp_ulpevent_make_shutdown_event()
590 skb = sctp_event2skb(event); in sctp_ulpevent_make_shutdown_event()
599 sse->sse_type = SCTP_SHUTDOWN_EVENT; in sctp_ulpevent_make_shutdown_event()
607 sse->sse_flags = 0; in sctp_ulpevent_make_shutdown_event()
616 sse->sse_length = sizeof(struct sctp_shutdown_event); in sctp_ulpevent_make_shutdown_event()
626 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_shutdown_event()
627 sse->sse_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_shutdown_event()
629 return event; in sctp_ulpevent_make_shutdown_event()
643 struct sctp_ulpevent *event; in sctp_ulpevent_make_adaptation_indication() local
647 event = sctp_ulpevent_new(sizeof(struct sctp_adaptation_event), in sctp_ulpevent_make_adaptation_indication()
649 if (!event) in sctp_ulpevent_make_adaptation_indication()
652 skb = sctp_event2skb(event); in sctp_ulpevent_make_adaptation_indication()
655 sai->sai_type = SCTP_ADAPTATION_INDICATION; in sctp_ulpevent_make_adaptation_indication()
656 sai->sai_flags = 0; in sctp_ulpevent_make_adaptation_indication()
657 sai->sai_length = sizeof(struct sctp_adaptation_event); in sctp_ulpevent_make_adaptation_indication()
658 sai->sai_adaptation_ind = asoc->peer.adaptation_ind; in sctp_ulpevent_make_adaptation_indication()
659 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_adaptation_indication()
660 sai->sai_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_adaptation_indication()
662 return event; in sctp_ulpevent_make_adaptation_indication()
679 struct sctp_ulpevent *event = NULL; in sctp_ulpevent_make_rcvmsg() local
680 struct sk_buff *skb = chunk->skb; in sctp_ulpevent_make_rcvmsg()
681 struct sock *sk = asoc->base.sk; in sctp_ulpevent_make_rcvmsg()
690 if (asoc->ep->rcvbuf_policy) in sctp_ulpevent_make_rcvmsg()
691 rx_count = atomic_read(&asoc->rmem_alloc); in sctp_ulpevent_make_rcvmsg()
693 rx_count = atomic_read(&sk->sk_rmem_alloc); in sctp_ulpevent_make_rcvmsg()
695 datalen = ntohs(chunk->chunk_hdr->length); in sctp_ulpevent_make_rcvmsg()
697 if (rx_count >= sk->sk_rcvbuf || !sk_rmem_schedule(sk, skb, datalen)) in sctp_ulpevent_make_rcvmsg()
701 skb = skb_clone(chunk->skb, gfp); in sctp_ulpevent_make_rcvmsg()
708 if (sctp_tsnmap_mark(&asoc->peer.tsn_map, in sctp_ulpevent_make_rcvmsg()
709 ntohl(chunk->subh.data_hdr->tsn), in sctp_ulpevent_make_rcvmsg()
710 chunk->transport)) in sctp_ulpevent_make_rcvmsg()
716 * RFC 2960 - Section 3.2 Chunk Field Descriptions in sctp_ulpevent_make_rcvmsg()
725 padding = SCTP_PAD4(datalen) - datalen; in sctp_ulpevent_make_rcvmsg()
728 skb_trim(skb, chunk->chunk_end - padding - skb->data); in sctp_ulpevent_make_rcvmsg()
730 /* Embed the event fields inside the cloned skb. */ in sctp_ulpevent_make_rcvmsg()
731 event = sctp_skb2event(skb); in sctp_ulpevent_make_rcvmsg()
733 /* Initialize event with flags 0 and correct length in sctp_ulpevent_make_rcvmsg()
737 sctp_ulpevent_init(event, 0, skb->len + sizeof(struct sk_buff)); in sctp_ulpevent_make_rcvmsg()
743 event->chunk = chunk; in sctp_ulpevent_make_rcvmsg()
745 sctp_ulpevent_receive_data(event, asoc); in sctp_ulpevent_make_rcvmsg()
747 event->stream = ntohs(chunk->subh.data_hdr->stream); in sctp_ulpevent_make_rcvmsg()
748 if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { in sctp_ulpevent_make_rcvmsg()
749 event->flags |= SCTP_UNORDERED; in sctp_ulpevent_make_rcvmsg()
750 event->cumtsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map); in sctp_ulpevent_make_rcvmsg()
752 event->tsn = ntohl(chunk->subh.data_hdr->tsn); in sctp_ulpevent_make_rcvmsg()
753 event->msg_flags |= chunk->chunk_hdr->flags; in sctp_ulpevent_make_rcvmsg()
755 return event; in sctp_ulpevent_make_rcvmsg()
763 /* Create a partial delivery related event.
776 struct sctp_ulpevent *event; in sctp_ulpevent_make_pdapi() local
780 event = sctp_ulpevent_new(sizeof(struct sctp_pdapi_event), in sctp_ulpevent_make_pdapi()
782 if (!event) in sctp_ulpevent_make_pdapi()
785 skb = sctp_event2skb(event); in sctp_ulpevent_make_pdapi()
794 pd->pdapi_type = SCTP_PARTIAL_DELIVERY_EVENT; in sctp_ulpevent_make_pdapi()
795 pd->pdapi_flags = flags; in sctp_ulpevent_make_pdapi()
796 pd->pdapi_stream = sid; in sctp_ulpevent_make_pdapi()
797 pd->pdapi_seq = seq; in sctp_ulpevent_make_pdapi()
805 pd->pdapi_length = sizeof(struct sctp_pdapi_event); in sctp_ulpevent_make_pdapi()
811 pd->pdapi_indication = indication; in sctp_ulpevent_make_pdapi()
817 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_pdapi()
818 pd->pdapi_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_pdapi()
820 return event; in sctp_ulpevent_make_pdapi()
829 struct sctp_ulpevent *event; in sctp_ulpevent_make_authkey() local
833 event = sctp_ulpevent_new(sizeof(struct sctp_authkey_event), in sctp_ulpevent_make_authkey()
835 if (!event) in sctp_ulpevent_make_authkey()
838 skb = sctp_event2skb(event); in sctp_ulpevent_make_authkey()
841 ak->auth_type = SCTP_AUTHENTICATION_EVENT; in sctp_ulpevent_make_authkey()
842 ak->auth_flags = 0; in sctp_ulpevent_make_authkey()
843 ak->auth_length = sizeof(struct sctp_authkey_event); in sctp_ulpevent_make_authkey()
845 ak->auth_keynumber = key_id; in sctp_ulpevent_make_authkey()
846 ak->auth_altkeynumber = 0; in sctp_ulpevent_make_authkey()
847 ak->auth_indication = indication; in sctp_ulpevent_make_authkey()
852 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_authkey()
853 ak->auth_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_authkey()
855 return event; in sctp_ulpevent_make_authkey()
867 struct sctp_ulpevent *event; in sctp_ulpevent_make_sender_dry_event() local
871 event = sctp_ulpevent_new(sizeof(struct sctp_sender_dry_event), in sctp_ulpevent_make_sender_dry_event()
873 if (!event) in sctp_ulpevent_make_sender_dry_event()
876 skb = sctp_event2skb(event); in sctp_ulpevent_make_sender_dry_event()
879 sdry->sender_dry_type = SCTP_SENDER_DRY_EVENT; in sctp_ulpevent_make_sender_dry_event()
880 sdry->sender_dry_flags = 0; in sctp_ulpevent_make_sender_dry_event()
881 sdry->sender_dry_length = sizeof(struct sctp_sender_dry_event); in sctp_ulpevent_make_sender_dry_event()
882 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_sender_dry_event()
883 sdry->sender_dry_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_sender_dry_event()
885 return event; in sctp_ulpevent_make_sender_dry_event()
893 struct sctp_ulpevent *event; in sctp_ulpevent_make_stream_reset_event() local
898 event = sctp_ulpevent_new(length, MSG_NOTIFICATION, gfp); in sctp_ulpevent_make_stream_reset_event()
899 if (!event) in sctp_ulpevent_make_stream_reset_event()
902 skb = sctp_event2skb(event); in sctp_ulpevent_make_stream_reset_event()
905 sreset->strreset_type = SCTP_STREAM_RESET_EVENT; in sctp_ulpevent_make_stream_reset_event()
906 sreset->strreset_flags = flags; in sctp_ulpevent_make_stream_reset_event()
907 sreset->strreset_length = length; in sctp_ulpevent_make_stream_reset_event()
908 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_stream_reset_event()
909 sreset->strreset_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_stream_reset_event()
912 sreset->strreset_stream_list[i] = ntohs(stream_list[i]); in sctp_ulpevent_make_stream_reset_event()
914 return event; in sctp_ulpevent_make_stream_reset_event()
922 struct sctp_ulpevent *event; in sctp_ulpevent_make_assoc_reset_event() local
925 event = sctp_ulpevent_new(sizeof(struct sctp_assoc_reset_event), in sctp_ulpevent_make_assoc_reset_event()
927 if (!event) in sctp_ulpevent_make_assoc_reset_event()
930 skb = sctp_event2skb(event); in sctp_ulpevent_make_assoc_reset_event()
933 areset->assocreset_type = SCTP_ASSOC_RESET_EVENT; in sctp_ulpevent_make_assoc_reset_event()
934 areset->assocreset_flags = flags; in sctp_ulpevent_make_assoc_reset_event()
935 areset->assocreset_length = sizeof(struct sctp_assoc_reset_event); in sctp_ulpevent_make_assoc_reset_event()
936 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_assoc_reset_event()
937 areset->assocreset_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_assoc_reset_event()
938 areset->assocreset_local_tsn = local_tsn; in sctp_ulpevent_make_assoc_reset_event()
939 areset->assocreset_remote_tsn = remote_tsn; in sctp_ulpevent_make_assoc_reset_event()
941 return event; in sctp_ulpevent_make_assoc_reset_event()
949 struct sctp_ulpevent *event; in sctp_ulpevent_make_stream_change_event() local
952 event = sctp_ulpevent_new(sizeof(struct sctp_stream_change_event), in sctp_ulpevent_make_stream_change_event()
954 if (!event) in sctp_ulpevent_make_stream_change_event()
957 skb = sctp_event2skb(event); in sctp_ulpevent_make_stream_change_event()
960 schange->strchange_type = SCTP_STREAM_CHANGE_EVENT; in sctp_ulpevent_make_stream_change_event()
961 schange->strchange_flags = flags; in sctp_ulpevent_make_stream_change_event()
962 schange->strchange_length = sizeof(struct sctp_stream_change_event); in sctp_ulpevent_make_stream_change_event()
963 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_make_stream_change_event()
964 schange->strchange_assoc_id = sctp_assoc2id(asoc); in sctp_ulpevent_make_stream_change_event()
965 schange->strchange_instrms = strchange_instrms; in sctp_ulpevent_make_stream_change_event()
966 schange->strchange_outstrms = strchange_outstrms; in sctp_ulpevent_make_stream_change_event()
968 return event; in sctp_ulpevent_make_stream_change_event()
972 * event.
974 __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event) in sctp_ulpevent_get_notification_type() argument
979 skb = sctp_event2skb(event); in sctp_ulpevent_get_notification_type()
980 notification = (union sctp_notification *) skb->data; in sctp_ulpevent_get_notification_type()
981 return notification->sn_header.sn_type; in sctp_ulpevent_get_notification_type()
987 void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, in sctp_ulpevent_read_sndrcvinfo() argument
992 if (sctp_ulpevent_is_notification(event)) in sctp_ulpevent_read_sndrcvinfo()
996 sinfo.sinfo_stream = event->stream; in sctp_ulpevent_read_sndrcvinfo()
997 sinfo.sinfo_ssn = event->ssn; in sctp_ulpevent_read_sndrcvinfo()
998 sinfo.sinfo_ppid = event->ppid; in sctp_ulpevent_read_sndrcvinfo()
999 sinfo.sinfo_flags = event->flags; in sctp_ulpevent_read_sndrcvinfo()
1000 sinfo.sinfo_tsn = event->tsn; in sctp_ulpevent_read_sndrcvinfo()
1001 sinfo.sinfo_cumtsn = event->cumtsn; in sctp_ulpevent_read_sndrcvinfo()
1002 sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc); in sctp_ulpevent_read_sndrcvinfo()
1004 sinfo.sinfo_context = event->asoc->default_rcv_context; in sctp_ulpevent_read_sndrcvinfo()
1015 void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event, in sctp_ulpevent_read_rcvinfo() argument
1020 if (sctp_ulpevent_is_notification(event)) in sctp_ulpevent_read_rcvinfo()
1024 rinfo.rcv_sid = event->stream; in sctp_ulpevent_read_rcvinfo()
1025 rinfo.rcv_ssn = event->ssn; in sctp_ulpevent_read_rcvinfo()
1026 rinfo.rcv_ppid = event->ppid; in sctp_ulpevent_read_rcvinfo()
1027 rinfo.rcv_flags = event->flags; in sctp_ulpevent_read_rcvinfo()
1028 rinfo.rcv_tsn = event->tsn; in sctp_ulpevent_read_rcvinfo()
1029 rinfo.rcv_cumtsn = event->cumtsn; in sctp_ulpevent_read_rcvinfo()
1030 rinfo.rcv_assoc_id = sctp_assoc2id(event->asoc); in sctp_ulpevent_read_rcvinfo()
1031 rinfo.rcv_context = event->asoc->default_rcv_context; in sctp_ulpevent_read_rcvinfo()
1040 static void __sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event, in __sctp_ulpevent_read_nxtinfo() argument
1047 nxtinfo.nxt_sid = event->stream; in __sctp_ulpevent_read_nxtinfo()
1048 nxtinfo.nxt_ppid = event->ppid; in __sctp_ulpevent_read_nxtinfo()
1049 nxtinfo.nxt_flags = event->flags; in __sctp_ulpevent_read_nxtinfo()
1050 if (sctp_ulpevent_is_notification(event)) in __sctp_ulpevent_read_nxtinfo()
1052 nxtinfo.nxt_length = skb->len; in __sctp_ulpevent_read_nxtinfo()
1053 nxtinfo.nxt_assoc_id = sctp_assoc2id(event->asoc); in __sctp_ulpevent_read_nxtinfo()
1059 void sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event, in sctp_ulpevent_read_nxtinfo() argument
1078 static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event, in sctp_ulpevent_receive_data() argument
1083 skb = sctp_event2skb(event); in sctp_ulpevent_receive_data()
1085 sctp_ulpevent_set_owner(event, asoc); in sctp_ulpevent_receive_data()
1088 if (!skb->data_len) in sctp_ulpevent_receive_data()
1091 /* Note: Not clearing the entire event struct as this is just a in sctp_ulpevent_receive_data()
1092 * fragment of the real event. However, we still need to do rwnd in sctp_ulpevent_receive_data()
1104 static void sctp_ulpevent_release_data(struct sctp_ulpevent *event) in sctp_ulpevent_release_data() argument
1111 * multiple associations may be on a single UDP-style socket. in sctp_ulpevent_release_data()
1116 skb = sctp_event2skb(event); in sctp_ulpevent_release_data()
1117 len = skb->len; in sctp_ulpevent_release_data()
1119 if (!skb->data_len) in sctp_ulpevent_release_data()
1132 sctp_assoc_rwnd_increase(event->asoc, len); in sctp_ulpevent_release_data()
1133 sctp_chunk_put(event->chunk); in sctp_ulpevent_release_data()
1134 sctp_ulpevent_release_owner(event); in sctp_ulpevent_release_data()
1137 static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event) in sctp_ulpevent_release_frag_data() argument
1141 skb = sctp_event2skb(event); in sctp_ulpevent_release_frag_data()
1143 if (!skb->data_len) in sctp_ulpevent_release_frag_data()
1156 sctp_chunk_put(event->chunk); in sctp_ulpevent_release_frag_data()
1157 sctp_ulpevent_release_owner(event); in sctp_ulpevent_release_frag_data()
1161 * to the owner, updating the rwnd in case of a DATA event and freeing the
1164 void sctp_ulpevent_free(struct sctp_ulpevent *event) in sctp_ulpevent_free() argument
1166 if (sctp_ulpevent_is_notification(event)) in sctp_ulpevent_free()
1167 sctp_ulpevent_release_owner(event); in sctp_ulpevent_free()
1169 sctp_ulpevent_release_data(event); in sctp_ulpevent_free()
1171 kfree_skb(sctp_event2skb(event)); in sctp_ulpevent_free()
1181 struct sctp_ulpevent *event = sctp_skb2event(skb); in sctp_queue_purge_ulpevents() local
1183 if (!sctp_ulpevent_is_notification(event)) in sctp_queue_purge_ulpevents()
1184 data_unread += skb->len; in sctp_queue_purge_ulpevents()
1186 sctp_ulpevent_free(event); in sctp_queue_purge_ulpevents()