OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [sctp/] [debug.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* SCTP kernel reference Implementation
2
 * Copyright (c) 1999-2000 Cisco, Inc.
3
 * Copyright (c) 1999-2001 Motorola, Inc.
4
 * Copyright (c) 2001 Intel Corp.
5
 * Copyright (c) 2001 International Business Machines Corp.
6
 *
7
 * This file is part of the SCTP kernel reference Implementation
8
 *
9
 * This file is part of the implementation of the add-IP extension,
10
 * based on <draft-ietf-tsvwg-addip-sctp-02.txt> June 29, 2001,
11
 * for the SCTP kernel reference Implementation.
12
 *
13
 * This file converts numerical ID value to alphabetical names for SCTP
14
 * terms such as chunk type, parameter time, event type, etc.
15
 *
16
 * The SCTP reference implementation is free software;
17
 * you can redistribute it and/or modify it under the terms of
18
 * the GNU General Public License as published by
19
 * the Free Software Foundation; either version 2, or (at your option)
20
 * any later version.
21
 *
22
 * The SCTP reference implementation is distributed in the hope that it
23
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
24
 *                 ************************
25
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26
 * See the GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with GNU CC; see the file COPYING.  If not, write to
30
 * the Free Software Foundation, 59 Temple Place - Suite 330,
31
 * Boston, MA 02111-1307, USA.
32
 *
33
 * Please send any bug reports or fixes you make to the
34
 * email address(es):
35
 *    lksctp developers <lksctp-developers@lists.sourceforge.net>
36
 *
37
 * Or submit a bug report through the following website:
38
 *    http://www.sf.net/projects/lksctp
39
 *
40
 * Written or modified by:
41
 *    La Monte H.P. Yarroll <piggy@acm.org>
42
 *    Karl Knutson          <karl@athena.chicago.il.us>
43
 *    Xingang Guo           <xingang.guo@intel.com>
44
 *    Jon Grimm             <jgrimm@us.ibm.com>
45
 *    Daisy Chang           <daisyc@us.ibm.com>
46
 *
47
 * Any bugs reported given to us we will try to fix... any fixes shared will
48
 * be incorporated into the next SCTP release.
49
 */
50
 
51
#include <net/sctp/sctp.h>
52
 
53
#if SCTP_DEBUG
54
int sctp_debug_flag = 1;        /* Initially enable DEBUG */
55
#endif  /* SCTP_DEBUG */
56
 
57
/* These are printable forms of Chunk ID's from section 3.1.  */
58
static const char *sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
59
        "DATA",
60
        "INIT",
61
        "INIT_ACK",
62
        "SACK",
63
        "HEARTBEAT",
64
        "HEARTBEAT_ACK",
65
        "ABORT",
66
        "SHUTDOWN",
67
        "SHUTDOWN_ACK",
68
        "ERROR",
69
        "COOKIE_ECHO",
70
        "COOKIE_ACK",
71
        "ECN_ECNE",
72
        "ECN_CWR",
73
        "SHUTDOWN_COMPLETE",
74
};
75
 
76
/* Lookup "chunk type" debug name. */
77
const char *sctp_cname(const sctp_subtype_t cid)
78
{
79
        if (cid.chunk < 0)
80
                return "illegal chunk id";
81
        if (cid.chunk <= SCTP_CID_BASE_MAX)
82
                return sctp_cid_tbl[cid.chunk];
83
 
84
        switch (cid.chunk) {
85
        case SCTP_CID_ASCONF:
86
                return "ASCONF";
87
 
88
        case SCTP_CID_ASCONF_ACK:
89
                return "ASCONF_ACK";
90
 
91
        default:
92
                return "unknown chunk";
93
        };
94
        return "unknown chunk";
95
}
96
 
