/* SCTP kernel implementation1* (C) Copyright IBM Corp. 2001, 20042* Copyright (c) 1999-2000 Cisco, Inc.3* Copyright (c) 1999-2001 Motorola, Inc.4* Copyright (c) 2001 Intel Corp.5*6* This file is part of the SCTP kernel implementation7*8* This file converts numerical ID value to alphabetical names for SCTP9* terms such as chunk type, parameter time, event type, etc.10*11* This SCTP implementation is free software;12* you can redistribute it and/or modify it under the terms of13* the GNU General Public License as published by14* the Free Software Foundation; either version 2, or (at your option)15* any later version.16*17* This SCTP implementation is distributed in the hope that it18* will be useful, but WITHOUT ANY WARRANTY; without even the implied19* ************************20* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.21* See the GNU General Public License for more details.22*23* You should have received a copy of the GNU General Public License24* along with GNU CC; see the file COPYING. If not, write to25* the Free Software Foundation, 59 Temple Place - Suite 330,26* Boston, MA 02111-1307, USA.27*28* Please send any bug reports or fixes you make to the29* email address(es):30* lksctp developers <[email protected]>31*32* Or submit a bug report through the following website:33* http://www.sf.net/projects/lksctp34*35* Written or modified by:36* La Monte H.P. Yarroll <[email protected]>37* Karl Knutson <[email protected]>38* Xingang Guo <[email protected]>39* Jon Grimm <[email protected]>40* Daisy Chang <[email protected]>41* Sridhar Samudrala <[email protected]>42*43* Any bugs reported given to us we will try to fix... any fixes shared will44* be incorporated into the next SCTP release.45*/4647#include <net/sctp/sctp.h>4849#if SCTP_DEBUG50int sctp_debug_flag = 1; /* Initially enable DEBUG */51#endif /* SCTP_DEBUG */5253/* These are printable forms of Chunk ID's from section 3.1. */54static const char *const sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {55"DATA",56"INIT",57"INIT_ACK",58"SACK",59"HEARTBEAT",60"HEARTBEAT_ACK",61"ABORT",62"SHUTDOWN",63"SHUTDOWN_ACK",64"ERROR",65"COOKIE_ECHO",66"COOKIE_ACK",67"ECN_ECNE",68"ECN_CWR",69"SHUTDOWN_COMPLETE",70};7172/* Lookup "chunk type" debug name. */73const char *sctp_cname(const sctp_subtype_t cid)74{75if (cid.chunk <= SCTP_CID_BASE_MAX)76return sctp_cid_tbl[cid.chunk];7778switch (cid.chunk) {79case SCTP_CID_ASCONF:80return "ASCONF";8182case SCTP_CID_ASCONF_ACK:83return "ASCONF_ACK";8485case SCTP_CID_FWD_TSN:86return "FWD_TSN";8788case SCTP_CID_AUTH:89return "AUTH";9091default:92break;93}9495return "unknown chunk";96}9798/* These are printable forms of the states. */99const char *const sctp_state_tbl[SCTP_STATE_NUM_STATES] = {100"STATE_CLOSED",101"STATE_COOKIE_WAIT",102"STATE_COOKIE_ECHOED",103"STATE_ESTABLISHED",104"STATE_SHUTDOWN_PENDING",105"STATE_SHUTDOWN_SENT",106"STATE_SHUTDOWN_RECEIVED",107"STATE_SHUTDOWN_ACK_SENT",108};109110/* Events that could change the state of an association. */111const char *const sctp_evttype_tbl[] = {112"EVENT_T_unknown",113"EVENT_T_CHUNK",114"EVENT_T_TIMEOUT",115"EVENT_T_OTHER",116"EVENT_T_PRIMITIVE"117};118119/* Return value of a state function */120const char *const sctp_status_tbl[] = {121"DISPOSITION_DISCARD",122"DISPOSITION_CONSUME",123"DISPOSITION_NOMEM",124"DISPOSITION_DELETE_TCB",125"DISPOSITION_ABORT",126"DISPOSITION_VIOLATION",127"DISPOSITION_NOT_IMPL",128"DISPOSITION_ERROR",129"DISPOSITION_BUG"130};131132/* Printable forms of primitives */133static const char *const sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {134"PRIMITIVE_ASSOCIATE",135"PRIMITIVE_SHUTDOWN",136"PRIMITIVE_ABORT",137"PRIMITIVE_SEND",138"PRIMITIVE_REQUESTHEARTBEAT",139"PRIMITIVE_ASCONF",140};141142/* Lookup primitive debug name. */143const char *sctp_pname(const sctp_subtype_t id)144{145if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)146return sctp_primitive_tbl[id.primitive];147return "unknown_primitive";148}149150static const char *const sctp_other_tbl[] = {151"NO_PENDING_TSN",152"ICMP_PROTO_UNREACH",153};154155/* Lookup "other" debug name. */156const char *sctp_oname(const sctp_subtype_t id)157{158if (id.other <= SCTP_EVENT_OTHER_MAX)159return sctp_other_tbl[id.other];160return "unknown 'other' event";161}162163static const char *const sctp_timer_tbl[] = {164"TIMEOUT_NONE",165"TIMEOUT_T1_COOKIE",166"TIMEOUT_T1_INIT",167"TIMEOUT_T2_SHUTDOWN",168"TIMEOUT_T3_RTX",169"TIMEOUT_T4_RTO",170"TIMEOUT_T5_SHUTDOWN_GUARD",171"TIMEOUT_HEARTBEAT",172"TIMEOUT_SACK",173"TIMEOUT_AUTOCLOSE",174};175176/* Lookup timer debug name. */177const char *sctp_tname(const sctp_subtype_t id)178{179if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)180return sctp_timer_tbl[id.timeout];181return "unknown_timer";182}183184185