summaryrefslogtreecommitdiff
path: root/include/net/sctp/ulpevent.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sctp/ulpevent.h')
-rw-r--r--include/net/sctp/ulpevent.h162
1 files changed, 87 insertions, 75 deletions
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 6e90b83a7013..8d0edaf22025 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -6,34 +6,34 @@
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
*
- * These are the definitions needed for the sctp_ulpevent type. The
+ * These are the definitions needed for the sctp_ulpevent type. The
* sctp_ulpevent type is used to carry information from the state machine
- * upwards to the ULP.
- *
- * The SCTP reference implementation is free software;
- * you can redistribute it and/or modify it under the terms of
+ * upwards to the ULP.
+ *
+ * The SCTP reference implementation is free software;
+ * you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
- *
- * the SCTP reference implementation is distributed in the hope that it
+ *
+ * the SCTP reference implementation is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* ************************
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with GNU CC; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
+ * Boston, MA 02111-1307, USA.
+ *
* Please send any bug reports or fixes you make to one of the
* following email addresses:
- *
+ *
* Jon Grimm <jgrimm@us.ibm.com>
* La Monte H.P. Yarroll <piggy@acm.org>
* Karl Knutson <karl@athena.chicago.il.us>
- *
+ *
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
*/
@@ -46,85 +46,97 @@
/* Warning: This sits inside an skb.cb[] area. Be very careful of
* growing this structure as it is at the maximum limit now.
*/
-typedef struct sctp_ulpevent {
- int malloced;
- sctp_association_t *asoc;
- struct sk_buff *parent;
+struct sctp_ulpevent {
+ struct sctp_association *asoc;
struct sctp_sndrcvinfo sndrcvinfo;
- int chunk_flags; /* Temp. until we get a new chunk_t */
int msg_flags;
-} sctp_ulpevent_t;
-
-
-sctp_ulpevent_t *sctp_ulpevent_new(int size, int msg_flags, int priority);
-
-sctp_ulpevent_t *sctp_ulpevent_init(sctp_ulpevent_t *event, struct sk_buff *skb, int msg_flags);
-
-void sctp_ulpevent_free(sctp_ulpevent_t *event);
-
-int sctp_ulpevent_is_notification(const sctp_ulpevent_t *event);
-
-sctp_ulpevent_t *sctp_ulpevent_make_assoc_change(
- const struct SCTP_association *asoc,
- __u16 flags,
- __u16 state,
- __u16 error,
- __u16 outbound,
- __u16 inbound,
- int priority);
-
-sctp_ulpevent_t *sctp_ulpevent_make_peer_addr_change(
- const struct SCTP_association *asoc,
- const struct sockaddr_storage *aaddr,
- int flags,
- int state,
- int error,
- int priority);
-
-sctp_ulpevent_t *sctp_ulpevent_make_remote_error(
- const struct SCTP_association *asoc,
- struct SCTP_chunk *chunk,
- __u16 flags,
- int priority);
-sctp_ulpevent_t *sctp_ulpevent_make_send_failed(
- const struct SCTP_association *asoc,
- struct SCTP_chunk *chunk,
- __u16 flags,
- __u32 error,
- int priority);
-
-sctp_ulpevent_t *sctp_ulpevent_make_shutdown_event(
- const struct SCTP_association *asoc,
- __u16 flags,
- int priority);
-
-sctp_ulpevent_t *sctp_ulpevent_make_rcvmsg(struct SCTP_association *asoc,
- struct SCTP_chunk *chunk,
- int priority);
-
-void sctp_ulpevent_read_sndrcvinfo(const sctp_ulpevent_t *event,
- struct msghdr *msghdr);
-
-__u16 sctp_ulpevent_get_notification_type(const sctp_ulpevent_t *event);
+};
+/* Retrieve the skb this event sits inside of. */
+static inline struct sk_buff *sctp_event2skb(struct sctp_ulpevent *ev)
+{
+ return container_of((void *)ev, struct sk_buff, cb);
+}
+/* Retrieve & cast the event sitting inside the skb. */
+static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
+{
+ return (struct sctp_ulpevent *)skb->cb;
+}
+
+struct sctp_ulpevent *sctp_ulpevent_new(int size, int flags, int priority);
+struct sctp_ulpevent *sctp_ulpevent_init(struct sctp_ulpevent *, int flags);
+void sctp_ulpevent_free(struct sctp_ulpevent *);
+int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
+
+struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
+ const struct sctp_association *asoc,
+ __u16 flags,
+ __u16 state,
+ __u16 error,
+ __u16 outbound,
+ __u16 inbound,
+ int priority);
+
+struct sctp_ulpevent *sctp_ulpevent_make_peer_addr_change(
+ const struct sctp_association *asoc,
+ const struct sockaddr_storage *aaddr,
+ int flags,
+ int state,
+ int error,
+ int priority);
+
+struct sctp_ulpevent *sctp_ulpevent_make_remote_error(
+ const struct sctp_association *asoc,
+ struct sctp_chunk *chunk,
+ __u16 flags,
+ int priority);
+struct sctp_ulpevent *sctp_ulpevent_make_send_failed(
+ const struct sctp_association *asoc,
+ struct sctp_chunk *chunk,
+ __u16 flags,
+ __u32 error,
+ int priority);
+
+struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event(
+ const struct sctp_association *asoc,
+ __u16 flags,
+ int priority);
+
+struct sctp_ulpevent *sctp_ulpevent_make_pdapi(
+ const struct sctp_association *asoc,
+ __u32 indication, int priority);
+
+struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc,
+ struct sctp_chunk *chunk,
+ int priority);
+
+void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
+ struct msghdr *);
+__u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
+
+/* Is this event type enabled? */
+static inline int sctp_ulpevent_type_enabled(__u16 sn_type,
+ struct sctp_event_subscribe *mask)
+{
+ char *amask = (char *) mask;
+ return amask[sn_type - SCTP_SN_TYPE_BASE];
+}
/* Given an event subscription, is this event enabled? */
-static inline int sctp_ulpevent_is_enabled(const sctp_ulpevent_t *event,
- const struct sctp_event_subscribe *mask)
+static inline int sctp_ulpevent_is_enabled(const struct sctp_ulpevent *event,
+ struct sctp_event_subscribe *mask)
{
- const char *amask = (const char *) mask;
__u16 sn_type;
int enabled = 1;
if (sctp_ulpevent_is_notification(event)) {
sn_type = sctp_ulpevent_get_notification_type(event);
- enabled = amask[sn_type - SCTP_SN_TYPE_BASE];
+ enabled = sctp_ulpevent_type_enabled(sn_type, mask);
}
return enabled;
}
-
#endif /* __sctp_ulpevent_h__ */