/* packet-radius.c
* Routines for RADIUS packet disassembly
*
- * $Id: packet-radius.c,v 1.3 1999/08/03 14:59:16 gram Exp $
+ * $Id: packet-radius.c,v 1.6 1999/12/02 23:25:29 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Johan Feyaerts
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-int proto_radius = -1;
-int hf_radius_length = -1;
-int hf_radius_code = -1;
-int hf_radius_id =-1;
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "packet.h"
#include "resolv.h"
+static int proto_radius = -1;
+static int hf_radius_length = -1;
+static int hf_radius_code = -1;
+static int hf_radius_id =-1;
+
+static gint ett_radius = -1;
+static gint ett_radius_avp = -1;
+
typedef struct _e_radiushdr {
guint8 rh_code;
guint8 rh_ident;
avptpstrval=match_strval(avph.avp_type, radius_attrib_type_vals);
if (avptpstrval == NULL) avptpstrval="Unknown Type";
valstr=rd_value_to_str(&avph, pd, offset);
+ if (!BYTES_ARE_IN_FRAME(offset, avph.avp_length)) {
+ break;
+ }
proto_tree_add_text(tree,offset,avph.avp_length,
"t:%s(%d) l:%d, value:%s",
avptpstrval,avph.avp_type,avph.avp_length,valstr);
offset=offset+avph.avp_length;
+ if (avph.avp_length == 0) {
+ break;
+ }
}
}
ti = proto_tree_add_item(tree,proto_radius, offset, rhlength,
NULL);
- radius_tree = proto_item_add_subtree(ti, ETT_RADIUS);
+ radius_tree = proto_item_add_subtree(ti, ett_radius);
proto_tree_add_item_format(radius_tree,hf_radius_code, offset, 1,
rh.rh_code, "Packet code:0x%01x (%s)",rhcode, codestrval);
avptf = proto_tree_add_text(radius_tree
,offset+hdrlength,avplength,
"Attribute value pairs");
- avptree = proto_item_add_subtree(avptf, ETT_RADIUS_AVP);
+ avptree = proto_item_add_subtree(avptf, ett_radius_avp);
if (avptree !=NULL)
{
{
static hf_register_info hf[] = {
{ &hf_radius_code,
- { "Code","radius.code", FT_UINT8, NULL }},
+ { "Code","radius.code", FT_UINT8, BASE_DEC, NULL, 0x0,
+ "" }},
+
{ &hf_radius_id,
- { "Identifier", "radius.id", FT_UINT8, NULL }},
+ { "Identifier", "radius.id", FT_UINT8, BASE_DEC, NULL, 0x0,
+ "" }},
+
{ &hf_radius_length,
- { "Length","radius.length", FT_UINT16, NULL }}
+ { "Length","radius.length", FT_UINT16, BASE_DEC, NULL, 0x0,
+ "" }}
+ };
+ static gint *ett[] = {
+ &ett_radius,
+ &ett_radius_avp,
};
proto_radius = proto_register_protocol ("Radius Protocol", "radius");
proto_register_field_array(proto_radius, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
}
-