diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-05-18 09:09:50 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-05-18 09:09:50 +0000 |
commit | f3d90d30a49382db3955b9ece00d71fe12d54c49 (patch) | |
tree | b3976154972b7e5a4d8ee25e4c4f2f5bef77d2f0 /packet-x25.c | |
parent | e7ea221d9c8370817a7b9c9dab3cea47586e1561 (diff) | |
download | wireshark-f3d90d30a49382db3955b9ece00d71fe12d54c49.tar.gz wireshark-f3d90d30a49382db3955b9ece00d71fe12d54c49.tar.bz2 wireshark-f3d90d30a49382db3955b9ece00d71fe12d54c49.zip |
Remove the "union pseudo_header" from the "frame_data" structure;
there's no need to keep it around in memory - when the frame data is
read in when handing a frame, read in the information, if any, necessary
to reconstruct the frame header, and reconstruct it. This saves some
memory.
This requires that the seek-and-read function be implemented inside
Wiretap, and that the Wiretap handle remain open even after we've
finished reading the file sequentially.
This also points out that we can't really do X.25-over-Ethernet
correctly, as we don't know where the direction (DTE->DCE or DCE->DTE)
flag is stored; it's not clear how the Ethernet type 0x0805 for X.25
Layer 3 is supposed to be handled in any case. We eliminate
X.25-over-Ethernet support (until we find out what we're supposed to
do).
svn path=/trunk/; revision=1975
Diffstat (limited to 'packet-x25.c')
-rw-r--r-- | packet-x25.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/packet-x25.c b/packet-x25.c index 59aa8f52e9..4b15f7f564 100644 --- a/packet-x25.c +++ b/packet-x25.c @@ -2,7 +2,7 @@ * Routines for x25 packet disassembly * Olivier Abad <abad@daba.dhis.net> * - * $Id: packet-x25.c,v 1.25 2000/05/11 08:15:56 gram Exp $ + * $Id: packet-x25.c,v 1.26 2000/05/18 09:05:49 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -38,6 +38,7 @@ #include <string.h> #include "etypes.h" #include "packet.h" +#include "packet-x25.h" #include "packet-ip.h" #include "packet-osi.h" #include "packet-clnp.h" @@ -1365,7 +1366,8 @@ static const value_string sharing_strategy_vals[] = { }; void -dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) +dissect_x25(const union pseudo_header *pseudo_header, const u_char *pd, + int offset, frame_data *fd, proto_tree *tree) { proto_tree *x25_tree=0, *ti; int localoffset=offset; @@ -1412,8 +1414,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) case X25_CALL_REQUEST: if (check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "%s VC:%d", - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Inc. call" - : "Call req." , + (pseudo_header->x25.flags & FROM_DCE) ? "Inc. call" + : "Call req." , vc); if (x25_tree) { proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, NullTVB, @@ -1421,7 +1423,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, NullTVB, localoffset+2, 1, X25_CALL_REQUEST, - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Incoming call" + (pseudo_header->x25.flags & FROM_DCE) ? "Incoming call" : "Call request"); } localoffset += 3; @@ -1524,8 +1526,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) case X25_CALL_ACCEPTED: if(check_col(fd, COL_INFO)) col_add_fstr(fd, COL_INFO, "%s VC:%d", - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Call conn." - : "Call acc." , + (pseudo_header->x25.flags & FROM_DCE) ? "Call conn." + : "Call acc." , vc); if (x25_tree) { proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, NullTVB, @@ -1533,7 +1535,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, NullTVB, localoffset+2, 1, X25_CALL_ACCEPTED, - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Call connected" + (pseudo_header->x25.flags & FROM_DCE) ? "Call connected" : "Call accepted"); } localoffset += 3; @@ -1553,8 +1555,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) case X25_CLEAR_REQUEST: if(check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "%s VC:%d %s - %s", - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Clear ind." - : "Clear req." , + (pseudo_header->x25.flags & FROM_DCE) ? "Clear ind." + : "Clear req." , vc, clear_code(pd[localoffset+3]), clear_diag(pd[localoffset+4])); } @@ -1565,7 +1567,7 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, NullTVB, localoffset+2, 1, X25_CLEAR_REQUEST, - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Clear indication" + (pseudo_header->x25.flags & FROM_DCE) ? "Clear indication" : "Clear request"); if (localoffset+3 < x25_pkt_len+offset) proto_tree_add_text(x25_tree, NullTVB, localoffset+3, 1, @@ -1632,8 +1634,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) case X25_RESET_REQUEST: if(check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "%s VC:%d %s - Diag.:%d", - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Reset ind." - : "Reset req.", + (pseudo_header->x25.flags & FROM_DCE) ? "Reset ind." + : "Reset req.", vc, reset_code(pd[localoffset+3]), (int)pd[localoffset+4]); } @@ -1644,8 +1646,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, NullTVB, localoffset+2, 1, X25_RESET_REQUEST, - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Reset indication" - : "Reset request"); + (pseudo_header->x25.flags & FROM_DCE) ? "Reset indication" + : "Reset request"); if (localoffset+3 < x25_pkt_len+offset) proto_tree_add_text(x25_tree, NullTVB, localoffset+3, 1, "Cause : %s", reset_code(pd[localoffset+3])); @@ -1669,8 +1671,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) case X25_RESTART_REQUEST: if(check_col(fd, COL_INFO)) { col_add_fstr(fd, COL_INFO, "%s %s - Diag.:%d", - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Restart ind." - : "Restart req.", + (pseudo_header->x25.flags & FROM_DCE) ? "Restart ind." + : "Restart req.", restart_code(pd[localoffset+3]), (int)pd[localoffset+4]); } @@ -1678,8 +1680,8 @@ dissect_x25(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) proto_tree_add_uint_format(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, NullTVB, localoffset+2, 1, X25_RESTART_REQUEST, - (fd->pseudo_header.x25.flags & FROM_DCE) ? "Restart indication" - : "Restart request"); + (pseudo_header->x25.flags & FROM_DCE) ? "Restart indication" + : "Restart request"); if (localoffset+3 < x25_pkt_len+offset) proto_tree_add_text(x25_tree, NullTVB, localoffset+3, 1, "Cause : %s", restart_code(pd[localoffset+3])); @@ -1980,9 +1982,3 @@ proto_register_x25(void) proto_register_subtree_array(ett, array_length(ett)); register_init_routine(&reinit_x25_hashtable); } - -void -proto_reg_handoff_x25(void) -{ - dissector_add("ethertype", ETHERTYPE_X25L3, dissect_x25); -} |