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");
561 /* assertion error */
569 pptp_subaddr_print(const u_char
*subaddr
)
571 printf(" SUB_ADDR(%.64s)", subaddr
);
575 pptp_vendor_print(const u_char
*vendor
)
577 printf(" VENDOR(%.64s)", vendor
);
580 /************************************/
581 /* PPTP message print out functions */
582 /************************************/
584 pptp_sccrq_print(const u_char
*dat
)
586 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
588 TCHECK(ptr
->proto_ver
);
589 pptp_proto_ver_print(&ptr
->proto_ver
);
590 TCHECK(ptr
->reserved1
);
591 TCHECK(ptr
->framing_cap
);
592 pptp_framing_cap_print(&ptr
->framing_cap
);
593 TCHECK(ptr
->bearer_cap
);
594 pptp_bearer_cap_print(&ptr
->bearer_cap
);
595 TCHECK(ptr
->max_channel
);
596 pptp_max_channel_print(&ptr
->max_channel
);
597 TCHECK(ptr
->firm_rev
);
598 pptp_firm_rev_print(&ptr
->firm_rev
);
599 TCHECK(ptr
->hostname
);
600 pptp_hostname_print(&ptr
->hostname
[0]);
602 pptp_vendor_print(&ptr
->vendor
[0]);
611 pptp_sccrp_print(const u_char
*dat
)
613 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
615 TCHECK(ptr
->proto_ver
);
616 pptp_proto_ver_print(&ptr
->proto_ver
);
617 TCHECK(ptr
->result_code
);
618 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
619 TCHECK(ptr
->err_code
);
620 pptp_err_code_print(&ptr
->err_code
);
621 TCHECK(ptr
->framing_cap
);
622 pptp_framing_cap_print(&ptr
->framing_cap
);
623 TCHECK(ptr
->bearer_cap
);
624 pptp_bearer_cap_print(&ptr
->bearer_cap
);
625 TCHECK(ptr
->max_channel
);
626 pptp_max_channel_print(&ptr
->max_channel
);
627 TCHECK(ptr
->firm_rev
);
628 pptp_firm_rev_print(&ptr
->firm_rev
);
629 TCHECK(ptr
->hostname
);
630 pptp_hostname_print(&ptr
->hostname
[0]);
632 pptp_vendor_print(&ptr
->vendor
[0]);
641 pptp_stopccrq_print(const u_char
*dat
)
643 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
646 printf(" REASON(%u", ptr
->reason
);
648 switch (ptr
->reason
) {
653 printf(":Stop-Protocol");
656 printf(":Stop-Local-Shutdown");
664 TCHECK(ptr
->reserved1
);
665 TCHECK(ptr
->reserved2
);
674 pptp_stopccrp_print(const u_char
*dat
)
676 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
678 TCHECK(ptr
->result_code
);
679 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
680 TCHECK(ptr
->err_code
);
681 pptp_err_code_print(&ptr
->err_code
);
682 TCHECK(ptr
->reserved1
);
691 pptp_echorq_print(const u_char
*dat
)
693 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
696 pptp_id_print(&ptr
->id
);
705 pptp_echorp_print(const u_char
*dat
)
707 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
710 pptp_id_print(&ptr
->id
);
711 TCHECK(ptr
->result_code
);
712 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
713 TCHECK(ptr
->err_code
);
714 pptp_err_code_print(&ptr
->err_code
);
715 TCHECK(ptr
->reserved1
);
724 pptp_ocrq_print(const u_char
*dat
)
726 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
728 TCHECK(ptr
->call_id
);
729 pptp_call_id_print(&ptr
->call_id
);
730 TCHECK(ptr
->call_ser
);
731 pptp_call_ser_print(&ptr
->call_ser
);
732 TCHECK(ptr
->min_bps
);
733 printf(" MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
));
734 TCHECK(ptr
->max_bps
);
735 printf(" MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
));
736 TCHECK(ptr
->bearer_type
);
737 pptp_bearer_type_print(&ptr
->bearer_type
);
738 TCHECK(ptr
->framing_type
);
739 pptp_framing_type_print(&ptr
->framing_type
);
740 TCHECK(ptr
->recv_winsiz
);
741 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
742 TCHECK(ptr
->pkt_proc_delay
);
743 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
744 TCHECK(ptr
->phone_no_len
);
745 printf(" PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
));
746 TCHECK(ptr
->reserved1
);
747 TCHECK(ptr
->phone_no
);
748 printf(" PHONE_NO(%.64s)", ptr
->phone_no
);
749 TCHECK(ptr
->subaddr
);
750 pptp_subaddr_print(&ptr
->subaddr
[0]);
759 pptp_ocrp_print(const u_char
*dat
)
761 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
763 TCHECK(ptr
->call_id
);
764 pptp_call_id_print(&ptr
->call_id
);
765 TCHECK(ptr
->peer_call_id
);
766 pptp_peer_call_id_print(&ptr
->peer_call_id
);
767 TCHECK(ptr
->result_code
);
768 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
769 TCHECK(ptr
->err_code
);
770 pptp_err_code_print(&ptr
->err_code
);
771 TCHECK(ptr
->cause_code
);
772 pptp_cause_code_print(&ptr
->cause_code
);
773 TCHECK(ptr
->conn_speed
);
774 pptp_conn_speed_print(&ptr
->conn_speed
);
775 TCHECK(ptr
->recv_winsiz
);
776 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
777 TCHECK(ptr
->pkt_proc_delay
);
778 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
779 TCHECK(ptr
->phy_chan_id
);
780 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
789 pptp_icrq_print(const u_char
*dat
)
791 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
793 TCHECK(ptr
->call_id
);
794 pptp_call_id_print(&ptr
->call_id
);
795 TCHECK(ptr
->call_ser
);
796 pptp_call_ser_print(&ptr
->call_ser
);
797 TCHECK(ptr
->bearer_type
);
798 pptp_bearer_type_print(&ptr
->bearer_type
);
799 TCHECK(ptr
->phy_chan_id
);
800 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
801 TCHECK(ptr
->dialed_no_len
);
802 printf(" DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
));
803 TCHECK(ptr
->dialing_no_len
);
804 printf(" DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
));
805 TCHECK(ptr
->dialed_no
);
806 printf(" DIALED_NO(%.64s)", ptr
->dialed_no
);
807 TCHECK(ptr
->dialing_no
);
808 printf(" DIALING_NO(%.64s)", ptr
->dialing_no
);
809 TCHECK(ptr
->subaddr
);
810 pptp_subaddr_print(&ptr
->subaddr
[0]);
819 pptp_icrp_print(const u_char
*dat
)
821 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
823 TCHECK(ptr
->call_id
);
824 pptp_call_id_print(&ptr
->call_id
);
825 TCHECK(ptr
->peer_call_id
);
826 pptp_peer_call_id_print(&ptr
->peer_call_id
);
827 TCHECK(ptr
->result_code
);
828 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
829 TCHECK(ptr
->err_code
);
830 pptp_err_code_print(&ptr
->err_code
);
831 TCHECK(ptr
->recv_winsiz
);
832 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
833 TCHECK(ptr
->pkt_proc_delay
);
834 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
835 TCHECK(ptr
->reserved1
);
844 pptp_iccn_print(const u_char
*dat
)
846 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
848 TCHECK(ptr
->peer_call_id
);
849 pptp_peer_call_id_print(&ptr
->peer_call_id
);
850 TCHECK(ptr
->reserved1
);
851 TCHECK(ptr
->conn_speed
);
852 pptp_conn_speed_print(&ptr
->conn_speed
);
853 TCHECK(ptr
->recv_winsiz
);
854 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
855 TCHECK(ptr
->pkt_proc_delay
);
856 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
857 TCHECK(ptr
->framing_type
);
858 pptp_framing_type_print(&ptr
->framing_type
);
867 pptp_ccrq_print(const u_char
*dat
)
869 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
871 TCHECK(ptr
->call_id
);
872 pptp_call_id_print(&ptr
->call_id
);
873 TCHECK(ptr
->reserved1
);
882 pptp_cdn_print(const u_char
*dat
)
884 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
886 TCHECK(ptr
->call_id
);
887 pptp_call_id_print(&ptr
->call_id
);
888 TCHECK(ptr
->result_code
);
889 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
890 TCHECK(ptr
->err_code
);
891 pptp_err_code_print(&ptr
->err_code
);
892 TCHECK(ptr
->cause_code
);
893 pptp_cause_code_print(&ptr
->cause_code
);
894 TCHECK(ptr
->reserved1
);
895 TCHECK(ptr
->call_stats
);
896 printf(" CALL_STATS(%.128s)", ptr
->call_stats
);
905 pptp_wen_print(const u_char
*dat
)
907 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
909 TCHECK(ptr
->peer_call_id
);
910 pptp_peer_call_id_print(&ptr
->peer_call_id
);
911 TCHECK(ptr
->reserved1
);
912 TCHECK(ptr
->crc_err
);
913 printf(" CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
));
914 TCHECK(ptr
->framing_err
);
915 printf(" FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
));
916 TCHECK(ptr
->hardware_overrun
);
917 printf(" HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
));
918 TCHECK(ptr
->buffer_overrun
);
919 printf(" BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
));
920 TCHECK(ptr
->timeout_err
);
921 printf(" TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
));
922 TCHECK(ptr
->align_err
);
923 printf(" ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
));
932 pptp_sli_print(const u_char
*dat
)
934 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
936 TCHECK(ptr
->peer_call_id
);
937 pptp_peer_call_id_print(&ptr
->peer_call_id
);
938 TCHECK(ptr
->reserved1
);
939 TCHECK(ptr
->send_accm
);
940 printf(" SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
));
941 TCHECK(ptr
->recv_accm
);
942 printf(" RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
));
951 pptp_print(const u_char
*dat
)
953 const struct pptp_hdr
*hdr
;
955 u_int16_t ctrl_msg_type
;
959 hdr
= (struct pptp_hdr
*)dat
;
963 printf(" Length=%u", EXTRACT_16BITS(&hdr
->length
));
965 TCHECK(hdr
->msg_type
);
967 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
968 case PPTP_MSG_TYPE_CTRL
:
971 case PPTP_MSG_TYPE_MGMT
:
975 printf(" UNKNOWN-MSG-TYPE");
980 TCHECK(hdr
->magic_cookie
);
981 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
982 if (mc
!= PPTP_MAGIC_COOKIE
) {
983 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
985 if (vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
986 printf(" Magic-Cookie=%08x", mc
);
988 TCHECK(hdr
->ctrl_msg_type
);
989 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
990 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
991 printf(" CTRL_MSGTYPE=%s",
992 pptp_message_type_string
[ctrl_msg_type
]);
994 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
996 TCHECK(hdr
->reserved0
);
1000 switch(ctrl_msg_type
) {
1001 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1002 pptp_sccrq_print(dat
);
1004 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1005 pptp_sccrp_print(dat
);
1007 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1008 pptp_stopccrq_print(dat
);
1010 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1011 pptp_stopccrp_print(dat
);
1013 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1014 pptp_echorq_print(dat
);
1016 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1017 pptp_echorp_print(dat
);
1019 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1020 pptp_ocrq_print(dat
);
1022 case PPTP_CTRL_MSG_TYPE_OCRP
:
1023 pptp_ocrp_print(dat
);
1025 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1026 pptp_icrq_print(dat
);
1028 case PPTP_CTRL_MSG_TYPE_ICRP
:
1029 pptp_icrp_print(dat
);
1031 case PPTP_CTRL_MSG_TYPE_ICCN
:
1032 pptp_iccn_print(dat
);
1034 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1035 pptp_ccrq_print(dat
);
1037 case PPTP_CTRL_MSG_TYPE_CDN
:
1038 pptp_cdn_print(dat
);
1040 case PPTP_CTRL_MSG_TYPE_WEN
:
1041 pptp_wen_print(dat
);
1043 case PPTP_CTRL_MSG_TYPE_SLI
:
1044 pptp_sli_print(dat
);