1 /* SCTP kernel reference Implementation
2 * (C) Copyright IBM Corp. 2001, 2004
3 * Copyright (c) 1999-2000 Cisco, Inc.
4 * Copyright (c) 1999-2001 Motorola, Inc.
5 * Copyright (c) 2001 Intel Corp.
6 * Copyright (c) 2001 Nokia, Inc.
7 * Copyright (c) 2001 La Monte H.P. Yarroll
9 * These are the definitions needed for the sctp_ulpevent type. The
10 * sctp_ulpevent type is used to carry information from the state machine
13 * This file is part of the SCTP kernel reference Implementation
15 * The SCTP reference implementation is free software;
16 * you can redistribute it and/or modify it under the terms of
17 * the GNU General Public License as published by
18 * the Free Software Foundation; either version 2, or (at your option)
21 * The SCTP reference implementation is distributed in the hope that it
22 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
23 * ************************
24 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 * See the GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with GNU CC; see the file COPYING. If not, write to
29 * the Free Software Foundation, 59 Temple Place - Suite 330,
30 * Boston, MA 02111-1307, USA.
32 * Please send any bug reports or fixes you make to the
34 * lksctp developers <lksctp-developers@lists.sourceforge.net>
36 * Or submit a bug report through the following website:
37 * http://www.sf.net/projects/lksctp
39 * Written or modified by:
40 * Jon Grimm <jgrimm@us.ibm.com>
41 * La Monte H.P. Yarroll <piggy@acm.org>
42 * Karl Knutson <karl@athena.chicago.il.us>
43 * Sridhar Samudrala <sri@us.ibm.com>
45 * Any bugs reported given to us we will try to fix... any fixes shared will
46 * be incorporated into the next SCTP release.
49 #ifndef __sctp_ulpevent_h__
50 #define __sctp_ulpevent_h__
52 /* A structure to carry information to the ULP (e.g. Sockets API) */
53 /* Warning: This sits inside an skb.cb[] area. Be very careful of
54 * growing this structure as it is at the maximum limit now.
56 struct sctp_ulpevent
{
57 struct sctp_association
*asoc
;
68 /* Retrieve the skb this event sits inside of. */
69 static inline struct sk_buff
*sctp_event2skb(struct sctp_ulpevent
*ev
)
71 return container_of((void *)ev
, struct sk_buff
, cb
);
74 /* Retrieve & cast the event sitting inside the skb. */
75 static inline struct sctp_ulpevent
*sctp_skb2event(struct sk_buff
*skb
)
77 return (struct sctp_ulpevent
*)skb
->cb
;
80 void sctp_ulpevent_free(struct sctp_ulpevent
*);
81 int sctp_ulpevent_is_notification(const struct sctp_ulpevent
*);
82 void sctp_queue_purge_ulpevents(struct sk_buff_head
*list
);
84 struct sctp_ulpevent
*sctp_ulpevent_make_assoc_change(
85 const struct sctp_association
*asoc
,
93 struct sctp_ulpevent
*sctp_ulpevent_make_peer_addr_change(
94 const struct sctp_association
*asoc
,
95 const struct sockaddr_storage
*aaddr
,
101 struct sctp_ulpevent
*sctp_ulpevent_make_remote_error(
102 const struct sctp_association
*asoc
,
103 struct sctp_chunk
*chunk
,
106 struct sctp_ulpevent
*sctp_ulpevent_make_send_failed(
107 const struct sctp_association
*asoc
,
108 struct sctp_chunk
*chunk
,
113 struct sctp_ulpevent
*sctp_ulpevent_make_shutdown_event(
114 const struct sctp_association
*asoc
,
118 struct sctp_ulpevent
*sctp_ulpevent_make_pdapi(
119 const struct sctp_association
*asoc
,
120 __u32 indication
, int gfp
);
122 struct sctp_ulpevent
*sctp_ulpevent_make_adaption_indication(
123 const struct sctp_association
*asoc
, int gfp
);
125 struct sctp_ulpevent
*sctp_ulpevent_make_rcvmsg(struct sctp_association
*asoc
,
126 struct sctp_chunk
*chunk
,
129 void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent
*event
,
131 __u16
sctp_ulpevent_get_notification_type(const struct sctp_ulpevent
*event
);
133 /* Is this event type enabled? */
134 static inline int sctp_ulpevent_type_enabled(__u16 sn_type
,
135 struct sctp_event_subscribe
*mask
)
137 char *amask
= (char *) mask
;
138 return amask
[sn_type
- SCTP_SN_TYPE_BASE
];
141 /* Given an event subscription, is this event enabled? */
142 static inline int sctp_ulpevent_is_enabled(const struct sctp_ulpevent
*event
,
143 struct sctp_event_subscribe
*mask
)
148 if (sctp_ulpevent_is_notification(event
)) {
149 sn_type
= sctp_ulpevent_get_notification_type(event
);
150 enabled
= sctp_ulpevent_type_enabled(sn_type
, mask
);
155 #endif /* __sctp_ulpevent_h__ */