2008-01-11 17:57:09 +03:00
/* SCTP kernel implementation
2005-04-17 02:20:36 +04: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 17:25:18 +03:00
*
2008-01-11 17:57:09 +03:00
* This file is part of the SCTP kernel implementation
2007-02-09 17:25:18 +03:00
*
2005-04-17 02:20:36 +04: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 17:25:18 +03:00
*
2008-01-11 17:57:09 +03:00
* This SCTP implementation is free software ;
2007-02-09 17:25:18 +03:00
* you can redistribute it and / or modify it under the terms of
2005-04-17 02:20:36 +04: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 17:25:18 +03:00
*
2008-01-11 17:57:09 +03:00
* This SCTP implementation is distributed in the hope that it
2005-04-17 02:20:36 +04: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 17:25:18 +03:00
*
2005-04-17 02:20:36 +04:00
* You should have received a copy of the GNU General Public License
2013-12-06 18:28:48 +04:00
* along with GNU CC ; see the file COPYING . If not , see
* < http : //www.gnu.org/licenses/>.
2007-02-09 17:25:18 +03:00
*
2005-04-17 02:20:36 +04:00
* Please send any bug reports or fixes you make to the
* email address ( es ) :
2013-07-23 16:51:47 +04:00
* lksctp developers < linux - sctp @ vger . kernel . org >
2007-02-09 17:25:18 +03:00
*
* Written or modified by :
2005-04-17 02:20:36 +04: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 21:42:58 +04:00
static const char * const sctp_cid_tbl [ SCTP_NUM_BASE_CHUNK_TYPES ] = {
2005-04-17 02:20:36 +04: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. */
2017-08-05 15:00:04 +03:00
const char * sctp_cname ( const union sctp_subtype cid )
2005-04-17 02:20:36 +04:00
{
if ( cid . chunk < = SCTP_CID_BASE_MAX )
return sctp_cid_tbl [ cid . chunk ] ;
2007-02-09 17:25:18 +03:00
2005-04-17 02:20:36 +04: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 12:46:10 +03:00
case SCTP_CID_AUTH :
return " AUTH " ;
2017-12-18 09:13:17 +03:00
case SCTP_CID_RECONF :
return " RECONF " ;
2005-04-17 02:20:36 +04:00
default :
2007-04-21 04:09:22 +04:00
break ;
}
2005-04-17 02:20:36 +04:00
return " unknown chunk " ;
}
/* These are printable forms of the states. */
2009-08-05 21:42:58 +04:00
const char * const sctp_state_tbl [ SCTP_STATE_NUM_STATES ] = {
2005-04-17 02:20:36 +04: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 21:42:58 +04:00
const char * const sctp_evttype_tbl [ ] = {
2005-04-17 02:20:36 +04: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 21:42:58 +04:00
const char * const sctp_status_tbl [ ] = {
2005-04-17 02:20:36 +04: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 21:42:58 +04:00
static const char * const sctp_primitive_tbl [ SCTP_NUM_PRIMITIVE_TYPES ] = {
2005-04-17 02:20:36 +04:00
" PRIMITIVE_ASSOCIATE " ,
" PRIMITIVE_SHUTDOWN " ,
" PRIMITIVE_ABORT " ,
" PRIMITIVE_SEND " ,
" PRIMITIVE_REQUESTHEARTBEAT " ,
2009-03-02 12:46:10 +03:00
" PRIMITIVE_ASCONF " ,
2005-04-17 02:20:36 +04:00
} ;
/* Lookup primitive debug name. */
2017-08-05 15:00:04 +03:00
const char * sctp_pname ( const union sctp_subtype id )
2005-04-17 02:20:36 +04:00
{
if ( id . primitive < = SCTP_EVENT_PRIMITIVE_MAX )
return sctp_primitive_tbl [ id . primitive ] ;
return " unknown_primitive " ;
}
2009-08-05 21:42:58 +04:00
static const char * const sctp_other_tbl [ ] = {
2005-04-17 02:20:36 +04:00
" NO_PENDING_TSN " ,
2007-02-09 17:25:18 +03:00
" ICMP_PROTO_UNREACH " ,
2005-04-17 02:20:36 +04:00
} ;
/* Lookup "other" debug name. */
2017-08-05 15:00:04 +03:00
const char * sctp_oname ( const union sctp_subtype id )
2005-04-17 02:20:36 +04:00
{
if ( id . other < = SCTP_EVENT_OTHER_MAX )
return sctp_other_tbl [ id . other ] ;
return " unknown 'other' event " ;
}
2009-08-05 21:42:58 +04:00
static const char * const sctp_timer_tbl [ ] = {
2005-04-17 02:20:36 +04:00
" TIMEOUT_NONE " ,
" TIMEOUT_T1_COOKIE " ,
" TIMEOUT_T1_INIT " ,
" TIMEOUT_T2_SHUTDOWN " ,
" TIMEOUT_T3_RTX " ,
" TIMEOUT_T4_RTO " ,
" TIMEOUT_T5_SHUTDOWN_GUARD " ,
" TIMEOUT_HEARTBEAT " ,
2017-01-24 12:25:54 +03:00
" TIMEOUT_RECONF " ,
2005-04-17 02:20:36 +04:00
" TIMEOUT_SACK " ,
" TIMEOUT_AUTOCLOSE " ,
} ;
/* Lookup timer debug name. */
2017-08-05 15:00:04 +03:00
const char * sctp_tname ( const union sctp_subtype id )
2005-04-17 02:20:36 +04:00
{
2017-01-24 12:25:54 +03:00
BUILD_BUG_ON ( SCTP_EVENT_TIMEOUT_MAX + 1 ! = ARRAY_SIZE ( sctp_timer_tbl ) ) ;
if ( id . timeout < ARRAY_SIZE ( sctp_timer_tbl ) )
2005-04-17 02:20:36 +04:00
return sctp_timer_tbl [ id . timeout ] ;
return " unknown_timer " ;
}