2008-01-11 15:57:09 +01:00
|
|
|
/* SCTP kernel implementation
|
2005-04-17 00:20:36 +02:00
|
|
|
* (C) Copyright IBM Corp. 2001, 2004
|
|
|
|
* Copyright (c) 1999-2000 Cisco, Inc.
|
|
|
|
* Copyright (c) 1999-2001 Motorola, Inc.
|
|
|
|
* Copyright (c) 2001 Intel Corp.
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
2008-01-11 15:57:09 +01:00
|
|
|
* This file is part of the SCTP kernel implementation
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
2005-04-17 00:20:36 +02:00
|
|
|
* This file converts numerical ID value to alphabetical names for SCTP
|
|
|
|
* terms such as chunk type, parameter time, event type, etc.
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
2008-01-11 15:57:09 +01:00
|
|
|
* This SCTP implementation is free software;
|
2007-02-09 15:25:18 +01:00
|
|
|
* you can redistribute it and/or modify it under the terms of
|
2005-04-17 00:20:36 +02:00
|
|
|
* the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
2008-01-11 15:57:09 +01:00
|
|
|
* This SCTP implementation is distributed in the hope that it
|
2005-04-17 00:20:36 +02:00
|
|
|
* 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.
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
2005-04-17 00:20:36 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2013-12-06 15:28:48 +01:00
|
|
|
* along with GNU CC; see the file COPYING. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
2005-04-17 00:20:36 +02:00
|
|
|
* Please send any bug reports or fixes you make to the
|
|
|
|
* email address(es):
|
2013-07-23 14:51:47 +02:00
|
|
|
* lksctp developers <linux-sctp@vger.kernel.org>
|
2007-02-09 15:25:18 +01:00
|
|
|
*
|
|
|
|
* Written or modified by:
|
2005-04-17 00:20:36 +02:00
|
|
|
* 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>
|
|
|
|
* Daisy Chang <daisyc@us.ibm.com>
|
|
|
|
* Sridhar Samudrala <sri@us.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <net/sctp/sctp.h>
|
|
|
|
|
|
|
|
/* These are printable forms of Chunk ID's from section 3.1. */
|
2009-08-05 19:42:58 +02:00
|
|
|
static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"DATA",
|
|
|
|
"INIT",
|
|
|
|
"INIT_ACK",
|
|
|
|
"SACK",
|
|
|
|
"HEARTBEAT",
|
|
|
|
"HEARTBEAT_ACK",
|
|
|
|
"ABORT",
|
|
|
|
"SHUTDOWN",
|
|
|
|
"SHUTDOWN_ACK",
|
|
|
|
"ERROR",
|
|
|
|
"COOKIE_ECHO",
|
|
|
|
"COOKIE_ACK",
|
|
|
|
"ECN_ECNE",
|
|
|
|
"ECN_CWR",
|
|
|
|
"SHUTDOWN_COMPLETE",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Lookup "chunk type" debug name. */
|
|
|
|
const char *sctp_cname(const sctp_subtype_t cid)
|
|
|
|
{
|
|
|
|
if (cid.chunk <= SCTP_CID_BASE_MAX)
|
|
|
|
return sctp_cid_tbl[cid.chunk];
|
2007-02-09 15:25:18 +01:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
switch (cid.chunk) {
|
|
|
|
case SCTP_CID_ASCONF:
|
|
|
|
return "ASCONF";
|
|
|
|
|
|
|
|
case SCTP_CID_ASCONF_ACK:
|
|
|
|
return "ASCONF_ACK";
|
|
|
|
|
|
|
|
case SCTP_CID_FWD_TSN:
|
|
|
|
return "FWD_TSN";
|
|
|
|
|
2009-03-02 10:46:10 +01:00
|
|
|
case SCTP_CID_AUTH:
|
|
|
|
return "AUTH";
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
default:
|
2007-04-21 02:09:22 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
return "unknown chunk";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* These are printable forms of the states. */
|
2009-08-05 19:42:58 +02:00
|
|
|
const char *const sctp_state_tbl[SCTP_STATE_NUM_STATES] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"STATE_CLOSED",
|
|
|
|
"STATE_COOKIE_WAIT",
|
|
|
|
"STATE_COOKIE_ECHOED",
|
|
|
|
"STATE_ESTABLISHED",
|
|
|
|
"STATE_SHUTDOWN_PENDING",
|
|
|
|
"STATE_SHUTDOWN_SENT",
|
|
|
|
"STATE_SHUTDOWN_RECEIVED",
|
|
|
|
"STATE_SHUTDOWN_ACK_SENT",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Events that could change the state of an association. */
|
2009-08-05 19:42:58 +02:00
|
|
|
const char *const sctp_evttype_tbl[] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"EVENT_T_unknown",
|
|
|
|
"EVENT_T_CHUNK",
|
|
|
|
"EVENT_T_TIMEOUT",
|
|
|
|
"EVENT_T_OTHER",
|
|
|
|
"EVENT_T_PRIMITIVE"
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Return value of a state function */
|
2009-08-05 19:42:58 +02:00
|
|
|
const char *const sctp_status_tbl[] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"DISPOSITION_DISCARD",
|
|
|
|
"DISPOSITION_CONSUME",
|
|
|
|
"DISPOSITION_NOMEM",
|
|
|
|
"DISPOSITION_DELETE_TCB",
|
|
|
|
"DISPOSITION_ABORT",
|
|
|
|
"DISPOSITION_VIOLATION",
|
|
|
|
"DISPOSITION_NOT_IMPL",
|
|
|
|
"DISPOSITION_ERROR",
|
|
|
|
"DISPOSITION_BUG"
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Printable forms of primitives */
|
2009-08-05 19:42:58 +02:00
|
|
|
static const char *const sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"PRIMITIVE_ASSOCIATE",
|
|
|
|
"PRIMITIVE_SHUTDOWN",
|
|
|
|
"PRIMITIVE_ABORT",
|
|
|
|
"PRIMITIVE_SEND",
|
|
|
|
"PRIMITIVE_REQUESTHEARTBEAT",
|
2009-03-02 10:46:10 +01:00
|
|
|
"PRIMITIVE_ASCONF",
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Lookup primitive debug name. */
|
|
|
|
const char *sctp_pname(const sctp_subtype_t id)
|
|
|
|
{
|
|
|
|
if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
|
|
|
|
return sctp_primitive_tbl[id.primitive];
|
|
|
|
return "unknown_primitive";
|
|
|
|
}
|
|
|
|
|
2009-08-05 19:42:58 +02:00
|
|
|
static const char *const sctp_other_tbl[] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"NO_PENDING_TSN",
|
2007-02-09 15:25:18 +01:00
|
|
|
"ICMP_PROTO_UNREACH",
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Lookup "other" debug name. */
|
|
|
|
const char *sctp_oname(const sctp_subtype_t id)
|
|
|
|
{
|
|
|
|
if (id.other <= SCTP_EVENT_OTHER_MAX)
|
|
|
|
return sctp_other_tbl[id.other];
|
|
|
|
return "unknown 'other' event";
|
|
|
|
}
|
|
|
|
|
2009-08-05 19:42:58 +02:00
|
|
|
static const char *const sctp_timer_tbl[] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
"TIMEOUT_NONE",
|
|
|
|
"TIMEOUT_T1_COOKIE",
|
|
|
|
"TIMEOUT_T1_INIT",
|
|
|
|
"TIMEOUT_T2_SHUTDOWN",
|
|
|
|
"TIMEOUT_T3_RTX",
|
|
|
|
"TIMEOUT_T4_RTO",
|
|
|
|
"TIMEOUT_T5_SHUTDOWN_GUARD",
|
|
|
|
"TIMEOUT_HEARTBEAT",
|
|
|
|
"TIMEOUT_SACK",
|
|
|
|
"TIMEOUT_AUTOCLOSE",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Lookup timer debug name. */
|
|
|
|
const char *sctp_tname(const sctp_subtype_t id)
|
|
|
|
{
|
|
|
|
if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
|
|
|
|
return sctp_timer_tbl[id.timeout];
|
|
|
|
return "unknown_timer";
|
|
|
|
}
|