2 * Routines for ppp packet disassembly
4 * $Id: packet-ppp.c,v 1.5 1998/10/10 03:32:14 gerald Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@zing.org>
9 * This file created and by Mike Hall <mlh@io.com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 #ifdef HAVE_SYS_TYPES_H
32 # include <sys/types.h>
43 dissect_ppp( const u_char *pd, frame_data *fd, GtkTree *tree ) {
45 GtkWidget *ti, *fh_tree;
49 ph.ppp_prot = pntohs(&pd[2]);
51 /* load the top pane info. This should be overwritten by
52 the next protocol in the stack */
53 if(fd->win_info[COL_NUM]) {
54 strcpy(fd->win_info[COL_SOURCE], "N/A" );
55 strcpy(fd->win_info[COL_DESTINATION], "N/A" );
56 strcpy(fd->win_info[COL_PROTOCOL], "N/A" );
57 strcpy(fd->win_info[COL_INFO], "PPP" );
60 /* populate a tree in the second pane with the status of the link
63 ti = add_item_to_tree( GTK_WIDGET(tree), 0, 4,
64 "Point-to-Point Protocol (%d on link, %d captured)", fd->pkt_len,
66 fh_tree = gtk_tree_new();
67 add_subtree(ti, fh_tree, ETT_PPP);
68 add_item_to_tree(fh_tree, 0, 1, "Address: %02x", ph.ppp_addr);
69 add_item_to_tree(fh_tree, 1, 1, "Control: %02x", ph.ppp_ctl);
70 add_item_to_tree(fh_tree, 2, 2, "Protocol: %04x", ph.ppp_prot);
73 switch (ph.ppp_prot) {
75 dissect_ip(pd, 4, fd, tree);
78 dissect_data(pd, 4, fd, tree);