diff options
| author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-05-08 23:11:02 +0200 |
|---|---|---|
| committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-05-08 23:11:02 +0200 |
| commit | cded208c7ea6d107dcbfdb2e2d4622daf41c2886 (patch) | |
| tree | a04a03736b0a928c2954382f924aadb105ee39cc /libdde_linux26/contrib/include/net/sctp | |
| parent | fc82e00ca1e174cb961dea6ad37622e9b26cd899 (diff) | |
remove .svn directories
Diffstat (limited to 'libdde_linux26/contrib/include/net/sctp')
14 files changed, 0 insertions, 5695 deletions
diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/all-wcprops b/libdde_linux26/contrib/include/net/sctp/.svn/all-wcprops deleted file mode 100644 index 1ae1fb74..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/all-wcprops +++ /dev/null @@ -1,71 +0,0 @@ -K 25 -svn:wc:ra_dav:version-url -V 75 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp -END -sctp.h -K 25 -svn:wc:ra_dav:version-url -V 82 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/sctp.h -END -constants.h -K 25 -svn:wc:ra_dav:version-url -V 87 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/constants.h -END -command.h -K 25 -svn:wc:ra_dav:version-url -V 85 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/command.h -END -user.h -K 25 -svn:wc:ra_dav:version-url -V 82 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/user.h -END -sm.h -K 25 -svn:wc:ra_dav:version-url -V 80 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/sm.h -END -auth.h -K 25 -svn:wc:ra_dav:version-url -V 82 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/auth.h -END -checksum.h -K 25 -svn:wc:ra_dav:version-url -V 86 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/checksum.h -END -tsnmap.h -K 25 -svn:wc:ra_dav:version-url -V 84 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/tsnmap.h -END -ulpevent.h -K 25 -svn:wc:ra_dav:version-url -V 86 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/ulpevent.h -END -ulpqueue.h -K 25 -svn:wc:ra_dav:version-url -V 86 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/ulpqueue.h -END -structs.h -K 25 -svn:wc:ra_dav:version-url -V 85 -/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp/structs.h -END diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/entries b/libdde_linux26/contrib/include/net/sctp/.svn/entries deleted file mode 100644 index c8565424..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/entries +++ /dev/null @@ -1,402 +0,0 @@ -9 - -dir -465 -http://svn.tudos.org/repos/tudos/trunk/l4/pkg/dde/linux26/contrib/include/net/sctp -http://svn.tudos.org/repos/tudos - - - -2009-05-20T14:32:55.606606Z -455 -l4check - - -svn:special svn:externals svn:needs-lock - - - - - - - - - - - -a704ac0b-3a55-4d43-a2a9-7be6f07c34fb - -sctp.h -file - - - - -2009-11-15T17:14:51.000000Z -8bb1d677b81a362f9869d9701096ae14 -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -20504 - -constants.h -file - - - - -2009-11-15T17:14:51.000000Z -6fa6e3178849507cc7621836757f9d6a -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -14731 - -command.h -file - - - - -2009-11-15T17:14:51.000000Z -c7245c28d8c5dde78ed554f89d40e7fb -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -8758 - -user.h -file - - - - -2009-11-15T17:14:51.000000Z -67e4fca3e9b35adde4ce92fd3fff6235 -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -22787 - -sm.h -file - - - - -2009-11-15T17:14:51.000000Z -c639452243c80bcbf5ea96784a310681 -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -15622 - -auth.h -file - - - - -2009-11-15T17:14:51.000000Z -e053da675c3b6a475976bfe15c5d9911 -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -4375 - -checksum.h -file - - - - -2009-11-15T17:14:51.000000Z -6c17b984b99cf3040d550f4e69a7490c -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -2711 - -tsnmap.h -file - - - - -2009-11-15T17:14:51.000000Z -d353dd1a2c02a29314b509088bcb9e4a -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -5789 - -ulpevent.h -file - - - - -2009-11-15T17:14:51.000000Z -551fa80762fc237fae401a1d2e293c1f -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -4989 - -ulpqueue.h -file - - - - -2009-11-15T17:14:51.000000Z -e19fcabbe53ba3d1a89f388dff841d6b -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -3167 - -structs.h -file - - - - -2009-11-15T17:14:51.000000Z -5004af3924bf153673c73ac01774b1c0 -2009-05-20T14:32:55.606606Z -455 -l4check - - - - - - - - - - - - - - - - - - - - - -63925 - diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/format b/libdde_linux26/contrib/include/net/sctp/.svn/format deleted file mode 100644 index ec635144..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/format +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/auth.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/auth.h.svn-base deleted file mode 100644 index 49bc9577..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/auth.h.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright 2007 Hewlett-Packard Development Company, L.P. - * - * This file is part of the SCTP kernel implementation - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * Vlad Yasevich <vladislav.yasevich@hp.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __sctp_auth_h__ -#define __sctp_auth_h__ - -#include <linux/list.h> -#include <linux/crypto.h> - -struct sctp_endpoint; -struct sctp_association; -struct sctp_authkey; -struct sctp_hmacalgo; - -/* - * Define a generic struct that will hold all the info - * necessary for an HMAC transform - */ -struct sctp_hmac { - __u16 hmac_id; /* one of the above ids */ - char *hmac_name; /* name for loading */ - __u16 hmac_len; /* length of the signature */ -}; - -/* This is generic structure that containst authentication bytes used - * as keying material. It's a what is referred to as byte-vector all - * over SCTP-AUTH - */ -struct sctp_auth_bytes { - atomic_t refcnt; - __u32 len; - __u8 data[]; -}; - -/* Definition for a shared key, weather endpoint or association */ -struct sctp_shared_key { - struct list_head key_list; - __u16 key_id; - struct sctp_auth_bytes *key; -}; - -#define key_for_each(__key, __list_head) \ - list_for_each_entry(__key, __list_head, key_list) - -#define key_for_each_safe(__key, __tmp, __list_head) \ - list_for_each_entry_safe(__key, __tmp, __list_head, key_list) - -static inline void sctp_auth_key_hold(struct sctp_auth_bytes *key) -{ - if (!key) - return; - - atomic_inc(&key->refcnt); -} - -void sctp_auth_key_put(struct sctp_auth_bytes *key); -struct sctp_shared_key *sctp_auth_shkey_create(__u16 key_id, gfp_t gfp); -void sctp_auth_destroy_keys(struct list_head *keys); -int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp); -struct sctp_shared_key *sctp_auth_get_shkey( - const struct sctp_association *asoc, - __u16 key_id); -int sctp_auth_asoc_copy_shkeys(const struct sctp_endpoint *ep, - struct sctp_association *asoc, - gfp_t gfp); -int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp); -void sctp_auth_destroy_hmacs(struct crypto_hash *auth_hmacs[]); -struct sctp_hmac *sctp_auth_get_hmac(__u16 hmac_id); -struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc); -void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, - struct sctp_hmac_algo_param *hmacs); -int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, - __be16 hmac_id); -int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); -int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); -void sctp_auth_calculate_hmac(const struct sctp_association *asoc, - struct sk_buff *skb, - struct sctp_auth_chunk *auth, gfp_t gfp); - -/* API Helpers */ -int sctp_auth_ep_add_chunkid(struct sctp_endpoint *ep, __u8 chunk_id); -int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, - struct sctp_hmacalgo *hmacs); -int sctp_auth_set_key(struct sctp_endpoint *ep, - struct sctp_association *asoc, - struct sctp_authkey *auth_key); -int sctp_auth_set_active_key(struct sctp_endpoint *ep, - struct sctp_association *asoc, - __u16 key_id); -int sctp_auth_del_key_id(struct sctp_endpoint *ep, - struct sctp_association *asoc, - __u16 key_id); - -#endif diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/checksum.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/checksum.h.svn-base deleted file mode 100644 index 2fec3c36..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/checksum.h.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -/* SCTP kernel reference Implementation - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001-2003 International Business Machines, Corp. - * - * This file is part of the SCTP kernel reference Implementation - * - * SCTP Checksum functions - * - * 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 - * 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * Dinakaran Joseph - * Jon Grimm <jgrimm@us.ibm.com> - * Sridhar Samudrala <sri@us.ibm.com> - * - * Rewritten to use libcrc32c by: - * Vlad Yasevich <vladislav.yasevich@hp.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#include <linux/types.h> -#include <net/sctp/sctp.h> -#include <linux/crc32c.h> - -static inline __be32 sctp_crc32c(__be32 crc, u8 *buffer, u16 length) -{ - return (__force __be32)crc32c((__force u32)crc, buffer, length); -} - -static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length) -{ - __be32 crc = ~cpu_to_be32(0); - __u8 zero[sizeof(__u32)] = {0}; - - /* Optimize this routine to be SCTP specific, knowing how - * to skip the checksum field of the SCTP header. - */ - - /* Calculate CRC up to the checksum. */ - crc = sctp_crc32c(crc, buffer, sizeof(struct sctphdr) - sizeof(__u32)); - - /* Skip checksum field of the header. */ - crc = sctp_crc32c(crc, zero, sizeof(__u32)); - - /* Calculate the rest of the CRC. */ - crc = sctp_crc32c(crc, &buffer[sizeof(struct sctphdr)], - length - sizeof(struct sctphdr)); - return crc; -} - -static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32) -{ - return sctp_crc32c(crc32, buffer, length); -} - -static inline __be32 sctp_end_cksum(__be32 crc32) -{ - return (__force __be32)~cpu_to_le32((__force u32)crc32); -} diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/command.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/command.h.svn-base deleted file mode 100644 index 88988ab0..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/command.h.svn-base +++ /dev/null @@ -1,221 +0,0 @@ -/* SCTP kernel Implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (C) 1999-2001 Cisco, Motorola - * - * This file is part of the SCTP kernel implementation - * - * These are the definitions needed for the command object. - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to one of the - * following email addresses: - * - * La Monte H.P. Yarroll <piggy@acm.org> - * Karl Knutson <karl@athena.chicago.il.us> - * Ardelle Fan <ardelle.fan@intel.com> - * Sridhar Samudrala <sri@us.ibm.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - - -#ifndef __net_sctp_command_h__ -#define __net_sctp_command_h__ - -#include <net/sctp/constants.h> -#include <net/sctp/structs.h> - - -typedef enum { - SCTP_CMD_NOP = 0, /* Do nothing. */ - SCTP_CMD_NEW_ASOC, /* Register a new association. */ - SCTP_CMD_DELETE_TCB, /* Delete the current association. */ - SCTP_CMD_NEW_STATE, /* Enter a new state. */ - SCTP_CMD_REPORT_TSN, /* Record the arrival of a TSN. */ - SCTP_CMD_GEN_SACK, /* Send a Selective ACK (maybe). */ - SCTP_CMD_PROCESS_SACK, /* Process an inbound SACK. */ - SCTP_CMD_GEN_INIT_ACK, /* Generate an INIT ACK chunk. */ - SCTP_CMD_PEER_INIT, /* Process a INIT from the peer. */ - SCTP_CMD_GEN_COOKIE_ECHO, /* Generate a COOKIE ECHO chunk. */ - SCTP_CMD_CHUNK_ULP, /* Send a chunk to the sockets layer. */ - SCTP_CMD_EVENT_ULP, /* Send a notification to the sockets layer. */ - SCTP_CMD_REPLY, /* Send a chunk to our peer. */ - SCTP_CMD_SEND_PKT, /* Send a full packet to our peer. */ - SCTP_CMD_RETRAN, /* Mark a transport for retransmission. */ - SCTP_CMD_ECN_CE, /* Do delayed CE processing. */ - SCTP_CMD_ECN_ECNE, /* Do delayed ECNE processing. */ - SCTP_CMD_ECN_CWR, /* Do delayed CWR processing. */ - SCTP_CMD_TIMER_START, /* Start a timer. */ - SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ - SCTP_CMD_TIMER_STOP, /* Stop a timer. */ - SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */ - SCTP_CMD_INIT_COUNTER_RESET, /* Reset init counter. */ - SCTP_CMD_INIT_COUNTER_INC, /* Increment init counter. */ - SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */ - SCTP_CMD_COOKIEECHO_RESTART, /* High level, do cookie-echo timer work. */ - SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ - SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ - SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ - SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */ - SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ - SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ - SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ - SCTP_CMD_TRANSPORT_RESET, /* Reset the status of a transport. */ - SCTP_CMD_TRANSPORT_ON, /* Mark the transport as active. */ - SCTP_CMD_REPORT_ERROR, /* Pass this error back out of the sm. */ - SCTP_CMD_REPORT_BAD_TAG, /* Verification tags didn't match. */ - SCTP_CMD_PROCESS_CTSN, /* Sideeffect from shutdown. */ - SCTP_CMD_ASSOC_FAILED, /* Handle association failure. */ - SCTP_CMD_DISCARD_PACKET, /* Discard the whole packet. */ - SCTP_CMD_GEN_SHUTDOWN, /* Generate a SHUTDOWN chunk. */ - SCTP_CMD_UPDATE_ASSOC, /* Update association information. */ - SCTP_CMD_PURGE_OUTQUEUE, /* Purge all data waiting to be sent. */ - SCTP_CMD_SETUP_T2, /* Hi-level, setup T2-shutdown parms. */ - SCTP_CMD_RTO_PENDING, /* Set transport's rto_pending. */ - SCTP_CMD_PART_DELIVER, /* Partial data delivery considerations. */ - SCTP_CMD_RENEGE, /* Renege data on an association. */ - SCTP_CMD_SETUP_T4, /* ADDIP, setup T4 RTO timer parms. */ - SCTP_CMD_PROCESS_OPERR, /* Process an ERROR chunk. */ - SCTP_CMD_REPORT_FWDTSN, /* Report new cumulative TSN Ack. */ - SCTP_CMD_PROCESS_FWDTSN, /* Skips were reported, so process further. */ - SCTP_CMD_CLEAR_INIT_TAG, /* Clears association peer's inittag. */ - SCTP_CMD_DEL_NON_PRIMARY, /* Removes non-primary peer transports. */ - SCTP_CMD_T3_RTX_TIMERS_STOP, /* Stops T3-rtx pending timers */ - SCTP_CMD_FORCE_PRIM_RETRAN, /* Forces retrans. over primary path. */ - SCTP_CMD_SET_SK_ERR, /* Set sk_err */ - SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ - SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ - SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ - SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ - SCTP_CMD_UPDATE_INITTAG, /* Update peer inittag */ - SCTP_CMD_LAST -} sctp_verb_t; - -#define SCTP_CMD_MAX (SCTP_CMD_LAST - 1) -#define SCTP_CMD_NUM_VERBS (SCTP_CMD_MAX + 1) - -/* How many commands can you put in an sctp_cmd_seq_t? - * This is a rather arbitrary number, ideally derived from a careful - * analysis of the state functions, but in reality just taken from - * thin air in the hopes othat we don't trigger a kernel panic. - */ -#define SCTP_MAX_NUM_COMMANDS 14 - -typedef union { - __s32 i32; - __u32 u32; - __be32 be32; - __u16 u16; - __u8 u8; - int error; - __be16 err; - sctp_state_t state; - sctp_event_timeout_t to; - unsigned long zero; - void *ptr; - struct sctp_chunk *chunk; - struct sctp_association *asoc; - struct sctp_transport *transport; - struct sctp_bind_addr *bp; - sctp_init_chunk_t *init; - struct sctp_ulpevent *ulpevent; - struct sctp_packet *packet; - sctp_sackhdr_t *sackh; -} sctp_arg_t; - -/* We are simulating ML type constructors here. - * - * SCTP_ARG_CONSTRUCTOR(NAME, TYPE, ELT) builds a function called - * SCTP_NAME() which takes an argument of type TYPE and returns an - * sctp_arg_t. It does this by inserting the sole argument into the - * ELT union element of a local sctp_arg_t. - * - * E.g., SCTP_ARG_CONSTRUCTOR(I32, __s32, i32) builds SCTP_I32(arg), - * which takes an __s32 and returns a sctp_arg_t containing the - * __s32. So, after foo = SCTP_I32(arg), foo.i32 == arg. - */ -static inline sctp_arg_t SCTP_NULL(void) -{ - sctp_arg_t retval; retval.ptr = NULL; return retval; -} -static inline sctp_arg_t SCTP_NOFORCE(void) -{ - sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 0; return retval; -} -static inline sctp_arg_t SCTP_FORCE(void) -{ - sctp_arg_t retval = {.zero = 0UL}; retval.i32 = 1; return retval; -} - -#define SCTP_ARG_CONSTRUCTOR(name, type, elt) \ -static inline sctp_arg_t \ -SCTP_## name (type arg) \ -{ sctp_arg_t retval = {.zero = 0UL}; retval.elt = arg; return retval; } - -SCTP_ARG_CONSTRUCTOR(I32, __s32, i32) -SCTP_ARG_CONSTRUCTOR(U32, __u32, u32) -SCTP_ARG_CONSTRUCTOR(BE32, __be32, be32) -SCTP_ARG_CONSTRUCTOR(U16, __u16, u16) -SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) -SCTP_ARG_CONSTRUCTOR(ERROR, int, error) -SCTP_ARG_CONSTRUCTOR(PERR, __be16, err) /* protocol error */ -SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) -SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) -SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) -SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) -SCTP_ARG_CONSTRUCTOR(ASOC, struct sctp_association *, asoc) -SCTP_ARG_CONSTRUCTOR(TRANSPORT, struct sctp_transport *, transport) -SCTP_ARG_CONSTRUCTOR(BA, struct sctp_bind_addr *, bp) -SCTP_ARG_CONSTRUCTOR(PEER_INIT, sctp_init_chunk_t *, init) -SCTP_ARG_CONSTRUCTOR(ULPEVENT, struct sctp_ulpevent *, ulpevent) -SCTP_ARG_CONSTRUCTOR(PACKET, struct sctp_packet *, packet) -SCTP_ARG_CONSTRUCTOR(SACKH, sctp_sackhdr_t *, sackh) - -typedef struct { - sctp_arg_t obj; - sctp_verb_t verb; -} sctp_cmd_t; - -typedef struct { - sctp_cmd_t cmds[SCTP_MAX_NUM_COMMANDS]; - __u8 next_free_slot; - __u8 next_cmd; -} sctp_cmd_seq_t; - - -/* Initialize a block of memory as a command sequence. - * Return 0 if the initialization fails. - */ -int sctp_init_cmd_seq(sctp_cmd_seq_t *seq); - -/* Add a command to an sctp_cmd_seq_t. - * - * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above - * to wrap data which goes in the obj argument. - */ -void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj); - -/* Return the next command structure in an sctp_cmd_seq. - * Return NULL at the end of the sequence. - */ -sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq); - -#endif /* __net_sctp_command_h__ */ - diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/constants.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/constants.h.svn-base deleted file mode 100644 index b05b0557..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/constants.h.svn-base +++ /dev/null @@ -1,445 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001 Intel Corp. - * - * This file is part of the SCTP kernel implementation - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * La Monte H.P. Yarroll <piggy@acm.org> - * Karl Knutson <karl@athena.chicago.il.us> - * Randall Stewart <randall@stewart.chicago.il.us> - * Ken Morneau <kmorneau@cisco.com> - * Qiaobing Xie <qxie1@motorola.com> - * Xingang Guo <xingang.guo@intel.com> - * Sridhar Samudrala <samudrala@us.ibm.com> - * Daisy Chang <daisyc@us.ibm.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __sctp_constants_h__ -#define __sctp_constants_h__ - -#include <linux/sctp.h> -#include <linux/ipv6.h> /* For ipv6hdr. */ -#include <net/sctp/user.h> -#include <net/tcp_states.h> /* For TCP states used in sctp_sock_state_t */ - -/* Value used for stream negotiation. */ -enum { SCTP_MAX_STREAM = 0xffff }; -enum { SCTP_DEFAULT_OUTSTREAMS = 10 }; -enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM }; - -/* Since CIDs are sparse, we need all four of the following - * symbols. CIDs are dense through SCTP_CID_BASE_MAX. - */ -#define SCTP_CID_BASE_MAX SCTP_CID_SHUTDOWN_COMPLETE -#define SCTP_CID_MAX SCTP_CID_ASCONF_ACK - -#define SCTP_NUM_BASE_CHUNK_TYPES (SCTP_CID_BASE_MAX + 1) - -#define SCTP_NUM_ADDIP_CHUNK_TYPES 2 - -#define SCTP_NUM_PRSCTP_CHUNK_TYPES 1 - -#define SCTP_NUM_AUTH_CHUNK_TYPES 1 - -#define SCTP_NUM_CHUNK_TYPES (SCTP_NUM_BASE_CHUNK_TYPES + \ - SCTP_NUM_ADDIP_CHUNK_TYPES +\ - SCTP_NUM_PRSCTP_CHUNK_TYPES +\ - SCTP_NUM_AUTH_CHUNK_TYPES) - -/* These are the different flavours of event. */ -typedef enum { - - SCTP_EVENT_T_CHUNK = 1, - SCTP_EVENT_T_TIMEOUT, - SCTP_EVENT_T_OTHER, - SCTP_EVENT_T_PRIMITIVE - -} sctp_event_t; - -#define SCTP_EVENT_T_MAX SCTP_EVENT_T_PRIMITIVE -#define SCTP_EVENT_T_NUM (SCTP_EVENT_T_MAX + 1) - -/* As a convenience for the state machine, we append SCTP_EVENT_* and - * SCTP_ULP_* to the list of possible chunks. - */ - -typedef enum { - SCTP_EVENT_TIMEOUT_NONE = 0, - SCTP_EVENT_TIMEOUT_T1_COOKIE, - SCTP_EVENT_TIMEOUT_T1_INIT, - SCTP_EVENT_TIMEOUT_T2_SHUTDOWN, - SCTP_EVENT_TIMEOUT_T3_RTX, - SCTP_EVENT_TIMEOUT_T4_RTO, - SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD, - SCTP_EVENT_TIMEOUT_HEARTBEAT, - SCTP_EVENT_TIMEOUT_SACK, - SCTP_EVENT_TIMEOUT_AUTOCLOSE, -} sctp_event_timeout_t; - -#define SCTP_EVENT_TIMEOUT_MAX SCTP_EVENT_TIMEOUT_AUTOCLOSE -#define SCTP_NUM_TIMEOUT_TYPES (SCTP_EVENT_TIMEOUT_MAX + 1) - -typedef enum { - SCTP_EVENT_NO_PENDING_TSN = 0, - SCTP_EVENT_ICMP_PROTO_UNREACH, -} sctp_event_other_t; - -#define SCTP_EVENT_OTHER_MAX SCTP_EVENT_ICMP_PROTO_UNREACH -#define SCTP_NUM_OTHER_TYPES (SCTP_EVENT_OTHER_MAX + 1) - -/* These are primitive requests from the ULP. */ -typedef enum { - SCTP_PRIMITIVE_ASSOCIATE = 0, - SCTP_PRIMITIVE_SHUTDOWN, - SCTP_PRIMITIVE_ABORT, - SCTP_PRIMITIVE_SEND, - SCTP_PRIMITIVE_REQUESTHEARTBEAT, - SCTP_PRIMITIVE_ASCONF, -} sctp_event_primitive_t; - -#define SCTP_EVENT_PRIMITIVE_MAX SCTP_PRIMITIVE_ASCONF -#define SCTP_NUM_PRIMITIVE_TYPES (SCTP_EVENT_PRIMITIVE_MAX + 1) - -/* We define here a utility type for manipulating subtypes. - * The subtype constructors all work like this: - * - * sctp_subtype_t foo = SCTP_ST_CHUNK(SCTP_CID_INIT); - */ - -typedef union { - sctp_cid_t chunk; - sctp_event_timeout_t timeout; - sctp_event_other_t other; - sctp_event_primitive_t primitive; -} sctp_subtype_t; - -#define SCTP_SUBTYPE_CONSTRUCTOR(_name, _type, _elt) \ -static inline sctp_subtype_t \ -SCTP_ST_## _name (_type _arg) \ -{ sctp_subtype_t _retval; _retval._elt = _arg; return _retval; } - -SCTP_SUBTYPE_CONSTRUCTOR(CHUNK, sctp_cid_t, chunk) -SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT, sctp_event_timeout_t, timeout) -SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) -SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) - - -#define sctp_chunk_is_control(a) (a->chunk_hdr->type != SCTP_CID_DATA) -#define sctp_chunk_is_data(a) (a->chunk_hdr->type == SCTP_CID_DATA) - -/* Calculate the actual data size in a data chunk */ -#define SCTP_DATA_SNDSIZE(c) ((int)((unsigned long)(c->chunk_end)\ - - (unsigned long)(c->chunk_hdr)\ - - sizeof(sctp_data_chunk_t))) - -#define SCTP_MAX_ERROR_CAUSE SCTP_ERROR_NONEXIST_IP -#define SCTP_NUM_ERROR_CAUSE 10 - -/* Internal error codes */ -typedef enum { - - SCTP_IERROR_NO_ERROR = 0, - SCTP_IERROR_BASE = 1000, - SCTP_IERROR_NO_COOKIE, - SCTP_IERROR_BAD_SIG, - SCTP_IERROR_STALE_COOKIE, - SCTP_IERROR_NOMEM, - SCTP_IERROR_MALFORMED, - SCTP_IERROR_BAD_TAG, - SCTP_IERROR_BIG_GAP, - SCTP_IERROR_DUP_TSN, - SCTP_IERROR_HIGH_TSN, - SCTP_IERROR_IGNORE_TSN, - SCTP_IERROR_NO_DATA, - SCTP_IERROR_BAD_STREAM, - SCTP_IERROR_BAD_PORTS, - SCTP_IERROR_AUTH_BAD_HMAC, - SCTP_IERROR_AUTH_BAD_KEYID, - SCTP_IERROR_PROTO_VIOLATION, - SCTP_IERROR_ERROR, - SCTP_IERROR_ABORT, -} sctp_ierror_t; - - - -/* SCTP state defines for internal state machine */ -typedef enum { - - SCTP_STATE_EMPTY = 0, - SCTP_STATE_CLOSED = 1, - SCTP_STATE_COOKIE_WAIT = 2, - SCTP_STATE_COOKIE_ECHOED = 3, - SCTP_STATE_ESTABLISHED = 4, - SCTP_STATE_SHUTDOWN_PENDING = 5, - SCTP_STATE_SHUTDOWN_SENT = 6, - SCTP_STATE_SHUTDOWN_RECEIVED = 7, - SCTP_STATE_SHUTDOWN_ACK_SENT = 8, - -} sctp_state_t; - -#define SCTP_STATE_MAX SCTP_STATE_SHUTDOWN_ACK_SENT -#define SCTP_STATE_NUM_STATES (SCTP_STATE_MAX + 1) - -/* These are values for sk->state. - * For a UDP-style SCTP socket, the states are defined as follows - * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to - * accept new associations, but it can initiate the creation of new ones. - * - A socket in SCTP_SS_LISTENING state indicates that it is willing to - * accept new associations and can initiate the creation of new ones. - * - A socket in SCTP_SS_ESTABLISHED state indicates that it is a peeled off - * socket with one association. - * For a TCP-style SCTP socket, the states are defined as follows - * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to - * accept new associations, but it can initiate the creation of new ones. - * - A socket in SCTP_SS_LISTENING state indicates that it is willing to - * accept new associations, but cannot initiate the creation of new ones. - * - A socket in SCTP_SS_ESTABLISHED state indicates that it has a single - * association. - */ -typedef enum { - SCTP_SS_CLOSED = TCP_CLOSE, - SCTP_SS_LISTENING = TCP_LISTEN, - SCTP_SS_ESTABLISHING = TCP_SYN_SENT, - SCTP_SS_ESTABLISHED = TCP_ESTABLISHED, - SCTP_SS_DISCONNECTING = TCP_CLOSING, -} sctp_sock_state_t; - -/* These functions map various type to printable names. */ -const char *sctp_cname(const sctp_subtype_t); /* chunk types */ -const char *sctp_oname(const sctp_subtype_t); /* other events */ -const char *sctp_tname(const sctp_subtype_t); /* timeouts */ -const char *sctp_pname(const sctp_subtype_t); /* primitives */ - -/* This is a table of printable names of sctp_state_t's. */ -extern const char *sctp_state_tbl[], *sctp_evttype_tbl[], *sctp_status_tbl[]; - -/* Maximum chunk length considering padding requirements. */ -enum { SCTP_MAX_CHUNK_LEN = ((1<<16) - sizeof(__u32)) }; - -/* Encourage Cookie-Echo bundling by pre-fragmenting chunks a little - * harder (until reaching ESTABLISHED state). - */ -enum { SCTP_ARBITRARY_COOKIE_ECHO_LEN = 200 }; - -/* Guess at how big to make the TSN mapping array. - * We guarantee that we can handle at least this big a gap between the - * cumulative ACK and the highest TSN. In practice, we can often - * handle up to twice this value. - * - * NEVER make this more than 32767 (2^15-1). The Gap Ack Blocks in a - * SACK (see section 3.3.4) are only 16 bits, so 2*SCTP_TSN_MAP_SIZE - * must be less than 65535 (2^16 - 1), or we will have overflow - * problems creating SACK's. - */ -#define SCTP_TSN_MAP_INITIAL BITS_PER_LONG -#define SCTP_TSN_MAP_INCREMENT SCTP_TSN_MAP_INITIAL -#define SCTP_TSN_MAP_SIZE 4096 -#define SCTP_TSN_MAX_GAP 65535 - -/* We will not record more than this many duplicate TSNs between two - * SACKs. The minimum PMTU is 576. Remove all the headers and there - * is enough room for 131 duplicate reports. Round down to the - * nearest power of 2. - */ -enum { SCTP_MIN_PMTU = 576 }; -enum { SCTP_MAX_DUP_TSNS = 16 }; -enum { SCTP_MAX_GABS = 16 }; - -/* Heartbeat interval - 30 secs */ -#define SCTP_DEFAULT_TIMEOUT_HEARTBEAT (30*1000) - -/* Delayed sack timer - 200ms */ -#define SCTP_DEFAULT_TIMEOUT_SACK (200) - -/* RTO.Initial - 3 seconds - * RTO.Min - 1 second - * RTO.Max - 60 seconds - * RTO.Alpha - 1/8 - * RTO.Beta - 1/4 - */ -#define SCTP_RTO_INITIAL (3 * 1000) -#define SCTP_RTO_MIN (1 * 1000) -#define SCTP_RTO_MAX (60 * 1000) - -#define SCTP_RTO_ALPHA 3 /* 1/8 when converted to right shifts. */ -#define SCTP_RTO_BETA 2 /* 1/4 when converted to right shifts. */ - -/* Maximum number of new data packets that can be sent in a burst. */ -#define SCTP_DEFAULT_MAX_BURST 4 - -#define SCTP_CLOCK_GRANULARITY 1 /* 1 jiffy */ - -#define SCTP_DEF_MAX_INIT 6 -#define SCTP_DEF_MAX_SEND 10 - -#define SCTP_DEFAULT_COOKIE_LIFE (60 * 1000) /* 60 seconds */ - -#define SCTP_DEFAULT_MINWINDOW 1500 /* default minimum rwnd size */ -#define SCTP_DEFAULT_MAXWINDOW 65535 /* default rwnd size */ -#define SCTP_DEFAULT_MAXSEGMENT 1500 /* MTU size, this is the limit - * to which we will raise the P-MTU. - */ -#define SCTP_DEFAULT_MINSEGMENT 512 /* MTU size ... if no mtu disc */ -#define SCTP_HOW_MANY_SECRETS 2 /* How many secrets I keep */ -#define SCTP_HOW_LONG_COOKIE_LIVE 3600 /* How many seconds the current - * secret will live? - */ -#define SCTP_SECRET_SIZE 32 /* Number of octets in a 256 bits. */ - -#define SCTP_SIGNATURE_SIZE 20 /* size of a SLA-1 signature */ - -#define SCTP_COOKIE_MULTIPLE 32 /* Pad out our cookie to make our hash - * functions simpler to write. - */ - -#if defined (CONFIG_SCTP_HMAC_MD5) -#define SCTP_COOKIE_HMAC_ALG "hmac(md5)" -#elif defined (CONFIG_SCTP_HMAC_SHA1) -#define SCTP_COOKIE_HMAC_ALG "hmac(sha1)" -#else -#define SCTP_COOKIE_HMAC_ALG NULL -#endif - -/* These return values describe the success or failure of a number of - * routines which form the lower interface to SCTP_outqueue. - */ -typedef enum { - SCTP_XMIT_OK, - SCTP_XMIT_PMTU_FULL, - SCTP_XMIT_RWND_FULL, - SCTP_XMIT_NAGLE_DELAY, -} sctp_xmit_t; - -/* These are the commands for manipulating transports. */ -typedef enum { - SCTP_TRANSPORT_UP, - SCTP_TRANSPORT_DOWN, -} sctp_transport_cmd_t; - -/* These are the address scopes defined mainly for IPv4 addresses - * based on draft of SCTP IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>. - * These scopes are hopefully generic enough to be used on scoping both - * IPv4 and IPv6 addresses in SCTP. - * At this point, the IPv6 scopes will be mapped to these internal scopes - * as much as possible. - */ -typedef enum { - SCTP_SCOPE_GLOBAL, /* IPv4 global addresses */ - SCTP_SCOPE_PRIVATE, /* IPv4 private addresses */ - SCTP_SCOPE_LINK, /* IPv4 link local address */ - SCTP_SCOPE_LOOPBACK, /* IPv4 loopback address */ - SCTP_SCOPE_UNUSABLE, /* IPv4 unusable addresses */ -} sctp_scope_t; - -/* Based on IPv4 scoping <draft-stewart-tsvwg-sctp-ipv4-00.txt>, - * SCTP IPv4 unusable addresses: 0.0.0.0/8, 224.0.0.0/4, 198.18.0.0/24, - * 192.88.99.0/24. - * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP - * addresses. - */ -#define IS_IPV4_UNUSABLE_ADDRESS(a) \ - ((htonl(INADDR_BROADCAST) == a) || \ - ipv4_is_multicast(a) || \ - ipv4_is_zeronet(a) || \ - ipv4_is_test_198(a) || \ - ipv4_is_anycast_6to4(a)) - -/* Flags used for the bind address copy functions. */ -#define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by - local sock family */ -#define SCTP_ADDR4_PEERSUPP 0x00000002 /* IPv4 address is supported by - peer */ -#define SCTP_ADDR6_PEERSUPP 0x00000004 /* IPv6 address is supported by - peer */ - -/* Reasons to retransmit. */ -typedef enum { - SCTP_RTXR_T3_RTX, - SCTP_RTXR_FAST_RTX, - SCTP_RTXR_PMTUD, - SCTP_RTXR_T1_RTX, -} sctp_retransmit_reason_t; - -/* Reasons to lower cwnd. */ -typedef enum { - SCTP_LOWER_CWND_T3_RTX, - SCTP_LOWER_CWND_FAST_RTX, - SCTP_LOWER_CWND_ECNE, - SCTP_LOWER_CWND_INACTIVE, -} sctp_lower_cwnd_t; - - -/* SCTP-AUTH Necessary constants */ - -/* SCTP-AUTH, Section 3.3 - * - * The following Table 2 shows the currently defined values for HMAC - * identifiers. - * - * +-----------------+--------------------------+ - * | HMAC Identifier | Message Digest Algorithm | - * +-----------------+--------------------------+ - * | 0 | Reserved | - * | 1 | SHA-1 defined in [8] | - * | 2 | Reserved | - * | 3 | SHA-256 defined in [8] | - * +-----------------+--------------------------+ - */ -enum { - SCTP_AUTH_HMAC_ID_RESERVED_0, - SCTP_AUTH_HMAC_ID_SHA1, - SCTP_AUTH_HMAC_ID_RESERVED_2, -#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE) - SCTP_AUTH_HMAC_ID_SHA256, -#endif - __SCTP_AUTH_HMAC_MAX -}; - -#define SCTP_AUTH_HMAC_ID_MAX __SCTP_AUTH_HMAC_MAX - 1 -#define SCTP_AUTH_NUM_HMACS __SCTP_AUTH_HMAC_MAX -#define SCTP_SHA1_SIG_SIZE 20 -#define SCTP_SHA256_SIG_SIZE 32 - -/* SCTP-AUTH, Section 3.2 - * The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE and AUTH chunks - * MUST NOT be listed in the CHUNKS parameter - */ -#define SCTP_NUM_NOAUTH_CHUNKS 4 -#define SCTP_AUTH_MAX_CHUNKS (SCTP_NUM_CHUNK_TYPES - SCTP_NUM_NOAUTH_CHUNKS) - -/* SCTP-AUTH Section 6.1 - * The RANDOM parameter MUST contain a 32 byte random number. - */ -#define SCTP_AUTH_RANDOM_LENGTH 32 - -#endif /* __sctp_constants_h__ */ diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/sctp.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/sctp.h.svn-base deleted file mode 100644 index bbb77421..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/sctp.h.svn-base +++ /dev/null @@ -1,697 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001-2003 Intel Corp. - * - * This file is part of the SCTP kernel implementation - * - * The base lksctp header. - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * La Monte H.P. Yarroll <piggy@acm.org> - * Xingang Guo <xingang.guo@intel.com> - * Jon Grimm <jgrimm@us.ibm.com> - * Daisy Chang <daisyc@us.ibm.com> - * Sridhar Samudrala <sri@us.ibm.com> - * Ardelle Fan <ardelle.fan@intel.com> - * Ryan Layer <rmlayer@us.ibm.com> - * Kevin Gao <kevin.gao@intel.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __net_sctp_h__ -#define __net_sctp_h__ - -/* Header Strategy. - * Start getting some control over the header file depencies: - * includes - * constants - * structs - * prototypes - * macros, externs, and inlines - * - * Move test_frame specific items out of the kernel headers - * and into the test frame headers. This is not perfect in any sense - * and will continue to evolve. - */ - - - -#ifdef TEST_FRAME -#undef CONFIG_SCTP_DBG_OBJCNT -#undef CONFIG_SYSCTL -#endif /* TEST_FRAME */ - -#include <linux/types.h> -#include <linux/slab.h> -#include <linux/in.h> -#include <linux/tty.h> -#include <linux/proc_fs.h> -#include <linux/spinlock.h> -#include <linux/jiffies.h> -#include <linux/idr.h> - -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -#include <net/ipv6.h> -#include <net/ip6_route.h> -#endif - -#include <asm/uaccess.h> -#include <asm/page.h> -#include <net/sock.h> -#include <net/snmp.h> -#include <net/sctp/structs.h> -#include <net/sctp/constants.h> - - -/* Set SCTP_DEBUG flag via config if not already set. */ -#ifndef SCTP_DEBUG -#ifdef CONFIG_SCTP_DBG_MSG -#define SCTP_DEBUG 1 -#else -#define SCTP_DEBUG 0 -#endif /* CONFIG_SCTP_DBG */ -#endif /* SCTP_DEBUG */ - -#ifdef CONFIG_IP_SCTP_MODULE -#define SCTP_PROTOSW_FLAG 0 -#else /* static! */ -#define SCTP_PROTOSW_FLAG INET_PROTOSW_PERMANENT -#endif - - -/* Certain internal static functions need to be exported when - * compiled into the test frame. - */ -#ifndef SCTP_STATIC -#define SCTP_STATIC static -#endif - -/* - * Function declarations. - */ - -/* - * sctp/protocol.c - */ -extern struct sock *sctp_get_ctl_sock(void); -extern void sctp_local_addr_free(struct rcu_head *head); -extern int sctp_copy_local_addr_list(struct sctp_bind_addr *, - sctp_scope_t, gfp_t gfp, - int flags); -extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); -extern int sctp_register_pf(struct sctp_pf *, sa_family_t); - -/* - * sctp/socket.c - */ -int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); -int sctp_inet_listen(struct socket *sock, int backlog); -void sctp_write_space(struct sock *sk); -unsigned int sctp_poll(struct file *file, struct socket *sock, - poll_table *wait); -void sctp_sock_rfree(struct sk_buff *skb); -extern struct percpu_counter sctp_sockets_allocated; - -/* - * sctp/primitive.c - */ -int sctp_primitive_ASSOCIATE(struct sctp_association *, void *arg); -int sctp_primitive_SHUTDOWN(struct sctp_association *, void *arg); -int sctp_primitive_ABORT(struct sctp_association *, void *arg); -int sctp_primitive_SEND(struct sctp_association *, void *arg); -int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg); -int sctp_primitive_ASCONF(struct sctp_association *, void *arg); - -/* - * sctp/input.c - */ -int sctp_rcv(struct sk_buff *skb); -void sctp_v4_err(struct sk_buff *skb, u32 info); -void sctp_hash_established(struct sctp_association *); -void sctp_unhash_established(struct sctp_association *); -void sctp_hash_endpoint(struct sctp_endpoint *); -void sctp_unhash_endpoint(struct sctp_endpoint *); -struct sock *sctp_err_lookup(int family, struct sk_buff *, - struct sctphdr *, struct sctp_association **, - struct sctp_transport **); -void sctp_err_finish(struct sock *, struct sctp_association *); -void sctp_icmp_frag_needed(struct sock *, struct sctp_association *, - struct sctp_transport *t, __u32 pmtu); -void sctp_icmp_proto_unreachable(struct sock *sk, - struct sctp_association *asoc, - struct sctp_transport *t); -void sctp_backlog_migrate(struct sctp_association *assoc, - struct sock *oldsk, struct sock *newsk); - -/* - * sctp/proc.c - */ -int sctp_snmp_proc_init(void); -void sctp_snmp_proc_exit(void); -int sctp_eps_proc_init(void); -void sctp_eps_proc_exit(void); -int sctp_assocs_proc_init(void); -void sctp_assocs_proc_exit(void); -int sctp_remaddr_proc_init(void); -void sctp_remaddr_proc_exit(void); - - -/* - * Module global variables - */ - - /* - * sctp/protocol.c - */ -extern struct kmem_cache *sctp_chunk_cachep __read_mostly; -extern struct kmem_cache *sctp_bucket_cachep __read_mostly; - -/* - * Section: Macros, externs, and inlines - */ - - -#ifdef TEST_FRAME -#include <test_frame.h> -#else - -/* spin lock wrappers. */ -#define sctp_spin_lock_irqsave(lock, flags) spin_lock_irqsave(lock, flags) -#define sctp_spin_unlock_irqrestore(lock, flags) \ - spin_unlock_irqrestore(lock, flags) -#define sctp_local_bh_disable() local_bh_disable() -#define sctp_local_bh_enable() local_bh_enable() -#define sctp_spin_lock(lock) spin_lock(lock) -#define sctp_spin_unlock(lock) spin_unlock(lock) -#define sctp_write_lock(lock) write_lock(lock) -#define sctp_write_unlock(lock) write_unlock(lock) -#define sctp_read_lock(lock) read_lock(lock) -#define sctp_read_unlock(lock) read_unlock(lock) - -/* sock lock wrappers. */ -#define sctp_lock_sock(sk) lock_sock(sk) -#define sctp_release_sock(sk) release_sock(sk) -#define sctp_bh_lock_sock(sk) bh_lock_sock(sk) -#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) - -/* SCTP SNMP MIB stats handlers */ -DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); -#define SCTP_INC_STATS(field) SNMP_INC_STATS(sctp_statistics, field) -#define SCTP_INC_STATS_BH(field) SNMP_INC_STATS_BH(sctp_statistics, field) -#define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field) -#define SCTP_DEC_STATS(field) SNMP_DEC_STATS(sctp_statistics, field) - -#endif /* !TEST_FRAME */ - -/* sctp mib definitions */ -enum -{ - SCTP_MIB_NUM = 0, - SCTP_MIB_CURRESTAB, /* CurrEstab */ - SCTP_MIB_ACTIVEESTABS, /* ActiveEstabs */ - SCTP_MIB_PASSIVEESTABS, /* PassiveEstabs */ - SCTP_MIB_ABORTEDS, /* Aborteds */ - SCTP_MIB_SHUTDOWNS, /* Shutdowns */ - SCTP_MIB_OUTOFBLUES, /* OutOfBlues */ - SCTP_MIB_CHECKSUMERRORS, /* ChecksumErrors */ - SCTP_MIB_OUTCTRLCHUNKS, /* OutCtrlChunks */ - SCTP_MIB_OUTORDERCHUNKS, /* OutOrderChunks */ - SCTP_MIB_OUTUNORDERCHUNKS, /* OutUnorderChunks */ - SCTP_MIB_INCTRLCHUNKS, /* InCtrlChunks */ - SCTP_MIB_INORDERCHUNKS, /* InOrderChunks */ - SCTP_MIB_INUNORDERCHUNKS, /* InUnorderChunks */ - SCTP_MIB_FRAGUSRMSGS, /* FragUsrMsgs */ - SCTP_MIB_REASMUSRMSGS, /* ReasmUsrMsgs */ - SCTP_MIB_OUTSCTPPACKS, /* OutSCTPPacks */ - SCTP_MIB_INSCTPPACKS, /* InSCTPPacks */ - SCTP_MIB_T1_INIT_EXPIREDS, - SCTP_MIB_T1_COOKIE_EXPIREDS, - SCTP_MIB_T2_SHUTDOWN_EXPIREDS, - SCTP_MIB_T3_RTX_EXPIREDS, - SCTP_MIB_T4_RTO_EXPIREDS, - SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, - SCTP_MIB_DELAY_SACK_EXPIREDS, - SCTP_MIB_AUTOCLOSE_EXPIREDS, - SCTP_MIB_T1_RETRANSMITS, - SCTP_MIB_T3_RETRANSMITS, - SCTP_MIB_PMTUD_RETRANSMITS, - SCTP_MIB_FAST_RETRANSMITS, - SCTP_MIB_IN_PKT_SOFTIRQ, - SCTP_MIB_IN_PKT_BACKLOG, - SCTP_MIB_IN_PKT_DISCARDS, - SCTP_MIB_IN_DATA_CHUNK_DISCARDS, - __SCTP_MIB_MAX -}; - -#define SCTP_MIB_MAX __SCTP_MIB_MAX -struct sctp_mib { - unsigned long mibs[SCTP_MIB_MAX]; -} __SNMP_MIB_ALIGN__; - - -/* Print debugging messages. */ -#if SCTP_DEBUG -extern int sctp_debug_flag; -#define SCTP_DEBUG_PRINTK(whatever...) \ - ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) -#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ - if (sctp_debug_flag) { \ - if (saddr->sa.sa_family == AF_INET6) { \ - printk(KERN_DEBUG \ - lead "%pI6" trail, \ - leadparm, \ - &saddr->v6.sin6_addr, \ - otherparms); \ - } else { \ - printk(KERN_DEBUG \ - lead "%pI4" trail, \ - leadparm, \ - &saddr->v4.sin_addr.s_addr, \ - otherparms); \ - } \ - } -#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } -#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } - -#define SCTP_ASSERT(expr, str, func) \ - if (!(expr)) { \ - SCTP_DEBUG_PRINTK("Assertion Failed: %s(%s) at %s:%s:%d\n", \ - str, (#expr), __FILE__, __func__, __LINE__); \ - func; \ - } - -#else /* SCTP_DEBUG */ - -#define SCTP_DEBUG_PRINTK(whatever...) -#define SCTP_DEBUG_PRINTK_IPADDR(whatever...) -#define SCTP_ENABLE_DEBUG -#define SCTP_DISABLE_DEBUG -#define SCTP_ASSERT(expr, str, func) - -#endif /* SCTP_DEBUG */ - - -/* - * Macros for keeping a global reference of object allocations. - */ -#ifdef CONFIG_SCTP_DBG_OBJCNT - -extern atomic_t sctp_dbg_objcnt_sock; -extern atomic_t sctp_dbg_objcnt_ep; -extern atomic_t sctp_dbg_objcnt_assoc; -extern atomic_t sctp_dbg_objcnt_transport; -extern atomic_t sctp_dbg_objcnt_chunk; -extern atomic_t sctp_dbg_objcnt_bind_addr; -extern atomic_t sctp_dbg_objcnt_bind_bucket; -extern atomic_t sctp_dbg_objcnt_addr; -extern atomic_t sctp_dbg_objcnt_ssnmap; -extern atomic_t sctp_dbg_objcnt_datamsg; -extern atomic_t sctp_dbg_objcnt_keys; - -/* Macros to atomically increment/decrement objcnt counters. */ -#define SCTP_DBG_OBJCNT_INC(name) \ -atomic_inc(&sctp_dbg_objcnt_## name) -#define SCTP_DBG_OBJCNT_DEC(name) \ -atomic_dec(&sctp_dbg_objcnt_## name) -#define SCTP_DBG_OBJCNT(name) \ -atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0) - -/* Macro to help create new entries in in the global array of - * objcnt counters. - */ -#define SCTP_DBG_OBJCNT_ENTRY(name) \ -{.label= #name, .counter= &sctp_dbg_objcnt_## name} - -void sctp_dbg_objcnt_init(void); -void sctp_dbg_objcnt_exit(void); - -#else - -#define SCTP_DBG_OBJCNT_INC(name) -#define SCTP_DBG_OBJCNT_DEC(name) - -static inline void sctp_dbg_objcnt_init(void) { return; } -static inline void sctp_dbg_objcnt_exit(void) { return; } - -#endif /* CONFIG_SCTP_DBG_OBJCOUNT */ - -#if defined CONFIG_SYSCTL -void sctp_sysctl_register(void); -void sctp_sysctl_unregister(void); -#else -static inline void sctp_sysctl_register(void) { return; } -static inline void sctp_sysctl_unregister(void) { return; } -#endif - -/* Size of Supported Address Parameter for 'x' address types. */ -#define SCTP_SAT_LEN(x) (sizeof(struct sctp_paramhdr) + (x) * sizeof(__u16)) - -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) - -void sctp_v6_pf_init(void); -void sctp_v6_pf_exit(void); -int sctp_v6_protosw_init(void); -void sctp_v6_protosw_exit(void); -int sctp_v6_add_protocol(void); -void sctp_v6_del_protocol(void); - -#else /* #ifdef defined(CONFIG_IPV6) */ - -static inline void sctp_v6_pf_init(void) { return; } -static inline void sctp_v6_pf_exit(void) { return; } -static inline int sctp_v6_protosw_init(void) { return 0; } -static inline void sctp_v6_protosw_exit(void) { return; } -static inline int sctp_v6_add_protocol(void) { return 0; } -static inline void sctp_v6_del_protocol(void) { return; } - -#endif /* #if defined(CONFIG_IPV6) */ - - -/* Map an association to an assoc_id. */ -static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) -{ - return (asoc?asoc->assoc_id:0); -} - -/* Look up the association by its id. */ -struct sctp_association *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); - - -/* A macro to walk a list of skbs. */ -#define sctp_skb_for_each(pos, head, tmp) \ - skb_queue_walk_safe(head, pos, tmp) - -/* A helper to append an entire skb list (list) to another (head). */ -static inline void sctp_skb_list_tail(struct sk_buff_head *list, - struct sk_buff_head *head) -{ - unsigned long flags; - - sctp_spin_lock_irqsave(&head->lock, flags); - sctp_spin_lock(&list->lock); - - skb_queue_splice_tail_init(list, head); - - sctp_spin_unlock(&list->lock); - sctp_spin_unlock_irqrestore(&head->lock, flags); -} - -/** - * sctp_list_dequeue - remove from the head of the queue - * @list: list to dequeue from - * - * Remove the head of the list. The head item is - * returned or %NULL if the list is empty. - */ - -static inline struct list_head *sctp_list_dequeue(struct list_head *list) -{ - struct list_head *result = NULL; - - if (list->next != list) { - result = list->next; - list->next = result->next; - list->next->prev = list; - INIT_LIST_HEAD(result); - } - return result; -} - -/* SCTP version of skb_set_owner_r. We need this one because - * of the way we have to do receive buffer accounting on bundled - * chunks. - */ -static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) -{ - struct sctp_ulpevent *event = sctp_skb2event(skb); - - skb->sk = sk; - skb->destructor = sctp_sock_rfree; - atomic_add(event->rmem_len, &sk->sk_rmem_alloc); - /* - * This mimics the behavior of skb_set_owner_r - */ - sk->sk_forward_alloc -= event->rmem_len; -} - -/* Tests if the list has one and only one entry. */ -static inline int sctp_list_single_entry(struct list_head *head) -{ - return ((head->next != head) && (head->next == head->prev)); -} - -/* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ -static inline __s32 sctp_jitter(__u32 rto) -{ - static __u32 sctp_rand; - __s32 ret; - - /* Avoid divide by zero. */ - if (!rto) - rto = 1; - - sctp_rand += jiffies; - sctp_rand ^= (sctp_rand << 12); - sctp_rand ^= (sctp_rand >> 20); - - /* Choose random number from 0 to rto, then move to -50% ~ +50% - * of rto. - */ - ret = sctp_rand % rto - (rto >> 1); - return ret; -} - -/* Break down data chunks at this point. */ -static inline int sctp_frag_point(const struct sctp_sock *sp, int pmtu) -{ - int frag = pmtu; - - frag -= sp->pf->af->net_header_len; - frag -= sizeof(struct sctphdr) + sizeof(struct sctp_data_chunk); - - if (sp->user_frag) - frag = min_t(int, frag, sp->user_frag); - - frag = min_t(int, frag, SCTP_MAX_CHUNK_LEN); - - return frag; -} - -static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc) -{ - - sctp_assoc_sync_pmtu(asoc); - asoc->pmtu_pending = 0; -} - -/* Walk through a list of TLV parameters. Don't trust the - * individual parameter lengths and instead depend on - * the chunk length to indicate when to stop. Make sure - * there is room for a param header too. - */ -#define sctp_walk_params(pos, chunk, member)\ -_sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) - -#define _sctp_walk_params(pos, chunk, end, member)\ -for (pos.v = chunk->member;\ - pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ - pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ - ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ - pos.v += WORD_ROUND(ntohs(pos.p->length))) - -#define sctp_walk_errors(err, chunk_hdr)\ -_sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) - -#define _sctp_walk_errors(err, chunk_hdr, end)\ -for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ - sizeof(sctp_chunkhdr_t));\ - (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ - (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ - ntohs(err->length) >= sizeof(sctp_errhdr_t); \ - err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) - -#define sctp_walk_fwdtsn(pos, chunk)\ -_sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk)) - -#define _sctp_walk_fwdtsn(pos, chunk, end)\ -for (pos = chunk->subh.fwdtsn_hdr->skip;\ - (void *)pos <= (void *)chunk->subh.fwdtsn_hdr->skip + end - sizeof(struct sctp_fwdtsn_skip);\ - pos++) - -/* Round an int up to the next multiple of 4. */ -#define WORD_ROUND(s) (((s)+3)&~3) - -/* Make a new instance of type. */ -#define t_new(type, flags) (type *)kmalloc(sizeof(type), flags) - -/* Compare two timevals. */ -#define tv_lt(s, t) \ - (s.tv_sec < t.tv_sec || (s.tv_sec == t.tv_sec && s.tv_usec < t.tv_usec)) - -/* Add tv1 to tv2. */ -#define TIMEVAL_ADD(tv1, tv2) \ -({ \ - suseconds_t usecs = (tv2).tv_usec + (tv1).tv_usec; \ - time_t secs = (tv2).tv_sec + (tv1).tv_sec; \ -\ - if (usecs >= 1000000) { \ - usecs -= 1000000; \ - secs++; \ - } \ - (tv2).tv_sec = secs; \ - (tv2).tv_usec = usecs; \ -}) - -/* External references. */ - -extern struct proto sctp_prot; -extern struct proto sctpv6_prot; -extern struct proc_dir_entry *proc_net_sctp; -void sctp_put_port(struct sock *sk); - -extern struct idr sctp_assocs_id; -extern spinlock_t sctp_assocs_id_lock; - -/* Static inline functions. */ - -/* Convert from an IP version number to an Address Family symbol. */ -static inline int ipver2af(__u8 ipver) -{ - switch (ipver) { - case 4: - return AF_INET; - case 6: - return AF_INET6; - default: - return 0; - }; -} - -/* Convert from an address parameter type to an address family. */ -static inline int param_type2af(__be16 type) -{ - switch (type) { - case SCTP_PARAM_IPV4_ADDRESS: - return AF_INET; - case SCTP_PARAM_IPV6_ADDRESS: - return AF_INET6; - default: - return 0; - }; -} - -/* Perform some sanity checks. */ -static inline int sctp_sanity_check(void) -{ - SCTP_ASSERT(sizeof(struct sctp_ulpevent) <= - sizeof(((struct sk_buff *)0)->cb), - "SCTP: ulpevent does not fit in skb!\n", return 0); - - return 1; -} - -/* Warning: The following hash functions assume a power of two 'size'. */ -/* This is the hash function for the SCTP port hash table. */ -static inline int sctp_phashfn(__u16 lport) -{ - return (lport & (sctp_port_hashsize - 1)); -} - -/* This is the hash function for the endpoint hash table. */ -static inline int sctp_ep_hashfn(__u16 lport) -{ - return (lport & (sctp_ep_hashsize - 1)); -} - -/* This is the hash function for the association hash table. */ -static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) -{ - int h = (lport << 16) + rport; - h ^= h>>8; - return (h & (sctp_assoc_hashsize - 1)); -} - -/* This is the hash function for the association hash table. This is - * not used yet, but could be used as a better hash function when - * we have a vtag. - */ -static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) -{ - int h = (lport << 16) + rport; - h ^= vtag; - return (h & (sctp_assoc_hashsize-1)); -} - -#define sctp_for_each_hentry(epb, node, head) \ - hlist_for_each_entry(epb, node, head, node) - -/* Is a socket of this style? */ -#define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) -static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) -{ - return sctp_sk(sk)->type == style; -} - -/* Is the association in this state? */ -#define sctp_state(asoc, state) __sctp_state((asoc), (SCTP_STATE_##state)) -static inline int __sctp_state(const struct sctp_association *asoc, - sctp_state_t state) -{ - return asoc->state == state; -} - -/* Is the socket in this state? */ -#define sctp_sstate(sk, state) __sctp_sstate((sk), (SCTP_SS_##state)) -static inline int __sctp_sstate(const struct sock *sk, sctp_sock_state_t state) -{ - return sk->sk_state == state; -} - -/* Map v4-mapped v6 address back to v4 address */ -static inline void sctp_v6_map_v4(union sctp_addr *addr) -{ - addr->v4.sin_family = AF_INET; - addr->v4.sin_port = addr->v6.sin6_port; - addr->v4.sin_addr.s_addr = addr->v6.sin6_addr.s6_addr32[3]; -} - -/* Map v4 address to v4-mapped v6 address */ -static inline void sctp_v4_map_v6(union sctp_addr *addr) -{ - addr->v6.sin6_family = AF_INET6; - addr->v6.sin6_port = addr->v4.sin_port; - addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; - addr->v6.sin6_addr.s6_addr32[0] = 0; - addr->v6.sin6_addr.s6_addr32[1] = 0; - addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); -} - -#endif /* __net_sctp_h__ */ diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/sm.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/sm.h.svn-base deleted file mode 100644 index c1dd8936..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/sm.h.svn-base +++ /dev/null @@ -1,447 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001 Intel Corp. - * - * This file is part of the SCTP kernel implementation - * - * These are definitions needed by the state machine. - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email addresses: - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * La Monte H.P. Yarroll <piggy@acm.org> - * Karl Knutson <karl@athena.chicago.il.us> - * Xingang Guo <xingang.guo@intel.com> - * Jon Grimm <jgrimm@us.ibm.com> - * Dajiang Zhang <dajiang.zhang@nokia.com> - * Sridhar Samudrala <sri@us.ibm.com> - * Daisy Chang <daisyc@us.ibm.com> - * Ardelle Fan <ardelle.fan@intel.com> - * Kevin Gao <kevin.gao@intel.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#include <linux/types.h> -#include <linux/compiler.h> -#include <linux/slab.h> -#include <linux/in.h> -#include <net/sctp/command.h> -#include <net/sctp/sctp.h> - -#ifndef __sctp_sm_h__ -#define __sctp_sm_h__ - -/* - * Possible values for the disposition are: - */ -typedef enum { - SCTP_DISPOSITION_DISCARD, /* No further processing. */ - SCTP_DISPOSITION_CONSUME, /* Process return values normally. */ - SCTP_DISPOSITION_NOMEM, /* We ran out of memory--recover. */ - SCTP_DISPOSITION_DELETE_TCB, /* Close the association. */ - SCTP_DISPOSITION_ABORT, /* Close the association NOW. */ - SCTP_DISPOSITION_VIOLATION, /* The peer is misbehaving. */ - SCTP_DISPOSITION_NOT_IMPL, /* This entry is not implemented. */ - SCTP_DISPOSITION_ERROR, /* This is plain old user error. */ - SCTP_DISPOSITION_BUG, /* This is a bug. */ -} sctp_disposition_t; - -typedef struct { - int name; - int action; -} sctp_sm_command_t; - -typedef sctp_disposition_t (sctp_state_fn_t) (const struct sctp_endpoint *, - const struct sctp_association *, - const sctp_subtype_t type, - void *arg, - sctp_cmd_seq_t *); -typedef void (sctp_timer_event_t) (unsigned long); -typedef struct { - sctp_state_fn_t *fn; - const char *name; -} sctp_sm_table_entry_t; - -/* A naming convention of "sctp_sf_xxx" applies to all the state functions - * currently in use. - */ - -/* Prototypes for generic state functions. */ -sctp_state_fn_t sctp_sf_not_impl; -sctp_state_fn_t sctp_sf_bug; - -/* Prototypes for gener timer state functions. */ -sctp_state_fn_t sctp_sf_timer_ignore; - -/* Prototypes for chunk state functions. */ -sctp_state_fn_t sctp_sf_do_9_1_abort; -sctp_state_fn_t sctp_sf_cookie_wait_abort; -sctp_state_fn_t sctp_sf_cookie_echoed_abort; -sctp_state_fn_t sctp_sf_shutdown_pending_abort; -sctp_state_fn_t sctp_sf_shutdown_sent_abort; -sctp_state_fn_t sctp_sf_shutdown_ack_sent_abort; -sctp_state_fn_t sctp_sf_do_5_1B_init; -sctp_state_fn_t sctp_sf_do_5_1C_ack; -sctp_state_fn_t sctp_sf_do_5_1D_ce; -sctp_state_fn_t sctp_sf_do_5_1E_ca; -sctp_state_fn_t sctp_sf_do_4_C; -sctp_state_fn_t sctp_sf_eat_data_6_2; -sctp_state_fn_t sctp_sf_eat_data_fast_4_4; -sctp_state_fn_t sctp_sf_eat_sack_6_2; -sctp_state_fn_t sctp_sf_operr_notify; -sctp_state_fn_t sctp_sf_t1_init_timer_expire; -sctp_state_fn_t sctp_sf_t1_cookie_timer_expire; -sctp_state_fn_t sctp_sf_t2_timer_expire; -sctp_state_fn_t sctp_sf_t4_timer_expire; -sctp_state_fn_t sctp_sf_t5_timer_expire; -sctp_state_fn_t sctp_sf_sendbeat_8_3; -sctp_state_fn_t sctp_sf_beat_8_3; -sctp_state_fn_t sctp_sf_backbeat_8_3; -sctp_state_fn_t sctp_sf_do_9_2_final; -sctp_state_fn_t sctp_sf_do_9_2_shutdown; -sctp_state_fn_t sctp_sf_do_9_2_shut_ctsn; -sctp_state_fn_t sctp_sf_do_ecn_cwr; -sctp_state_fn_t sctp_sf_do_ecne; -sctp_state_fn_t sctp_sf_ootb; -sctp_state_fn_t sctp_sf_pdiscard; -sctp_state_fn_t sctp_sf_violation; -sctp_state_fn_t sctp_sf_discard_chunk; -sctp_state_fn_t sctp_sf_do_5_2_1_siminit; -sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; -sctp_state_fn_t sctp_sf_do_5_2_3_initack; -sctp_state_fn_t sctp_sf_do_5_2_4_dupcook; -sctp_state_fn_t sctp_sf_unk_chunk; -sctp_state_fn_t sctp_sf_do_8_5_1_E_sa; -sctp_state_fn_t sctp_sf_cookie_echoed_err; -sctp_state_fn_t sctp_sf_do_asconf; -sctp_state_fn_t sctp_sf_do_asconf_ack; -sctp_state_fn_t sctp_sf_do_9_2_reshutack; -sctp_state_fn_t sctp_sf_eat_fwd_tsn; -sctp_state_fn_t sctp_sf_eat_fwd_tsn_fast; -sctp_state_fn_t sctp_sf_eat_auth; - -/* Prototypes for primitive event state functions. */ -sctp_state_fn_t sctp_sf_do_prm_asoc; -sctp_state_fn_t sctp_sf_do_prm_send; -sctp_state_fn_t sctp_sf_do_9_2_prm_shutdown; -sctp_state_fn_t sctp_sf_cookie_wait_prm_shutdown; -sctp_state_fn_t sctp_sf_cookie_echoed_prm_shutdown; -sctp_state_fn_t sctp_sf_do_9_1_prm_abort; -sctp_state_fn_t sctp_sf_cookie_wait_prm_abort; -sctp_state_fn_t sctp_sf_cookie_echoed_prm_abort; -sctp_state_fn_t sctp_sf_shutdown_pending_prm_abort; -sctp_state_fn_t sctp_sf_shutdown_sent_prm_abort; -sctp_state_fn_t sctp_sf_shutdown_ack_sent_prm_abort; -sctp_state_fn_t sctp_sf_error_closed; -sctp_state_fn_t sctp_sf_error_shutdown; -sctp_state_fn_t sctp_sf_ignore_primitive; -sctp_state_fn_t sctp_sf_do_prm_requestheartbeat; -sctp_state_fn_t sctp_sf_do_prm_asconf; - -/* Prototypes for other event state functions. */ -sctp_state_fn_t sctp_sf_do_9_2_start_shutdown; -sctp_state_fn_t sctp_sf_do_9_2_shutdown_ack; -sctp_state_fn_t sctp_sf_ignore_other; -sctp_state_fn_t sctp_sf_cookie_wait_icmp_abort; - -/* Prototypes for timeout event state functions. */ -sctp_state_fn_t sctp_sf_do_6_3_3_rtx; -sctp_state_fn_t sctp_sf_do_6_2_sack; -sctp_state_fn_t sctp_sf_autoclose_timer_expire; - -/* Prototypes for utility support functions. */ -__u8 sctp_get_chunk_type(struct sctp_chunk *chunk); -const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t, - sctp_state_t, - sctp_subtype_t); -int sctp_chunk_iif(const struct sctp_chunk *); -struct sctp_association *sctp_make_temp_asoc(const struct sctp_endpoint *, - struct sctp_chunk *, - gfp_t gfp); -__u32 sctp_generate_verification_tag(void); -void sctp_populate_tie_tags(__u8 *cookie, __u32 curTag, __u32 hisTag); - -/* Prototypes for chunk-building functions. */ -struct sctp_chunk *sctp_make_init(const struct sctp_association *, - const struct sctp_bind_addr *, - gfp_t gfp, int vparam_len); -struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *, - const struct sctp_chunk *, - const gfp_t gfp, - const int unkparam_len); -struct sctp_chunk *sctp_make_cookie_echo(const struct sctp_association *, - const struct sctp_chunk *); -struct sctp_chunk *sctp_make_cookie_ack(const struct sctp_association *, - const struct sctp_chunk *); -struct sctp_chunk *sctp_make_cwr(const struct sctp_association *, - const __u32 lowest_tsn, - const struct sctp_chunk *); -struct sctp_chunk * sctp_make_datafrag_empty(struct sctp_association *, - const struct sctp_sndrcvinfo *sinfo, - int len, const __u8 flags, - __u16 ssn); -struct sctp_chunk *sctp_make_ecne(const struct sctp_association *, - const __u32); -struct sctp_chunk *sctp_make_sack(const struct sctp_association *); -struct sctp_chunk *sctp_make_shutdown(const struct sctp_association *asoc, - const struct sctp_chunk *chunk); -struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc, - const struct sctp_chunk *); -struct sctp_chunk *sctp_make_shutdown_complete(const struct sctp_association *, - const struct sctp_chunk *); -void sctp_init_cause(struct sctp_chunk *, __be16 cause, size_t); -struct sctp_chunk *sctp_make_abort(const struct sctp_association *, - const struct sctp_chunk *, - const size_t hint); -struct sctp_chunk *sctp_make_abort_no_data(const struct sctp_association *, - const struct sctp_chunk *, - __u32 tsn); -struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, - const struct msghdr *, size_t msg_len); -struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, - const struct sctp_chunk *, - const __u8 *, - const size_t ); -struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *, - const struct sctp_chunk *, - struct sctp_paramhdr *); -struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, - const struct sctp_transport *, - const void *payload, - const size_t paylen); -struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *, - const struct sctp_chunk *, - const void *payload, - const size_t paylen); -struct sctp_chunk *sctp_make_op_error(const struct sctp_association *, - const struct sctp_chunk *chunk, - __be16 cause_code, - const void *payload, - size_t paylen); - -struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *, - union sctp_addr *, - struct sockaddr *, - int, __be16); -struct sctp_chunk *sctp_make_asconf_set_prim(struct sctp_association *asoc, - union sctp_addr *addr); -int sctp_verify_asconf(const struct sctp_association *asoc, - struct sctp_paramhdr *param_hdr, void *chunk_end, - struct sctp_paramhdr **errp); -struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, - struct sctp_chunk *asconf); -int sctp_process_asconf_ack(struct sctp_association *asoc, - struct sctp_chunk *asconf_ack); -struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc, - __u32 new_cum_tsn, size_t nstreams, - struct sctp_fwdtsn_skip *skiplist); -struct sctp_chunk *sctp_make_auth(const struct sctp_association *asoc); - -void sctp_chunk_assign_tsn(struct sctp_chunk *); -void sctp_chunk_assign_ssn(struct sctp_chunk *); - -/* Prototypes for statetable processing. */ - -int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, - sctp_state_t state, - struct sctp_endpoint *, - struct sctp_association *asoc, - void *event_arg, - gfp_t gfp); - -/* 2nd level prototypes */ -void sctp_generate_t3_rtx_event(unsigned long peer); -void sctp_generate_heartbeat_event(unsigned long peer); - -void sctp_ootb_pkt_free(struct sctp_packet *); - -struct sctp_association *sctp_unpack_cookie(const struct sctp_endpoint *, - const struct sctp_association *, - struct sctp_chunk *, - gfp_t gfp, int *err, - struct sctp_chunk **err_chk_p); -int sctp_addip_addr_config(struct sctp_association *, sctp_param_t, - struct sockaddr_storage*, int); - -/* 3rd level prototypes */ -__u32 sctp_generate_tag(const struct sctp_endpoint *); -__u32 sctp_generate_tsn(const struct sctp_endpoint *); - -/* Extern declarations for major data structures. */ -extern sctp_timer_event_t *sctp_timer_events[SCTP_NUM_TIMEOUT_TYPES]; - - -/* Get the size of a DATA chunk payload. */ -static inline __u16 sctp_data_size(struct sctp_chunk *chunk) -{ - __u16 size; - - size = ntohs(chunk->chunk_hdr->length); - size -= sizeof(sctp_data_chunk_t); - - return size; -} - -/* Compare two TSNs */ - -/* RFC 1982 - Serial Number Arithmetic - * - * 2. Comparison - * Then, s1 is said to be equal to s2 if and only if i1 is equal to i2, - * in all other cases, s1 is not equal to s2. - * - * s1 is said to be less than s2 if, and only if, s1 is not equal to s2, - * and - * - * (i1 < i2 and i2 - i1 < 2^(SERIAL_BITS - 1)) or - * (i1 > i2 and i1 - i2 > 2^(SERIAL_BITS - 1)) - * - * s1 is said to be greater than s2 if, and only if, s1 is not equal to - * s2, and - * - * (i1 < i2 and i2 - i1 > 2^(SERIAL_BITS - 1)) or - * (i1 > i2 and i1 - i2 < 2^(SERIAL_BITS - 1)) - */ - -/* - * RFC 2960 - * 1.6 Serial Number Arithmetic - * - * Comparisons and arithmetic on TSNs in this document SHOULD use Serial - * Number Arithmetic as defined in [RFC1982] where SERIAL_BITS = 32. - */ - -enum { - TSN_SIGN_BIT = (1<<31) -}; - -static inline int TSN_lt(__u32 s, __u32 t) -{ - return (((s) - (t)) & TSN_SIGN_BIT); -} - -static inline int TSN_lte(__u32 s, __u32 t) -{ - return (((s) == (t)) || (((s) - (t)) & TSN_SIGN_BIT)); -} - -/* Compare two SSNs */ - -/* - * RFC 2960 - * 1.6 Serial Number Arithmetic - * - * Comparisons and arithmetic on Stream Sequence Numbers in this document - * SHOULD use Serial Number Arithmetic as defined in [RFC1982] where - * SERIAL_BITS = 16. - */ -enum { - SSN_SIGN_BIT = (1<<15) -}; - -static inline int SSN_lt(__u16 s, __u16 t) -{ - return (((s) - (t)) & SSN_SIGN_BIT); -} - -static inline int SSN_lte(__u16 s, __u16 t) -{ - return (((s) == (t)) || (((s) - (t)) & SSN_SIGN_BIT)); -} - -/* - * ADDIP 3.1.1 - * The valid range of Serial Number is from 0 to 4294967295 (2**32 - 1). Serial - * Numbers wrap back to 0 after reaching 4294967295. - */ -enum { - ADDIP_SERIAL_SIGN_BIT = (1<<31) -}; - -static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) -{ - return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT)); -} - -/* Check VTAG of the packet matches the sender's own tag. */ -static inline int -sctp_vtag_verify(const struct sctp_chunk *chunk, - const struct sctp_association *asoc) -{ - /* RFC 2960 Sec 8.5 When receiving an SCTP packet, the endpoint - * MUST ensure that the value in the Verification Tag field of - * the received SCTP packet matches its own Tag. If the received - * Verification Tag value does not match the receiver's own - * tag value, the receiver shall silently discard the packet... - */ - if (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag) - return 1; - - return 0; -} - -/* Check VTAG of the packet matches the sender's own tag and the T bit is - * not set, OR its peer's tag and the T bit is set in the Chunk Flags. - */ -static inline int -sctp_vtag_verify_either(const struct sctp_chunk *chunk, - const struct sctp_association *asoc) -{ - /* RFC 2960 Section 8.5.1, sctpimpguide Section 2.41 - * - * B) The receiver of a ABORT MUST accept the packet - * if the Verification Tag field of the packet matches its own tag - * and the T bit is not set - * OR - * it is set to its peer's tag and the T bit is set in the Chunk - * Flags. - * Otherwise, the receiver MUST silently discard the packet - * and take no further action. - * - * C) The receiver of a SHUTDOWN COMPLETE shall accept the packet - * if the Verification Tag field of the packet matches its own tag - * and the T bit is not set - * OR - * it is set to its peer's tag and the T bit is set in the Chunk - * Flags. - * Otherwise, the receiver MUST silently discard the packet - * and take no further action. An endpoint MUST ignore the - * SHUTDOWN COMPLETE if it is not in the SHUTDOWN-ACK-SENT state. - */ - if ((!sctp_test_T_bit(chunk) && - (ntohl(chunk->sctp_hdr->vtag) == asoc->c.my_vtag)) || - (sctp_test_T_bit(chunk) && - (ntohl(chunk->sctp_hdr->vtag) == asoc->c.peer_vtag))) { - return 1; - } - - return 0; -} - -#endif /* __sctp_sm_h__ */ diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/structs.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/structs.h.svn-base deleted file mode 100644 index 9661d7b7..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/structs.h.svn-base +++ /dev/null @@ -1,2000 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001 Intel Corp. - * - * This file is part of the SCTP kernel implementation - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email addresses: - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * Randall Stewart <randall@sctp.chicago.il.us> - * Ken Morneau <kmorneau@cisco.com> - * Qiaobing Xie <qxie1@email.mot.com> - * La Monte H.P. Yarroll <piggy@acm.org> - * Karl Knutson <karl@athena.chicago.il.us> - * Jon Grimm <jgrimm@us.ibm.com> - * Xingang Guo <xingang.guo@intel.com> - * Hui Huang <hui.huang@nokia.com> - * Sridhar Samudrala <sri@us.ibm.com> - * Daisy Chang <daisyc@us.ibm.com> - * Dajiang Zhang <dajiang.zhang@nokia.com> - * Ardelle Fan <ardelle.fan@intel.com> - * Ryan Layer <rmlayer@us.ibm.com> - * Anup Pemmaiah <pemmaiah@cc.usu.edu> - * Kevin Gao <kevin.gao@intel.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __sctp_structs_h__ -#define __sctp_structs_h__ - -#include <linux/time.h> /* We get struct timespec. */ -#include <linux/socket.h> /* linux/in.h needs this!! */ -#include <linux/in.h> /* We get struct sockaddr_in. */ -#include <linux/in6.h> /* We get struct in6_addr */ -#include <linux/ipv6.h> -#include <asm/param.h> /* We get MAXHOSTNAMELEN. */ -#include <asm/atomic.h> /* This gets us atomic counters. */ -#include <linux/skbuff.h> /* We need sk_buff_head. */ -#include <linux/workqueue.h> /* We need tq_struct. */ -#include <linux/sctp.h> /* We need sctp* header structs. */ -#include <net/sctp/auth.h> /* We need auth specific structs */ - -/* A convenience structure for handling sockaddr structures. - * We should wean ourselves off this. - */ -union sctp_addr { - struct sockaddr_in v4; - struct sockaddr_in6 v6; - struct sockaddr sa; -}; - -/* Forward declarations for data structures. */ -struct sctp_globals; -struct sctp_endpoint; -struct sctp_association; -struct sctp_transport; -struct sctp_packet; -struct sctp_chunk; -struct sctp_inq; -struct sctp_outq; -struct sctp_bind_addr; -struct sctp_ulpq; -struct sctp_ep_common; -struct sctp_ssnmap; -struct crypto_hash; - - -#include <net/sctp/tsnmap.h> -#include <net/sctp/ulpevent.h> -#include <net/sctp/ulpqueue.h> - -/* Structures useful for managing bind/connect. */ - -struct sctp_bind_bucket { - unsigned short port; - unsigned short fastreuse; - struct hlist_node node; - struct hlist_head owner; -}; - -struct sctp_bind_hashbucket { - spinlock_t lock; - struct hlist_head chain; -}; - -/* Used for hashing all associations. */ -struct sctp_hashbucket { - rwlock_t lock; - struct hlist_head chain; -} __attribute__((__aligned__(8))); - - -/* The SCTP globals structure. */ -extern struct sctp_globals { - /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values - * - * The following protocol parameters are RECOMMENDED: - * - * RTO.Initial - 3 seconds - * RTO.Min - 1 second - * RTO.Max - 60 seconds - * RTO.Alpha - 1/8 (3 when converted to right shifts.) - * RTO.Beta - 1/4 (2 when converted to right shifts.) - */ - unsigned int rto_initial; - unsigned int rto_min; - unsigned int rto_max; - - /* Note: rto_alpha and rto_beta are really defined as inverse - * powers of two to facilitate integer operations. - */ - int rto_alpha; - int rto_beta; - - /* Max.Burst - 4 */ - int max_burst; - - /* Whether Cookie Preservative is enabled(1) or not(0) */ - int cookie_preserve_enable; - - /* Valid.Cookie.Life - 60 seconds */ - unsigned int valid_cookie_life; - - /* Delayed SACK timeout 200ms default*/ - unsigned int sack_timeout; - - /* HB.interval - 30 seconds */ - unsigned int hb_interval; - - /* Association.Max.Retrans - 10 attempts - * Path.Max.Retrans - 5 attempts (per destination address) - * Max.Init.Retransmits - 8 attempts - */ - int max_retrans_association; - int max_retrans_path; - int max_retrans_init; - - /* - * Policy for preforming sctp/socket accounting - * 0 - do socket level accounting, all assocs share sk_sndbuf - * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes - */ - int sndbuf_policy; - - /* - * Policy for preforming sctp/socket accounting - * 0 - do socket level accounting, all assocs share sk_rcvbuf - * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes - */ - int rcvbuf_policy; - - /* The following variables are implementation specific. */ - - /* Default initialization values to be applied to new associations. */ - __u16 max_instreams; - __u16 max_outstreams; - - /* This is a list of groups of functions for each address - * family that we support. - */ - struct list_head address_families; - - /* This is the hash of all endpoints. */ - int ep_hashsize; - struct sctp_hashbucket *ep_hashtable; - - /* This is the hash of all associations. */ - int assoc_hashsize; - struct sctp_hashbucket *assoc_hashtable; - - /* This is the sctp port control hash. */ - int port_hashsize; - struct sctp_bind_hashbucket *port_hashtable; - - /* This is the global local address list. - * We actively maintain this complete list of addresses on - * the system by catching address add/delete events. - * - * It is a list of sctp_sockaddr_entry. - */ - struct list_head local_addr_list; - - /* Lock that protects the local_addr_list writers */ - spinlock_t addr_list_lock; - - /* Flag to indicate if addip is enabled. */ - int addip_enable; - int addip_noauth_enable; - - /* Flag to indicate if PR-SCTP is enabled. */ - int prsctp_enable; - - /* Flag to idicate if SCTP-AUTH is enabled */ - int auth_enable; -} sctp_globals; - -#define sctp_rto_initial (sctp_globals.rto_initial) -#define sctp_rto_min (sctp_globals.rto_min) -#define sctp_rto_max (sctp_globals.rto_max) -#define sctp_rto_alpha (sctp_globals.rto_alpha) -#define sctp_rto_beta (sctp_globals.rto_beta) -#define sctp_max_burst (sctp_globals.max_burst) -#define sctp_valid_cookie_life (sctp_globals.valid_cookie_life) -#define sctp_cookie_preserve_enable (sctp_globals.cookie_preserve_enable) -#define sctp_max_retrans_association (sctp_globals.max_retrans_association) -#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy) -#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy) -#define sctp_max_retrans_path (sctp_globals.max_retrans_path) -#define sctp_max_retrans_init (sctp_globals.max_retrans_init) -#define sctp_sack_timeout (sctp_globals.sack_timeout) -#define sctp_hb_interval (sctp_globals.hb_interval) -#define sctp_max_instreams (sctp_globals.max_instreams) -#define sctp_max_outstreams (sctp_globals.max_outstreams) -#define sctp_address_families (sctp_globals.address_families) -#define sctp_ep_hashsize (sctp_globals.ep_hashsize) -#define sctp_ep_hashtable (sctp_globals.ep_hashtable) -#define sctp_assoc_hashsize (sctp_globals.assoc_hashsize) -#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) -#define sctp_port_hashsize (sctp_globals.port_hashsize) -#define sctp_port_rover (sctp_globals.port_rover) -#define sctp_port_alloc_lock (sctp_globals.port_alloc_lock) -#define sctp_port_hashtable (sctp_globals.port_hashtable) -#define sctp_local_addr_list (sctp_globals.local_addr_list) -#define sctp_local_addr_lock (sctp_globals.addr_list_lock) -#define sctp_addip_enable (sctp_globals.addip_enable) -#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) -#define sctp_prsctp_enable (sctp_globals.prsctp_enable) -#define sctp_auth_enable (sctp_globals.auth_enable) - -/* SCTP Socket type: UDP or TCP style. */ -typedef enum { - SCTP_SOCKET_UDP = 0, - SCTP_SOCKET_UDP_HIGH_BANDWIDTH, - SCTP_SOCKET_TCP -} sctp_socket_type_t; - -/* Per socket SCTP information. */ -struct sctp_sock { - /* inet_sock has to be the first member of sctp_sock */ - struct inet_sock inet; - /* What kind of a socket is this? */ - sctp_socket_type_t type; - - /* PF_ family specific functions. */ - struct sctp_pf *pf; - - /* Access to HMAC transform. */ - struct crypto_hash *hmac; - - /* What is our base endpointer? */ - struct sctp_endpoint *ep; - - struct sctp_bind_bucket *bind_hash; - /* Various Socket Options. */ - __u16 default_stream; - __u32 default_ppid; - __u16 default_flags; - __u32 default_context; - __u32 default_timetolive; - __u32 default_rcv_context; - int max_burst; - - /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to - * the destination address every heartbeat interval. This value - * will be inherited by all new associations. - */ - __u32 hbinterval; - - /* This is the max_retrans value for new associations. */ - __u16 pathmaxrxt; - - /* The initial Path MTU to use for new associations. */ - __u32 pathmtu; - - /* The default SACK delay timeout for new associations. */ - __u32 sackdelay; - __u32 sackfreq; - - /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */ - __u32 param_flags; - - struct sctp_initmsg initmsg; - struct sctp_rtoinfo rtoinfo; - struct sctp_paddrparams paddrparam; - struct sctp_event_subscribe subscribe; - struct sctp_assocparams assocparams; - int user_frag; - __u32 autoclose; - __u8 nodelay; - __u8 disable_fragments; - __u8 v4mapped; - __u8 frag_interleave; - __u32 adaptation_ind; - __u32 pd_point; - - atomic_t pd_mode; - /* Receive to here while partial delivery is in effect. */ - struct sk_buff_head pd_lobby; -}; - -static inline struct sctp_sock *sctp_sk(const struct sock *sk) -{ - return (struct sctp_sock *)sk; -} - -static inline struct sock *sctp_opt2sk(const struct sctp_sock *sp) -{ - return (struct sock *)sp; -} - -#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) -struct sctp6_sock { - struct sctp_sock sctp; - struct ipv6_pinfo inet6; -}; -#endif /* CONFIG_IPV6 */ - - -/* This is our APPLICATION-SPECIFIC state cookie. - * THIS IS NOT DICTATED BY THE SPECIFICATION. - */ -/* These are the parts of an association which we send in the cookie. - * Most of these are straight out of: - * RFC2960 12.2 Parameters necessary per association (i.e. the TCB) - * - */ - -struct sctp_cookie { - - /* My : Tag expected in every inbound packet and sent - * Verification: in the INIT or INIT ACK chunk. - * Tag : - */ - __u32 my_vtag; - - /* Peer's : Tag expected in every outbound packet except - * Verification: in the INIT chunk. - * Tag : - */ - __u32 peer_vtag; - - /* The rest of these are not from the spec, but really need to - * be in the cookie. - */ - - /* My Tie Tag : Assist in discovering a restarting association. */ - __u32 my_ttag; - - /* Peer's Tie Tag: Assist in discovering a restarting association. */ - __u32 peer_ttag; - - /* When does this cookie expire? */ - struct timeval expiration; - - /* Number of inbound/outbound streams which are set - * and negotiated during the INIT process. - */ - __u16 sinit_num_ostreams; - __u16 sinit_max_instreams; - - /* This is the first sequence number I used. */ - __u32 initial_tsn; - - /* This holds the originating address of the INIT packet. */ - union sctp_addr peer_addr; - - /* IG Section 2.35.3 - * Include the source port of the INIT-ACK - */ - __u16 my_port; - - __u8 prsctp_capable; - - /* Padding for future use */ - __u8 padding; - - __u32 adaptation_ind; - - __u8 auth_random[sizeof(sctp_paramhdr_t) + SCTP_AUTH_RANDOM_LENGTH]; - __u8 auth_hmacs[SCTP_AUTH_NUM_HMACS + 2]; - __u8 auth_chunks[sizeof(sctp_paramhdr_t) + SCTP_AUTH_MAX_CHUNKS]; - - /* This is a shim for my peer's INIT packet, followed by - * a copy of the raw address list of the association. - * The length of the raw address list is saved in the - * raw_addr_list_len field, which will be used at the time when - * the association TCB is re-constructed from the cookie. - */ - __u32 raw_addr_list_len; - struct sctp_init_chunk peer_init[0]; -}; - - -/* The format of our cookie that we send to our peer. */ -struct sctp_signed_cookie { - __u8 signature[SCTP_SECRET_SIZE]; - __u32 __pad; /* force sctp_cookie alignment to 64 bits */ - struct sctp_cookie c; -} __attribute__((packed)); - -/* This is another convenience type to allocate memory for address - * params for the maximum size and pass such structures around - * internally. - */ -union sctp_addr_param { - struct sctp_paramhdr p; - struct sctp_ipv4addr_param v4; - struct sctp_ipv6addr_param v6; -}; - -/* A convenience type to allow walking through the various - * parameters and avoid casting all over the place. - */ -union sctp_params { - void *v; - struct sctp_paramhdr *p; - struct sctp_cookie_preserve_param *life; - struct sctp_hostname_param *dns; - struct sctp_cookie_param *cookie; - struct sctp_supported_addrs_param *sat; - struct sctp_ipv4addr_param *v4; - struct sctp_ipv6addr_param *v6; - union sctp_addr_param *addr; - struct sctp_adaptation_ind_param *aind; - struct sctp_supported_ext_param *ext; - struct sctp_random_param *random; - struct sctp_chunks_param *chunks; - struct sctp_hmac_algo_param *hmac_algo; - struct sctp_addip_param *addip; -}; - -/* RFC 2960. Section 3.3.5 Heartbeat. - * Heartbeat Information: variable length - * The Sender-specific Heartbeat Info field should normally include - * information about the sender's current time when this HEARTBEAT - * chunk is sent and the destination transport address to which this - * HEARTBEAT is sent (see Section 8.3). - */ -typedef struct sctp_sender_hb_info { - struct sctp_paramhdr param_hdr; - union sctp_addr daddr; - unsigned long sent_at; - __u64 hb_nonce; -} __attribute__((packed)) sctp_sender_hb_info_t; - -/* - * RFC 2960 1.3.2 Sequenced Delivery within Streams - * - * The term "stream" is used in SCTP to refer to a sequence of user - * messages that are to be delivered to the upper-layer protocol in - * order with respect to other messages within the same stream. This is - * in contrast to its usage in TCP, where it refers to a sequence of - * bytes (in this document a byte is assumed to be eight bits). - * ... - * - * This is the structure we use to track both our outbound and inbound - * SSN, or Stream Sequence Numbers. - */ - -struct sctp_stream { - __u16 *ssn; - unsigned int len; -}; - -struct sctp_ssnmap { - struct sctp_stream in; - struct sctp_stream out; - int malloced; -}; - -struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, - gfp_t gfp); -void sctp_ssnmap_free(struct sctp_ssnmap *map); -void sctp_ssnmap_clear(struct sctp_ssnmap *map); - -/* What is the current SSN number for this stream? */ -static inline __u16 sctp_ssn_peek(struct sctp_stream *stream, __u16 id) -{ - return stream->ssn[id]; -} - -/* Return the next SSN number for this stream. */ -static inline __u16 sctp_ssn_next(struct sctp_stream *stream, __u16 id) -{ - return stream->ssn[id]++; -} - -/* Skip over this ssn and all below. */ -static inline void sctp_ssn_skip(struct sctp_stream *stream, __u16 id, - __u16 ssn) -{ - stream->ssn[id] = ssn+1; -} - -/* - * Pointers to address related SCTP functions. - * (i.e. things that depend on the address family.) - */ -struct sctp_af { - int (*sctp_xmit) (struct sk_buff *skb, - struct sctp_transport *); - int (*setsockopt) (struct sock *sk, - int level, - int optname, - char __user *optval, - int optlen); - int (*getsockopt) (struct sock *sk, - int level, - int optname, - char __user *optval, - int __user *optlen); - int (*compat_setsockopt) (struct sock *sk, - int level, - int optname, - char __user *optval, - int optlen); - int (*compat_getsockopt) (struct sock *sk, - int level, - int optname, - char __user *optval, - int __user *optlen); - struct dst_entry *(*get_dst) (struct sctp_association *asoc, - union sctp_addr *daddr, - union sctp_addr *saddr); - void (*get_saddr) (struct sctp_sock *sk, - struct sctp_association *asoc, - struct dst_entry *dst, - union sctp_addr *daddr, - union sctp_addr *saddr); - void (*copy_addrlist) (struct list_head *, - struct net_device *); - void (*dst_saddr) (union sctp_addr *saddr, - struct dst_entry *dst, - __be16 port); - int (*cmp_addr) (const union sctp_addr *addr1, - const union sctp_addr *addr2); - void (*addr_copy) (union sctp_addr *dst, - union sctp_addr *src); - void (*from_skb) (union sctp_addr *, - struct sk_buff *skb, - int saddr); - void (*from_sk) (union sctp_addr *, - struct sock *sk); - void (*to_sk_saddr) (union sctp_addr *, - struct sock *sk); - void (*to_sk_daddr) (union sctp_addr *, - struct sock *sk); - void (*from_addr_param) (union sctp_addr *, - union sctp_addr_param *, - __be16 port, int iif); - int (*to_addr_param) (const union sctp_addr *, - union sctp_addr_param *); - int (*addr_valid) (union sctp_addr *, - struct sctp_sock *, - const struct sk_buff *); - sctp_scope_t (*scope) (union sctp_addr *); - void (*inaddr_any) (union sctp_addr *, __be16); - int (*is_any) (const union sctp_addr *); - int (*available) (union sctp_addr *, - struct sctp_sock *); - int (*skb_iif) (const struct sk_buff *sk); - int (*is_ce) (const struct sk_buff *sk); - void (*seq_dump_addr)(struct seq_file *seq, - union sctp_addr *addr); - void (*ecn_capable)(struct sock *sk); - __u16 net_header_len; - int sockaddr_len; - sa_family_t sa_family; - struct list_head list; -}; - -struct sctp_af *sctp_get_af_specific(sa_family_t); -int sctp_register_af(struct sctp_af *); - -/* Protocol family functions. */ -struct sctp_pf { - void (*event_msgname)(struct sctp_ulpevent *, char *, int *); - void (*skb_msgname) (struct sk_buff *, char *, int *); - int (*af_supported) (sa_family_t, struct sctp_sock *); - int (*cmp_addr) (const union sctp_addr *, - const union sctp_addr *, - struct sctp_sock *); - int (*bind_verify) (struct sctp_sock *, union sctp_addr *); - int (*send_verify) (struct sctp_sock *, union sctp_addr *); - int (*supported_addrs)(const struct sctp_sock *, __be16 *); - struct sock *(*create_accept_sk) (struct sock *sk, - struct sctp_association *asoc); - void (*addr_v4map) (struct sctp_sock *, union sctp_addr *); - struct sctp_af *af; -}; - - -/* Structure to track chunk fragments that have been acked, but peer - * fragments of the same message have not. - */ -struct sctp_datamsg { - /* Chunks waiting to be submitted to lower layer. */ - struct list_head chunks; - /* Chunks that have been transmitted. */ - struct list_head track; - /* Reference counting. */ - atomic_t refcnt; - /* When is this message no longer interesting to the peer? */ - unsigned long expires_at; - /* Did the messenge fail to send? */ - int send_error; - char send_failed; - /* Control whether chunks from this message can be abandoned. */ - char can_abandon; -}; - -struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, - struct sctp_sndrcvinfo *, - struct msghdr *, int len); -void sctp_datamsg_put(struct sctp_datamsg *); -void sctp_chunk_fail(struct sctp_chunk *, int error); -int sctp_chunk_abandoned(struct sctp_chunk *); - -/* RFC2960 1.4 Key Terms - * - * o Chunk: A unit of information within an SCTP packet, consisting of - * a chunk header and chunk-specific content. - * - * As a matter of convenience, we remember the SCTP common header for - * each chunk as well as a few other header pointers... - */ -struct sctp_chunk { - struct list_head list; - - atomic_t refcnt; - - /* This is our link to the per-transport transmitted list. */ - struct list_head transmitted_list; - - /* This field is used by chunks that hold fragmented data. - * For the first fragment this is the list that holds the rest of - * fragments. For the remaining fragments, this is the link to the - * frag_list maintained in the first fragment. - */ - struct list_head frag_list; - - /* This points to the sk_buff containing the actual data. */ - struct sk_buff *skb; - - /* These are the SCTP headers by reverse order in a packet. - * Note that some of these may happen more than once. In that - * case, we point at the "current" one, whatever that means - * for that level of header. - */ - - /* We point this at the FIRST TLV parameter to chunk_hdr. */ - union sctp_params param_hdr; - union { - __u8 *v; - struct sctp_datahdr *data_hdr; - struct sctp_inithdr *init_hdr; - struct sctp_sackhdr *sack_hdr; - struct sctp_heartbeathdr *hb_hdr; - struct sctp_sender_hb_info *hbs_hdr; - struct sctp_shutdownhdr *shutdown_hdr; - struct sctp_signed_cookie *cookie_hdr; - struct sctp_ecnehdr *ecne_hdr; - struct sctp_cwrhdr *ecn_cwr_hdr; - struct sctp_errhdr *err_hdr; - struct sctp_addiphdr *addip_hdr; - struct sctp_fwdtsn_hdr *fwdtsn_hdr; - struct sctp_authhdr *auth_hdr; - } subh; - - __u8 *chunk_end; - - struct sctp_chunkhdr *chunk_hdr; - struct sctphdr *sctp_hdr; - - /* This needs to be recoverable for SCTP_SEND_FAILED events. */ - struct sctp_sndrcvinfo sinfo; - - /* Which association does this belong to? */ - struct sctp_association *asoc; - - /* What endpoint received this chunk? */ - struct sctp_ep_common *rcvr; - - /* We fill this in if we are calculating RTT. */ - unsigned long sent_at; - - /* What is the origin IP address for this chunk? */ - union sctp_addr source; - /* Destination address for this chunk. */ - union sctp_addr dest; - - /* For outbound message, track all fragments for SEND_FAILED. */ - struct sctp_datamsg *msg; - - /* For an inbound chunk, this tells us where it came from. - * For an outbound chunk, it tells us where we'd like it to - * go. It is NULL if we have no preference. - */ - struct sctp_transport *transport; - - /* SCTP-AUTH: For the special case inbound processing of COOKIE-ECHO - * we need save a pointer to the AUTH chunk, since the SCTP-AUTH - * spec violates the principle premis that all chunks are processed - * in order. - */ - struct sk_buff *auth_chunk; - -#define SCTP_CAN_FRTX 0x0 -#define SCTP_NEED_FRTX 0x1 -#define SCTP_DONT_FRTX 0x2 - __u16 rtt_in_progress:1, /* This chunk used for RTT calc? */ - resent:1, /* Has this chunk ever been resent. */ - has_tsn:1, /* Does this chunk have a TSN yet? */ - has_ssn:1, /* Does this chunk have a SSN yet? */ - singleton:1, /* Only chunk in the packet? */ - end_of_packet:1, /* Last chunk in the packet? */ - ecn_ce_done:1, /* Have we processed the ECN CE bit? */ - pdiscard:1, /* Discard the whole packet now? */ - tsn_gap_acked:1, /* Is this chunk acked by a GAP ACK? */ - data_accepted:1, /* At least 1 chunk accepted */ - auth:1, /* IN: was auth'ed | OUT: needs auth */ - has_asconf:1, /* IN: have seen an asconf before */ - tsn_missing_report:2, /* Data chunk missing counter. */ - fast_retransmit:2; /* Is this chunk fast retransmitted? */ -}; - -void sctp_chunk_hold(struct sctp_chunk *); -void sctp_chunk_put(struct sctp_chunk *); -int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, - struct iovec *data); -void sctp_chunk_free(struct sctp_chunk *); -void *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data); -struct sctp_chunk *sctp_chunkify(struct sk_buff *, - const struct sctp_association *, - struct sock *); -void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, - union sctp_addr *); -const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); - -enum { - SCTP_ADDR_NEW, /* new address added to assoc/ep */ - SCTP_ADDR_SRC, /* address can be used as source */ - SCTP_ADDR_DEL, /* address about to be deleted */ -}; - -/* This is a structure for holding either an IPv6 or an IPv4 address. */ -struct sctp_sockaddr_entry { - struct list_head list; - struct rcu_head rcu; - union sctp_addr a; - __u8 state; - __u8 valid; -}; - -typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *); - -/* This structure holds lists of chunks as we are assembling for - * transmission. - */ -struct sctp_packet { - /* These are the SCTP header values (host order) for the packet. */ - __u16 source_port; - __u16 destination_port; - __u32 vtag; - - /* This contains the payload chunks. */ - struct list_head chunk_list; - - /* This is the overhead of the sctp and ip headers. */ - size_t overhead; - /* This is the total size of all chunks INCLUDING padding. */ - size_t size; - - /* The packet is destined for this transport address. - * The function we finally use to pass down to the next lower - * layer lives in the transport structure. - */ - struct sctp_transport *transport; - - /* pointer to the auth chunk for this packet */ - struct sctp_chunk *auth; - - /* This packet contains a COOKIE-ECHO chunk. */ - __u8 has_cookie_echo; - - /* This packet contains a SACK chunk. */ - __u8 has_sack; - - /* This packet contains an AUTH chunk */ - __u8 has_auth; - - /* This packet contains at least 1 DATA chunk */ - __u8 has_data; - - /* SCTP cannot fragment this packet. So let ip fragment it. */ - __u8 ipfragok; - - __u8 malloced; -}; - -struct sctp_packet *sctp_packet_init(struct sctp_packet *, - struct sctp_transport *, - __u16 sport, __u16 dport); -struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int); -sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *, - struct sctp_chunk *, int); -sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *, - struct sctp_chunk *); -int sctp_packet_transmit(struct sctp_packet *); -void sctp_packet_free(struct sctp_packet *); - -static inline int sctp_packet_empty(struct sctp_packet *packet) -{ - return (packet->size == packet->overhead); -} - -/* This represents a remote transport address. - * For local transport addresses, we just use union sctp_addr. - * - * RFC2960 Section 1.4 Key Terms - * - * o Transport address: A Transport Address is traditionally defined - * by Network Layer address, Transport Layer protocol and Transport - * Layer port number. In the case of SCTP running over IP, a - * transport address is defined by the combination of an IP address - * and an SCTP port number (where SCTP is the Transport protocol). - * - * RFC2960 Section 7.1 SCTP Differences from TCP Congestion control - * - * o The sender keeps a separate congestion control parameter set for - * each of the destination addresses it can send to (not each - * source-destination pair but for each destination). The parameters - * should decay if the address is not used for a long enough time - * period. - * - */ -struct sctp_transport { - /* A list of transports. */ - struct list_head transports; - - /* Reference counting. */ - atomic_t refcnt; - int dead; - - /* This is the peer's IP address and port. */ - union sctp_addr ipaddr; - - /* These are the functions we call to handle LLP stuff. */ - struct sctp_af *af_specific; - - /* Which association do we belong to? */ - struct sctp_association *asoc; - - /* RFC2960 - * - * 12.3 Per Transport Address Data - * - * For each destination transport address in the peer's - * address list derived from the INIT or INIT ACK chunk, a - * number of data elements needs to be maintained including: - */ - /* RTO : The current retransmission timeout value. */ - unsigned long rto; - unsigned long last_rto; - - __u32 rtt; /* This is the most recent RTT. */ - - /* RTTVAR : The current RTT variation. */ - __u32 rttvar; - - /* SRTT : The current smoothed round trip time. */ - __u32 srtt; - - /* RTO-Pending : A flag used to track if one of the DATA - * chunks sent to this address is currently being - * used to compute a RTT. If this flag is 0, - * the next DATA chunk sent to this destination - * should be used to compute a RTT and this flag - * should be set. Every time the RTT - * calculation completes (i.e. the DATA chunk - * is SACK'd) clear this flag. - */ - __u8 rto_pending; - - /* Flag to track the current fast recovery state */ - __u8 fast_recovery; - - /* - * These are the congestion stats. - */ - /* cwnd : The current congestion window. */ - __u32 cwnd; /* This is the actual cwnd. */ - - /* ssthresh : The current slow start threshold value. */ - __u32 ssthresh; - - /* partial : The tracking method for increase of cwnd when in - * bytes acked : congestion avoidance mode (see Section 6.2.2) - */ - __u32 partial_bytes_acked; - - /* Data that has been sent, but not acknowledged. */ - __u32 flight_size; - - /* TSN marking the fast recovery exit point */ - __u32 fast_recovery_exit; - - /* Destination */ - struct dst_entry *dst; - /* Source address. */ - union sctp_addr saddr; - - /* When was the last time(in jiffies) that a data packet was sent on - * this transport? This is used to adjust the cwnd when the transport - * becomes inactive. - */ - unsigned long last_time_used; - - /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to - * the destination address every heartbeat interval. - */ - unsigned long hbinterval; - - /* SACK delay timeout */ - unsigned long sackdelay; - __u32 sackfreq; - - /* When was the last time (in jiffies) that we heard from this - * transport? We use this to pick new active and retran paths. - */ - unsigned long last_time_heard; - - /* Last time(in jiffies) when cwnd is reduced due to the congestion - * indication based on ECNE chunk. - */ - unsigned long last_time_ecne_reduced; - - /* This is the max_retrans value for the transport and will - * be initialized from the assocs value. This can be changed - * using SCTP_SET_PEER_ADDR_PARAMS socket option. - */ - __u16 pathmaxrxt; - - /* is the Path MTU update pending on this tranport */ - __u8 pmtu_pending; - - /* PMTU : The current known path MTU. */ - __u32 pathmtu; - - /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */ - __u32 param_flags; - - /* The number of times INIT has been sent on this transport. */ - int init_sent_count; - - /* state : The current state of this destination, - * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN. - */ - int state; - - /* These are the error stats for this destination. */ - - /* Error count : The current error count for this destination. */ - unsigned short error_count; - - /* Per : A timer used by each destination. - * Destination : - * Timer : - * - * [Everywhere else in the text this is called T3-rtx. -ed] - */ - struct timer_list T3_rtx_timer; - - /* Heartbeat timer is per destination. */ - struct timer_list hb_timer; - - /* Since we're using per-destination retransmission timers - * (see above), we're also using per-destination "transmitted" - * queues. This probably ought to be a private struct - * accessible only within the outqueue, but it's not, yet. - */ - struct list_head transmitted; - - /* We build bundle-able packets for this transport here. */ - struct sctp_packet packet; - - /* This is the list of transports that have chunks to send. */ - struct list_head send_ready; - - int malloced; /* Is this structure kfree()able? */ - - /* State information saved for SFR_CACC algorithm. The key - * idea in SFR_CACC is to maintain state at the sender on a - * per-destination basis when a changeover happens. - * char changeover_active; - * char cycling_changeover; - * __u32 next_tsn_at_change; - * char cacc_saw_newack; - */ - struct { - /* An unsigned integer, which stores the next TSN to be - * used by the sender, at the moment of changeover. - */ - __u32 next_tsn_at_change; - - /* A flag which indicates the occurrence of a changeover */ - char changeover_active; - - /* A flag which indicates whether the change of primary is - * the first switch to this destination address during an - * active switch. - */ - char cycling_changeover; - - /* A temporary flag, which is used during the processing of - * a SACK to estimate the causative TSN(s)'s group. - */ - char cacc_saw_newack; - } cacc; - - /* 64-bit random number sent with heartbeat. */ - __u64 hb_nonce; -}; - -struct sctp_transport *sctp_transport_new(const union sctp_addr *, - gfp_t); -void sctp_transport_set_owner(struct sctp_transport *, - struct sctp_association *); -void sctp_transport_route(struct sctp_transport *, union sctp_addr *, - struct sctp_sock *); -void sctp_transport_pmtu(struct sctp_transport *); -void sctp_transport_free(struct sctp_transport *); -void sctp_transport_reset_timers(struct sctp_transport *, int); -void sctp_transport_hold(struct sctp_transport *); -void sctp_transport_put(struct sctp_transport *); -void sctp_transport_update_rto(struct sctp_transport *, __u32); -void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32); -void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); -unsigned long sctp_transport_timeout(struct sctp_transport *); -void sctp_transport_reset(struct sctp_transport *); -void sctp_transport_update_pmtu(struct sctp_transport *, u32); - - -/* This is the structure we use to queue packets as they come into - * SCTP. We write packets to it and read chunks from it. - */ -struct sctp_inq { - /* This is actually a queue of sctp_chunk each - * containing a partially decoded packet. - */ - struct list_head in_chunk_list; - /* This is the packet which is currently off the in queue and is - * being worked on through the inbound chunk processing. - */ - struct sctp_chunk *in_progress; - - /* This is the delayed task to finish delivering inbound - * messages. - */ - struct work_struct immediate; - - int malloced; /* Is this structure kfree()able? */ -}; - -void sctp_inq_init(struct sctp_inq *); -void sctp_inq_free(struct sctp_inq *); -void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet); -struct sctp_chunk *sctp_inq_pop(struct sctp_inq *); -struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *); -void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t); - -/* This is the structure we use to hold outbound chunks. You push - * chunks in and they automatically pop out the other end as bundled - * packets (it calls (*output_handler)()). - * - * This structure covers sections 6.3, 6.4, 6.7, 6.8, 6.10, 7., 8.1, - * and 8.2 of the v13 draft. - * - * It handles retransmissions. The connection to the timeout portion - * of the state machine is through sctp_..._timeout() and timeout_handler. - * - * If you feed it SACKs, it will eat them. - * - * If you give it big chunks, it will fragment them. - * - * It assigns TSN's to data chunks. This happens at the last possible - * instant before transmission. - * - * When free()'d, it empties itself out via output_handler(). - */ -struct sctp_outq { - struct sctp_association *asoc; - - /* Data pending that has never been transmitted. */ - struct list_head out_chunk_list; - - unsigned out_qlen; /* Total length of queued data chunks. */ - - /* Error of send failed, may used in SCTP_SEND_FAILED event. */ - unsigned error; - - /* These are control chunks we want to send. */ - struct list_head control_chunk_list; - - /* These are chunks that have been sacked but are above the - * CTSN, or cumulative tsn ack point. - */ - struct list_head sacked; - - /* Put chunks on this list to schedule them for - * retransmission. - */ - struct list_head retransmit; - - /* Put chunks on this list to save them for FWD TSN processing as - * they were abandoned. - */ - struct list_head abandoned; - - /* How many unackd bytes do we have in-flight? */ - __u32 outstanding_bytes; - - /* Are we doing fast-rtx on this queue */ - char fast_rtx; - - /* Corked? */ - char cork; - - /* Is this structure empty? */ - char empty; - - /* Are we kfree()able? */ - char malloced; -}; - -void sctp_outq_init(struct sctp_association *, struct sctp_outq *); -void sctp_outq_teardown(struct sctp_outq *); -void sctp_outq_free(struct sctp_outq*); -int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk); -int sctp_outq_sack(struct sctp_outq *, struct sctp_sackhdr *); -int sctp_outq_is_empty(const struct sctp_outq *); -void sctp_outq_restart(struct sctp_outq *); - -void sctp_retransmit(struct sctp_outq *, struct sctp_transport *, - sctp_retransmit_reason_t); -void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8); -int sctp_outq_uncork(struct sctp_outq *); -/* Uncork and flush an outqueue. */ -static inline void sctp_outq_cork(struct sctp_outq *q) -{ - q->cork = 1; -} - -/* These bind address data fields common between endpoints and associations */ -struct sctp_bind_addr { - - /* RFC 2960 12.1 Parameters necessary for the SCTP instance - * - * SCTP Port: The local SCTP port number the endpoint is - * bound to. - */ - __u16 port; - - /* RFC 2960 12.1 Parameters necessary for the SCTP instance - * - * Address List: The list of IP addresses that this instance - * has bound. This information is passed to one's - * peer(s) in INIT and INIT ACK chunks. - */ - struct list_head address_list; - - int malloced; /* Are we kfree()able? */ -}; - -void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); -void sctp_bind_addr_free(struct sctp_bind_addr *); -int sctp_bind_addr_copy(struct sctp_bind_addr *dest, - const struct sctp_bind_addr *src, - sctp_scope_t scope, gfp_t gfp, - int flags); -int sctp_bind_addr_dup(struct sctp_bind_addr *dest, - const struct sctp_bind_addr *src, - gfp_t gfp); -int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, - __u8 addr_state, gfp_t gfp); -int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); -int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, - struct sctp_sock *); -int sctp_bind_addr_conflict(struct sctp_bind_addr *, const union sctp_addr *, - struct sctp_sock *, struct sctp_sock *); -int sctp_bind_addr_state(const struct sctp_bind_addr *bp, - const union sctp_addr *addr); -union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, - const union sctp_addr *addrs, - int addrcnt, - struct sctp_sock *opt); -union sctp_params sctp_bind_addrs_to_raw(const struct sctp_bind_addr *bp, - int *addrs_len, - gfp_t gfp); -int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len, - __u16 port, gfp_t gfp); - -sctp_scope_t sctp_scope(const union sctp_addr *); -int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); -int sctp_is_any(struct sock *sk, const union sctp_addr *addr); -int sctp_addr_is_valid(const union sctp_addr *addr); - - -/* What type of endpoint? */ -typedef enum { - SCTP_EP_TYPE_SOCKET, - SCTP_EP_TYPE_ASSOCIATION, -} sctp_endpoint_type_t; - -/* - * A common base class to bridge the implmentation view of a - * socket (usually listening) endpoint versus an association's - * local endpoint. - * This common structure is useful for several purposes: - * 1) Common interface for lookup routines. - * a) Subfunctions work for either endpoint or association - * b) Single interface to lookup allows hiding the lookup lock rather - * than acquiring it externally. - * 2) Common interface for the inbound chunk handling/state machine. - * 3) Common object handling routines for reference counting, etc. - * 4) Disentangle association lookup from endpoint lookup, where we - * do not have to find our endpoint to find our association. - * - */ - -struct sctp_ep_common { - /* Fields to help us manage our entries in the hash tables. */ - struct hlist_node node; - int hashent; - - /* Runtime type information. What kind of endpoint is this? */ - sctp_endpoint_type_t type; - - /* Some fields to help us manage this object. - * refcnt - Reference count access to this object. - * dead - Do not attempt to use this object. - * malloced - Do we need to kfree this object? - */ - atomic_t refcnt; - char dead; - char malloced; - - /* What socket does this endpoint belong to? */ - struct sock *sk; - - /* This is where we receive inbound chunks. */ - struct sctp_inq inqueue; - - /* This substructure includes the defining parameters of the - * endpoint: - * bind_addr.port is our shared port number. - * bind_addr.address_list is our set of local IP addresses. - */ - struct sctp_bind_addr bind_addr; -}; - - -/* RFC Section 1.4 Key Terms - * - * o SCTP endpoint: The logical sender/receiver of SCTP packets. On a - * multi-homed host, an SCTP endpoint is represented to its peers as a - * combination of a set of eligible destination transport addresses to - * which SCTP packets can be sent and a set of eligible source - * transport addresses from which SCTP packets can be received. - * All transport addresses used by an SCTP endpoint must use the - * same port number, but can use multiple IP addresses. A transport - * address used by an SCTP endpoint must not be used by another - * SCTP endpoint. In other words, a transport address is unique - * to an SCTP endpoint. - * - * From an implementation perspective, each socket has one of these. - * A TCP-style socket will have exactly one association on one of - * these. An UDP-style socket will have multiple associations hanging - * off one of these. - */ - -struct sctp_endpoint { - /* Common substructure for endpoint and association. */ - struct sctp_ep_common base; - - /* Associations: A list of current associations and mappings - * to the data consumers for each association. This - * may be in the form of a hash table or other - * implementation dependent structure. The data - * consumers may be process identification - * information such as file descriptors, named pipe - * pointer, or table pointers dependent on how SCTP - * is implemented. - */ - /* This is really a list of struct sctp_association entries. */ - struct list_head asocs; - - /* Secret Key: A secret key used by this endpoint to compute - * the MAC. This SHOULD be a cryptographic quality - * random number with a sufficient length. - * Discussion in [RFC1750] can be helpful in - * selection of the key. - */ - __u8 secret_key[SCTP_HOW_MANY_SECRETS][SCTP_SECRET_SIZE]; - int current_key; - int last_key; - int key_changed_at; - - /* digest: This is a digest of the sctp cookie. This field is - * only used on the receive path when we try to validate - * that the cookie has not been tampered with. We put - * this here so we pre-allocate this once and can re-use - * on every receive. - */ - __u8 *digest; - - /* sendbuf acct. policy. */ - __u32 sndbuf_policy; - - /* rcvbuf acct. policy. */ - __u32 rcvbuf_policy; - - /* SCTP AUTH: array of the HMACs that will be allocated - * we need this per association so that we don't serialize - */ - struct crypto_hash **auth_hmacs; - - /* SCTP-AUTH: hmacs for the endpoint encoded into parameter */ - struct sctp_hmac_algo_param *auth_hmacs_list; - - /* SCTP-AUTH: chunks to authenticate encoded into parameter */ - struct sctp_chunks_param *auth_chunk_list; - - /* SCTP-AUTH: endpoint shared keys */ - struct list_head endpoint_shared_keys; - __u16 active_key_id; -}; - -/* Recover the outter endpoint structure. */ -static inline struct sctp_endpoint *sctp_ep(struct sctp_ep_common *base) -{ - struct sctp_endpoint *ep; - - ep = container_of(base, struct sctp_endpoint, base); - return ep; -} - -/* These are function signatures for manipulating endpoints. */ -struct sctp_endpoint *sctp_endpoint_new(struct sock *, gfp_t); -void sctp_endpoint_free(struct sctp_endpoint *); -void sctp_endpoint_put(struct sctp_endpoint *); -void sctp_endpoint_hold(struct sctp_endpoint *); -void sctp_endpoint_add_asoc(struct sctp_endpoint *, struct sctp_association *); -struct sctp_association *sctp_endpoint_lookup_assoc( - const struct sctp_endpoint *ep, - const union sctp_addr *paddr, - struct sctp_transport **); -int sctp_endpoint_is_peeled_off(struct sctp_endpoint *, - const union sctp_addr *); -struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, - const union sctp_addr *); -int sctp_has_association(const union sctp_addr *laddr, - const union sctp_addr *paddr); - -int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, - sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, - struct sctp_chunk **err_chunk); -int sctp_process_init(struct sctp_association *, sctp_cid_t cid, - const union sctp_addr *peer, - sctp_init_chunk_t *init, gfp_t gfp); -__u32 sctp_generate_tag(const struct sctp_endpoint *); -__u32 sctp_generate_tsn(const struct sctp_endpoint *); - -struct sctp_inithdr_host { - __u32 init_tag; - __u32 a_rwnd; - __u16 num_outbound_streams; - __u16 num_inbound_streams; - __u32 initial_tsn; -}; - -/* RFC2960 - * - * 12. Recommended Transmission Control Block (TCB) Parameters - * - * This section details a recommended set of parameters that should - * be contained within the TCB for an implementation. This section is - * for illustrative purposes and should not be deemed as requirements - * on an implementation or as an exhaustive list of all parameters - * inside an SCTP TCB. Each implementation may need its own additional - * parameters for optimization. - */ - - -/* Here we have information about each individual association. */ -struct sctp_association { - - /* A base structure common to endpoint and association. - * In this context, it represents the associations's view - * of the local endpoint of the association. - */ - struct sctp_ep_common base; - - /* Associations on the same socket. */ - struct list_head asocs; - - /* association id. */ - sctp_assoc_t assoc_id; - - /* This is our parent endpoint. */ - struct sctp_endpoint *ep; - - /* These are those association elements needed in the cookie. */ - struct sctp_cookie c; - - /* This is all information about our peer. */ - struct { - /* rwnd - * - * Peer Rwnd : Current calculated value of the peer's rwnd. - */ - __u32 rwnd; - - /* transport_addr_list - * - * Peer : A list of SCTP transport addresses that the - * Transport : peer is bound to. This information is derived - * Address : from the INIT or INIT ACK and is used to - * List : associate an inbound packet with a given - * : association. Normally this information is - * : hashed or keyed for quick lookup and access - * : of the TCB. - * : The list is also initialized with the list - * : of addresses passed with the sctp_connectx() - * : call. - * - * It is a list of SCTP_transport's. - */ - struct list_head transport_addr_list; - - /* transport_count - * - * Peer : A count of the number of peer addresses - * Transport : in the Peer Transport Address List. - * Address : - * Count : - */ - __u16 transport_count; - - /* port - * The transport layer port number. - */ - __u16 port; - - /* primary_path - * - * Primary : This is the current primary destination - * Path : transport address of the peer endpoint. It - * : may also specify a source transport address - * : on this endpoint. - * - * All of these paths live on transport_addr_list. - * - * At the bakeoffs, we discovered that the intent of - * primaryPath is that it only changes when the ULP - * asks to have it changed. We add the activePath to - * designate the connection we are currently using to - * transmit new data and most control chunks. - */ - struct sctp_transport *primary_path; - - /* Cache the primary path address here, when we - * need a an address for msg_name. - */ - union sctp_addr primary_addr; - - /* active_path - * The path that we are currently using to - * transmit new data and most control chunks. - */ - struct sctp_transport *active_path; - - /* retran_path - * - * RFC2960 6.4 Multi-homed SCTP Endpoints - * ... - * Furthermore, when its peer is multi-homed, an - * endpoint SHOULD try to retransmit a chunk to an - * active destination transport address that is - * different from the last destination address to - * which the DATA chunk was sent. - */ - struct sctp_transport *retran_path; - - /* Pointer to last transport I have sent on. */ - struct sctp_transport *last_sent_to; - - /* This is the last transport I have received DATA on. */ - struct sctp_transport *last_data_from; - - /* - * Mapping An array of bits or bytes indicating which out of - * Array order TSN's have been received (relative to the - * Last Rcvd TSN). If no gaps exist, i.e. no out of - * order packets have been received, this array - * will be set to all zero. This structure may be - * in the form of a circular buffer or bit array. - * - * Last Rcvd : This is the last TSN received in - * TSN : sequence. This value is set initially by - * : taking the peer's Initial TSN, received in - * : the INIT or INIT ACK chunk, and subtracting - * : one from it. - * - * Throughout most of the specification this is called the - * "Cumulative TSN ACK Point". In this case, we - * ignore the advice in 12.2 in favour of the term - * used in the bulk of the text. This value is hidden - * in tsn_map--we get it by calling sctp_tsnmap_get_ctsn(). - */ - struct sctp_tsnmap tsn_map; - - /* Ack State : This flag indicates if the next received - * : packet is to be responded to with a - * : SACK. This is initializedto 0. When a packet - * : is received it is incremented. If this value - * : reaches 2 or more, a SACK is sent and the - * : value is reset to 0. Note: This is used only - * : when no DATA chunks are received out of - * : order. When DATA chunks are out of order, - * : SACK's are not delayed (see Section 6). - */ - __u8 sack_needed; /* Do we need to sack the peer? */ - __u32 sack_cnt; - - /* These are capabilities which our peer advertised. */ - __u8 ecn_capable; /* Can peer do ECN? */ - __u8 ipv4_address; /* Peer understands IPv4 addresses? */ - __u8 ipv6_address; /* Peer understands IPv6 addresses? */ - __u8 hostname_address;/* Peer understands DNS addresses? */ - __u8 asconf_capable; /* Does peer support ADDIP? */ - __u8 prsctp_capable; /* Can peer do PR-SCTP? */ - __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ - - __u32 adaptation_ind; /* Adaptation Code point. */ - - /* This mask is used to disable sending the ASCONF chunk - * with specified parameter to peer. - */ - __be16 addip_disabled_mask; - - struct sctp_inithdr_host i; - int cookie_len; - void *cookie; - - /* ADDIP Section 4.2 Upon reception of an ASCONF Chunk. - * C1) ... "Peer-Serial-Number'. This value MUST be initialized to the - * Initial TSN Value minus 1 - */ - __u32 addip_serial; - - /* SCTP-AUTH: We need to know pears random number, hmac list - * and authenticated chunk list. All that is part of the - * cookie and these are just pointers to those locations - */ - sctp_random_param_t *peer_random; - sctp_chunks_param_t *peer_chunks; - sctp_hmac_algo_param_t *peer_hmacs; - } peer; - - /* State : A state variable indicating what state the - * : association is in, i.e. COOKIE-WAIT, - * : COOKIE-ECHOED, ESTABLISHED, SHUTDOWN-PENDING, - * : SHUTDOWN-SENT, SHUTDOWN-RECEIVED, SHUTDOWN-ACK-SENT. - * - * Note: No "CLOSED" state is illustrated since if a - * association is "CLOSED" its TCB SHOULD be removed. - * - * In this implementation we DO have a CLOSED - * state which is used during initiation and shutdown. - * - * State takes values from SCTP_STATE_*. - */ - sctp_state_t state; - - /* The cookie life I award for any cookie. */ - struct timeval cookie_life; - - /* Overall : The overall association error count. - * Error Count : [Clear this any time I get something.] - */ - int overall_error_count; - - /* These are the association's initial, max, and min RTO values. - * These values will be initialized by system defaults, but can - * be modified via the SCTP_RTOINFO socket option. - */ - unsigned long rto_initial; - unsigned long rto_max; - unsigned long rto_min; - - /* Maximum number of new data packets that can be sent in a burst. */ - int max_burst; - - /* This is the max_retrans value for the association. This value will - * be initialized initialized from system defaults, but can be - * modified by the SCTP_ASSOCINFO socket option. - */ - int max_retrans; - - /* Maximum number of times the endpoint will retransmit INIT */ - __u16 max_init_attempts; - - /* How many times have we resent an INIT? */ - __u16 init_retries; - - /* The largest timeout or RTO value to use in attempting an INIT */ - unsigned long max_init_timeo; - - /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to - * the destination address every heartbeat interval. This value - * will be inherited by all new transports. - */ - unsigned long hbinterval; - - /* This is the max_retrans value for new transports in the - * association. - */ - __u16 pathmaxrxt; - - /* Flag that path mtu update is pending */ - __u8 pmtu_pending; - - /* Association : The smallest PMTU discovered for all of the - * PMTU : peer's transport addresses. - */ - __u32 pathmtu; - - /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */ - __u32 param_flags; - - /* SACK delay timeout */ - unsigned long sackdelay; - __u32 sackfreq; - - - unsigned long timeouts[SCTP_NUM_TIMEOUT_TYPES]; - struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; - - /* Transport to which SHUTDOWN chunk was last sent. */ - struct sctp_transport *shutdown_last_sent_to; - - /* How many times have we resent a SHUTDOWN */ - int shutdown_retries; - - /* Transport to which INIT chunk was last sent. */ - struct sctp_transport *init_last_sent_to; - - /* Next TSN : The next TSN number to be assigned to a new - * : DATA chunk. This is sent in the INIT or INIT - * : ACK chunk to the peer and incremented each - * : time a DATA chunk is assigned a TSN - * : (normally just prior to transmit or during - * : fragmentation). - */ - __u32 next_tsn; - - /* - * Last Rcvd : This is the last TSN received in sequence. This value - * TSN : is set initially by taking the peer's Initial TSN, - * : received in the INIT or INIT ACK chunk, and - * : subtracting one from it. - * - * Most of RFC 2960 refers to this as the Cumulative TSN Ack Point. - */ - - __u32 ctsn_ack_point; - - /* PR-SCTP Advanced.Peer.Ack.Point */ - __u32 adv_peer_ack_point; - - /* Highest TSN that is acknowledged by incoming SACKs. */ - __u32 highest_sacked; - - /* The number of unacknowledged data chunks. Reported through - * the SCTP_STATUS sockopt. - */ - __u16 unack_data; - - /* The total number of data chunks that we've had to retransmit - * as the result of a T3 timer expiration - */ - __u32 rtx_data_chunks; - - /* This is the association's receive buffer space. This value is used - * to set a_rwnd field in an INIT or a SACK chunk. - */ - __u32 rwnd; - - /* This is the last advertised value of rwnd over a SACK chunk. */ - __u32 a_rwnd; - - /* Number of bytes by which the rwnd has slopped. The rwnd is allowed - * to slop over a maximum of the association's frag_point. - */ - __u32 rwnd_over; - - /* This is the sndbuf size in use for the association. - * This corresponds to the sndbuf size for the association, - * as specified in the sk->sndbuf. - */ - int sndbuf_used; - - /* This is the amount of memory that this association has allocated - * in the receive path at any given time. - */ - atomic_t rmem_alloc; - - /* This is the wait queue head for send requests waiting on - * the association sndbuf space. - */ - wait_queue_head_t wait; - - /* The message size at which SCTP fragmentation will occur. */ - __u32 frag_point; - - /* Counter used to count INIT errors. */ - int init_err_counter; - - /* Count the number of INIT cycles (for doubling timeout). */ - int init_cycle; - - /* Default send parameters. */ - __u16 default_stream; - __u16 default_flags; - __u32 default_ppid; - __u32 default_context; - __u32 default_timetolive; - - /* Default receive parameters */ - __u32 default_rcv_context; - - /* This tracks outbound ssn for a given stream. */ - struct sctp_ssnmap *ssnmap; - - /* All outbound chunks go through this structure. */ - struct sctp_outq outqueue; - - /* A smart pipe that will handle reordering and fragmentation, - * as well as handle passing events up to the ULP. - */ - struct sctp_ulpq ulpq; - - /* Last TSN that caused an ECNE Chunk to be sent. */ - __u32 last_ecne_tsn; - - /* Last TSN that caused a CWR Chunk to be sent. */ - __u32 last_cwr_tsn; - - /* How many duplicated TSNs have we seen? */ - int numduptsns; - - /* Number of seconds of idle time before an association is closed. - * In the association context, this is really used as a boolean - * since the real timeout is stored in the timeouts array - */ - __u32 autoclose; - - /* These are to support - * "SCTP Extensions for Dynamic Reconfiguration of IP Addresses - * and Enforcement of Flow and Message Limits" - * <draft-ietf-tsvwg-addip-sctp-02.txt> - * or "ADDIP" for short. - */ - - - - /* ADDIP Section 4.1.1 Congestion Control of ASCONF Chunks - * - * R1) One and only one ASCONF Chunk MAY be in transit and - * unacknowledged at any one time. If a sender, after sending - * an ASCONF chunk, decides it needs to transfer another - * ASCONF Chunk, it MUST wait until the ASCONF-ACK Chunk - * returns from the previous ASCONF Chunk before sending a - * subsequent ASCONF. Note this restriction binds each side, - * so at any time two ASCONF may be in-transit on any given - * association (one sent from each endpoint). - * - * [This is our one-and-only-one ASCONF in flight. If we do - * not have an ASCONF in flight, this is NULL.] - */ - struct sctp_chunk *addip_last_asconf; - - /* ADDIP Section 5.2 Upon reception of an ASCONF Chunk. - * - * This is needed to implement itmes E1 - E4 of the updated - * spec. Here is the justification: - * - * Since the peer may bundle multiple ASCONF chunks toward us, - * we now need the ability to cache multiple ACKs. The section - * describes in detail how they are cached and cleaned up. - */ - struct list_head asconf_ack_list; - - /* These ASCONF chunks are waiting to be sent. - * - * These chunaks can't be pushed to outqueue until receiving - * ASCONF_ACK for the previous ASCONF indicated by - * addip_last_asconf, so as to guarantee that only one ASCONF - * is in flight at any time. - * - * ADDIP Section 4.1.1 Congestion Control of ASCONF Chunks - * - * In defining the ASCONF Chunk transfer procedures, it is - * essential that these transfers MUST NOT cause congestion - * within the network. To achieve this, we place these - * restrictions on the transfer of ASCONF Chunks: - * - * R1) One and only one ASCONF Chunk MAY be in transit and - * unacknowledged at any one time. If a sender, after sending - * an ASCONF chunk, decides it needs to transfer another - * ASCONF Chunk, it MUST wait until the ASCONF-ACK Chunk - * returns from the previous ASCONF Chunk before sending a - * subsequent ASCONF. Note this restriction binds each side, - * so at any time two ASCONF may be in-transit on any given - * association (one sent from each endpoint). - * - * - * [I really think this is EXACTLY the sort of intelligence - * which already resides in sctp_outq. Please move this - * queue and its supporting logic down there. --piggy] - */ - struct list_head addip_chunk_list; - - /* ADDIP Section 4.1 ASCONF Chunk Procedures - * - * A2) A serial number should be assigned to the Chunk. The - * serial number SHOULD be a monotonically increasing - * number. The serial number SHOULD be initialized at - * the start of the association to the same value as the - * Initial TSN and every time a new ASCONF chunk is created - * it is incremented by one after assigning the serial number - * to the newly created chunk. - * - * ADDIP - * 3.1.1 Address/Stream Configuration Change Chunk (ASCONF) - * - * Serial Number : 32 bits (unsigned integer) - * - * This value represents a Serial Number for the ASCONF - * Chunk. The valid range of Serial Number is from 0 to - * 4294967295 (2^32 - 1). Serial Numbers wrap back to 0 - * after reaching 4294967295. - */ - __u32 addip_serial; - - /* SCTP AUTH: list of the endpoint shared keys. These - * keys are provided out of band by the user applicaton - * and can't change during the lifetime of the association - */ - struct list_head endpoint_shared_keys; - - /* SCTP AUTH: - * The current generated assocaition shared key (secret) - */ - struct sctp_auth_bytes *asoc_shared_key; - - /* SCTP AUTH: hmac id of the first peer requested algorithm - * that we support. - */ - __u16 default_hmac_id; - - __u16 active_key_id; - - /* Need to send an ECNE Chunk? */ - char need_ecne; - - /* Is it a temporary association? */ - char temp; -}; - - -/* An eyecatcher for determining if we are really looking at an - * association data structure. - */ -enum { - SCTP_ASSOC_EYECATCHER = 0xa550c123, -}; - -/* Recover the outter association structure. */ -static inline struct sctp_association *sctp_assoc(struct sctp_ep_common *base) -{ - struct sctp_association *asoc; - - asoc = container_of(base, struct sctp_association, base); - return asoc; -} - -/* These are function signatures for manipulating associations. */ - - -struct sctp_association * -sctp_association_new(const struct sctp_endpoint *, const struct sock *, - sctp_scope_t scope, gfp_t gfp); -void sctp_association_free(struct sctp_association *); -void sctp_association_put(struct sctp_association *); -void sctp_association_hold(struct sctp_association *); - -struct sctp_transport *sctp_assoc_choose_init_transport( - struct sctp_association *); -struct sctp_transport *sctp_assoc_choose_shutdown_transport( - struct sctp_association *); -void sctp_assoc_update_retran_path(struct sctp_association *); -struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *, - const union sctp_addr *); -int sctp_assoc_lookup_laddr(struct sctp_association *asoc, - const union sctp_addr *laddr); -struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, - const union sctp_addr *address, - const gfp_t gfp, - const int peer_state); -void sctp_assoc_del_peer(struct sctp_association *asoc, - const union sctp_addr *addr); -void sctp_assoc_rm_peer(struct sctp_association *asoc, - struct sctp_transport *peer); -void sctp_assoc_control_transport(struct sctp_association *, - struct sctp_transport *, - sctp_transport_cmd_t, sctp_sn_error_t); -struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); -struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, - const union sctp_addr *, - const union sctp_addr *); -void sctp_assoc_migrate(struct sctp_association *, struct sock *); -void sctp_assoc_update(struct sctp_association *old, - struct sctp_association *new); - -__u32 sctp_association_get_next_tsn(struct sctp_association *); - -void sctp_assoc_sync_pmtu(struct sctp_association *); -void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned); -void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); -void sctp_assoc_set_primary(struct sctp_association *, - struct sctp_transport *); -void sctp_assoc_del_nonprimary_peers(struct sctp_association *, - struct sctp_transport *); -int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, - gfp_t); -int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, - struct sctp_cookie*, - gfp_t gfp); -int sctp_assoc_set_id(struct sctp_association *, gfp_t); -void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc); -struct sctp_chunk *sctp_assoc_lookup_asconf_ack( - const struct sctp_association *asoc, - __be32 serial); - - -int sctp_cmp_addr_exact(const union sctp_addr *ss1, - const union sctp_addr *ss2); -struct sctp_chunk *sctp_get_ecne_prepend(struct sctp_association *asoc); - -/* A convenience structure to parse out SCTP specific CMSGs. */ -typedef struct sctp_cmsgs { - struct sctp_initmsg *init; - struct sctp_sndrcvinfo *info; -} sctp_cmsgs_t; - -/* Structure for tracking memory objects */ -typedef struct { - char *label; - atomic_t *counter; -} sctp_dbg_objcnt_entry_t; - -#endif /* __sctp_structs_h__ */ diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/tsnmap.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/tsnmap.h.svn-base deleted file mode 100644 index 4aabc5a9..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/tsnmap.h.svn-base +++ /dev/null @@ -1,178 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001 Intel Corp. - * - * This file is part of the SCTP kernel implementation - * - * These are the definitions needed for the tsnmap type. The tsnmap is used - * to track out of order TSNs received. - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * Jon Grimm <jgrimm@us.ibm.com> - * La Monte H.P. Yarroll <piggy@acm.org> - * Karl Knutson <karl@athena.chicago.il.us> - * Sridhar Samudrala <sri@us.ibm.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ -#include <net/sctp/constants.h> - -#ifndef __sctp_tsnmap_h__ -#define __sctp_tsnmap_h__ - -/* RFC 2960 12.2 Parameters necessary per association (i.e. the TCB) - * Mapping An array of bits or bytes indicating which out of - * Array order TSN's have been received (relative to the - * Last Rcvd TSN). If no gaps exist, i.e. no out of - * order packets have been received, this array - * will be set to all zero. This structure may be - * in the form of a circular buffer or bit array. - */ -struct sctp_tsnmap { - /* This array counts the number of chunks with each TSN. - * It points at one of the two buffers with which we will - * ping-pong between. - */ - unsigned long *tsn_map; - - /* This is the TSN at tsn_map[0]. */ - __u32 base_tsn; - - /* Last Rcvd : This is the last TSN received in - * TSN : sequence. This value is set initially by - * : taking the peer's Initial TSN, received in - * : the INIT or INIT ACK chunk, and subtracting - * : one from it. - * - * Throughout most of the specification this is called the - * "Cumulative TSN ACK Point". In this case, we - * ignore the advice in 12.2 in favour of the term - * used in the bulk of the text. - */ - __u32 cumulative_tsn_ack_point; - - /* This is the highest TSN we've marked. */ - __u32 max_tsn_seen; - - /* This is the minimum number of TSNs we can track. This corresponds - * to the size of tsn_map. Note: the overflow_map allows us to - * potentially track more than this quantity. - */ - __u16 len; - - /* Data chunks pending receipt. used by SCTP_STATUS sockopt */ - __u16 pending_data; - - /* Record duplicate TSNs here. We clear this after - * every SACK. Store up to SCTP_MAX_DUP_TSNS worth of - * information. - */ - __u16 num_dup_tsns; - __be32 dup_tsns[SCTP_MAX_DUP_TSNS]; -}; - -struct sctp_tsnmap_iter { - __u32 start; -}; - -/* Initialize a block of memory as a tsnmap. */ -struct sctp_tsnmap *sctp_tsnmap_init(struct sctp_tsnmap *, __u16 len, - __u32 initial_tsn, gfp_t gfp); - -void sctp_tsnmap_free(struct sctp_tsnmap *map); - -/* Test the tracking state of this TSN. - * Returns: - * 0 if the TSN has not yet been seen - * >0 if the TSN has been seen (duplicate) - * <0 if the TSN is invalid (too large to track) - */ -int sctp_tsnmap_check(const struct sctp_tsnmap *, __u32 tsn); - -/* Mark this TSN as seen. */ -int sctp_tsnmap_mark(struct sctp_tsnmap *, __u32 tsn); - -/* Mark this TSN and all lower as seen. */ -void sctp_tsnmap_skip(struct sctp_tsnmap *map, __u32 tsn); - -/* Retrieve the Cumulative TSN ACK Point. */ -static inline __u32 sctp_tsnmap_get_ctsn(const struct sctp_tsnmap *map) -{ - return map->cumulative_tsn_ack_point; -} - -/* Retrieve the highest TSN we've seen. */ -static inline __u32 sctp_tsnmap_get_max_tsn_seen(const struct sctp_tsnmap *map) -{ - return map->max_tsn_seen; -} - -/* How many duplicate TSNs are stored? */ -static inline __u16 sctp_tsnmap_num_dups(struct sctp_tsnmap *map) -{ - return map->num_dup_tsns; -} - -/* Return pointer to duplicate tsn array as needed by SACK. */ -static inline __be32 *sctp_tsnmap_get_dups(struct sctp_tsnmap *map) -{ - map->num_dup_tsns = 0; - return map->dup_tsns; -} - -/* How many gap ack blocks do we have recorded? */ -__u16 sctp_tsnmap_num_gabs(struct sctp_tsnmap *map, - struct sctp_gap_ack_block *gabs); - -/* Refresh the count on pending data. */ -__u16 sctp_tsnmap_pending(struct sctp_tsnmap *map); - -/* Is there a gap in the TSN map? */ -static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) -{ - return (map->cumulative_tsn_ack_point != map->max_tsn_seen); -} - -/* Mark a duplicate TSN. Note: limit the storage of duplicate TSN - * information. - */ -static inline void sctp_tsnmap_mark_dup(struct sctp_tsnmap *map, __u32 tsn) -{ - if (map->num_dup_tsns < SCTP_MAX_DUP_TSNS) - map->dup_tsns[map->num_dup_tsns++] = htonl(tsn); -} - -/* Renege a TSN that was seen. */ -void sctp_tsnmap_renege(struct sctp_tsnmap *, __u32 tsn); - -/* Is there a gap in the TSN map? */ -int sctp_tsnmap_has_gap(const struct sctp_tsnmap *); - -#endif /* __sctp_tsnmap_h__ */ diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/ulpevent.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/ulpevent.h.svn-base deleted file mode 100644 index 7ea12e8e..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/ulpevent.h.svn-base +++ /dev/null @@ -1,168 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001 Intel Corp. - * Copyright (c) 2001 Nokia, Inc. - * Copyright (c) 2001 La Monte H.P. Yarroll - * - * 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. - * - * This file is part of the SCTP kernel implementation - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * Jon Grimm <jgrimm@us.ibm.com> - * La Monte H.P. Yarroll <piggy@acm.org> - * Karl Knutson <karl@athena.chicago.il.us> - * Sridhar Samudrala <sri@us.ibm.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __sctp_ulpevent_h__ -#define __sctp_ulpevent_h__ - -/* A structure to carry information to the ULP (e.g. Sockets API) */ -/* Warning: This sits inside an skb.cb[] area. Be very careful of - * growing this structure as it is at the maximum limit now. - */ -struct sctp_ulpevent { - struct sctp_association *asoc; - __u16 stream; - __u16 ssn; - __u16 flags; - __u32 ppid; - __u32 tsn; - __u32 cumtsn; - int msg_flags; - int iif; - unsigned int rmem_len; -}; - -/* Retrieve the skb this event sits inside of. */ -static inline struct sk_buff *sctp_event2skb(const 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; -} - -void sctp_ulpevent_free(struct sctp_ulpevent *); -int sctp_ulpevent_is_notification(const struct sctp_ulpevent *); -void sctp_queue_purge_ulpevents(struct sk_buff_head *list); - -struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( - const struct sctp_association *asoc, - __u16 flags, - __u16 state, - __u16 error, - __u16 outbound, - __u16 inbound, - struct sctp_chunk *chunk, - gfp_t gfp); - -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, - gfp_t gfp); - -struct sctp_ulpevent *sctp_ulpevent_make_remote_error( - const struct sctp_association *asoc, - struct sctp_chunk *chunk, - __u16 flags, - gfp_t gfp); -struct sctp_ulpevent *sctp_ulpevent_make_send_failed( - const struct sctp_association *asoc, - struct sctp_chunk *chunk, - __u16 flags, - __u32 error, - gfp_t gfp); - -struct sctp_ulpevent *sctp_ulpevent_make_shutdown_event( - const struct sctp_association *asoc, - __u16 flags, - gfp_t gfp); - -struct sctp_ulpevent *sctp_ulpevent_make_pdapi( - const struct sctp_association *asoc, - __u32 indication, gfp_t gfp); - -struct sctp_ulpevent *sctp_ulpevent_make_adaptation_indication( - const struct sctp_association *asoc, gfp_t gfp); - -struct sctp_ulpevent *sctp_ulpevent_make_rcvmsg(struct sctp_association *asoc, - struct sctp_chunk *chunk, - gfp_t gfp); - -struct sctp_ulpevent *sctp_ulpevent_make_authkey( - const struct sctp_association *asoc, __u16 key_id, - __u32 indication, gfp_t gfp); - -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 struct sctp_ulpevent *event, - struct sctp_event_subscribe *mask) -{ - __u16 sn_type; - int enabled = 1; - - if (sctp_ulpevent_is_notification(event)) { - sn_type = sctp_ulpevent_get_notification_type(event); - enabled = sctp_ulpevent_type_enabled(sn_type, mask); - } - return enabled; -} - -#endif /* __sctp_ulpevent_h__ */ - - - - - - - diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/ulpqueue.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/ulpqueue.h.svn-base deleted file mode 100644 index 2e5ee0d8..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/ulpqueue.h.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2001 Intel Corp. - * Copyright (c) 2001 Nokia, Inc. - * Copyright (c) 2001 La Monte H.P. Yarroll - * - * These are the definitions needed for the sctp_ulpq type. The - * sctp_ulpq is the interface between the Upper Layer Protocol, or ULP, - * and the core SCTP state machine. This is the component which handles - * reassembly and ordering. - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email addresses: - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * Jon Grimm <jgrimm@us.ibm.com> - * La Monte H.P. Yarroll <piggy@acm.org> - * Sridhar Samudrala <sri@us.ibm.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __sctp_ulpqueue_h__ -#define __sctp_ulpqueue_h__ - -/* A structure to carry information to the ULP (e.g. Sockets API) */ -struct sctp_ulpq { - char malloced; - char pd_mode; - struct sctp_association *asoc; - struct sk_buff_head reasm; - struct sk_buff_head lobby; -}; - -/* Prototypes. */ -struct sctp_ulpq *sctp_ulpq_init(struct sctp_ulpq *, - struct sctp_association *); -void sctp_ulpq_flush(struct sctp_ulpq *ulpq); -void sctp_ulpq_free(struct sctp_ulpq *); - -/* Add a new DATA chunk for processing. */ -int sctp_ulpq_tail_data(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); - -/* Add a new event for propagation to the ULP. */ -int sctp_ulpq_tail_event(struct sctp_ulpq *, struct sctp_ulpevent *ev); - -/* Renege previously received chunks. */ -void sctp_ulpq_renege(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); - -/* Perform partial delivery. */ -void sctp_ulpq_partial_delivery(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); - -/* Abort the partial delivery. */ -void sctp_ulpq_abort_pd(struct sctp_ulpq *, gfp_t); - -/* Clear the partial data delivery condition on this socket. */ -int sctp_clear_pd(struct sock *sk, struct sctp_association *asoc); - -/* Skip over an SSN. */ -void sctp_ulpq_skip(struct sctp_ulpq *ulpq, __u16 sid, __u16 ssn); - -void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *, __u32); -#endif /* __sctp_ulpqueue_h__ */ - - - - - - - diff --git a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/user.h.svn-base b/libdde_linux26/contrib/include/net/sctp/.svn/text-base/user.h.svn-base deleted file mode 100644 index b259fc57..00000000 --- a/libdde_linux26/contrib/include/net/sctp/.svn/text-base/user.h.svn-base +++ /dev/null @@ -1,761 +0,0 @@ -/* SCTP kernel implementation - * (C) Copyright IBM Corp. 2001, 2004 - * Copyright (c) 1999-2000 Cisco, Inc. - * Copyright (c) 1999-2001 Motorola, Inc. - * Copyright (c) 2002 Intel Corp. - * - * This file is part of the SCTP kernel implementation - * - * This header represents the structures and constants needed to support - * the SCTP Extension to the Sockets API. - * - * This SCTP 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. - * - * This SCTP 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. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers <lksctp-developers@lists.sourceforge.net> - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * Written or modified by: - * La Monte H.P. Yarroll <piggy@acm.org> - * R. Stewart <randall@sctp.chicago.il.us> - * K. Morneau <kmorneau@cisco.com> - * Q. Xie <qxie1@email.mot.com> - * Karl Knutson <karl@athena.chicago.il.us> - * Jon Grimm <jgrimm@us.ibm.com> - * Daisy Chang <daisyc@us.ibm.com> - * Ryan Layer <rmlayer@us.ibm.com> - * Ardelle Fan <ardelle.fan@intel.com> - * Sridhar Samudrala <sri@us.ibm.com> - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - */ - -#ifndef __net_sctp_user_h__ -#define __net_sctp_user_h__ - -#include <linux/types.h> -#include <linux/socket.h> - -typedef __s32 sctp_assoc_t; - -/* The following symbols come from the Sockets API Extensions for - * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. - */ -enum sctp_optname { - SCTP_RTOINFO, -#define SCTP_RTOINFO SCTP_RTOINFO - SCTP_ASSOCINFO, -#define SCTP_ASSOCINFO SCTP_ASSOCINFO - SCTP_INITMSG, -#define SCTP_INITMSG SCTP_INITMSG - SCTP_NODELAY, /* Get/set nodelay option. */ -#define SCTP_NODELAY SCTP_NODELAY - SCTP_AUTOCLOSE, -#define SCTP_AUTOCLOSE SCTP_AUTOCLOSE - SCTP_SET_PEER_PRIMARY_ADDR, -#define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR - SCTP_PRIMARY_ADDR, -#define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR - SCTP_ADAPTATION_LAYER, -#define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER - SCTP_DISABLE_FRAGMENTS, -#define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS - SCTP_PEER_ADDR_PARAMS, -#define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS - SCTP_DEFAULT_SEND_PARAM, -#define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM - SCTP_EVENTS, -#define SCTP_EVENTS SCTP_EVENTS - SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */ -#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR - SCTP_MAXSEG, /* Get/set maximum fragment. */ -#define SCTP_MAXSEG SCTP_MAXSEG - SCTP_STATUS, -#define SCTP_STATUS SCTP_STATUS - SCTP_GET_PEER_ADDR_INFO, -#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO - SCTP_DELAYED_ACK, -#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK -#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK - SCTP_CONTEXT, /* Receive Context */ -#define SCTP_CONTEXT SCTP_CONTEXT - SCTP_FRAGMENT_INTERLEAVE, -#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE - SCTP_PARTIAL_DELIVERY_POINT, /* Set/Get partial delivery point */ -#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT - SCTP_MAX_BURST, /* Set/Get max burst */ -#define SCTP_MAX_BURST SCTP_MAX_BURST - SCTP_AUTH_CHUNK, /* Set only: add a chunk type to authenticat */ -#define SCTP_AUTH_CHUNK SCTP_AUTH_CHUNK - SCTP_HMAC_IDENT, -#define SCTP_HMAC_IDENT SCTP_HMAC_IDENT - SCTP_AUTH_KEY, -#define SCTP_AUTH_KEY SCTP_AUTH_KEY - SCTP_AUTH_ACTIVE_KEY, -#define SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY - SCTP_AUTH_DELETE_KEY, -#define SCTP_AUTH_DELETE_KEY SCTP_AUTH_DELETE_KEY - SCTP_PEER_AUTH_CHUNKS, /* Read only */ -#define SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS - SCTP_LOCAL_AUTH_CHUNKS, /* Read only */ -#define SCTP_LOCAL_AUTH_CHUNKS SCTP_LOCAL_AUTH_CHUNKS - SCTP_GET_ASSOC_NUMBER, /* Read only */ -#define SCTP_GET_ASSOC_NUMBER SCTP_GET_ASSOC_NUMBER - - - /* Internal Socket Options. Some of the sctp library functions are - * implemented using these socket options. - */ - SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */ -#define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD - SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */ -#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM - SCTP_SOCKOPT_PEELOFF, /* peel off association. */ -#define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF - SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */ -#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD - SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */ -#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD - SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */ -#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD - SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */ -#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD - SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */ -#define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD - SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */ -#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS - SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ -#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS - SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ -#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX -}; - -/* - * 5.2.1 SCTP Initiation Structure (SCTP_INIT) - * - * This cmsghdr structure provides information for initializing new - * SCTP associations with sendmsg(). The SCTP_INITMSG socket option - * uses this same data structure. This structure is not used for - * recvmsg(). - * - * cmsg_level cmsg_type cmsg_data[] - * ------------ ------------ ---------------------- - * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg - * - */ -struct sctp_initmsg { - __u16 sinit_num_ostreams; - __u16 sinit_max_instreams; - __u16 sinit_max_attempts; - __u16 sinit_max_init_timeo; -}; - -/* - * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) - * - * This cmsghdr structure specifies SCTP options for sendmsg() and - * describes SCTP header information about a received message through - * recvmsg(). - * - * cmsg_level cmsg_type cmsg_data[] - * ------------ ------------ ---------------------- - * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo - * - */ -struct sctp_sndrcvinfo { - __u16 sinfo_stream; - __u16 sinfo_ssn; - __u16 sinfo_flags; - __u32 sinfo_ppid; - __u32 sinfo_context; - __u32 sinfo_timetolive; - __u32 sinfo_tsn; - __u32 sinfo_cumtsn; - sctp_assoc_t sinfo_assoc_id; -}; - -/* - * sinfo_flags: 16 bits (unsigned integer) - * - * This field may contain any of the following flags and is composed of - * a bitwise OR of these values. - */ - -enum sctp_sinfo_flags { - SCTP_UNORDERED = 1, /* Send/receive message unordered. */ - SCTP_ADDR_OVER = 2, /* Override the primary destination. */ - SCTP_ABORT=4, /* Send an ABORT message to the peer. */ - SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ -}; - - -typedef union { - __u8 raw; - struct sctp_initmsg init; - struct sctp_sndrcvinfo sndrcv; -} sctp_cmsg_data_t; - -/* These are cmsg_types. */ -typedef enum sctp_cmsg_type { - SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ - SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ -} sctp_cmsg_t; - - -/* - * 5.3.1.1 SCTP_ASSOC_CHANGE - * - * Communication notifications inform the ULP that an SCTP association - * has either begun or ended. The identifier for a new association is - * provided by this notificaion. The notification information has the - * following format: - * - */ -struct sctp_assoc_change { - __u16 sac_type; - __u16 sac_flags; - __u32 sac_length; - __u16 sac_state; - __u16 sac_error; - __u16 sac_outbound_streams; - __u16 sac_inbound_streams; - sctp_assoc_t sac_assoc_id; - __u8 sac_info[0]; -}; - -/* - * sac_state: 32 bits (signed integer) - * - * This field holds one of a number of values that communicate the - * event that happened to the association. They include: - * - * Note: The following state names deviate from the API draft as - * the names clash too easily with other kernel symbols. - */ -enum sctp_sac_state { - SCTP_COMM_UP, - SCTP_COMM_LOST, - SCTP_RESTART, - SCTP_SHUTDOWN_COMP, - SCTP_CANT_STR_ASSOC, -}; - -/* - * 5.3.1.2 SCTP_PEER_ADDR_CHANGE - * - * When a destination address on a multi-homed peer encounters a change - * an interface details event is sent. The information has the - * following structure: - */ -struct sctp_paddr_change { - __u16 spc_type; - __u16 spc_flags; - __u32 spc_length; - struct sockaddr_storage spc_aaddr; - int spc_state; - int spc_error; - sctp_assoc_t spc_assoc_id; -} __attribute__((packed, aligned(4))); - -/* - * spc_state: 32 bits (signed integer) - * - * This field holds one of a number of values that communicate the - * event that happened to the address. They include: - */ -enum sctp_spc_state { - SCTP_ADDR_AVAILABLE, - SCTP_ADDR_UNREACHABLE, - SCTP_ADDR_REMOVED, - SCTP_ADDR_ADDED, - SCTP_ADDR_MADE_PRIM, - SCTP_ADDR_CONFIRMED, -}; - - -/* - * 5.3.1.3 SCTP_REMOTE_ERROR - * - * A remote peer may send an Operational Error message to its peer. - * This message indicates a variety of error conditions on an - * association. The entire error TLV as it appears on the wire is - * included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP - * specification [SCTP] and any extensions for a list of possible - * error formats. SCTP error TLVs have the format: - */ -struct sctp_remote_error { - __u16 sre_type; - __u16 sre_flags; - __u32 sre_length; - __u16 sre_error; - sctp_assoc_t sre_assoc_id; - __u8 sre_data[0]; -}; - - -/* - * 5.3.1.4 SCTP_SEND_FAILED - * - * If SCTP cannot deliver a message it may return the message as a - * notification. - */ -struct sctp_send_failed { - __u16 ssf_type; - __u16 ssf_flags; - __u32 ssf_length; - __u32 ssf_error; - struct sctp_sndrcvinfo ssf_info; - sctp_assoc_t ssf_assoc_id; - __u8 ssf_data[0]; -}; - -/* - * ssf_flags: 16 bits (unsigned integer) - * - * The flag value will take one of the following values - * - * SCTP_DATA_UNSENT - Indicates that the data was never put on - * the wire. - * - * SCTP_DATA_SENT - Indicates that the data was put on the wire. - * Note that this does not necessarily mean that the - * data was (or was not) successfully delivered. - */ -enum sctp_ssf_flags { - SCTP_DATA_UNSENT, - SCTP_DATA_SENT, -}; - -/* - * 5.3.1.5 SCTP_SHUTDOWN_EVENT - * - * When a peer sends a SHUTDOWN, SCTP delivers this notification to - * inform the application that it should cease sending data. - */ -struct sctp_shutdown_event { - __u16 sse_type; - __u16 sse_flags; - __u32 sse_length; - sctp_assoc_t sse_assoc_id; -}; - -/* - * 5.3.1.6 SCTP_ADAPTATION_INDICATION - * - * When a peer sends a Adaptation Layer Indication parameter , SCTP - * delivers this notification to inform the application - * that of the peers requested adaptation layer. - */ -struct sctp_adaptation_event { - __u16 sai_type; - __u16 sai_flags; - __u32 sai_length; - __u32 sai_adaptation_ind; - sctp_assoc_t sai_assoc_id; -}; - -/* - * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT - * - * When a receiver is engaged in a partial delivery of a - * message this notification will be used to indicate - * various events. - */ -struct sctp_pdapi_event { - __u16 pdapi_type; - __u16 pdapi_flags; - __u32 pdapi_length; - __u32 pdapi_indication; - sctp_assoc_t pdapi_assoc_id; -}; - -enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; - -struct sctp_authkey_event { - __u16 auth_type; - __u16 auth_flags; - __u32 auth_length; - __u16 auth_keynumber; - __u16 auth_altkeynumber; - __u32 auth_indication; - sctp_assoc_t auth_assoc_id; -}; - -enum { SCTP_AUTH_NEWKEY = 0, }; - - -/* - * Described in Section 7.3 - * Ancillary Data and Notification Interest Options - */ -struct sctp_event_subscribe { - __u8 sctp_data_io_event; - __u8 sctp_association_event; - __u8 sctp_address_event; - __u8 sctp_send_failure_event; - __u8 sctp_peer_error_event; - __u8 sctp_shutdown_event; - __u8 sctp_partial_delivery_event; - __u8 sctp_adaptation_layer_event; - __u8 sctp_authentication_event; -}; - -/* - * 5.3.1 SCTP Notification Structure - * - * The notification structure is defined as the union of all - * notification types. - * - */ -union sctp_notification { - struct { - __u16 sn_type; /* Notification type. */ - __u16 sn_flags; - __u32 sn_length; - } sn_header; - struct sctp_assoc_change sn_assoc_change; - struct sctp_paddr_change sn_paddr_change; - struct sctp_remote_error sn_remote_error; - struct sctp_send_failed sn_send_failed; - struct sctp_shutdown_event sn_shutdown_event; - struct sctp_adaptation_event sn_adaptation_event; - struct sctp_pdapi_event sn_pdapi_event; - struct sctp_authkey_event sn_authkey_event; -}; - -/* Section 5.3.1 - * All standard values for sn_type flags are greater than 2^15. - * Values from 2^15 and down are reserved. - */ - -enum sctp_sn_type { - SCTP_SN_TYPE_BASE = (1<<15), - SCTP_ASSOC_CHANGE, - SCTP_PEER_ADDR_CHANGE, - SCTP_SEND_FAILED, - SCTP_REMOTE_ERROR, - SCTP_SHUTDOWN_EVENT, - SCTP_PARTIAL_DELIVERY_EVENT, - SCTP_ADAPTATION_INDICATION, - SCTP_AUTHENTICATION_INDICATION, -}; - -/* Notification error codes used to fill up the error fields in some - * notifications. - * SCTP_PEER_ADDRESS_CHAGE : spc_error - * SCTP_ASSOC_CHANGE : sac_error - * These names should be potentially included in the draft 04 of the SCTP - * sockets API specification. - */ -typedef enum sctp_sn_error { - SCTP_FAILED_THRESHOLD, - SCTP_RECEIVED_SACK, - SCTP_HEARTBEAT_SUCCESS, - SCTP_RESPONSE_TO_USER_REQ, - SCTP_INTERNAL_ERROR, - SCTP_SHUTDOWN_GUARD_EXPIRES, - SCTP_PEER_FAULTY, -} sctp_sn_error_t; - -/* - * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) - * - * The protocol parameters used to initialize and bound retransmission - * timeout (RTO) are tunable. See [SCTP] for more information on how - * these parameters are used in RTO calculation. - */ -struct sctp_rtoinfo { - sctp_assoc_t srto_assoc_id; - __u32 srto_initial; - __u32 srto_max; - __u32 srto_min; -}; - -/* - * 7.1.2 Association Parameters (SCTP_ASSOCINFO) - * - * This option is used to both examine and set various association and - * endpoint parameters. - */ -struct sctp_assocparams { - sctp_assoc_t sasoc_assoc_id; - __u16 sasoc_asocmaxrxt; - __u16 sasoc_number_peer_destinations; - __u32 sasoc_peer_rwnd; - __u32 sasoc_local_rwnd; - __u32 sasoc_cookie_life; -}; - -/* - * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) - * - * Requests that the peer mark the enclosed address as the association - * primary. The enclosed address must be one of the association's - * locally bound addresses. The following structure is used to make a - * set primary request: - */ -struct sctp_setpeerprim { - sctp_assoc_t sspp_assoc_id; - struct sockaddr_storage sspp_addr; -} __attribute__((packed, aligned(4))); - -/* - * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) - * - * Requests that the local SCTP stack use the enclosed peer address as - * the association primary. The enclosed address must be one of the - * association peer's addresses. The following structure is used to - * make a set peer primary request: - */ -struct sctp_prim { - sctp_assoc_t ssp_assoc_id; - struct sockaddr_storage ssp_addr; -} __attribute__((packed, aligned(4))); - -/* - * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) - * - * Requests that the local endpoint set the specified Adaptation Layer - * Indication parameter for all future INIT and INIT-ACK exchanges. - */ -struct sctp_setadaptation { - __u32 ssb_adaptation_ind; -}; - -/* - * 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) - * - * Applications can enable or disable heartbeats for any peer address - * of an association, modify an address's heartbeat interval, force a - * heartbeat to be sent immediately, and adjust the address's maximum - * number of retransmissions sent before an address is considered - * unreachable. The following structure is used to access and modify an - * address's parameters: - */ -enum sctp_spp_flags { - SPP_HB_ENABLE = 1<<0, /*Enable heartbeats*/ - SPP_HB_DISABLE = 1<<1, /*Disable heartbeats*/ - SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, - SPP_HB_DEMAND = 1<<2, /*Send heartbeat immediately*/ - SPP_PMTUD_ENABLE = 1<<3, /*Enable PMTU discovery*/ - SPP_PMTUD_DISABLE = 1<<4, /*Disable PMTU discovery*/ - SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, - SPP_SACKDELAY_ENABLE = 1<<5, /*Enable SACK*/ - SPP_SACKDELAY_DISABLE = 1<<6, /*Disable SACK*/ - SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, - SPP_HB_TIME_IS_ZERO = 1<<7, /* Set HB delay to 0 */ -}; - -struct sctp_paddrparams { - sctp_assoc_t spp_assoc_id; - struct sockaddr_storage spp_address; - __u32 spp_hbinterval; - __u16 spp_pathmaxrxt; - __u32 spp_pathmtu; - __u32 spp_sackdelay; - __u32 spp_flags; -} __attribute__((packed, aligned(4))); - -/* - * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK) - * - * This set option adds a chunk type that the user is requesting to be - * received only in an authenticated way. Changes to the list of chunks - * will only effect future associations on the socket. - */ -struct sctp_authchunk { - __u8 sauth_chunk; -}; - -/* - * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT) - * - * This option gets or sets the list of HMAC algorithms that the local - * endpoint requires the peer to use. -*/ -struct sctp_hmacalgo { - __u32 shmac_num_idents; - __u16 shmac_idents[]; -}; - -/* - * 7.1.20. Set a shared key (SCTP_AUTH_KEY) - * - * This option will set a shared secret key which is used to build an - * association shared key. - */ -struct sctp_authkey { - sctp_assoc_t sca_assoc_id; - __u16 sca_keynumber; - __u16 sca_keylength; - __u8 sca_key[]; -}; - -/* - * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY) - * - * This option will get or set the active shared key to be used to build - * the association shared key. - */ - -struct sctp_authkeyid { - sctp_assoc_t scact_assoc_id; - __u16 scact_keynumber; -}; - - -/* - * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK) - * - * This option will effect the way delayed acks are performed. This - * option allows you to get or set the delayed ack time, in - * milliseconds. It also allows changing the delayed ack frequency. - * Changing the frequency to 1 disables the delayed sack algorithm. If - * the assoc_id is 0, then this sets or gets the endpoints default - * values. If the assoc_id field is non-zero, then the set or get - * effects the specified association for the one to many model (the - * assoc_id field is ignored by the one to one model). Note that if - * sack_delay or sack_freq are 0 when setting this option, then the - * current values will remain unchanged. - */ -struct sctp_sack_info { - sctp_assoc_t sack_assoc_id; - uint32_t sack_delay; - uint32_t sack_freq; -}; - -struct sctp_assoc_value { - sctp_assoc_t assoc_id; - uint32_t assoc_value; -}; - -/* - * 7.2.2 Peer Address Information - * - * Applications can retrieve information about a specific peer address - * of an association, including its reachability state, congestion - * window, and retransmission timer values. This information is - * read-only. The following structure is used to access this - * information: - */ -struct sctp_paddrinfo { - sctp_assoc_t spinfo_assoc_id; - struct sockaddr_storage spinfo_address; - __s32 spinfo_state; - __u32 spinfo_cwnd; - __u32 spinfo_srtt; - __u32 spinfo_rto; - __u32 spinfo_mtu; -} __attribute__((packed, aligned(4))); - -/* Peer addresses's state. */ -/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x] - * calls. - * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters. - * Not yet confirmed by a heartbeat and not available for data - * transfers. - * ACTIVE : Peer address confirmed, active and available for data transfers. - * INACTIVE: Peer address inactive and not available for data transfers. - */ -enum sctp_spinfo_state { - SCTP_INACTIVE, - SCTP_ACTIVE, - SCTP_UNCONFIRMED, - SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */ -}; - -/* - * 7.2.1 Association Status (SCTP_STATUS) - * - * Applications can retrieve current status information about an - * association, including association state, peer receiver window size, - * number of unacked data chunks, and number of data chunks pending - * receipt. This information is read-only. The following structure is - * used to access this information: - */ -struct sctp_status { - sctp_assoc_t sstat_assoc_id; - __s32 sstat_state; - __u32 sstat_rwnd; - __u16 sstat_unackdata; - __u16 sstat_penddata; - __u16 sstat_instrms; - __u16 sstat_outstrms; - __u32 sstat_fragmentation_point; - struct sctp_paddrinfo sstat_primary; -}; - -/* - * 7.2.3. Get the list of chunks the peer requires to be authenticated - * (SCTP_PEER_AUTH_CHUNKS) - * - * This option gets a list of chunks for a specified association that - * the peer requires to be received authenticated only. - */ -struct sctp_authchunks { - sctp_assoc_t gauth_assoc_id; - __u32 gauth_number_of_chunks; - uint8_t gauth_chunks[]; -}; - -/* - * 8.3, 8.5 get all peer/local addresses in an association. - * This parameter struct is used by SCTP_GET_PEER_ADDRS and - * SCTP_GET_LOCAL_ADDRS socket options used internally to implement - * sctp_getpaddrs() and sctp_getladdrs() API. - */ -struct sctp_getaddrs_old { - sctp_assoc_t assoc_id; - int addr_num; - struct sockaddr __user *addrs; -}; -struct sctp_getaddrs { - sctp_assoc_t assoc_id; /*input*/ - __u32 addr_num; /*output*/ - __u8 addrs[0]; /*output, variable size*/ -}; - -/* These are bit fields for msghdr->msg_flags. See section 5.1. */ -/* On user space Linux, these live in <bits/socket.h> as an enum. */ -enum sctp_msg_flags { - MSG_NOTIFICATION = 0x8000, -#define MSG_NOTIFICATION MSG_NOTIFICATION -}; - -/* - * 8.1 sctp_bindx() - * - * The flags parameter is formed from the bitwise OR of zero or more of the - * following currently defined flags: - */ -#define SCTP_BINDX_ADD_ADDR 0x01 -#define SCTP_BINDX_REM_ADDR 0x02 - -/* This is the structure that is passed as an argument(optval) to - * getsockopt(SCTP_SOCKOPT_PEELOFF). - */ -typedef struct { - sctp_assoc_t associd; - int sd; -} sctp_peeloff_arg_t; - -#endif /* __net_sctp_user_h__ */ |