97
/* These are printable form of variable-length parameters. */
98
const char *sctp_param_tbl[SCTP_PARAM_ECN_CAPABLE + 1] = {
99
        "",
100
        "PARAM_HEARTBEAT_INFO",
101
        "",
102
        "",
103
        "",
104
        "PARAM_IPV4_ADDRESS",
105
        "PARAM_IPV6_ADDRESS",
106
        "PARAM_STATE_COOKIE",
107
        "PARAM_UNRECOGNIZED_PARAMETERS",
108
        "PARAM_COOKIE_PRESERVATIVE",
109
        "",
110
        "PARAM_HOST_NAME_ADDRESS",
111
        "PARAM_SUPPORTED_ADDRESS_TYPES",
112
};
113
 
114
/* These are printable forms of the states.  */
115
const char *sctp_state_tbl[SCTP_STATE_NUM_STATES] = {
116
        "STATE_EMPTY",
117
        "STATE_CLOSED",
118
        "STATE_COOKIE_WAIT",
119
        "STATE_COOKIE_ECHOED",
120
        "STATE_ESTABLISHED",
121
        "STATE_SHUTDOWN_PENDING",
122
        "STATE_SHUTDOWN_SENT",
123
        "STATE_SHUTDOWN_RECEIVED",
124
        "STATE_SHUTDOWN_ACK_SENT",
125
};
126
 
127
/* Events that could change the state of an association.  */
128
const char *sctp_evttype_tbl[] = {
129
        "EVENT_T_unknown",
130
        "EVENT_T_CHUNK",
131
        "EVENT_T_TIMEOUT",
132
        "EVENT_T_OTHER",
133
        "EVENT_T_PRIMITIVE"
134
};
135
 
136
/* Return value of a state function */
137
const char *sctp_status_tbl[] = {
138
        "DISPOSITION_DISCARD",
139
        "DISPOSITION_CONSUME",
140
        "DISPOSITION_NOMEM",
141
        "DISPOSITION_DELETE_TCB",
142
        "DISPOSITION_ABORT",
143
        "DISPOSITION_VIOLATION",
144
        "DISPOSITION_NOT_IMPL",
145
        "DISPOSITION_ERROR",
146
        "DISPOSITION_BUG"
147
};
148
 
149
/* Printable forms of primitives */
150
static const char *sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
151
        "PRIMITIVE_ASSOCIATE",
152
        "PRIMITIVE_SHUTDOWN",
153
        "PRIMITIVE_ABORT",
154
        "PRIMITIVE_SEND",
155
        "PRIMITIVE_REQUESTHEARTBEAT",
156
};
157
 
158
/* Lookup primitive debug name. */
159
const char *sctp_pname(const sctp_subtype_t id)
160
{
161
        if (id.primitive < 0)
162
                return "illegal primitive";
163
        if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
164
                return sctp_primitive_tbl[id.primitive];
165
        return "unknown_primitive";
166
}
167
 
168
static const char *sctp_other_tbl[] = {
169
        "NO_PENDING_TSN",
170
};
171
 
172
/* Lookup "other" debug name. */
173
const char *sctp_oname(const sctp_subtype_t id)
174
{
175
        if (id.other < 0)
176
                return "illegal 'other' event";
177
        if (id.other < SCTP_EVENT_OTHER_MAX)
178
                return sctp_other_tbl[id.other];
179
        return "unknown 'other' event";
180
}
181
 
182
static const char *sctp_timer_tbl[] = {
183
        "TIMEOUT_NONE",
184
        "TIMEOUT_T1_COOKIE",
185
        "TIMEOUT_T1_INIT",
186
        "TIMEOUT_T2_SHUTDOWN",
187
        "TIMEOUT_T3_RTX",
188
        "TIMEOUT_T4_RTO",
189
        "TIMEOUT_T5_SHUTDOWN_GUARD",
190
        "TIMEOUT_HEARTBEAT",
191
        "TIMEOUT_SACK",
192
        "TIMEOUT_AUTOCLOSE",
193
};
194
 
195
/* Lookup timer debug name. */
196
const char *sctp_tname(const sctp_subtype_t id)
197
{
198
        if (id.timeout < 0)
199
                return "illegal 'timer' event";
200
        if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
201
                return sctp_timer_tbl[id.timeout];
202
        return "unknown_timer";
203
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.