2 * Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
9 * this paragraph in its entirety in the documentation or other materials
10 * provided with the distribution, and (3) all advertising materials mentioning
11 * features or use of this software display the following acknowledgement:
12 * ``This product includes software developed by the University of California,
13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14 * the University nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 * PPTP support contributed by Motonori Shindo (mshindo@mshindo.net)
26 static const char rcsid
[] _U_
=
27 "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.12 2006-06-23 02:03:09 hannes Exp $";
34 #include <tcpdump-stdinc.h>
38 #include "interface.h"
41 static char tstr
[] = " [|pptp]";
43 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
44 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
45 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
47 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
48 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
49 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
50 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
51 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
52 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
53 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
54 #define PPTP_CTRL_MSG_TYPE_OCRP 8
55 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
56 #define PPTP_CTRL_MSG_TYPE_ICRP 10
57 #define PPTP_CTRL_MSG_TYPE_ICCN 11
58 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
59 #define PPTP_CTRL_MSG_TYPE_CDN 13
60 #define PPTP_CTRL_MSG_TYPE_WEN 14
61 #define PPTP_CTRL_MSG_TYPE_SLI 15
63 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
64 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
66 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
67 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
69 static const char *pptp_message_type_string
[] = {
70 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
71 "SCCRQ", /* 1 Start-Control-Connection-Request */
72 "SCCRP", /* 2 Start-Control-Connection-Reply */
73 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
74 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
75 "ECHORQ", /* 5 Echo Request */
76 "ECHORP", /* 6 Echo Reply */
78 "OCRQ", /* 7 Outgoing-Call-Request */
79 "OCRP", /* 8 Outgoing-Call-Reply */
80 "ICRQ", /* 9 Incoming-Call-Request */
81 "ICRP", /* 10 Incoming-Call-Reply */
82 "ICCN", /* 11 Incoming-Call-Connected */
83 "CCRQ", /* 12 Call-Clear-Request */
84 "CDN", /* 13 Call-Disconnect-Notify */
86 "WEN", /* 14 WAN-Error-Notify */
88 "SLI" /* 15 Set-Link-Info */
89 #define PPTP_MAX_MSGTYPE_INDEX 16
92 /* common for all PPTP control messages */
96 u_int32_t magic_cookie
;
97 u_int16_t ctrl_msg_type
;
101 struct pptp_msg_sccrq
{
104 u_int32_t framing_cap
;
105 u_int32_t bearer_cap
;
106 u_int16_t max_channel
;
112 struct pptp_msg_sccrp
{
114 u_int8_t result_code
;
116 u_int32_t framing_cap
;
117 u_int32_t bearer_cap
;
118 u_int16_t max_channel
;
124 struct pptp_msg_stopccrq
{
130 struct pptp_msg_stopccrp
{
131 u_int8_t result_code
;
136 struct pptp_msg_echorq
{
140 struct pptp_msg_echorp
{
142 u_int8_t result_code
;
147 struct pptp_msg_ocrq
{
152 u_int32_t bearer_type
;
153 u_int32_t framing_type
;
154 u_int16_t recv_winsiz
;
155 u_int16_t pkt_proc_delay
;
156 u_int16_t phone_no_len
;
162 struct pptp_msg_ocrp
{
164 u_int16_t peer_call_id
;
165 u_int8_t result_code
;
167 u_int16_t cause_code
;
168 u_int32_t conn_speed
;
169 u_int16_t recv_winsiz
;
170 u_int16_t pkt_proc_delay
;
171 u_int32_t phy_chan_id
;
174 struct pptp_msg_icrq
{
177 u_int32_t bearer_type
;
178 u_int32_t phy_chan_id
;
179 u_int16_t dialed_no_len
;
180 u_int16_t dialing_no_len
;
181 u_char dialed_no
[64]; /* DNIS */
182 u_char dialing_no
[64]; /* CLID */
186 struct pptp_msg_icrp
{
188 u_int16_t peer_call_id
;
189 u_int8_t result_code
;
191 u_int16_t recv_winsiz
;
192 u_int16_t pkt_proc_delay
;
196 struct pptp_msg_iccn
{
197 u_int16_t peer_call_id
;
199 u_int32_t conn_speed
;
200 u_int16_t recv_winsiz
;
201 u_int16_t pkt_proc_delay
;
202 u_int32_t framing_type
;
205 struct pptp_msg_ccrq
{
210 struct pptp_msg_cdn
{
212 u_int8_t result_code
;
214 u_int16_t cause_code
;
216 u_char call_stats
[128];
219 struct pptp_msg_wen
{
220 u_int16_t peer_call_id
;
223 u_int32_t framing_err
;
224 u_int32_t hardware_overrun
;
225 u_int32_t buffer_overrun
;
226 u_int32_t timeout_err
;
230 struct pptp_msg_sli
{
231 u_int16_t peer_call_id
;
237 /* attributes that appear more than once in above messages:
241 --------------------------------------
242 2 u_int32_t bearer_cap;
243 2 u_int32_t bearer_type;
245 2 u_int16_t call_ser;
246 2 u_int16_t cause_code;
247 2 u_int32_t conn_speed;
249 2 u_int16_t firm_rev;
250 2 u_int32_t framing_cap;
251 2 u_int32_t framing_type;
252 2 u_char hostname[64];
254 2 u_int16_t max_channel;
255 5 u_int16_t peer_call_id;
256 2 u_int32_t phy_chan_id;
257 4 u_int16_t pkt_proc_delay;
258 2 u_int16_t proto_ver;
259 4 u_int16_t recv_winsiz;
260 2 u_int8_t reserved1;
261 9 u_int16_t reserved1;
262 6 u_int8_t result_code;
263 2 u_char subaddr[64];
266 so I will prepare print out functions for these attributes (except for
270 /******************************************/
271 /* Attribute-specific print out functions */
272 /******************************************/
274 /* In these attribute-specific print-out functions, it't not necessary
275 to do TCHECK because they are already checked in the caller of
279 pptp_bearer_cap_print(const u_int32_t
*bearer_cap
)
281 printf(" BEARER_CAP(");
282 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
) {
285 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
) {
292 pptp_bearer_type_print(const u_int32_t
*bearer_type
)
294 printf(" BEARER_TYPE(");
295 switch (EXTRACT_32BITS(bearer_type
)) {
297 printf("A"); /* Analog */
300 printf("D"); /* Digital */
313 pptp_call_id_print(const u_int16_t
*call_id
)
315 printf(" CALL_ID(%u)", EXTRACT_16BITS(call_id
));
319 pptp_call_ser_print(const u_int16_t
*call_ser
)
321 printf(" CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
));
325 pptp_cause_code_print(const u_int16_t
*cause_code
)
327 printf(" CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
));
331 pptp_conn_speed_print(const u_int32_t
*conn_speed
)
333 printf(" CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
));
337 pptp_err_code_print(const u_int8_t
*err_code
)
339 printf(" ERR_CODE(%u", *err_code
);
346 printf(":Not-Connected");
349 printf(":Bad-Format");
352 printf(":Bad-Valude");
355 printf(":No-Resource");
358 printf(":Bad-Call-ID");
361 printf(":PAC-Error");
372 pptp_firm_rev_print(const u_int16_t
*firm_rev
)
374 printf(" FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
));
378 pptp_framing_cap_print(const u_int32_t
*framing_cap
)
380 printf(" FRAME_CAP(");
381 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
382 printf("A"); /* Async */
384 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
385 printf("S"); /* Sync */
391 pptp_framing_type_print(const u_int32_t
*framing_type
)
393 printf(" FRAME_TYPE(");
394 switch (EXTRACT_32BITS(framing_type
)) {
396 printf("A"); /* Async */
399 printf("S"); /* Sync */
402 printf("E"); /* Either */
412 pptp_hostname_print(const u_char
*hostname
)
414 printf(" HOSTNAME(%.64s)", hostname
);
418 pptp_id_print(const u_int32_t
*id
)
420 printf(" ID(%u)", EXTRACT_32BITS(id
));
424 pptp_max_channel_print(const u_int16_t
*max_channel
)
426 printf(" MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
));
430 pptp_peer_call_id_print(const u_int16_t
*peer_call_id
)
432 printf(" PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
));
436 pptp_phy_chan_id_print(const u_int32_t
*phy_chan_id
)
438 printf(" PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
));
442 pptp_pkt_proc_delay_print(const u_int16_t
*pkt_proc_delay
)
444 printf(" PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
));
448 pptp_proto_ver_print(const u_int16_t
*proto_ver
)
450 printf(" PROTO_VER(%u.%u)", /* Version.Revision */
451 EXTRACT_16BITS(proto_ver
) >> 8,
452 EXTRACT_16BITS(proto_ver
) & 0xff);
456 pptp_recv_winsiz_print(const u_int16_t
*recv_winsiz
)
458 printf(" RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
));
462 pptp_result_code_print(const u_int8_t
*result_code
, int ctrl_msg_type
)
464 printf(" RESULT_CODE(%u", *result_code
);
466 switch (ctrl_msg_type
) {
467 case PPTP_CTRL_MSG_TYPE_SCCRP
:
468 switch (*result_code
) {
470 printf(":Successful channel establishment");
473 printf(":General error");
476 printf(":Command channel already exists");
479 printf(":Requester is not authorized to establish a command channel");
482 printf(":The protocol version of the requester is not supported");
489 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
490 case PPTP_CTRL_MSG_TYPE_ECHORP
:
491 switch (*result_code
) {
496 printf(":General Error");
503 case PPTP_CTRL_MSG_TYPE_OCRP
:
504 switch (*result_code
) {
506 printf(":Connected");
509 printf(":General Error");
512 printf(":No Carrier");
518 printf(":No Dial Tone");
524 printf(":Do Not Accept");
531 case PPTP_CTRL_MSG_TYPE_ICRP
:
532 switch (*result_code
) {
537 printf(":General Error");
540 printf(":Do Not Accept");
547 case PPTP_CTRL_MSG_TYPE_CDN
:
548 switch (*result_code
) {
550 printf(":Lost Carrier");
553 printf(":General Error");
556 printf(":Admin Shutdown");
566 /* assertion error */
574 pptp_subaddr_print(const u_char
*subaddr
)
576 printf(" SUB_ADDR(%.64s)", subaddr
);
580 pptp_vendor_print(const u_char
*vendor
)
582 printf(" VENDOR(%.64s)", vendor
);
585 /************************************/
586 /* PPTP message print out functions */
587 /************************************/
589 pptp_sccrq_print(const u_char
*dat
)
591 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
593 TCHECK(ptr
->proto_ver
);
594 pptp_proto_ver_print(&ptr
->proto_ver
);
595 TCHECK(ptr
->reserved1
);
596 TCHECK(ptr
->framing_cap
);
597 pptp_framing_cap_print(&ptr
->framing_cap
);
598 TCHECK(ptr
->bearer_cap
);
599 pptp_bearer_cap_print(&ptr
->bearer_cap
);
600 TCHECK(ptr
->max_channel
);
601 pptp_max_channel_print(&ptr
->max_channel
);
602 TCHECK(ptr
->firm_rev
);
603 pptp_firm_rev_print(&ptr
->firm_rev
);
604 TCHECK(ptr
->hostname
);
605 pptp_hostname_print(&ptr
->hostname
[0]);
607 pptp_vendor_print(&ptr
->vendor
[0]);
616 pptp_sccrp_print(const u_char
*dat
)
618 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
620 TCHECK(ptr
->proto_ver
);
621 pptp_proto_ver_print(&ptr
->proto_ver
);
622 TCHECK(ptr
->result_code
);
623 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
624 TCHECK(ptr
->err_code
);
625 pptp_err_code_print(&ptr
->err_code
);
626 TCHECK(ptr
->framing_cap
);
627 pptp_framing_cap_print(&ptr
->framing_cap
);
628 TCHECK(ptr
->bearer_cap
);
629 pptp_bearer_cap_print(&ptr
->bearer_cap
);
630 TCHECK(ptr
->max_channel
);
631 pptp_max_channel_print(&ptr
->max_channel
);
632 TCHECK(ptr
->firm_rev
);
633 pptp_firm_rev_print(&ptr
->firm_rev
);
634 TCHECK(ptr
->hostname
);
635 pptp_hostname_print(&ptr
->hostname
[0]);
637 pptp_vendor_print(&ptr
->vendor
[0]);
646 pptp_stopccrq_print(const u_char
*dat
)
648 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
651 printf(" REASON(%u", ptr
->reason
);
653 switch (ptr
->reason
) {
658 printf(":Stop-Protocol");
661 printf(":Stop-Local-Shutdown");
669 TCHECK(ptr
->reserved1
);
670 TCHECK(ptr
->reserved2
);
679 pptp_stopccrp_print(const u_char
*dat
)
681 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
683 TCHECK(ptr
->result_code
);
684 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
685 TCHECK(ptr
->err_code
);
686 pptp_err_code_print(&ptr
->err_code
);
687 TCHECK(ptr
->reserved1
);
696 pptp_echorq_print(const u_char
*dat
)
698 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
701 pptp_id_print(&ptr
->id
);
710 pptp_echorp_print(const u_char
*dat
)
712 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
715 pptp_id_print(&ptr
->id
);
716 TCHECK(ptr
->result_code
);
717 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
718 TCHECK(ptr
->err_code
);
719 pptp_err_code_print(&ptr
->err_code
);
720 TCHECK(ptr
->reserved1
);
729 pptp_ocrq_print(const u_char
*dat
)
731 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
733 TCHECK(ptr
->call_id
);
734 pptp_call_id_print(&ptr
->call_id
);
735 TCHECK(ptr
->call_ser
);
736 pptp_call_ser_print(&ptr
->call_ser
);
737 TCHECK(ptr
->min_bps
);
738 printf(" MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
));
739 TCHECK(ptr
->max_bps
);
740 printf(" MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
));
741 TCHECK(ptr
->bearer_type
);
742 pptp_bearer_type_print(&ptr
->bearer_type
);
743 TCHECK(ptr
->framing_type
);
744 pptp_framing_type_print(&ptr
->framing_type
);
745 TCHECK(ptr
->recv_winsiz
);
746 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
747 TCHECK(ptr
->pkt_proc_delay
);
748 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
749 TCHECK(ptr
->phone_no_len
);
750 printf(" PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
));
751 TCHECK(ptr
->reserved1
);
752 TCHECK(ptr
->phone_no
);
753 printf(" PHONE_NO(%.64s)", ptr
->phone_no
);
754 TCHECK(ptr
->subaddr
);
755 pptp_subaddr_print(&ptr
->subaddr
[0]);
764 pptp_ocrp_print(const u_char
*dat
)
766 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
768 TCHECK(ptr
->call_id
);
769 pptp_call_id_print(&ptr
->call_id
);
770 TCHECK(ptr
->peer_call_id
);
771 pptp_peer_call_id_print(&ptr
->peer_call_id
);
772 TCHECK(ptr
->result_code
);
773 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
774 TCHECK(ptr
->err_code
);
775 pptp_err_code_print(&ptr
->err_code
);
776 TCHECK(ptr
->cause_code
);
777 pptp_cause_code_print(&ptr
->cause_code
);
778 TCHECK(ptr
->conn_speed
);
779 pptp_conn_speed_print(&ptr
->conn_speed
);
780 TCHECK(ptr
->recv_winsiz
);
781 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
782 TCHECK(ptr
->pkt_proc_delay
);
783 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
784 TCHECK(ptr
->phy_chan_id
);
785 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
794 pptp_icrq_print(const u_char
*dat
)
796 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
798 TCHECK(ptr
->call_id
);
799 pptp_call_id_print(&ptr
->call_id
);
800 TCHECK(ptr
->call_ser
);
801 pptp_call_ser_print(&ptr
->call_ser
);
802 TCHECK(ptr
->bearer_type
);
803 pptp_bearer_type_print(&ptr
->bearer_type
);
804 TCHECK(ptr
->phy_chan_id
);
805 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
806 TCHECK(ptr
->dialed_no_len
);
807 printf(" DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
));
808 TCHECK(ptr
->dialing_no_len
);
809 printf(" DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
));
810 TCHECK(ptr
->dialed_no
);
811 printf(" DIALED_NO(%.64s)", ptr
->dialed_no
);
812 TCHECK(ptr
->dialing_no
);
813 printf(" DIALING_NO(%.64s)", ptr
->dialing_no
);
814 TCHECK(ptr
->subaddr
);
815 pptp_subaddr_print(&ptr
->subaddr
[0]);
824 pptp_icrp_print(const u_char
*dat
)
826 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
828 TCHECK(ptr
->call_id
);
829 pptp_call_id_print(&ptr
->call_id
);
830 TCHECK(ptr
->peer_call_id
);
831 pptp_peer_call_id_print(&ptr
->peer_call_id
);
832 TCHECK(ptr
->result_code
);
833 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
834 TCHECK(ptr
->err_code
);
835 pptp_err_code_print(&ptr
->err_code
);
836 TCHECK(ptr
->recv_winsiz
);
837 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
838 TCHECK(ptr
->pkt_proc_delay
);
839 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
840 TCHECK(ptr
->reserved1
);
849 pptp_iccn_print(const u_char
*dat
)
851 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
853 TCHECK(ptr
->peer_call_id
);
854 pptp_peer_call_id_print(&ptr
->peer_call_id
);
855 TCHECK(ptr
->reserved1
);
856 TCHECK(ptr
->conn_speed
);
857 pptp_conn_speed_print(&ptr
->conn_speed
);
858 TCHECK(ptr
->recv_winsiz
);
859 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
860 TCHECK(ptr
->pkt_proc_delay
);
861 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
862 TCHECK(ptr
->framing_type
);
863 pptp_framing_type_print(&ptr
->framing_type
);
872 pptp_ccrq_print(const u_char
*dat
)
874 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
876 TCHECK(ptr
->call_id
);
877 pptp_call_id_print(&ptr
->call_id
);
878 TCHECK(ptr
->reserved1
);
887 pptp_cdn_print(const u_char
*dat
)
889 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
891 TCHECK(ptr
->call_id
);
892 pptp_call_id_print(&ptr
->call_id
);
893 TCHECK(ptr
->result_code
);
894 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
895 TCHECK(ptr
->err_code
);
896 pptp_err_code_print(&ptr
->err_code
);
897 TCHECK(ptr
->cause_code
);
898 pptp_cause_code_print(&ptr
->cause_code
);
899 TCHECK(ptr
->reserved1
);
900 TCHECK(ptr
->call_stats
);
901 printf(" CALL_STATS(%.128s)", ptr
->call_stats
);
910 pptp_wen_print(const u_char
*dat
)
912 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
914 TCHECK(ptr
->peer_call_id
);
915 pptp_peer_call_id_print(&ptr
->peer_call_id
);
916 TCHECK(ptr
->reserved1
);
917 TCHECK(ptr
->crc_err
);
918 printf(" CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
));
919 TCHECK(ptr
->framing_err
);
920 printf(" FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
));
921 TCHECK(ptr
->hardware_overrun
);
922 printf(" HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
));
923 TCHECK(ptr
->buffer_overrun
);
924 printf(" BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
));
925 TCHECK(ptr
->timeout_err
);
926 printf(" TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
));
927 TCHECK(ptr
->align_err
);
928 printf(" ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
));
937 pptp_sli_print(const u_char
*dat
)
939 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
941 TCHECK(ptr
->peer_call_id
);
942 pptp_peer_call_id_print(&ptr
->peer_call_id
);
943 TCHECK(ptr
->reserved1
);
944 TCHECK(ptr
->send_accm
);
945 printf(" SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
));
946 TCHECK(ptr
->recv_accm
);
947 printf(" RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
));
956 pptp_print(const u_char
*dat
)
958 const struct pptp_hdr
*hdr
;
960 u_int16_t ctrl_msg_type
;
964 hdr
= (struct pptp_hdr
*)dat
;
968 printf(" Length=%u", EXTRACT_16BITS(&hdr
->length
));
970 TCHECK(hdr
->msg_type
);
972 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
973 case PPTP_MSG_TYPE_CTRL
:
976 case PPTP_MSG_TYPE_MGMT
:
980 printf(" UNKNOWN-MSG-TYPE");
985 TCHECK(hdr
->magic_cookie
);
986 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
987 if (mc
!= PPTP_MAGIC_COOKIE
) {
988 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
990 if (vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
991 printf(" Magic-Cookie=%08x", mc
);
993 TCHECK(hdr
->ctrl_msg_type
);
994 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
995 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
996 printf(" CTRL_MSGTYPE=%s",
997 pptp_message_type_string
[ctrl_msg_type
]);
999 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
1001 TCHECK(hdr
->reserved0
);
1005 switch(ctrl_msg_type
) {
1006 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1007 pptp_sccrq_print(dat
);
1009 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1010 pptp_sccrp_print(dat
);
1012 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1013 pptp_stopccrq_print(dat
);
1015 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1016 pptp_stopccrp_print(dat
);
1018 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1019 pptp_echorq_print(dat
);
1021 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1022 pptp_echorp_print(dat
);
1024 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1025 pptp_ocrq_print(dat
);
1027 case PPTP_CTRL_MSG_TYPE_OCRP
:
1028 pptp_ocrp_print(dat
);
1030 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1031 pptp_icrq_print(dat
);
1033 case PPTP_CTRL_MSG_TYPE_ICRP
:
1034 pptp_icrp_print(dat
);
1036 case PPTP_CTRL_MSG_TYPE_ICCN
:
1037 pptp_iccn_print(dat
);
1039 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1040 pptp_ccrq_print(dat
);
1042 case PPTP_CTRL_MSG_TYPE_CDN
:
1043 pptp_cdn_print(dat
);
1045 case PPTP_CTRL_MSG_TYPE_WEN
:
1046 pptp_wen_print(dat
);
1048 case PPTP_CTRL_MSG_TYPE_SLI
:
1049 pptp_sli_print(dat
);