* Routines for v120 frame disassembly
* Bert Driehuis <driehuis@playbeing.org>
*
- * $Id: packet-v120.c,v 1.26 2002/04/11 09:38:03 guy Exp $
+ * $Id: packet-v120.c,v 1.31 2003/09/02 19:18:52 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
* Copyright 1998
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it 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.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include "config.h"
#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
#include <stdio.h>
#include <glib.h>
#include <string.h>
return;
}
- if (pinfo->pseudo_header->x25.flags & FROM_DCE) {
- if(check_col(pinfo->cinfo, COL_RES_DL_DST))
- col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
- if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
- col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
- }
- else {
+ if (pinfo->p2p_dir == P2P_DIR_SENT) {
+ is_response = (byte0 & 0x02) ? FALSE: TRUE;
if(check_col(pinfo->cinfo, COL_RES_DL_DST))
col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DCE");
if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DTE");
+ } else {
+ /* XXX - what if the direction is unknown? */
+ is_response = (byte0 & 0x02) ? TRUE : FALSE;
+ if(check_col(pinfo->cinfo, COL_RES_DL_DST))
+ col_set_str(pinfo->cinfo, COL_RES_DL_DST, "DTE");
+ if(check_col(pinfo->cinfo, COL_RES_DL_SRC))
+ col_set_str(pinfo->cinfo, COL_RES_DL_SRC, "DCE");
}
- if (((pinfo->pseudo_header->x25.flags & FROM_DCE) && byte0 & 0x02) ||
- (!(pinfo->pseudo_header->x25.flags & FROM_DCE) && !(byte0 & 0x02)))
- is_response = TRUE;
- else
- is_response = FALSE;
-
if (tree) {
ti = proto_tree_add_protocol_format(tree, proto_v120, tvb, 0, -1, "V.120");
v120_tree = proto_item_add_subtree(ti, ett_v120);
ti = NULL;
}
control = dissect_xdlc_control(tvb, 2, pinfo, v120_tree, hf_v120_control,
- ett_v120_control, is_response, TRUE);
+ ett_v120_control, is_response, TRUE, FALSE);
if (tree) {
v120len = 2 + XDLC_CONTROL_LEN(control, TRUE);
if (tvb_bytes_exist(tvb, v120len, 1))
"V.120", "v120");
proto_register_field_array (proto_v120, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+
+ register_dissector("v120", dissect_v120, proto_v120);
}
void
proto_reg_handoff_v120(void)
{
- dissector_handle_t v120_handle;
-
data_handle = find_dissector("data");
- v120_handle = create_dissector_handle(dissect_v120, proto_v120);
- dissector_add("wtap_encap", WTAP_ENCAP_V120, v120_handle);
}