4 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that: (1) source code distributions
9 * retain the above copyright notice and this paragraph in its entirety, (2)
10 * distributions including binary code include the above copyright notice and
11 * this paragraph in its entirety in the documentation or other materials
12 * provided with the distribution, and (3) all advertising materials mentioning
13 * features or use of this software display the following acknowledgement:
14 * ``This product includes software developed by the University of California,
15 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
16 * the University nor the names of its contributors may be used to endorse
17 * or promote products derived from this software without specific prior
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 * PPTP support contributed by Motonori Shindo (mshindo@mshindo.net)
27 #include <sys/cdefs.h>
30 static const char rcsid
[] _U_
=
31 "@(#) Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.11.2.1 2006/06/23 02:07:27 hannes Exp";
33 __RCSID("$NetBSD: tcpdump2rcsid.ex,v 1.1 2001/06/25 20:09:58 itojun Exp $");
41 #include <tcpdump-stdinc.h>
45 #include "interface.h"
48 static char tstr
[] = " [|pptp]";
50 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
51 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
52 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
54 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
55 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
56 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
57 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
58 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
59 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
60 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
61 #define PPTP_CTRL_MSG_TYPE_OCRP 8
62 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
63 #define PPTP_CTRL_MSG_TYPE_ICRP 10
64 #define PPTP_CTRL_MSG_TYPE_ICCN 11
65 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
66 #define PPTP_CTRL_MSG_TYPE_CDN 13
67 #define PPTP_CTRL_MSG_TYPE_WEN 14
68 #define PPTP_CTRL_MSG_TYPE_SLI 15
70 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
71 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
73 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
74 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
76 static const char *pptp_message_type_string
[] = {
77 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
78 "SCCRQ", /* 1 Start-Control-Connection-Request */
79 "SCCRP", /* 2 Start-Control-Connection-Reply */
80 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
81 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
82 "ECHORQ", /* 5 Echo Request */
83 "ECHORP", /* 6 Echo Reply */
85 "OCRQ", /* 7 Outgoing-Call-Request */
86 "OCRP", /* 8 Outgoing-Call-Reply */
87 "ICRQ", /* 9 Incoming-Call-Request */
88 "ICRP", /* 10 Incoming-Call-Reply */
89 "ICCN", /* 11 Incoming-Call-Connected */
90 "CCRQ", /* 12 Call-Clear-Request */
91 "CDN", /* 13 Call-Disconnect-Notify */
93 "WEN", /* 14 WAN-Error-Notify */
95 "SLI" /* 15 Set-Link-Info */
96 #define PPTP_MAX_MSGTYPE_INDEX 16
99 /* common for all PPTP control messages */
103 u_int32_t magic_cookie
;
104 u_int16_t ctrl_msg_type
;
108 struct pptp_msg_sccrq
{
111 u_int32_t framing_cap
;
112 u_int32_t bearer_cap
;
113 u_int16_t max_channel
;
119 struct pptp_msg_sccrp
{
121 u_int8_t result_code
;
123 u_int32_t framing_cap
;
124 u_int32_t bearer_cap
;
125 u_int16_t max_channel
;
131 struct pptp_msg_stopccrq
{
137 struct pptp_msg_stopccrp
{
138 u_int8_t result_code
;
143 struct pptp_msg_echorq
{
147 struct pptp_msg_echorp
{
149 u_int8_t result_code
;
154 struct pptp_msg_ocrq
{
159 u_int32_t bearer_type
;
160 u_int32_t framing_type
;
161 u_int16_t recv_winsiz
;
162 u_int16_t pkt_proc_delay
;
163 u_int16_t phone_no_len
;
169 struct pptp_msg_ocrp
{
171 u_int16_t peer_call_id
;
172 u_int8_t result_code
;
174 u_int16_t cause_code
;
175 u_int32_t conn_speed
;
176 u_int16_t recv_winsiz
;
177 u_int16_t pkt_proc_delay
;
178 u_int32_t phy_chan_id
;
181 struct pptp_msg_icrq
{
184 u_int32_t bearer_type
;
185 u_int32_t phy_chan_id
;
186 u_int16_t dialed_no_len
;
187 u_int16_t dialing_no_len
;
188 u_char dialed_no
[64]; /* DNIS */
189 u_char dialing_no
[64]; /* CLID */
193 struct pptp_msg_icrp
{
195 u_int16_t peer_call_id
;
196 u_int8_t result_code
;
198 u_int16_t recv_winsiz
;
199 u_int16_t pkt_proc_delay
;
203 struct pptp_msg_iccn
{
204 u_int16_t peer_call_id
;
206 u_int32_t conn_speed
;
207 u_int16_t recv_winsiz
;
208 u_int16_t pkt_proc_delay
;
209 u_int32_t framing_type
;
212 struct pptp_msg_ccrq
{
217 struct pptp_msg_cdn
{
219 u_int8_t result_code
;
221 u_int16_t cause_code
;
223 u_char call_stats
[128];
226 struct pptp_msg_wen
{
227 u_int16_t peer_call_id
;
230 u_int32_t framing_err
;
231 u_int32_t hardware_overrun
;
232 u_int32_t buffer_overrun
;
233 u_int32_t timeout_err
;
237 struct pptp_msg_sli
{
238 u_int16_t peer_call_id
;
244 /* attributes that appear more than once in above messages:
248 --------------------------------------
249 2 u_int32_t bearer_cap;
250 2 u_int32_t bearer_type;
252 2 u_int16_t call_ser;
253 2 u_int16_t cause_code;
254 2 u_int32_t conn_speed;
256 2 u_int16_t firm_rev;
257 2 u_int32_t framing_cap;
258 2 u_int32_t framing_type;
259 2 u_char hostname[64];
261 2 u_int16_t max_channel;
262 5 u_int16_t peer_call_id;
263 2 u_int32_t phy_chan_id;
264 4 u_int16_t pkt_proc_delay;
265 2 u_int16_t proto_ver;
266 4 u_int16_t recv_winsiz;
267 2 u_int8_t reserved1;
268 9 u_int16_t reserved1;
269 6 u_int8_t result_code;
270 2 u_char subaddr[64];
273 so I will prepare print out functions for these attributes (except for
277 /******************************************/
278 /* Attribute-specific print out functions */
279 /******************************************/
281 /* In these attribute-specific print-out functions, it't not necessary
282 to do TCHECK because they are already checked in the caller of
286 pptp_bearer_cap_print(const u_int32_t
*bearer_cap
)
288 printf(" BEARER_CAP(");
289 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
) {
292 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
) {
299 pptp_bearer_type_print(const u_int32_t
*bearer_type
)
301 printf(" BEARER_TYPE(");
302 switch (EXTRACT_32BITS(bearer_type
)) {
304 printf("A"); /* Analog */
307 printf("D"); /* Digital */
320 pptp_call_id_print(const u_int16_t
*call_id
)
322 printf(" CALL_ID(%u)", EXTRACT_16BITS(call_id
));
326 pptp_call_ser_print(const u_int16_t
*call_ser
)
328 printf(" CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
));
332 pptp_cause_code_print(const u_int16_t
*cause_code
)
334 printf(" CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
));
338 pptp_conn_speed_print(const u_int32_t
*conn_speed
)
340 printf(" CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
));
344 pptp_err_code_print(const u_int8_t
*err_code
)
346 printf(" ERR_CODE(%u", *err_code
);
353 printf(":Not-Connected");
356 printf(":Bad-Format");
359 printf(":Bad-Valude");
362 printf(":No-Resource");
365 printf(":Bad-Call-ID");
368 printf(":PAC-Error");
379 pptp_firm_rev_print(const u_int16_t
*firm_rev
)
381 printf(" FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
));
385 pptp_framing_cap_print(const u_int32_t
*framing_cap
)
387 printf(" FRAME_CAP(");
388 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
389 printf("A"); /* Async */
391 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
392 printf("S"); /* Sync */
398 pptp_framing_type_print(const u_int32_t
*framing_type
)
400 printf(" FRAME_TYPE(");
401 switch (EXTRACT_32BITS(framing_type
)) {
403 printf("A"); /* Async */
406 printf("S"); /* Sync */
409 printf("E"); /* Either */
419 pptp_hostname_print(const u_char
*hostname
)
421 printf(" HOSTNAME(%.64s)", hostname
);
425 pptp_id_print(const u_int32_t
*id
)
427 printf(" ID(%u)", EXTRACT_32BITS(id
));
431 pptp_max_channel_print(const u_int16_t
*max_channel
)
433 printf(" MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
));
437 pptp_peer_call_id_print(const u_int16_t
*peer_call_id
)
439 printf(" PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
));
443 pptp_phy_chan_id_print(const u_int32_t
*phy_chan_id
)
445 printf(" PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
));
449 pptp_pkt_proc_delay_print(const u_int16_t
*pkt_proc_delay
)
451 printf(" PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
));
455 pptp_proto_ver_print(const u_int16_t
*proto_ver
)
457 printf(" PROTO_VER(%u.%u)", /* Version.Revision */
458 EXTRACT_16BITS(proto_ver
) >> 8,
459 EXTRACT_16BITS(proto_ver
) & 0xff);
463 pptp_recv_winsiz_print(const u_int16_t
*recv_winsiz
)
465 printf(" RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
));
469 pptp_result_code_print(const u_int8_t
*result_code
, int ctrl_msg_type
)
471 printf(" RESULT_CODE(%u", *result_code
);
473 switch (ctrl_msg_type
) {
474 case PPTP_CTRL_MSG_TYPE_SCCRP
:
475 switch (*result_code
) {
477 printf(":Successful channel establishment");
480 printf(":General error");
483 printf(":Command channel already exists");
486 printf(":Requester is not authorized to establish a command channel");
489 printf(":The protocol version of the requester is not supported");
496 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
497 case PPTP_CTRL_MSG_TYPE_ECHORP
:
498 switch (*result_code
) {
503 printf(":General Error");
510 case PPTP_CTRL_MSG_TYPE_OCRP
:
511 switch (*result_code
) {
513 printf(":Connected");
516 printf(":General Error");
519 printf(":No Carrier");
525 printf(":No Dial Tone");
531 printf(":Do Not Accept");
538 case PPTP_CTRL_MSG_TYPE_ICRP
:
539 switch (*result_code
) {
544 printf(":General Error");
547 printf(":Do Not Accept");
554 case PPTP_CTRL_MSG_TYPE_CDN
:
555 switch (*result_code
) {
557 printf(":Lost Carrier");
560 printf(":General Error");
563 printf(":Admin Shutdown");
573 /* assertion error */
581 pptp_subaddr_print(const u_char
*subaddr
)
583 printf(" SUB_ADDR(%.64s)", subaddr
);
587 pptp_vendor_print(const u_char
*vendor
)
589 printf(" VENDOR(%.64s)", vendor
);
592 /************************************/
593 /* PPTP message print out functions */
594 /************************************/
596 pptp_sccrq_print(const u_char
*dat
)
598 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
600 TCHECK(ptr
->proto_ver
);
601 pptp_proto_ver_print(&ptr
->proto_ver
);
602 TCHECK(ptr
->reserved1
);
603 TCHECK(ptr
->framing_cap
);
604 pptp_framing_cap_print(&ptr
->framing_cap
);
605 TCHECK(ptr
->bearer_cap
);
606 pptp_bearer_cap_print(&ptr
->bearer_cap
);
607 TCHECK(ptr
->max_channel
);
608 pptp_max_channel_print(&ptr
->max_channel
);
609 TCHECK(ptr
->firm_rev
);
610 pptp_firm_rev_print(&ptr
->firm_rev
);
611 TCHECK(ptr
->hostname
);
612 pptp_hostname_print(&ptr
->hostname
[0]);
614 pptp_vendor_print(&ptr
->vendor
[0]);
623 pptp_sccrp_print(const u_char
*dat
)
625 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
627 TCHECK(ptr
->proto_ver
);
628 pptp_proto_ver_print(&ptr
->proto_ver
);
629 TCHECK(ptr
->result_code
);
630 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
631 TCHECK(ptr
->err_code
);
632 pptp_err_code_print(&ptr
->err_code
);
633 TCHECK(ptr
->framing_cap
);
634 pptp_framing_cap_print(&ptr
->framing_cap
);
635 TCHECK(ptr
->bearer_cap
);
636 pptp_bearer_cap_print(&ptr
->bearer_cap
);
637 TCHECK(ptr
->max_channel
);
638 pptp_max_channel_print(&ptr
->max_channel
);
639 TCHECK(ptr
->firm_rev
);
640 pptp_firm_rev_print(&ptr
->firm_rev
);
641 TCHECK(ptr
->hostname
);
642 pptp_hostname_print(&ptr
->hostname
[0]);
644 pptp_vendor_print(&ptr
->vendor
[0]);
653 pptp_stopccrq_print(const u_char
*dat
)
655 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
658 printf(" REASON(%u", ptr
->reason
);
660 switch (ptr
->reason
) {
665 printf(":Stop-Protocol");
668 printf(":Stop-Local-Shutdown");
676 TCHECK(ptr
->reserved1
);
677 TCHECK(ptr
->reserved2
);
686 pptp_stopccrp_print(const u_char
*dat
)
688 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
690 TCHECK(ptr
->result_code
);
691 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
692 TCHECK(ptr
->err_code
);
693 pptp_err_code_print(&ptr
->err_code
);
694 TCHECK(ptr
->reserved1
);
703 pptp_echorq_print(const u_char
*dat
)
705 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
708 pptp_id_print(&ptr
->id
);
717 pptp_echorp_print(const u_char
*dat
)
719 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
722 pptp_id_print(&ptr
->id
);
723 TCHECK(ptr
->result_code
);
724 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
725 TCHECK(ptr
->err_code
);
726 pptp_err_code_print(&ptr
->err_code
);
727 TCHECK(ptr
->reserved1
);
736 pptp_ocrq_print(const u_char
*dat
)
738 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
740 TCHECK(ptr
->call_id
);
741 pptp_call_id_print(&ptr
->call_id
);
742 TCHECK(ptr
->call_ser
);
743 pptp_call_ser_print(&ptr
->call_ser
);
744 TCHECK(ptr
->min_bps
);
745 printf(" MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
));
746 TCHECK(ptr
->max_bps
);
747 printf(" MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
));
748 TCHECK(ptr
->bearer_type
);
749 pptp_bearer_type_print(&ptr
->bearer_type
);
750 TCHECK(ptr
->framing_type
);
751 pptp_framing_type_print(&ptr
->framing_type
);
752 TCHECK(ptr
->recv_winsiz
);
753 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
754 TCHECK(ptr
->pkt_proc_delay
);
755 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
756 TCHECK(ptr
->phone_no_len
);
757 printf(" PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
));
758 TCHECK(ptr
->reserved1
);
759 TCHECK(ptr
->phone_no
);
760 printf(" PHONE_NO(%.64s)", ptr
->phone_no
);
761 TCHECK(ptr
->subaddr
);
762 pptp_subaddr_print(&ptr
->subaddr
[0]);
771 pptp_ocrp_print(const u_char
*dat
)
773 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
775 TCHECK(ptr
->call_id
);
776 pptp_call_id_print(&ptr
->call_id
);
777 TCHECK(ptr
->peer_call_id
);
778 pptp_peer_call_id_print(&ptr
->peer_call_id
);
779 TCHECK(ptr
->result_code
);
780 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
781 TCHECK(ptr
->err_code
);
782 pptp_err_code_print(&ptr
->err_code
);
783 TCHECK(ptr
->cause_code
);
784 pptp_cause_code_print(&ptr
->cause_code
);
785 TCHECK(ptr
->conn_speed
);
786 pptp_conn_speed_print(&ptr
->conn_speed
);
787 TCHECK(ptr
->recv_winsiz
);
788 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
789 TCHECK(ptr
->pkt_proc_delay
);
790 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
791 TCHECK(ptr
->phy_chan_id
);
792 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
801 pptp_icrq_print(const u_char
*dat
)
803 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
805 TCHECK(ptr
->call_id
);
806 pptp_call_id_print(&ptr
->call_id
);
807 TCHECK(ptr
->call_ser
);
808 pptp_call_ser_print(&ptr
->call_ser
);
809 TCHECK(ptr
->bearer_type
);
810 pptp_bearer_type_print(&ptr
->bearer_type
);
811 TCHECK(ptr
->phy_chan_id
);
812 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
813 TCHECK(ptr
->dialed_no_len
);
814 printf(" DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
));
815 TCHECK(ptr
->dialing_no_len
);
816 printf(" DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
));
817 TCHECK(ptr
->dialed_no
);
818 printf(" DIALED_NO(%.64s)", ptr
->dialed_no
);
819 TCHECK(ptr
->dialing_no
);
820 printf(" DIALING_NO(%.64s)", ptr
->dialing_no
);
821 TCHECK(ptr
->subaddr
);
822 pptp_subaddr_print(&ptr
->subaddr
[0]);
831 pptp_icrp_print(const u_char
*dat
)
833 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
835 TCHECK(ptr
->call_id
);
836 pptp_call_id_print(&ptr
->call_id
);
837 TCHECK(ptr
->peer_call_id
);
838 pptp_peer_call_id_print(&ptr
->peer_call_id
);
839 TCHECK(ptr
->result_code
);
840 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
841 TCHECK(ptr
->err_code
);
842 pptp_err_code_print(&ptr
->err_code
);
843 TCHECK(ptr
->recv_winsiz
);
844 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
845 TCHECK(ptr
->pkt_proc_delay
);
846 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
847 TCHECK(ptr
->reserved1
);
856 pptp_iccn_print(const u_char
*dat
)
858 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
860 TCHECK(ptr
->peer_call_id
);
861 pptp_peer_call_id_print(&ptr
->peer_call_id
);
862 TCHECK(ptr
->reserved1
);
863 TCHECK(ptr
->conn_speed
);
864 pptp_conn_speed_print(&ptr
->conn_speed
);
865 TCHECK(ptr
->recv_winsiz
);
866 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
867 TCHECK(ptr
->pkt_proc_delay
);
868 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
869 TCHECK(ptr
->framing_type
);
870 pptp_framing_type_print(&ptr
->framing_type
);
879 pptp_ccrq_print(const u_char
*dat
)
881 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
883 TCHECK(ptr
->call_id
);
884 pptp_call_id_print(&ptr
->call_id
);
885 TCHECK(ptr
->reserved1
);
894 pptp_cdn_print(const u_char
*dat
)
896 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
898 TCHECK(ptr
->call_id
);
899 pptp_call_id_print(&ptr
->call_id
);
900 TCHECK(ptr
->result_code
);
901 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
902 TCHECK(ptr
->err_code
);
903 pptp_err_code_print(&ptr
->err_code
);
904 TCHECK(ptr
->cause_code
);
905 pptp_cause_code_print(&ptr
->cause_code
);
906 TCHECK(ptr
->reserved1
);
907 TCHECK(ptr
->call_stats
);
908 printf(" CALL_STATS(%.128s)", ptr
->call_stats
);
917 pptp_wen_print(const u_char
*dat
)
919 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
921 TCHECK(ptr
->peer_call_id
);
922 pptp_peer_call_id_print(&ptr
->peer_call_id
);
923 TCHECK(ptr
->reserved1
);
924 TCHECK(ptr
->crc_err
);
925 printf(" CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
));
926 TCHECK(ptr
->framing_err
);
927 printf(" FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
));
928 TCHECK(ptr
->hardware_overrun
);
929 printf(" HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
));
930 TCHECK(ptr
->buffer_overrun
);
931 printf(" BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
));
932 TCHECK(ptr
->timeout_err
);
933 printf(" TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
));
934 TCHECK(ptr
->align_err
);
935 printf(" ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
));
944 pptp_sli_print(const u_char
*dat
)
946 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
948 TCHECK(ptr
->peer_call_id
);
949 pptp_peer_call_id_print(&ptr
->peer_call_id
);
950 TCHECK(ptr
->reserved1
);
951 TCHECK(ptr
->send_accm
);
952 printf(" SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
));
953 TCHECK(ptr
->recv_accm
);
954 printf(" RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
));
963 pptp_print(const u_char
*dat
)
965 const struct pptp_hdr
*hdr
;
967 u_int16_t ctrl_msg_type
;
971 hdr
= (struct pptp_hdr
*)dat
;
975 printf(" Length=%u", EXTRACT_16BITS(&hdr
->length
));
977 TCHECK(hdr
->msg_type
);
979 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
980 case PPTP_MSG_TYPE_CTRL
:
983 case PPTP_MSG_TYPE_MGMT
:
987 printf(" UNKNOWN-MSG-TYPE");
992 TCHECK(hdr
->magic_cookie
);
993 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
994 if (mc
!= PPTP_MAGIC_COOKIE
) {
995 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
997 if (vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
998 printf(" Magic-Cookie=%08x", mc
);
1000 TCHECK(hdr
->ctrl_msg_type
);
1001 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
1002 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
1003 printf(" CTRL_MSGTYPE=%s",
1004 pptp_message_type_string
[ctrl_msg_type
]);
1006 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
1008 TCHECK(hdr
->reserved0
);
1012 switch(ctrl_msg_type
) {
1013 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1014 pptp_sccrq_print(dat
);
1016 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1017 pptp_sccrp_print(dat
);
1019 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1020 pptp_stopccrq_print(dat
);
1022 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1023 pptp_stopccrp_print(dat
);
1025 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1026 pptp_echorq_print(dat
);
1028 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1029 pptp_echorp_print(dat
);
1031 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1032 pptp_ocrq_print(dat
);
1034 case PPTP_CTRL_MSG_TYPE_OCRP
:
1035 pptp_ocrp_print(dat
);
1037 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1038 pptp_icrq_print(dat
);
1040 case PPTP_CTRL_MSG_TYPE_ICRP
:
1041 pptp_icrp_print(dat
);
1043 case PPTP_CTRL_MSG_TYPE_ICCN
:
1044 pptp_iccn_print(dat
);
1046 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1047 pptp_ccrq_print(dat
);
1049 case PPTP_CTRL_MSG_TYPE_CDN
:
1050 pptp_cdn_print(dat
);
1052 case PPTP_CTRL_MSG_TYPE_WEN
:
1053 pptp_wen_print(dat
);
1055 case PPTP_CTRL_MSG_TYPE_SLI
:
1056 pptp_sli_print(dat
);