/* SCTP kernel implementation Copyright (C) 1999-20011* Cisco, Motorola, and IBM2* Copyright 2001 La Monte H.P. Yarroll3*4* This file is part of the SCTP kernel implementation5*6* These functions manipulate sctp command sequences.7*8* This SCTP implementation is free software;9* you can redistribute it and/or modify it under the terms of10* the GNU General Public License as published by11* the Free Software Foundation; either version 2, or (at your option)12* any later version.13*14* This SCTP implementation is distributed in the hope that it15* will be useful, but WITHOUT ANY WARRANTY; without even the implied16* ************************17* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.18* See the GNU General Public License for more details.19*20* You should have received a copy of the GNU General Public License21* along with GNU CC; see the file COPYING. If not, write to22* the Free Software Foundation, 59 Temple Place - Suite 330,23* Boston, MA 02111-1307, USA.24*25* Please send any bug reports or fixes you make to the26* email address(es):27* lksctp developers <[email protected]>28*29* Or submit a bug report through the following website:30* http://www.sf.net/projects/lksctp31*32* Written or modified by:33* La Monte H.P. Yarroll <[email protected]>34* Karl Knutson <[email protected]>35*36* Any bugs reported given to us we will try to fix... any fixes shared will37* be incorporated into the next SCTP release.38*/3940#include <linux/types.h>41#include <net/sctp/sctp.h>42#include <net/sctp/sm.h>4344/* Initialize a block of memory as a command sequence. */45int sctp_init_cmd_seq(sctp_cmd_seq_t *seq)46{47memset(seq, 0, sizeof(sctp_cmd_seq_t));48return 1; /* We always succeed. */49}5051/* Add a command to a sctp_cmd_seq_t.52* Return 0 if the command sequence is full.53*/54void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj)55{56BUG_ON(seq->next_free_slot >= SCTP_MAX_NUM_COMMANDS);5758seq->cmds[seq->next_free_slot].verb = verb;59seq->cmds[seq->next_free_slot++].obj = obj;60}6162/* Return the next command structure in a sctp_cmd_seq.63* Returns NULL at the end of the sequence.64*/65sctp_cmd_t *sctp_next_cmd(sctp_cmd_seq_t *seq)66{67sctp_cmd_t *retval = NULL;6869if (seq->next_cmd < seq->next_free_slot)70retval = &seq->cmds[seq->next_cmd++];7172return retval;73}74757677