1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49#ifndef __sctp_ulpevent_h__
50#define __sctp_ulpevent_h__
51
52
53
54
55
56struct sctp_ulpevent {
57 struct sctp_association *asoc;
58 __u16 stream;
59 __u16 ssn;
60 __u16 flags;
61 __u32 ppid;
62 __u32 tsn;
63 __u32 cumtsn;
64 int msg_flags;
65 int iif;
66 unsigned int rmem_len;
67};
68
69
70static inline struct sk_buff *sctp_event2skb(const struct sctp_ulpevent *ev)
71{
72 return container_of((void *)ev, struct sk_buff, cb);
73}
74
75
76static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
77{
78 return (struct sctp_ulpevent *)skb->cb;
79}
80
81void sctp_ulpevent_free(struct sctp_ulpevent *);
82int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
83unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list);
84
85struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
86 const struct sctp_association *asoc,
87 __u16 flags,
88 __u16 state,
89 __u16 error,
90 __u16 outbound,
91 __u16 inbound,
92 struct sctp_chunk *chunk,
93 gfp_t gfp);
94
95struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
96 const struct sctp_association *asoc,
97 const struct sockaddr_storage *aaddr,
98 int flags,
99 int state,
100 int error,
101 gfp_t gfp);
102
103struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
104 const struct sctp_association *asoc,
105 struct sctp_chunk *chunk,
106 __u16 flags,
107 gfp_t gfp);
108struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
109 const struct sctp_association *asoc,
110 struct sctp_chunk *chunk,
111 __u16 flags,
112 __u32 error,
113 gfp_t gfp);
114
115struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
116 const struct sctp_association *asoc,
117 __u16 flags,
118 gfp_t gfp);
119
120struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
121 const struct sctp_association *asoc,
122 __u32 indication, gfp_t gfp);
123
124struct sctp_ulpevent *sctp_ulpevent_make_adaptation_indication(
125 const struct sctp_association *asoc, gfp_t gfp);
126
127struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
128 struct sctp_chunk *chunk,
129 gfp_t gfp);
130
131struct sctp_ulpevent *sctp_ulpevent_make_authkey(
132 const struct sctp_association *asoc, __u16 key_id,
133 __u32 indication, gfp_t gfp);
134
135struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event(
136 const struct sctp_association *asoc, gfp_t gfp);
137
138void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
139 struct msghdr *);
140__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
141
142
143static inline int sctp_ulpevent_type_enabled(__u16 sn_type,
144 struct sctp_event_subscribe *mask)
145{
146 char *amask = (char *) mask;
147 return amask[sn_type - SCTP_SN_TYPE_BASE];
148}
149
150
151static inline int sctp_ulpevent_is_enabled(const struct sctp_ulpevent *event,
152 struct sctp_event_subscribe *mask)
153{
154 __u16 sn_type;
155 int enabled = 1;
156
157 if (sctp_ulpevent_is_notification(event)) {
158 sn_type = sctp_ulpevent_get_notification_type(event);
159 enabled = sctp_ulpevent_type_enabled(sn_type, mask);
160 }
161 return enabled;
162}
163
164#endif
165
166
167
168
169
170
171
172