Lines Matching refs:event

10  * These functions manipulate an sctp event.   The struct ulpevent is used
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,
42 memset(event, 0, sizeof(struct sctp_ulpevent));
43 event->msg_flags = msg_flags;
44 event->rmem_len = len;
51 struct sctp_ulpevent *event;
58 event = sctp_skb2event(skb);
59 sctp_ulpevent_init(event, msg_flags, skb->truesize);
61 return event;
68 int sctp_ulpevent_is_notification(const struct sctp_ulpevent *event)
70 return MSG_NOTIFICATION == (event->msg_flags & MSG_NOTIFICATION);
76 static inline void sctp_ulpevent_set_owner(struct sctp_ulpevent *event,
79 struct sctp_chunk *chunk = event->chunk;
86 skb = sctp_event2skb(event);
87 event->asoc = (struct sctp_association *)asoc;
88 atomic_add(event->rmem_len, &event->asoc->rmem_alloc);
95 static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event)
97 struct sctp_association *asoc = event->asoc;
99 atomic_sub(event->rmem_len, &asoc->rmem_alloc);
103 /* Create and initialize an SCTP_ASSOC_CHANGE event.
119 struct sctp_ulpevent *event;
136 /* Embed the event fields inside the cloned skb. */
137 event = sctp_skb2event(skb);
138 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
148 event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change),
150 if (!event)
153 skb = sctp_event2skb(event);
170 * event that happened to the association.
224 sctp_ulpevent_set_owner(event, asoc);
227 return event;
233 /* Create and initialize an SCTP_PEER_ADDR_CHANGE event.
239 * an interface details event is sent.
246 struct sctp_ulpevent *event;
250 event = sctp_ulpevent_new(sizeof(struct sctp_paddr_change),
252 if (!event)
255 skb = sctp_event2skb(event);
291 * event that happened to the address.
315 sctp_ulpevent_set_owner(event, asoc);
333 return event;
344 struct sctp_ulpevent *event;
352 event = sctp_ulpevent_make_peer_addr_change(asoc, &addr, 0, state,
354 if (event)
355 asoc->stream.si->enqueue_event(&asoc->ulpq, event);
369 * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
379 struct sctp_ulpevent *event;
402 /* Embed the event fields inside the cloned skb. */
403 event = sctp_skb2event(skb);
404 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
417 sctp_ulpevent_set_owner(event, asoc);
420 return event;
434 struct sctp_ulpevent *event;
453 /* Embed the event fields inside the cloned skb. */
454 event = sctp_skb2event(skb);
455 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
525 sctp_ulpevent_set_owner(event, asoc);
527 return event;
538 struct sctp_ulpevent *event;
550 event = sctp_skb2event(skb);
551 sctp_ulpevent_init(event, MSG_NOTIFICATION, skb->truesize);
566 sctp_ulpevent_set_owner(event, asoc);
569 return event;
581 struct sctp_ulpevent *event;
585 event = sctp_ulpevent_new(sizeof(struct sctp_shutdown_event),
587 if (!event)
590 skb = sctp_event2skb(event);
626 sctp_ulpevent_set_owner(event, asoc);
629 return event;
643 struct sctp_ulpevent *event;
647 event = sctp_ulpevent_new(sizeof(struct sctp_adaptation_event),
649 if (!event)
652 skb = sctp_event2skb(event);
659 sctp_ulpevent_set_owner(event, asoc);
662 return event;
679 struct sctp_ulpevent *event = NULL;
730 /* Embed the event fields inside the cloned skb. */
731 event = sctp_skb2event(skb);
733 /* Initialize event with flags 0 and correct length
737 sctp_ulpevent_init(event, 0, skb->len + sizeof(struct sk_buff));
743 event->chunk = chunk;
745 sctp_ulpevent_receive_data(event, asoc);
747 event->stream = ntohs(chunk->subh.data_hdr->stream);
749 event->flags |= SCTP_UNORDERED;
750 event->cumtsn = sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map);
752 event->tsn = ntohl(chunk->subh.data_hdr->tsn);
753 event->msg_flags |= chunk->chunk_hdr->flags;
755 return event;
763 /* Create a partial delivery related event.
776 struct sctp_ulpevent *event;
780 event = sctp_ulpevent_new(sizeof(struct sctp_pdapi_event),
782 if (!event)
785 skb = sctp_event2skb(event);
817 sctp_ulpevent_set_owner(event, asoc);
820 return event;
829 struct sctp_ulpevent *event;
833 event = sctp_ulpevent_new(sizeof(struct sctp_authkey_event),
835 if (!event)
838 skb = sctp_event2skb(event);
852 sctp_ulpevent_set_owner(event, asoc);
855 return event;
867 struct sctp_ulpevent *event;
871 event = sctp_ulpevent_new(sizeof(struct sctp_sender_dry_event),
873 if (!event)
876 skb = sctp_event2skb(event);
882 sctp_ulpevent_set_owner(event, asoc);
885 return event;
893 struct sctp_ulpevent *event;
898 event = sctp_ulpevent_new(length, MSG_NOTIFICATION, gfp);
899 if (!event)
902 skb = sctp_event2skb(event);
908 sctp_ulpevent_set_owner(event, asoc);
914 return event;
922 struct sctp_ulpevent *event;
925 event = sctp_ulpevent_new(sizeof(struct sctp_assoc_reset_event),
927 if (!event)
930 skb = sctp_event2skb(event);
936 sctp_ulpevent_set_owner(event, asoc);
941 return event;
949 struct sctp_ulpevent *event;
952 event = sctp_ulpevent_new(sizeof(struct sctp_stream_change_event),
954 if (!event)
957 skb = sctp_event2skb(event);
963 sctp_ulpevent_set_owner(event, asoc);
968 return event;
972 * event.
974 __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event)
979 skb = sctp_event2skb(event);
987 void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
992 if (sctp_ulpevent_is_notification(event))
996 sinfo.sinfo_stream = event->stream;
997 sinfo.sinfo_ssn = event->ssn;
998 sinfo.sinfo_ppid = event->ppid;
999 sinfo.sinfo_flags = event->flags;
1000 sinfo.sinfo_tsn = event->tsn;
1001 sinfo.sinfo_cumtsn = event->cumtsn;
1002 sinfo.sinfo_assoc_id = sctp_assoc2id(event->asoc);
1004 sinfo.sinfo_context = event->asoc->default_rcv_context;
1015 void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event,
1020 if (sctp_ulpevent_is_notification(event))
1024 rinfo.rcv_sid = event->stream;
1025 rinfo.rcv_ssn = event->ssn;
1026 rinfo.rcv_ppid = event->ppid;
1027 rinfo.rcv_flags = event->flags;
1028 rinfo.rcv_tsn = event->tsn;
1029 rinfo.rcv_cumtsn = event->cumtsn;
1030 rinfo.rcv_assoc_id = sctp_assoc2id(event->asoc);
1031 rinfo.rcv_context = event->asoc->default_rcv_context;
1040 static void __sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event,
1047 nxtinfo.nxt_sid = event->stream;
1048 nxtinfo.nxt_ppid = event->ppid;
1049 nxtinfo.nxt_flags = event->flags;
1050 if (sctp_ulpevent_is_notification(event))
1053 nxtinfo.nxt_assoc_id = sctp_assoc2id(event->asoc);
1059 void sctp_ulpevent_read_nxtinfo(const struct sctp_ulpevent *event,
1078 static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
1083 skb = sctp_event2skb(event);
1085 sctp_ulpevent_set_owner(event, asoc);
1091 /* Note: Not clearing the entire event struct as this is just a
1092 * fragment of the real event. However, we still need to do rwnd
1104 static void sctp_ulpevent_release_data(struct sctp_ulpevent *event)
1116 skb = sctp_event2skb(event);
1132 sctp_assoc_rwnd_increase(event->asoc, len);
1133 sctp_chunk_put(event->chunk);
1134 sctp_ulpevent_release_owner(event);
1137 static void sctp_ulpevent_release_frag_data(struct sctp_ulpevent *event)
1141 skb = sctp_event2skb(event);
1156 sctp_chunk_put(event->chunk);
1157 sctp_ulpevent_release_owner(event);
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)
1166 if (sctp_ulpevent_is_notification(event))
1167 sctp_ulpevent_release_owner(event);
1169 sctp_ulpevent_release_data(event);
1171 kfree_skb(sctp_event2skb(event));
1181 struct sctp_ulpevent *event = sctp_skb2event(skb);
1183 if (!sctp_ulpevent_is_notification(event))
1186 sctp_ulpevent_free(event);