2 * Routines for FC Link Control Frames
3 * Copyright 2001, Dinesh G Dutt <ddutt@cisco.com>
5 * $Id: packet-fclctl.c,v 1.1 2002/12/08 02:32:17 gerald Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from WHATEVER_FILE_YOU_USED (where "WHATEVER_FILE_YOU_USED"
12 * is a dissector file; if you just copied this from README.developer,
13 * don't bother with the "Copied from" - you don't even need to put
14 * in a "Copied from" if you copied an existing dissector, especially
15 * if the bulk of the code in the new dissector is your code)
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40 #ifdef HAVE_SYS_TYPES_H
41 # include <sys/types.h>
44 #ifdef HAVE_NETINET_IN_H
45 # include <netinet/in.h>
50 #ifdef NEED_SNPRINTF_H
51 # include "snprintf.h"
54 #include <epan/packet.h>
56 #include "packet-fc.h"
57 #include "packet-fclctl.h"
59 static gchar errstr[64];
62 fclctl_get_typestr (guint8 linkctl_type, guint8 type)
64 if ((linkctl_type == FC_LCTL_FBSYB) ||
65 (linkctl_type == FC_LCTL_FBSYL)) {
66 return (val_to_str ((type & 0xF0), fc_lctl_fbsy_val, "0x%x"));
72 fclctl_get_paramstr (guint32 linkctl_type, guint32 param)
78 if (linkctl_type == FC_LCTL_PBSY) {
79 strcpy (errstr, val_to_str (((param & 0xFF000000) >> 24),
80 fc_lctl_pbsy_acode_val, "0x%x"));
81 len = strlen (errstr);
82 strcpy (&errstr[len], ", ");
83 len = strlen (errstr);
85 val_to_str (((param & 0x00FF0000) >> 16),
86 fc_lctl_pbsy_rjt_val, "0x%x"));
88 else if ((linkctl_type == FC_LCTL_FRJT) ||
89 (linkctl_type == FC_LCTL_PRJT)) {
91 val_to_str (((param & 0xFF000000) >> 24),
92 fc_lctl_rjt_acode_val, "0x%x"));
93 len = strlen (errstr);
94 strcpy (&errstr[len], ", ");
95 len = strlen (errstr);
97 val_to_str (((param & 0x00FF0000) >> 16), fc_lctl_rjt_val,