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)
28 #include <tcpdump-stdinc.h>
32 #include "interface.h"
35 static const char tstr
[] = " [|pptp]";
37 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
38 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
39 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
41 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
42 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
43 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
44 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
45 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
46 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
47 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
48 #define PPTP_CTRL_MSG_TYPE_OCRP 8
49 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
50 #define PPTP_CTRL_MSG_TYPE_ICRP 10
51 #define PPTP_CTRL_MSG_TYPE_ICCN 11
52 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
53 #define PPTP_CTRL_MSG_TYPE_CDN 13
54 #define PPTP_CTRL_MSG_TYPE_WEN 14
55 #define PPTP_CTRL_MSG_TYPE_SLI 15
57 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
58 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
60 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
61 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
63 static const char *pptp_message_type_string
[] = {
64 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
65 "SCCRQ", /* 1 Start-Control-Connection-Request */
66 "SCCRP", /* 2 Start-Control-Connection-Reply */
67 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
68 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
69 "ECHORQ", /* 5 Echo Request */
70 "ECHORP", /* 6 Echo Reply */
72 "OCRQ", /* 7 Outgoing-Call-Request */
73 "OCRP", /* 8 Outgoing-Call-Reply */
74 "ICRQ", /* 9 Incoming-Call-Request */
75 "ICRP", /* 10 Incoming-Call-Reply */
76 "ICCN", /* 11 Incoming-Call-Connected */
77 "CCRQ", /* 12 Call-Clear-Request */
78 "CDN", /* 13 Call-Disconnect-Notify */
80 "WEN", /* 14 WAN-Error-Notify */
82 "SLI" /* 15 Set-Link-Info */
83 #define PPTP_MAX_MSGTYPE_INDEX 16
86 /* common for all PPTP control messages */
90 u_int32_t magic_cookie
;
91 u_int16_t ctrl_msg_type
;
95 struct pptp_msg_sccrq
{
98 u_int32_t framing_cap
;
100 u_int16_t max_channel
;
106 struct pptp_msg_sccrp
{
108 u_int8_t result_code
;
110 u_int32_t framing_cap
;
111 u_int32_t bearer_cap
;
112 u_int16_t max_channel
;
118 struct pptp_msg_stopccrq
{
124 struct pptp_msg_stopccrp
{
125 u_int8_t result_code
;
130 struct pptp_msg_echorq
{
134 struct pptp_msg_echorp
{
136 u_int8_t result_code
;
141 struct pptp_msg_ocrq
{
146 u_int32_t bearer_type
;
147 u_int32_t framing_type
;
148 u_int16_t recv_winsiz
;
149 u_int16_t pkt_proc_delay
;
150 u_int16_t phone_no_len
;
156 struct pptp_msg_ocrp
{
158 u_int16_t peer_call_id
;
159 u_int8_t result_code
;
161 u_int16_t cause_code
;
162 u_int32_t conn_speed
;
163 u_int16_t recv_winsiz
;
164 u_int16_t pkt_proc_delay
;
165 u_int32_t phy_chan_id
;
168 struct pptp_msg_icrq
{
171 u_int32_t bearer_type
;
172 u_int32_t phy_chan_id
;
173 u_int16_t dialed_no_len
;
174 u_int16_t dialing_no_len
;
175 u_char dialed_no
[64]; /* DNIS */
176 u_char dialing_no
[64]; /* CLID */
180 struct pptp_msg_icrp
{
182 u_int16_t peer_call_id
;
183 u_int8_t result_code
;
185 u_int16_t recv_winsiz
;
186 u_int16_t pkt_proc_delay
;
190 struct pptp_msg_iccn
{
191 u_int16_t peer_call_id
;
193 u_int32_t conn_speed
;
194 u_int16_t recv_winsiz
;
195 u_int16_t pkt_proc_delay
;
196 u_int32_t framing_type
;
199 struct pptp_msg_ccrq
{
204 struct pptp_msg_cdn
{
206 u_int8_t result_code
;
208 u_int16_t cause_code
;
210 u_char call_stats
[128];
213 struct pptp_msg_wen
{
214 u_int16_t peer_call_id
;
217 u_int32_t framing_err
;
218 u_int32_t hardware_overrun
;
219 u_int32_t buffer_overrun
;
220 u_int32_t timeout_err
;
224 struct pptp_msg_sli
{
225 u_int16_t peer_call_id
;
231 /* attributes that appear more than once in above messages:
235 --------------------------------------
236 2 u_int32_t bearer_cap;
237 2 u_int32_t bearer_type;
239 2 u_int16_t call_ser;
240 2 u_int16_t cause_code;
241 2 u_int32_t conn_speed;
243 2 u_int16_t firm_rev;
244 2 u_int32_t framing_cap;
245 2 u_int32_t framing_type;
246 2 u_char hostname[64];
248 2 u_int16_t max_channel;
249 5 u_int16_t peer_call_id;
250 2 u_int32_t phy_chan_id;
251 4 u_int16_t pkt_proc_delay;
252 2 u_int16_t proto_ver;
253 4 u_int16_t recv_winsiz;
254 2 u_int8_t reserved1;
255 9 u_int16_t reserved1;
256 6 u_int8_t result_code;
257 2 u_char subaddr[64];
260 so I will prepare print out functions for these attributes (except for
264 /******************************************/
265 /* Attribute-specific print out functions */
266 /******************************************/
268 /* In these attribute-specific print-out functions, it't not necessary
269 to do TCHECK because they are already checked in the caller of
273 pptp_bearer_cap_print(const u_int32_t
*bearer_cap
)
275 printf(" BEARER_CAP(");
276 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
) {
279 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
) {
286 pptp_bearer_type_print(const u_int32_t
*bearer_type
)
288 printf(" BEARER_TYPE(");
289 switch (EXTRACT_32BITS(bearer_type
)) {
291 printf("A"); /* Analog */
294 printf("D"); /* Digital */
307 pptp_call_id_print(const u_int16_t
*call_id
)
309 printf(" CALL_ID(%u)", EXTRACT_16BITS(call_id
));
313 pptp_call_ser_print(const u_int16_t
*call_ser
)
315 printf(" CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
));
319 pptp_cause_code_print(const u_int16_t
*cause_code
)
321 printf(" CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
));
325 pptp_conn_speed_print(const u_int32_t
*conn_speed
)
327 printf(" CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
));
331 pptp_err_code_print(const u_int8_t
*err_code
)
333 printf(" ERR_CODE(%u", *err_code
);
340 printf(":Not-Connected");
343 printf(":Bad-Format");
346 printf(":Bad-Valude");
349 printf(":No-Resource");
352 printf(":Bad-Call-ID");
355 printf(":PAC-Error");
366 pptp_firm_rev_print(const u_int16_t
*firm_rev
)
368 printf(" FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
));
372 pptp_framing_cap_print(const u_int32_t
*framing_cap
)
374 printf(" FRAME_CAP(");
375 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
376 printf("A"); /* Async */
378 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
379 printf("S"); /* Sync */
385 pptp_framing_type_print(const u_int32_t
*framing_type
)
387 printf(" FRAME_TYPE(");
388 switch (EXTRACT_32BITS(framing_type
)) {
390 printf("A"); /* Async */
393 printf("S"); /* Sync */
396 printf("E"); /* Either */
406 pptp_hostname_print(const u_char
*hostname
)
408 printf(" HOSTNAME(%.64s)", hostname
);
412 pptp_id_print(const u_int32_t
*id
)
414 printf(" ID(%u)", EXTRACT_32BITS(id
));
418 pptp_max_channel_print(const u_int16_t
*max_channel
)
420 printf(" MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
));
424 pptp_peer_call_id_print(const u_int16_t
*peer_call_id
)
426 printf(" PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
));
430 pptp_phy_chan_id_print(const u_int32_t
*phy_chan_id
)
432 printf(" PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
));
436 pptp_pkt_proc_delay_print(const u_int16_t
*pkt_proc_delay
)
438 printf(" PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
));
442 pptp_proto_ver_print(const u_int16_t
*proto_ver
)
444 printf(" PROTO_VER(%u.%u)", /* Version.Revision */
445 EXTRACT_16BITS(proto_ver
) >> 8,
446 EXTRACT_16BITS(proto_ver
) & 0xff);
450 pptp_recv_winsiz_print(const u_int16_t
*recv_winsiz
)
452 printf(" RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
));
456 pptp_result_code_print(const u_int8_t
*result_code
, int ctrl_msg_type
)
458 printf(" RESULT_CODE(%u", *result_code
);
460 switch (ctrl_msg_type
) {
461 case PPTP_CTRL_MSG_TYPE_SCCRP
:
462 switch (*result_code
) {
464 printf(":Successful channel establishment");
467 printf(":General error");
470 printf(":Command channel already exists");
473 printf(":Requester is not authorized to establish a command channel");
476 printf(":The protocol version of the requester is not supported");
483 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
484 case PPTP_CTRL_MSG_TYPE_ECHORP
:
485 switch (*result_code
) {
490 printf(":General Error");
497 case PPTP_CTRL_MSG_TYPE_OCRP
:
498 switch (*result_code
) {
500 printf(":Connected");
503 printf(":General Error");
506 printf(":No Carrier");
512 printf(":No Dial Tone");
518 printf(":Do Not Accept");
525 case PPTP_CTRL_MSG_TYPE_ICRP
:
526 switch (*result_code
) {
531 printf(":General Error");
534 printf(":Do Not Accept");
541 case PPTP_CTRL_MSG_TYPE_CDN
:
542 switch (*result_code
) {
544 printf(":Lost Carrier");
547 printf(":General Error");
550 printf(":Admin Shutdown");
560 /* assertion error */
568 pptp_subaddr_print(const u_char
*subaddr
)
570 printf(" SUB_ADDR(%.64s)", subaddr
);
574 pptp_vendor_print(const u_char
*vendor
)
576 printf(" VENDOR(%.64s)", vendor
);
579 /************************************/
580 /* PPTP message print out functions */
581 /************************************/
583 pptp_sccrq_print(const u_char
*dat
)
585 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
587 TCHECK(ptr
->proto_ver
);
588 pptp_proto_ver_print(&ptr
->proto_ver
);
589 TCHECK(ptr
->reserved1
);
590 TCHECK(ptr
->framing_cap
);
591 pptp_framing_cap_print(&ptr
->framing_cap
);
592 TCHECK(ptr
->bearer_cap
);
593 pptp_bearer_cap_print(&ptr
->bearer_cap
);
594 TCHECK(ptr
->max_channel
);
595 pptp_max_channel_print(&ptr
->max_channel
);
596 TCHECK(ptr
->firm_rev
);
597 pptp_firm_rev_print(&ptr
->firm_rev
);
598 TCHECK(ptr
->hostname
);
599 pptp_hostname_print(&ptr
->hostname
[0]);
601 pptp_vendor_print(&ptr
->vendor
[0]);
610 pptp_sccrp_print(const u_char
*dat
)
612 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
614 TCHECK(ptr
->proto_ver
);
615 pptp_proto_ver_print(&ptr
->proto_ver
);
616 TCHECK(ptr
->result_code
);
617 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
618 TCHECK(ptr
->err_code
);
619 pptp_err_code_print(&ptr
->err_code
);
620 TCHECK(ptr
->framing_cap
);
621 pptp_framing_cap_print(&ptr
->framing_cap
);
622 TCHECK(ptr
->bearer_cap
);
623 pptp_bearer_cap_print(&ptr
->bearer_cap
);
624 TCHECK(ptr
->max_channel
);
625 pptp_max_channel_print(&ptr
->max_channel
);
626 TCHECK(ptr
->firm_rev
);
627 pptp_firm_rev_print(&ptr
->firm_rev
);
628 TCHECK(ptr
->hostname
);
629 pptp_hostname_print(&ptr
->hostname
[0]);
631 pptp_vendor_print(&ptr
->vendor
[0]);
640 pptp_stopccrq_print(const u_char
*dat
)
642 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
645 printf(" REASON(%u", ptr
->reason
);
647 switch (ptr
->reason
) {
652 printf(":Stop-Protocol");
655 printf(":Stop-Local-Shutdown");
663 TCHECK(ptr
->reserved1
);
664 TCHECK(ptr
->reserved2
);
673 pptp_stopccrp_print(const u_char
*dat
)
675 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
677 TCHECK(ptr
->result_code
);
678 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
679 TCHECK(ptr
->err_code
);
680 pptp_err_code_print(&ptr
->err_code
);
681 TCHECK(ptr
->reserved1
);
690 pptp_echorq_print(const u_char
*dat
)
692 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
695 pptp_id_print(&ptr
->id
);
704 pptp_echorp_print(const u_char
*dat
)
706 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
709 pptp_id_print(&ptr
->id
);
710 TCHECK(ptr
->result_code
);
711 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
712 TCHECK(ptr
->err_code
);
713 pptp_err_code_print(&ptr
->err_code
);
714 TCHECK(ptr
->reserved1
);
723 pptp_ocrq_print(const u_char
*dat
)
725 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
727 TCHECK(ptr
->call_id
);
728 pptp_call_id_print(&ptr
->call_id
);
729 TCHECK(ptr
->call_ser
);
730 pptp_call_ser_print(&ptr
->call_ser
);
731 TCHECK(ptr
->min_bps
);
732 printf(" MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
));
733 TCHECK(ptr
->max_bps
);
734 printf(" MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
));
735 TCHECK(ptr
->bearer_type
);
736 pptp_bearer_type_print(&ptr
->bearer_type
);
737 TCHECK(ptr
->framing_type
);
738 pptp_framing_type_print(&ptr
->framing_type
);
739 TCHECK(ptr
->recv_winsiz
);
740 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
741 TCHECK(ptr
->pkt_proc_delay
);
742 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
743 TCHECK(ptr
->phone_no_len
);
744 printf(" PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
));
745 TCHECK(ptr
->reserved1
);
746 TCHECK(ptr
->phone_no
);
747 printf(" PHONE_NO(%.64s)", ptr
->phone_no
);
748 TCHECK(ptr
->subaddr
);
749 pptp_subaddr_print(&ptr
->subaddr
[0]);
758 pptp_ocrp_print(const u_char
*dat
)
760 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
762 TCHECK(ptr
->call_id
);
763 pptp_call_id_print(&ptr
->call_id
);
764 TCHECK(ptr
->peer_call_id
);
765 pptp_peer_call_id_print(&ptr
->peer_call_id
);
766 TCHECK(ptr
->result_code
);
767 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
768 TCHECK(ptr
->err_code
);
769 pptp_err_code_print(&ptr
->err_code
);
770 TCHECK(ptr
->cause_code
);
771 pptp_cause_code_print(&ptr
->cause_code
);
772 TCHECK(ptr
->conn_speed
);
773 pptp_conn_speed_print(&ptr
->conn_speed
);
774 TCHECK(ptr
->recv_winsiz
);
775 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
776 TCHECK(ptr
->pkt_proc_delay
);
777 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
778 TCHECK(ptr
->phy_chan_id
);
779 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
788 pptp_icrq_print(const u_char
*dat
)
790 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
792 TCHECK(ptr
->call_id
);
793 pptp_call_id_print(&ptr
->call_id
);
794 TCHECK(ptr
->call_ser
);
795 pptp_call_ser_print(&ptr
->call_ser
);
796 TCHECK(ptr
->bearer_type
);
797 pptp_bearer_type_print(&ptr
->bearer_type
);
798 TCHECK(ptr
->phy_chan_id
);
799 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
800 TCHECK(ptr
->dialed_no_len
);
801 printf(" DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
));
802 TCHECK(ptr
->dialing_no_len
);
803 printf(" DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
));
804 TCHECK(ptr
->dialed_no
);
805 printf(" DIALED_NO(%.64s)", ptr
->dialed_no
);
806 TCHECK(ptr
->dialing_no
);
807 printf(" DIALING_NO(%.64s)", ptr
->dialing_no
);
808 TCHECK(ptr
->subaddr
);
809 pptp_subaddr_print(&ptr
->subaddr
[0]);
818 pptp_icrp_print(const u_char
*dat
)
820 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
822 TCHECK(ptr
->call_id
);
823 pptp_call_id_print(&ptr
->call_id
);
824 TCHECK(ptr
->peer_call_id
);
825 pptp_peer_call_id_print(&ptr
->peer_call_id
);
826 TCHECK(ptr
->result_code
);
827 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
828 TCHECK(ptr
->err_code
);
829 pptp_err_code_print(&ptr
->err_code
);
830 TCHECK(ptr
->recv_winsiz
);
831 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
832 TCHECK(ptr
->pkt_proc_delay
);
833 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
834 TCHECK(ptr
->reserved1
);
843 pptp_iccn_print(const u_char
*dat
)
845 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
847 TCHECK(ptr
->peer_call_id
);
848 pptp_peer_call_id_print(&ptr
->peer_call_id
);
849 TCHECK(ptr
->reserved1
);
850 TCHECK(ptr
->conn_speed
);
851 pptp_conn_speed_print(&ptr
->conn_speed
);
852 TCHECK(ptr
->recv_winsiz
);
853 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
854 TCHECK(ptr
->pkt_proc_delay
);
855 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
856 TCHECK(ptr
->framing_type
);
857 pptp_framing_type_print(&ptr
->framing_type
);
866 pptp_ccrq_print(const u_char
*dat
)
868 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
870 TCHECK(ptr
->call_id
);
871 pptp_call_id_print(&ptr
->call_id
);
872 TCHECK(ptr
->reserved1
);
881 pptp_cdn_print(const u_char
*dat
)
883 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
885 TCHECK(ptr
->call_id
);
886 pptp_call_id_print(&ptr
->call_id
);
887 TCHECK(ptr
->result_code
);
888 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
889 TCHECK(ptr
->err_code
);
890 pptp_err_code_print(&ptr
->err_code
);
891 TCHECK(ptr
->cause_code
);
892 pptp_cause_code_print(&ptr
->cause_code
);
893 TCHECK(ptr
->reserved1
);
894 TCHECK(ptr
->call_stats
);
895 printf(" CALL_STATS(%.128s)", ptr
->call_stats
);
904 pptp_wen_print(const u_char
*dat
)
906 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
908 TCHECK(ptr
->peer_call_id
);
909 pptp_peer_call_id_print(&ptr
->peer_call_id
);
910 TCHECK(ptr
->reserved1
);
911 TCHECK(ptr
->crc_err
);
912 printf(" CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
));
913 TCHECK(ptr
->framing_err
);
914 printf(" FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
));
915 TCHECK(ptr
->hardware_overrun
);
916 printf(" HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
));
917 TCHECK(ptr
->buffer_overrun
);
918 printf(" BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
));
919 TCHECK(ptr
->timeout_err
);
920 printf(" TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
));
921 TCHECK(ptr
->align_err
);
922 printf(" ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
));
931 pptp_sli_print(const u_char
*dat
)
933 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
935 TCHECK(ptr
->peer_call_id
);
936 pptp_peer_call_id_print(&ptr
->peer_call_id
);
937 TCHECK(ptr
->reserved1
);
938 TCHECK(ptr
->send_accm
);
939 printf(" SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
));
940 TCHECK(ptr
->recv_accm
);
941 printf(" RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
));
950 pptp_print(const u_char
*dat
)
952 const struct pptp_hdr
*hdr
;
954 u_int16_t ctrl_msg_type
;
958 hdr
= (struct pptp_hdr
*)dat
;
962 printf(" Length=%u", EXTRACT_16BITS(&hdr
->length
));
964 TCHECK(hdr
->msg_type
);
966 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
967 case PPTP_MSG_TYPE_CTRL
:
970 case PPTP_MSG_TYPE_MGMT
:
974 printf(" UNKNOWN-MSG-TYPE");
979 TCHECK(hdr
->magic_cookie
);
980 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
981 if (mc
!= PPTP_MAGIC_COOKIE
) {
982 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
984 if (vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
985 printf(" Magic-Cookie=%08x", mc
);
987 TCHECK(hdr
->ctrl_msg_type
);
988 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
989 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
990 printf(" CTRL_MSGTYPE=%s",
991 pptp_message_type_string
[ctrl_msg_type
]);
993 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
995 TCHECK(hdr
->reserved0
);
999 switch(ctrl_msg_type
) {
1000 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1001 pptp_sccrq_print(dat
);
1003 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1004 pptp_sccrp_print(dat
);
1006 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1007 pptp_stopccrq_print(dat
);
1009 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1010 pptp_stopccrp_print(dat
);
1012 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1013 pptp_echorq_print(dat
);
1015 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1016 pptp_echorp_print(dat
);
1018 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1019 pptp_ocrq_print(dat
);
1021 case PPTP_CTRL_MSG_TYPE_OCRP
:
1022 pptp_ocrp_print(dat
);
1024 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1025 pptp_icrq_print(dat
);
1027 case PPTP_CTRL_MSG_TYPE_ICRP
:
1028 pptp_icrp_print(dat
);
1030 case PPTP_CTRL_MSG_TYPE_ICCN
:
1031 pptp_iccn_print(dat
);
1033 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1034 pptp_ccrq_print(dat
);
1036 case PPTP_CTRL_MSG_TYPE_CDN
:
1037 pptp_cdn_print(dat
);
1039 case PPTP_CTRL_MSG_TYPE_WEN
:
1040 pptp_wen_print(dat
);
1042 case PPTP_CTRL_MSG_TYPE_SLI
:
1043 pptp_sli_print(dat
);