linux/net/sctp/primitive.c
<<
>>
Prefs
   1/* SCTP kernel implementation
   2 * Copyright (c) 1999-2000 Cisco, Inc.
   3 * Copyright (c) 1999-2001 Motorola, Inc.
   4 *
   5 * This file is part of the SCTP kernel implementation
   6 *
   7 * These functions implement the SCTP primitive functions from Section 10.
   8 *
   9 * Note that the descriptions from the specification are USER level
  10 * functions--this file is the functions which populate the struct proto
  11 * for SCTP which is the BOTTOM of the sockets interface.
  12 *
  13 * This SCTP implementation is free software;
  14 * you can redistribute it and/or modify it under the terms of
  15 * the GNU General Public License as published by
  16 * the Free Software Foundation; either version 2, or (at your option)
  17 * any later version.
  18 *
  19 * This SCTP implementation is distributed in the hope that it
  20 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  21 *                 ************************
  22 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  23 * See the GNU General Public License for more details.
  24 *
  25 * You should have received a copy of the GNU General Public License
  26 * along with GNU CC; see the file COPYING.  If not, write to
  27 * the Free Software Foundation, 59 Temple Place - Suite 330,
  28 * Boston, MA 02111-1307, USA.
  29 *
  30 * Please send any bug reports or fixes you make to the
  31 * email address(es):
  32 *    lksctp developers <lksctp-developers@lists.sourceforge.net>
  33 *
  34 * Or submit a bug report through the following website:
  35 *    http://www.sf.net/projects/lksctp
  36 *
  37 * Written or modified by:
  38 *    La Monte H.P. Yarroll <piggy@acm.org>
  39 *    Narasimha Budihal     <narasimha@refcode.org>
  40 *    Karl Knutson          <karl@athena.chicago.il.us>
  41 *    Ardelle Fan           <ardelle.fan@intel.com>
  42 *    Kevin Gao             <kevin.gao@intel.com>
  43 *
  44 * Any bugs reported given to us we will try to fix... any fixes shared will
  45 * be incorporated into the next SCTP release.
  46 */
  47
  48#include <linux/types.h>
  49#include <linux/list.h> /* For struct list_head */
  50#include <linux/socket.h>
  51#include <linux/ip.h>
  52#include <linux/time.h> /* For struct timeval */
  53#include <linux/gfp.h>
  54#include <net/sock.h>
  55#include <net/sctp/sctp.h>
  56#include <net/sctp/sm.h>
  57
  58#define DECLARE_PRIMITIVE(name) \
  59/* This is called in the code as sctp_primitive_ ## name.  */ \
  60int sctp_primitive_ ## name(struct net *net, struct sctp_association *asoc, \
  61                            void *arg) { \
  62        int error = 0; \
  63        sctp_event_t event_type; sctp_subtype_t subtype; \
  64        sctp_state_t state; \
  65        struct sctp_endpoint *ep; \
  66        \
  67        event_type = SCTP_EVENT_T_PRIMITIVE; \
  68        subtype = SCTP_ST_PRIMITIVE(SCTP_PRIMITIVE_ ## name); \
  69        state = asoc ? asoc->state :   45v2.6.22.3"
	  >
  v2.6.22.3
  ="sref">SCTP_ST_PRIMITIVE(
      
TULL" > state : as71; \ arg72+1e"L45" class="line" name="ive.c#L62" id="L62" class="linet/sctp/primitive.c#Lan cmL65" class="line" naan cm 58#define name(struct asoc ?
< href="net/sctp/phref="+code=sctp_association" href="net/sctp/primitive.c#L66" id7ref="+co7e=error" class="sref">e7ror = 0; \ href="net/sctp/pGFP_KERNEL" > SCTP_PRIMITIVE_ #7ref="+co7e=subtype" class="sref"7subty7e; \ ss="line" name="ive.c#L62" id="L62" class="l class="sref">SCTP_PRIMITIVE_ #7sta7e}ass="sref">SCTP_PRIMITIVE_ #7 *76/a>> > 6SCTP_EVENT_T_P7IMITI7, * Please send7 nam7. struct <8 href8; * the Free Software8 *as8d * the Free Software Foundati8 *arg8; * the Free Software Foundati8ref="+co8e=error" class="sref">e8ror * the Free Software Foundati8ref="+co8e=subtype" class="sref"8subty8. sta8"> * oL1nme=10class="sref< oLaimitive.c#L24" id="L24" class="line" na8 *8e me="L65"mment"> * These functions implement the Same="L6"8> 6 * These functions implement the SSCTP primmitive functions from SeIMITI8, 10 * Any bugs reported given to us we8 nam8; altradisrefalv"line" nnd"L9"orspan class="comment"> * you can redistribu9E_CLo2pE9A)42/a> struct <9 href9; 45 * be9 *as9d linux/time.h> arg92/a>> e9ror > sta9"> * 58#define 96/a>> 6 * This file 9ame="L8">> 8nam9. * the Free Software Foundatio0unctions 0which populate the struc01hreERd * the Free Software Foundatio0 is the B0OTTOM of the sockets int02hreER. 0 12class="sref.imitilocally1queu" ius4">dataimitive.c#L24" id="L24" class="line" na10is SCTP i0mplementation is free so04hreER* class="srefin19="conl"> 15 * the GN0e it and/0or modify it under the t05hreER"> * 14pe4">acknow9" ges * the GN0U General0 Public License as publi06hreERe in19ref * you can redistribut0n; either0 version 2, or (at your 07hreER) in19=" namclass="sref eadingL11" aliailur", class=class="comment"> * you can redistribut0an class=0"comment"> * any later v08hreER, 17 0 18 58#define 12 * the Free Software Foundatiote it and//or modify it under the tterms1of * the Free Software FoundatiotU Generall Public License as publiished1by * the Free Software Foundatioon; eitherr version 2, or (at your opti1n) * the Free Software Foundatiopan class=="comment"> * any later vversi1n. 18 dataimitive.c#L24" id="L24" class="line" na1tation is1 distributed in the hope1 that1it * you can redistribut2 is the BOOTTOM of the sockets inteerfa1** class=class="comment"> * you can redistributLITY or F1ITNESS FOR A PARTICULAR 1PURPO1E. 17 1 24 58#define * Boston, MA 02111-13107, U1A. * will be useful, but WITHO1me="L29">1 29 * will be useful, but WITHO1munctions reports or fixes you mak1e to 1he ac#L31"id=yteic27"t [,lts" xt]"comment"> * the Free Software Foundati1pan class1="comment"> * email addr1ess(e1): * the Free Software Foundati1pe="L12"> 12flag] [,no-bundle>flag] [,payloadass="ccol-id] ="comment"> * the Free Software Foundatiome="L33">1 33 * the Free Software Foundatiobug repor1t through the following 1websi1e: * the Free Software FoundatiobU Generalttp://www.sf.net/project1s/lks1tp data via="lin"L17" class="line" name="L17"> 171 36 17 * Written or modi1fied 1y: 37 13 * Thie="L29">1 <narasimha@refcode1.org&1t; a45" cl"linealass="sref">3"> 13 * Thiunctions lt;karl@athena.chicago.i1l.us&1t; 3"> 13 * Thian class1 <ardelle.fan@intel1.com&1t; ac#L31" -i" cllocasrefm31"age>a45b > 15 * the GNo 1 <kevin.gao@intel1.com&1t; 13 * Thiis SCTP immplementation is free sofent"1 * 13 * Thiug repor1 to fix... any fixes sha1red w1ll sizedata 1" numberspad=ytes"L13"> 13 * ThiU Generalated into the next SCTP 1relea1e. 13 * Thie="L36">1 4614) 37linux/1types14; g4"> atsmitive.cc"lri" id="L59n class="comment"> * you can redistributee="L29">1ment">/* For struct list1_head15; e="L9"> a45" clULP ie" namtransL34"19ref * you can redistributeunctions .h" class="fref">linux/s1ocket15d M31"age>f 23 * See the GNU1lude/linu1x/ip.h" class="fref">lin1ux/ip15. /* For struct ti1meval15; imitive.c#L12" id="L12" class="line" nam is SCTP igfp.h" class="fref">linu1x/gfp15* 17net1/sock15: * the Free Software Foundatioctp/sctp.1h" class="fref">net/sctp1/sctp15p data./pri>us4">dataimitive.c#L24" id="L24" class="line" na1et/sctp/s1m.h" class="fref">net/sc1tp/sm15) ve.cs" clbyl"lineaft4"> 14lifeux/ti expiL31.imitiimitive.c#L24" id="L24" class="line" na1e#L47" id1="L57" class="line" name1="L5715: * you can redistributenux/type1f="+code=name" class="sr1ef">n1me) \ m31"age1.i"line"> e="e.c namULP ie" nam"ata ve."> ve.> 15 * the GNUe="L29">1s sctp_primitive_ ## nam1e. *16; *a16d * you can redistributd *ar16: data mitive.ce1rror<16. 17subt16* 13 * Th st16l 13 * Th U General Public License as publissctp16p me="L65"sa45L11" i0" id"ame="L13"> 13 * Th t/sctp/s1ass="line" name="L66"> 166 13 * Th #L47" id1ss="sref">SCTP_EVENT_T_P1RIMIT16: 13 * Th nux/type1="+code=name" class="sre1f">na16e) \ 17 struct <1a hre17* * will be useful, but WITHO1T *a17d flag -i" ass=lag,vefipL31sct, nnd"L9"esitive.c#L9us4"="comment"> * will be useful, but WITHO1T *ar17: * will be useful, but WITHO1Tref="+co17e=error" class="sref">e17ror<17. 17st17: * the Free Software Foundatio7 * >a45bundle>" assus4">data mith"comment"> * the Free Software Foundatio7n; either version 2, or (at your o6 0when"comment"> * the Free Software Foundatio7#L47" id17s="sref">SCTP_EVENT_T_P17IMIT17, 17na17. struct <18 hre18; atsis>a45b > 15 * the GN8 *a18d ar18; 17e18ror<18. > st18"> * 58#define > 6 13 * Th8 na18; 13 * Th9E_CLo2pE19A)42/a> struct <19 hre19; * the Free Software Foundatio9 *a19d * the Free Software Foundatio9 *ar19; * the Free Software Foundatio9ref="+co19e=error" class="sref">e19ror<19. * the Free Software Foundatio9ref="+co19e=subtype" class="sref"19subt19* me="L65"sa45peronclic HeartBea"coniine" name="ss="comment"> * will be useful, but WITHO19st19l * will be useful, but WITHO19 * * will be useful, but WITHO19ame="L6"19> 6 17 17 18na19. 37 37 a45" cl"linealass="sref">3"> 13 * T20 is the 20OTTOM of the sockets in202hre2R. 20 12 17 * > 58#define * any later 208hre2R, * the Free Software Foundati2ounctions2wwhich populate the stru2t1hre2to 2 12 * any later 2versi2n. 2 18 58#define pri>origifalvLXRne" name= byl namt; LXRnnet/un"tylxr@lne" .no lxr.lne" .no knndly host"L37"mt; Redpill Lne" c AS