2 * Routines for the Point-to-Point Tunnelling Protocol (PPTP) (RFC 2637)
3 * Brad Robel-Forrest <brad.robel-forrest@watchguard.com>
5 * $Id: packet-pptp.c,v 1.13 2000/11/19 08:54:02 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@zing.org>
9 * Copyright 1998 Gerald Combs
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>
37 #ifdef HAVE_NETINET_IN_H
38 #include <netinet/in.h>
44 static int proto_pptp = -1;
45 static int hf_pptp_message_type = -1;
47 static gint ett_pptp = -1;
49 #define TCP_PORT_PPTP 1723
51 #define MAGIC_COOKIE 0x1A2B3C4D
53 #define NUM_MSG_TYPES 3
54 #define msgtype2str(t) \
55 ((t < NUM_MSG_TYPES) ? msgtypestr[t] : "UNKNOWN-MESSAGES-TYPE")
57 static const char *msgtypestr[NUM_MSG_TYPES] = {
58 "UNKNOWN-MESSAGE-TYPE",
63 #define NUM_FRAME_TYPES 4
64 #define frametype2str(t) \
65 ((t < NUM_FRAME_TYPES) ? frametypestr[t] : "UNKNOWN-FRAMING-TYPE")
67 static const char *frametypestr[NUM_FRAME_TYPES] = {
68 "UNKNOWN-FRAMING-TYPE",
74 #define NUM_BEARER_TYPES 4
75 #define bearertype2str(t) \
76 ((t < NUM_BEARER_TYPES) ? bearertypestr[t] : "UNKNOWN-BEARER-TYPE")
78 static const char *bearertypestr[NUM_BEARER_TYPES] = {
79 "UNKNOWN-BEARER-TYPE",
85 #define NUM_CNTRLRESULT_TYPES 6
86 #define cntrlresulttype2str(t) \
87 ((t < NUM_CNTRLRESULT_TYPES) ? cntrlresulttypestr[t] : "UNKNOWN-CNTRLRESULT-TYPE")
89 static const char *cntrlresulttypestr[NUM_CNTRLRESULT_TYPES] = {
90 "UNKNOWN-CNTRLRESULT-TYPE",
93 "COMMAND-CHANNEL-EXISTS",
95 "VERSION-NOT-SUPPORTED"
98 #define NUM_ERROR_TYPES 7
99 #define errortype2str(t) \
100 ((t < NUM_ERROR_TYPES) ? errortypestr[t] : "UNKNOWN-ERROR-TYPE")
102 static const char *errortypestr[NUM_ERROR_TYPES] = {
112 #define NUM_REASON_TYPES 4
113 #define reasontype2str(t) \
114 ((t < NUM_REASON_TYPES) ? reasontypestr[t] : "UNKNOWN-REASON-TYPE")
116 static const char *reasontypestr[NUM_REASON_TYPES] = {
117 "UNKNOWN-REASON-TYPE",
120 "STOP-LOCAL-SHUTDOWN"
123 #define NUM_STOPRESULT_TYPES 3
124 #define stopresulttype2str(t) \
125 ((t < NUM_STOPRESULT_TYPES) ? stopresulttypestr[t] : "UNKNOWN-STOPRESULT-TYPE")
127 static const char *stopresulttypestr[NUM_STOPRESULT_TYPES] = {
128 "UNKNOWN-STOPRESULT-TYPE",
133 #define NUM_ECHORESULT_TYPES 3
134 #define echoresulttype2str(t) \
135 ((t < NUM_ECHORESULT_TYPES) ? echoresulttypestr[t] : "UNKNOWN-ECHORESULT-TYPE")
137 static const char *echoresulttypestr[NUM_ECHORESULT_TYPES] = {
138 "UNKNOWN-ECHORESULT-TYPE",
143 #define NUM_OUTRESULT_TYPES 8
144 #define outresulttype2str(t) \
145 ((t < NUM_OUTRESULT_TYPES) ? outresulttypestr[t] : "UNKNOWN-OUTRESULT-TYPE")
147 static const char *outresulttypestr[NUM_OUTRESULT_TYPES] = {
148 "UNKNOWN-OUTRESULT-TYPE",
158 #define NUM_INRESULT_TYPES 4
159 #define inresulttype2str(t) \
160 ((t < NUM_INRESULT_TYPES) ? inresulttypestr[t] : "UNKNOWN-INRESULT-TYPE")
162 static const char *inresulttypestr[NUM_INRESULT_TYPES] = {
163 "UNKNOWN-INRESULT-TYPE",
169 #define NUM_DISCRESULT_TYPES 5
170 #define discresulttype2str(t) \
171 ((t < NUM_DISCRESULT_TYPES) ? discresulttypestr[t] : "UNKNOWN-DISCRESULT-TYPE")
173 static const char *discresulttypestr[NUM_DISCRESULT_TYPES] = {
174 "UNKNOWN-DISCRESULT-TYPE",
181 static void dissect_unknown(const u_char *, int, frame_data *, proto_tree *);
182 static void dissect_cntrl_req(const u_char *, int, frame_data *, proto_tree *);
183 static void dissect_cntrl_reply(const u_char *, int, frame_data *, proto_tree *);
184 static void dissect_stop_req(const u_char *, int, frame_data *, proto_tree *);
185 static void dissect_stop_reply(const u_char *, int, frame_data *, proto_tree *);
186 static void dissect_echo_req(const u_char *, int, frame_data *, proto_tree *);
187 static void dissect_echo_reply(const u_char *, int, frame_data *, proto_tree *);
188 static void dissect_out_req(const u_char *, int, frame_data *, proto_tree *);
189 static void dissect_out_reply(const u_char *, int, frame_data *, proto_tree *);
190 static void dissect_in_req(const u_char *, int, frame_data *, proto_tree *);
191 static void dissect_in_reply(const u_char *, int, frame_data *, proto_tree *);
192 static void dissect_in_connected(const u_char *, int, frame_data *, proto_tree *);
193 static void dissect_clear_req(const u_char *, int, frame_data *, proto_tree *);
194 static void dissect_disc_notify(const u_char *, int, frame_data *, proto_tree *);
195 static void dissect_error_notify(const u_char *, int, frame_data *, proto_tree *);
196 static void dissect_set_link(const u_char *, int, frame_data *, proto_tree *);
198 #define NUM_CNTRL_TYPES 16
199 #define cntrltype2str(t) \
200 ((t < NUM_CNTRL_TYPES) ? strfuncs[t].str : "UNKNOWN-CONTROL-TYPE")
202 static struct strfunc {
204 void (*func)(const u_char *, int, frame_data *, proto_tree *);
205 } strfuncs[NUM_CNTRL_TYPES] = {
206 {"UNKNOWN-CONTROL-TYPE", dissect_unknown },
207 {"START-CONTROL-REQUEST", dissect_cntrl_req },
208 {"START-CONTROL-REPLY", dissect_cntrl_reply },
209 {"STOP-CONTROL-REQUEST", dissect_stop_req },
210 {"STOP-CONTROL-REPLY", dissect_stop_reply },
211 {"ECHO-REQUEST", dissect_echo_req },
212 {"ECHO-REPLY", dissect_echo_reply },
213 {"OUTGOING-CALL-REQUEST", dissect_out_req },
214 {"OUTGOING-CALL-REPLY", dissect_out_reply },
215 {"INCOMING-CALL-REQUEST", dissect_in_req },
216 {"INCOMING-CALL-REPLY", dissect_in_reply },
217 {"INCOMING-CALL-CONNECTED", dissect_in_connected },
218 {"CLEAR-CALL-REQUEST", dissect_clear_req },
219 {"DISCONNECT-NOTIFY", dissect_disc_notify },
220 {"ERROR-NOTIFY", dissect_error_notify },
221 {"SET-LINK", dissect_set_link }
387 dissect_pptp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
389 struct pptp_hdr * hdr = (struct pptp_hdr *)(pd + offset);
393 OLD_CHECK_DISPLAY_AS_DATA(proto_pptp, pd, offset, fd, tree);
395 if (check_col(fd, COL_PROTOCOL))
396 col_set_str(fd, COL_PROTOCOL, "PPTP");
398 len = pntohs(&hdr->len);
399 cntrl_type = pntohs(&hdr->cntrl_type);
401 if (check_col(fd, COL_INFO))
402 col_add_fstr(fd, COL_INFO, "%s", cntrltype2str(cntrl_type));
404 if (IS_DATA_IN_FRAME(offset) && tree) {
408 proto_tree * pptp_tree;
410 ti = proto_tree_add_item(tree, proto_pptp, NullTVB, offset, len, FALSE);
411 pptp_tree = proto_item_add_subtree(ti, ett_pptp);
413 proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->len),
415 offset += sizeof(hdr->len);
417 msg_type = pntohs(&hdr->type);
418 proto_tree_add_uint_format(pptp_tree, hf_pptp_message_type, NullTVB,
419 offset, sizeof(hdr->type),
421 "Message type: %s (%u)",
422 msgtype2str(msg_type), msg_type);
424 offset += sizeof(hdr->type);
426 cookie = pntohl(&hdr->cookie);
428 if (cookie == MAGIC_COOKIE)
429 proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cookie),
430 "Cookie: %#08x (correct)", cookie);
432 proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cookie),
433 "Cookie: %#08x (incorrect)", cookie);
434 offset += sizeof(hdr->cookie);
436 proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->cntrl_type),
437 "Control type: %s (%u)", cntrltype2str(cntrl_type), cntrl_type);
438 offset += sizeof(hdr->cntrl_type);
440 proto_tree_add_text(pptp_tree, NullTVB, offset, sizeof(hdr->resv),
441 "Reserved: %u", pntohs(&hdr->resv));
442 offset += sizeof(hdr->resv);
444 if (cntrl_type < NUM_CNTRL_TYPES)
445 ( *(strfuncs[cntrl_type].func))(pd, offset, fd, pptp_tree);
447 old_dissect_data(pd, offset, fd, pptp_tree);
452 dissect_unknown(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
453 old_dissect_data(pd, offset, fd, tree);
457 dissect_cntrl_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
459 struct cntrl_req * hdr = (struct cntrl_req *)(pd + offset);
463 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->major_ver) + sizeof(hdr->minor_ver),
464 "Protocol version: %u.%u", hdr->major_ver, hdr->minor_ver );
465 offset += sizeof(hdr->major_ver) + sizeof(hdr->minor_ver);
467 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
468 "Reserved: %u", pntohs(&hdr->resv));
469 offset += sizeof(hdr->resv);
471 frame = pntohl(&hdr->frame);
472 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->frame),
473 "Framing capabilities: %s (%u)", frametype2str(frame), frame);
474 offset += sizeof(hdr->frame);
476 bearer = pntohl(&hdr->bearer);
477 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->bearer),
478 "Bearer capabilities: %s (%u)", bearertype2str(bearer), bearer);
479 offset += sizeof(hdr->bearer);
481 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->max_chan),
482 "Maximum channels: %u", pntohs(&hdr->max_chan));
483 offset += sizeof(hdr->max_chan);
485 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->firm_rev),
486 "Firmware revision: %u", pntohs(&hdr->firm_rev));
487 offset += sizeof(hdr->firm_rev);
489 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->host),
490 "Hostname: %s", hdr->host);
491 offset += sizeof(hdr->host);
493 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->vendor),
494 "Vendor: %s", hdr->vendor);
498 dissect_cntrl_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
499 struct cntrl_reply * hdr = (struct cntrl_reply *)(pd + offset);
503 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->major_ver) + sizeof(hdr->minor_ver),
504 "Protocol version: %u.%u", hdr->major_ver, hdr->minor_ver );
505 offset += sizeof(hdr->major_ver) + sizeof(hdr->minor_ver);
507 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->result),
508 "Result: %s (%u)", cntrlresulttype2str(hdr->result), hdr->result);
509 offset += sizeof(hdr->result);
511 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->error),
512 "Error: %s (%u)", errortype2str(hdr->error), hdr->error);
513 offset += sizeof(hdr->error);
515 frame = pntohl(&hdr->frame);
516 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->frame),
517 "Framing capabilities: %s (%u)", frametype2str(frame), frame);
518 offset += sizeof(hdr->frame);
520 bearer = pntohl(&hdr->bearer);
521 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->bearer),
522 "Bearer capabilities: %s (%u)", bearertype2str(bearer), bearer);
523 offset += sizeof(hdr->bearer);
525 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->max_chan),
526 "Maximum channels: %u", pntohs(&hdr->max_chan));
527 offset += sizeof(hdr->max_chan);
529 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->firm_rev),
530 "Firmware revision: %u", pntohs(&hdr->firm_rev));
531 offset += sizeof(hdr->firm_rev);
533 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->host),
534 "Hostname: %s", hdr->host);
535 offset += sizeof(hdr->host);
537 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->vendor),
538 "Vendor: %s", hdr->vendor);
542 dissect_stop_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
543 struct stop_req * hdr = (struct stop_req *)(pd + offset);
545 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->reason),
546 "Reason: %s (%u)", reasontype2str(hdr->reason), hdr->reason);
547 offset += sizeof(hdr->reason);
549 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv0),
550 "Reserved: %u", hdr->resv0);
551 offset += sizeof(hdr->resv0);
553 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv1),
554 "Reserved: %u", pntohs(&hdr->resv1));
555 offset += sizeof(hdr->resv1);
559 dissect_stop_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
560 struct stop_reply * hdr = (struct stop_reply *)(pd + offset);
562 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->result),
563 "Result: %s (%u)", stopresulttype2str(hdr->result), hdr->result);
564 offset += sizeof(hdr->result);
566 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->error),
567 "Error: %s (%u)", errortype2str(hdr->error), hdr->error);
568 offset += sizeof(hdr->error);
570 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
571 "Reserved: %u", pntohs(&hdr->resv));
572 offset += sizeof(hdr->resv);
576 dissect_echo_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
577 struct echo_req * hdr = (struct echo_req *)(pd + offset);
579 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->ident),
580 "Identifier: %u", pntohl(&hdr->ident));
581 offset += sizeof(hdr->ident);
585 dissect_echo_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
586 struct echo_reply * hdr = (struct echo_reply *)(pd + offset);
588 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->ident),
589 "Identifier: %u", pntohl(&hdr->ident));
590 offset += sizeof(hdr->ident);
592 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->result),
593 "Result: %s (%u)", echoresulttype2str(hdr->result), hdr->result);
594 offset += sizeof(hdr->result);
596 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->error),
597 "Error: %s (%u)", errortype2str(hdr->error), hdr->error);
598 offset += sizeof(hdr->error);
600 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
601 "Reserved: %u", pntohs(&hdr->resv));
602 offset += sizeof(hdr->resv);
606 dissect_out_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
607 struct out_req * hdr = (struct out_req *)(pd + offset);
611 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_id),
612 "Call ID: %u", pntohs(&hdr->call_id));
613 offset += sizeof(hdr->call_id);
615 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_serial),
616 "Call Serial Number: %u", pntohs(&hdr->call_serial));
617 offset += sizeof(hdr->call_serial);
619 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->min_bps),
620 "Minimum BPS: %u", pntohl(&hdr->min_bps));
621 offset += sizeof(hdr->min_bps);
623 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->max_bps),
624 "Maximum BPS: %u", pntohl(&hdr->max_bps));
625 offset += sizeof(hdr->max_bps);
627 bearer = pntohl(&hdr->bearer);
628 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->bearer),
629 "Bearer capabilities: %s (%u)", bearertype2str(bearer), bearer);
630 offset += sizeof(hdr->bearer);
632 frame = pntohl(&hdr->frame);
633 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->frame),
634 "Framing capabilities: %s (%u)", frametype2str(frame), frame);
635 offset += sizeof(hdr->frame);
637 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->win_size),
638 "Receive window size: %u", pntohs(&hdr->win_size));
639 offset += sizeof(hdr->win_size);
641 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->delay),
642 "Processing delay: %u", pntohs(&hdr->delay));
643 offset += sizeof(hdr->delay);
645 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->phone_len),
646 "Phone number length: %u", pntohs(&hdr->phone_len));
647 offset += sizeof(hdr->phone_len);
649 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
650 "Reserved: %u", pntohs(&hdr->resv));
651 offset += sizeof(hdr->resv);
653 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->phone),
654 "Phone number: %s", hdr->phone);
655 offset += sizeof(hdr->phone);
657 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->subaddr),
658 "Subaddress: %s", hdr->subaddr);
659 offset += sizeof(hdr->subaddr);
663 dissect_out_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
664 struct out_reply * hdr = (struct out_reply *)(pd + offset);
666 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_id),
667 "Call ID: %u", pntohs(&hdr->call_id));
668 offset += sizeof(hdr->call_id);
670 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->peer_id),
671 "Peer's call ID: %u", pntohs(&hdr->peer_id));
672 offset += sizeof(hdr->peer_id);
674 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->result),
675 "Result: %s (%u)", outresulttype2str(hdr->result), hdr->result);
676 offset += sizeof(hdr->result);
678 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->error),
679 "Error: %s (%u)", errortype2str(hdr->error), hdr->error);
680 offset += sizeof(hdr->error);
682 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->cause),
683 "Cause code: %u", pntohs(&hdr->cause));
684 offset += sizeof(hdr->cause);
686 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->speed),
687 "Connect speed: %u", pntohl(&hdr->speed));
688 offset += sizeof(hdr->speed);
690 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->win_size),
691 "Receive window size: %u", pntohs(&hdr->win_size));
692 offset += sizeof(hdr->win_size);
694 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->delay),
695 "Processing delay: %u", pntohs(&hdr->delay));
696 offset += sizeof(hdr->delay);
698 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->channel_id),
699 "Physical channel ID: %u", pntohl(&hdr->channel_id));
700 offset += sizeof(hdr->channel_id);
705 dissect_in_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
706 struct in_req * hdr = (struct in_req *)(pd + offset);
709 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_id),
710 "Call ID: %u", pntohs(&hdr->call_id));
711 offset += sizeof(hdr->call_id);
713 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_serial),
714 "Call serial number: %u", pntohs(&hdr->call_serial));
715 offset += sizeof(hdr->call_serial);
717 bearer = pntohl(&hdr->bearer);
718 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->bearer),
719 "Bearer capabilities: %s (%u)", bearertype2str(bearer), bearer);
720 offset += sizeof(hdr->bearer);
722 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->channel_id),
723 "Physical channel ID: %u", pntohl(&hdr->channel_id));
724 offset += sizeof(hdr->channel_id);
726 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->dialed_len),
727 "Dialed number length: %u", pntohs(&hdr->dialed_len));
728 offset += sizeof(hdr->dialed_len);
730 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->dialing_len),
731 "Dialing number length: %u", pntohs(&hdr->dialing_len));
732 offset += sizeof(hdr->dialing_len);
734 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->dialed),
735 "Dialed number: %s", hdr->dialed);
736 offset += sizeof(hdr->dialed);
738 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->dialing),
739 "Dialing number: %s", hdr->dialing);
740 offset += sizeof(hdr->dialing);
742 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->subaddr),
743 "Subaddress: %s", hdr->subaddr);
744 offset += sizeof(hdr->subaddr);
748 dissect_in_reply(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
749 struct in_reply * hdr = (struct in_reply *)(pd + offset);
751 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_id),
752 "Call ID: %u", pntohs(&hdr->call_id));
753 offset += sizeof(hdr->call_id);
755 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->peer_id),
756 "Peer's call ID: %u", pntohs(&hdr->peer_id));
757 offset += sizeof(hdr->peer_id);
759 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->result),
760 "Result: %s (%u)", inresulttype2str(hdr->result), hdr->result);
761 offset += sizeof(hdr->result);
763 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->error),
764 "Error: %s (%u)", errortype2str(hdr->error), hdr->error);
765 offset += sizeof(hdr->error);
767 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->win_size),
768 "Receive window size: %u", pntohs(&hdr->win_size));
769 offset += sizeof(hdr->win_size);
771 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->delay),
772 "Processing delay: %u", pntohs(&hdr->delay));
773 offset += sizeof(hdr->delay);
775 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
776 "Reserved: %u", hdr->resv);
777 offset += sizeof(hdr->resv);
781 dissect_in_connected(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
782 struct in_connected * hdr = (struct in_connected *)(pd + offset);
785 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->peer_id),
786 "Peer's call ID: %u", pntohs(&hdr->peer_id));
787 offset += sizeof(hdr->peer_id);
789 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
790 "Reserved: %u", pntohs(&hdr->resv));
791 offset += sizeof(hdr->resv);
793 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->speed),
794 "Connect speed: %u", pntohl(&hdr->speed));
795 offset += sizeof(hdr->speed);
797 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->win_size),
798 "Receive window size: %u", pntohs(&hdr->win_size));
799 offset += sizeof(hdr->win_size);
801 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->delay),
802 "Processing delay: %u", pntohs(&hdr->delay));
803 offset += sizeof(hdr->delay);
805 frame = pntohl(&hdr->frame);
806 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->frame),
807 "Framing capabilities: %s (%u)", frametype2str(frame), frame);
808 offset += sizeof(hdr->frame);
812 dissect_clear_req(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
813 struct clear_req * hdr = (struct clear_req *)(pd + offset);
815 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_id),
816 "Call ID: %u", pntohs(&hdr->call_id));
817 offset += sizeof(hdr->call_id);
819 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
820 "Reserved: %u", pntohs(&hdr->resv));
821 offset += sizeof(hdr->resv);
825 dissect_disc_notify(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
826 struct disc_notify * hdr = (struct disc_notify *)(pd + offset);
828 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->call_id),
829 "Call ID: %u", pntohs(&hdr->call_id));
830 offset += sizeof(hdr->call_id);
832 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->result),
833 "Result: %s (%u)", discresulttype2str(hdr->result), hdr->result);
834 offset += sizeof(hdr->result);
836 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->error),
837 "Error: %s (%u)", errortype2str(hdr->error), hdr->error);
838 offset += sizeof(hdr->error);
840 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->cause),
841 "Cause code: %u", pntohs(&hdr->cause));
842 offset += sizeof(hdr->cause);
844 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
845 "Reserved: %u", pntohs(&hdr->resv));
846 offset += sizeof(hdr->resv);
848 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->stats),
849 "Call statistics: %s", hdr->stats);
850 offset += sizeof(hdr->stats);
854 dissect_error_notify(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
855 struct error_notify * hdr = (struct error_notify *)(pd + offset);
857 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->peer_id),
858 "Peer's call ID: %u", pntohs(&hdr->peer_id));
859 offset += sizeof(hdr->peer_id);
861 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
862 "Reserved: %u", pntohs(&hdr->resv));
863 offset += sizeof(hdr->resv);
865 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->crc),
866 "CRC errors: %u", pntohl(&hdr->crc));
867 offset += sizeof(hdr->crc);
869 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->frame),
870 "Framing errors: %u", pntohl(&hdr->frame));
871 offset += sizeof(hdr->frame);
873 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->hardware),
874 "Hardware overruns: %u", pntohl(&hdr->hardware));
875 offset += sizeof(hdr->hardware);
877 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->buffer),
878 "Buffer overruns: %u", pntohl(&hdr->buffer));
879 offset += sizeof(hdr->buffer);
881 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->timeout),
882 "Time-out errors: %u", pntohl(&hdr->timeout));
883 offset += sizeof(hdr->timeout);
885 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->alignment),
886 "Alignment errors: %u", pntohl(&hdr->alignment));
887 offset += sizeof(hdr->alignment);
891 dissect_set_link(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
892 struct set_link * hdr = (struct set_link *)(pd + offset);
894 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->peer_id),
895 "Peer's call ID: %u", pntohs(&hdr->peer_id));
896 offset += sizeof(hdr->peer_id);
898 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->resv),
899 "Reserved: %u", pntohs(&hdr->resv));
900 offset += sizeof(hdr->resv);
902 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->send_acm),
903 "Send ACCM: %#08x", pntohl(&hdr->send_acm));
904 offset += sizeof(hdr->send_acm);
906 proto_tree_add_text(tree, NullTVB, offset, sizeof(hdr->recv_acm),
907 "Recv ACCM: %#08x", pntohl(&hdr->recv_acm));
908 offset += sizeof(hdr->recv_acm);
912 proto_register_pptp(void)
914 static gint *ett[] = {
918 static hf_register_info hf[] = {
919 { &hf_pptp_message_type,
920 { "Message Type", "pptp.type",
921 FT_UINT16, BASE_HEX, NULL, 0x0,
922 "PPTP message type" }}
925 proto_pptp = proto_register_protocol("Point-to-Point Tunnelling Protocol",
927 proto_register_field_array(proto_pptp, hf, array_length(hf));
928 proto_register_subtree_array(ett, array_length(ett));
932 proto_reg_handoff_pptp(void)
934 old_dissector_add("tcp.port", TCP_PORT_PPTP, dissect_pptp);