Root/
1 | /* SCTP kernel implementation Copyright (C) 1999-2001 |
2 | * Cisco, Motorola, and IBM |
3 | * Copyright 2001 La Monte H.P. Yarroll |
4 | * |
5 | * This file is part of the SCTP kernel implementation |
6 | * |
7 | * These functions manipulate sctp command sequences. |
8 | * |
9 | * This SCTP implementation is free software; |
10 | * you can redistribute it and/or modify it under the terms of |
11 | * the GNU General Public License as published by |
12 | * the Free Software Foundation; either version 2, or (at your option) |
13 | * any later version. |
14 | * |
15 | * This SCTP implementation is distributed in the hope that it |
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
17 | * ************************ |
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
19 | * See the GNU General Public License for more details. |
20 | * |
21 | * You should have received a copy of the GNU General Public License |
22 | * along with GNU CC; see the file COPYING. If not, write to |
23 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
24 | * Boston, MA 02111-1307, USA. |
25 | * |
26 | * Please send any bug reports or fixes you make to the |
27 | * email address(es): |
28 | * lksctp developers <lksctp-developers@lists.sourceforge.net> |
29 | * |
30 | * Or submit a bug report through the following website: |
31 | * http://www.sf.net/projects/lksctp |
32 | * |
33 | * Written or modified by: |
34 | * La Monte H.P. Yarroll <piggy@acm.org> |
35 | * Karl Knutson <karl@athena.chicago.il.us> |
36 | * |
37 | * Any bugs reported given to us we will try to fix... any fixes shared will |
38 | * be incorporated into the next SCTP release. |
39 | */ |
40 | |
41 | #include <linux/types.h> |
42 | #include <net/sctp/sctp.h> |
43 | #include <net/sctp/sm.h> |
44 | |
45 | /* Initialize a block of memory as a command sequence. */ |
46 | int sctp_init_cmd_seq(sctp_cmd_seq_t *seq) |
47 | { |
48 | memset(seq, 0, sizeof(sctp_cmd_seq_t)); |
49 | return 1; /* We always succeed. */ |
50 | } |
51 | |
52 | /* Add a command to a sctp_cmd_seq_t. |
53 | * Return 0 if the command sequence is full. |
54 | */ |
55 | void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj) |
56 | { |
57 | BUG_ON(seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS); |
58 | |
59 | seq->cmds[seq->next_free_slot].verb = verb; |
60 | seq->cmds[seq->next_free_slot++].obj = obj; |
61 | } |
62 | |
63 | /* Return the next command structure in a sctp_cmd_seq. |
64 | * Returns NULL at the end of the sequence. |
65 | */ |
66 | sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq) |
67 | { |
68 | sctp_cmd_t *retval = NULL; |
69 | |
70 | if (seq->next_cmd < seq->next_free_slot) |
71 | retval = &seq->cmds[seq->next_cmd++]; |
72 | |
73 | return retval; |
74 | } |
75 | |
76 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9