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
[] =
27 "@(#) $Header: /tcpdump/master/tcpdump/print-pptp.c,v 1.3 2001-10-31 08:54:31 guy Exp $";
35 #include <sys/types.h>
36 #include <sys/param.h>
37 #include <netinet/in.h>
38 #include <arpa/inet.h>
40 #include "interface.h"
42 static char tstr
[] = " [|pptp]";
52 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
53 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
54 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
56 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
57 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
58 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
59 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
60 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
61 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
62 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
63 #define PPTP_CTRL_MSG_TYPE_OCRP 8
64 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
65 #define PPTP_CTRL_MSG_TYPE_ICRP 10
66 #define PPTP_CTRL_MSG_TYPE_ICCN 11
67 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
68 #define PPTP_CTRL_MSG_TYPE_CDN 13
69 #define PPTP_CTRL_MSG_TYPE_WEN 14
70 #define PPTP_CTRL_MSG_TYPE_SLI 15
72 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
73 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
75 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
76 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
78 static char *pptp_message_type_string
[] = {
79 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
80 "SCCRQ", /* 1 Start-Control-Connection-Request */
81 "SCCRP", /* 2 Start-Control-Connection-Reply */
82 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
83 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
84 "ECHORQ", /* 5 Echo Request */
85 "ECHORP", /* 6 Echo Reply */
87 "OCRQ", /* 7 Outgoing-Call-Request */
88 "OCRP", /* 8 Outgoing-Call-Reply */
89 "ICRQ", /* 9 Incoming-Call-Request */
90 "ICRP", /* 10 Incoming-Call-Reply */
91 "ICCN", /* 11 Incoming-Call-Connected */
92 "CCRQ", /* 12 Call-Clear-Request */
93 "CDN", /* 13 Call-Disconnect-Notify */
95 "WEN", /* 14 WAN-Error-Notify */
97 "SLI" /* 15 Set-Link-Info */
98 #define PPTP_MAX_MSGTYPE_INDEX 16
101 /* common for all PPTP control messages */
105 u_int32_t magic_cookie
;
106 u_int16_t ctrl_msg_type
;
110 struct pptp_msg_sccrq
{
113 u_int32_t framing_cap
;
114 u_int32_t bearer_cap
;
115 u_int16_t max_channel
;
121 struct pptp_msg_sccrp
{
123 u_int8_t result_code
;
125 u_int32_t framing_cap
;
126 u_int32_t bearer_cap
;
127 u_int16_t max_channel
;
133 struct pptp_msg_stopccrq
{
139 struct pptp_msg_stopccrp
{
140 u_int8_t result_code
;
145 struct pptp_msg_echorq
{
149 struct pptp_msg_echorp
{
151 u_int8_t result_code
;
156 struct pptp_msg_ocrq
{
161 u_int32_t bearer_type
;
162 u_int32_t framing_type
;
163 u_int16_t recv_winsiz
;
164 u_int16_t pkt_proc_delay
;
165 u_int16_t phone_no_len
;
171 struct pptp_msg_ocrp
{
173 u_int16_t peer_call_id
;
174 u_int8_t result_code
;
176 u_int16_t cause_code
;
177 u_int32_t conn_speed
;
178 u_int16_t recv_winsiz
;
179 u_int16_t pkt_proc_delay
;
180 u_int32_t phy_chan_id
;
183 struct pptp_msg_icrq
{
186 u_int32_t bearer_type
;
187 u_int32_t phy_chan_id
;
188 u_int16_t dialed_no_len
;
189 u_int16_t dialing_no_len
;
190 u_char dialed_no
[64]; /* DNIS */
191 u_char dialing_no
[64]; /* CLID */
195 struct pptp_msg_icrp
{
197 u_int16_t peer_call_id
;
198 u_int8_t result_code
;
200 u_int16_t recv_winsiz
;
201 u_int16_t pkt_proc_delay
;
205 struct pptp_msg_iccn
{
206 u_int16_t peer_call_id
;
208 u_int32_t conn_speed
;
209 u_int16_t recv_winsiz
;
210 u_int16_t pkt_proc_delay
;
211 u_int32_t framing_type
;
214 struct pptp_msg_ccrq
{
219 struct pptp_msg_cdn
{
221 u_int8_t result_code
;
223 u_int16_t cause_code
;
225 u_char call_stats
[128];
228 struct pptp_msg_wen
{
229 u_int16_t peer_call_id
;
232 u_int32_t framing_err
;
233 u_int32_t hardware_overrun
;
234 u_int32_t buffer_overrun
;
235 u_int32_t timeout_err
;
239 struct pptp_msg_sli
{
240 u_int16_t peer_call_id
;
246 /* attributes that appear more than once in above messages:
250 --------------------------------------
251 2 u_int32_t bearer_cap;
252 2 u_int32_t bearer_type;
254 2 u_int16_t call_ser;
255 2 u_int16_t cause_code;
256 2 u_int32_t conn_speed;
258 2 u_int16_t firm_rev;
259 2 u_int32_t framing_cap;
260 2 u_int32_t framing_type;
261 2 u_char hostname[64];
263 2 u_int16_t max_channel;
264 5 u_int16_t peer_call_id;
265 2 u_int32_t phy_chan_id;
266 4 u_int16_t pkt_proc_delay;
267 2 u_int16_t proto_ver;
268 4 u_int16_t recv_winsiz;
269 2 u_int8_t reserved1;
270 9 u_int16_t reserved1;
271 6 u_int8_t result_code;
272 2 u_char subaddr[64];
275 so I will prepare print out functions for these attributes (except for
279 /******************************************/
280 /* Attribute-specific print out functions */
281 /******************************************/
283 /* In these attribute-specific print-out functions, it't not necessary
284 to do TCHECK because they are already checked in the caller of
288 pptp_bearer_cap_print(const u_int32_t
*bearer_cap
)
290 printf(" BEARER_CAP(");
291 if (ntohl(*bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
) {
294 if (ntohl(*bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
) {
301 pptp_bearer_type_print(const u_int32_t
*bearer_type
)
303 printf(" BEARER_TYPE(");
304 switch (ntohl(*bearer_type
)) {
306 printf("A"); /* Analog */
309 printf("D"); /* Digital */
322 pptp_call_id_print(const u_int16_t
*call_id
)
324 printf(" CALL_ID(%u)", ntohs(*call_id
));
328 pptp_call_ser_print(const u_int16_t
*call_ser
)
330 printf(" CALL_SER_NUM(%u)", ntohs(*call_ser
));
334 pptp_cause_code_print(const u_int16_t
*cause_code
)
336 printf(" CAUSE_CODE(%u)", ntohs(*cause_code
));
340 pptp_conn_speed_print(const u_int32_t
*conn_speed
)
342 printf(" CONN_SPEED(%lu)", (unsigned long)ntohl(*conn_speed
));
346 pptp_err_code_print(const u_int8_t
*err_code
)
348 printf(" ERR_CODE(%u", *err_code
);
355 printf(":Not-Connected");
358 printf(":Bad-Format");
361 printf(":Bad-Valude");
364 printf(":No-Resource");
367 printf(":Bad-Call-ID");
370 printf(":PAC-Error");
381 pptp_firm_rev_print(const u_int16_t
*firm_rev
)
383 printf(" FIRM_REV(%u)", ntohs(*firm_rev
));
387 pptp_framing_cap_print(const u_int32_t
*framing_cap
)
389 printf(" FRAME_CAP(");
390 if (ntohl(*framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
391 printf("A"); /* Async */
393 if (ntohl(*framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
394 printf("S"); /* Sync */
400 pptp_framing_type_print(const u_int32_t
*framing_type
)
402 printf(" FRAME_TYPE(");
403 switch (ntohl(*framing_type
)) {
405 printf("A"); /* Async */
408 printf("S"); /* Sync */
411 printf("E"); /* Either */
421 pptp_hostname_print(const u_char
*hostname
)
423 printf(" HOSTNAME(%.64s)", hostname
);
427 pptp_id_print(const u_int32_t
*id
)
429 printf(" ID(%lu)", (unsigned long)ntohl(*id
));
433 pptp_max_channel_print(const u_int16_t
*max_channel
)
435 printf(" MAX_CHAN(%u)", ntohs(*max_channel
));
439 pptp_peer_call_id_print(const u_int16_t
*peer_call_id
)
441 printf(" PEER_CALL_ID(%u)", ntohs(*peer_call_id
));
445 pptp_phy_chan_id_print(const u_int32_t
*phy_chan_id
)
447 printf(" PHY_CHAN_ID(%lu)", (unsigned long)ntohl(*phy_chan_id
));
451 pptp_pkt_proc_delay_print(const u_int16_t
*pkt_proc_delay
)
453 printf(" PROC_DELAY(%u)", ntohs(*pkt_proc_delay
));
457 pptp_proto_ver_print(const u_int16_t
*proto_ver
)
459 printf(" PROTO_VER(%u.%u)", /* Version.Revision */
460 ntohs(*proto_ver
) >> 8, ntohs(*proto_ver
) & 0xff);
464 pptp_recv_winsiz_print(const u_int16_t
*recv_winsiz
)
466 printf(" RECV_WIN(%u)", ntohs(*recv_winsiz
));
470 pptp_result_code_print(const u_int8_t
*result_code
, int ctrl_msg_type
)
472 printf(" RESULT_CODE(%u", *result_code
);
474 switch (ctrl_msg_type
) {
475 case PPTP_CTRL_MSG_TYPE_SCCRP
:
476 switch (*result_code
) {
478 printf(":Successful channel establishment");
481 printf(":General error");
484 printf(":Command channel already exists");
487 printf(":Requester is not authorized to establish a command channel");
490 printf(":The protocol version of the requester is not supported");
497 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
498 case PPTP_CTRL_MSG_TYPE_ECHORP
:
499 switch (*result_code
) {
504 printf(":General Error");
511 case PPTP_CTRL_MSG_TYPE_OCRP
:
512 switch (*result_code
) {
514 printf(":Connected");
517 printf(":General Error");
520 printf(":No Carrier");
526 printf(":No Dial Tone");
532 printf(":Do Not Accept");
539 case PPTP_CTRL_MSG_TYPE_ICRP
:
540 switch (*result_code
) {
545 printf(":General Error");
548 printf(":Do Not Accept");
555 case PPTP_CTRL_MSG_TYPE_CDN
:
556 switch (*result_code
) {
558 printf(":Lost Carrier");
561 printf(":General Error");
564 printf(":Admin Shutdown");
574 /* assertion error */
582 pptp_subaddr_print(const u_char
*subaddr
)
584 printf(" SUB_ADDR(%.64s)", subaddr
);
588 pptp_vendor_print(const u_char
*vendor
)
590 printf(" VENDOR(%.64s)", vendor
);
593 /************************************/
594 /* PPTP message print out functions */
595 /************************************/
597 pptp_sccrq_print(const u_char
*dat
)
599 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
601 TCHECK(ptr
->proto_ver
);
602 pptp_proto_ver_print(&ptr
->proto_ver
);
603 TCHECK(ptr
->reserved1
);
604 TCHECK(ptr
->framing_cap
);
605 pptp_framing_cap_print(&ptr
->framing_cap
);
606 TCHECK(ptr
->bearer_cap
);
607 pptp_bearer_cap_print(&ptr
->bearer_cap
);
608 TCHECK(ptr
->max_channel
);
609 pptp_max_channel_print(&ptr
->max_channel
);
610 TCHECK(ptr
->firm_rev
);
611 pptp_firm_rev_print(&ptr
->firm_rev
);
612 TCHECK(ptr
->hostname
);
613 pptp_hostname_print(&ptr
->hostname
[0]);
615 pptp_vendor_print(&ptr
->vendor
[0]);
624 pptp_sccrp_print(const u_char
*dat
)
626 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
628 TCHECK(ptr
->proto_ver
);
629 pptp_proto_ver_print(&ptr
->proto_ver
);
630 TCHECK(ptr
->result_code
);
631 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
632 TCHECK(ptr
->err_code
);
633 pptp_err_code_print(&ptr
->err_code
);
634 TCHECK(ptr
->framing_cap
);
635 pptp_framing_cap_print(&ptr
->framing_cap
);
636 TCHECK(ptr
->bearer_cap
);
637 pptp_bearer_cap_print(&ptr
->bearer_cap
);
638 TCHECK(ptr
->max_channel
);
639 pptp_max_channel_print(&ptr
->max_channel
);
640 TCHECK(ptr
->firm_rev
);
641 pptp_firm_rev_print(&ptr
->firm_rev
);
642 TCHECK(ptr
->hostname
);
643 pptp_hostname_print(&ptr
->hostname
[0]);
645 pptp_vendor_print(&ptr
->vendor
[0]);
654 pptp_stopccrq_print(const u_char
*dat
)
656 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
659 printf(" REASON(%u", ptr
->reason
);
661 switch (ptr
->reason
) {
666 printf(":Stop-Protocol");
669 printf(":Stop-Local-Shutdown");
677 TCHECK(ptr
->reserved1
);
678 TCHECK(ptr
->reserved2
);
687 pptp_stopccrp_print(const u_char
*dat
)
689 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
691 TCHECK(ptr
->result_code
);
692 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
693 TCHECK(ptr
->err_code
);
694 pptp_err_code_print(&ptr
->err_code
);
695 TCHECK(ptr
->reserved1
);
704 pptp_echorq_print(const u_char
*dat
)
706 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
709 pptp_id_print(&ptr
->id
);
718 pptp_echorp_print(const u_char
*dat
)
720 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
723 pptp_id_print(&ptr
->id
);
724 TCHECK(ptr
->result_code
);
725 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
726 TCHECK(ptr
->err_code
);
727 pptp_err_code_print(&ptr
->err_code
);
728 TCHECK(ptr
->reserved1
);
737 pptp_ocrq_print(const u_char
*dat
)
739 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
741 TCHECK(ptr
->call_id
);
742 pptp_call_id_print(&ptr
->call_id
);
743 TCHECK(ptr
->call_ser
);
744 pptp_call_ser_print(&ptr
->call_ser
);
745 TCHECK(ptr
->min_bps
);
746 printf(" MIN_BPS(%lu)", (unsigned long)ntohl(ptr
->min_bps
));
747 TCHECK(ptr
->max_bps
);
748 printf(" MAX_BPS(%lu)", (unsigned long)ntohl(ptr
->max_bps
));
749 TCHECK(ptr
->bearer_type
);
750 pptp_bearer_type_print(&ptr
->bearer_type
);
751 TCHECK(ptr
->framing_type
);
752 pptp_framing_type_print(&ptr
->framing_type
);
753 TCHECK(ptr
->recv_winsiz
);
754 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
755 TCHECK(ptr
->pkt_proc_delay
);
756 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
757 TCHECK(ptr
->phone_no_len
);
758 printf(" PHONE_NO_LEN(%u)", ntohs(ptr
->phone_no_len
));
759 TCHECK(ptr
->reserved1
);
760 TCHECK(ptr
->phone_no
);
761 printf(" PHONE_NO(%.64s)", ptr
->phone_no
);
762 TCHECK(ptr
->subaddr
);
763 pptp_subaddr_print(&ptr
->subaddr
[0]);
772 pptp_ocrp_print(const u_char
*dat
)
774 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
776 TCHECK(ptr
->call_id
);
777 pptp_call_id_print(&ptr
->call_id
);
778 TCHECK(ptr
->peer_call_id
);
779 pptp_peer_call_id_print(&ptr
->peer_call_id
);
780 TCHECK(ptr
->result_code
);
781 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
782 TCHECK(ptr
->err_code
);
783 pptp_err_code_print(&ptr
->err_code
);
784 TCHECK(ptr
->cause_code
);
785 pptp_cause_code_print(&ptr
->cause_code
);
786 TCHECK(ptr
->conn_speed
);
787 pptp_conn_speed_print(&ptr
->conn_speed
);
788 TCHECK(ptr
->recv_winsiz
);
789 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
790 TCHECK(ptr
->pkt_proc_delay
);
791 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
792 TCHECK(ptr
->phy_chan_id
);
793 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
802 pptp_icrq_print(const u_char
*dat
)
804 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
806 TCHECK(ptr
->call_id
);
807 pptp_call_id_print(&ptr
->call_id
);
808 TCHECK(ptr
->call_ser
);
809 pptp_call_ser_print(&ptr
->call_ser
);
810 TCHECK(ptr
->bearer_type
);
811 pptp_bearer_type_print(&ptr
->bearer_type
);
812 TCHECK(ptr
->phy_chan_id
);
813 pptp_phy_chan_id_print(&ptr
->phy_chan_id
);
814 TCHECK(ptr
->dialed_no_len
);
815 printf(" DIALED_NO_LEN(%u)", ntohs(ptr
->dialed_no_len
));
816 TCHECK(ptr
->dialing_no_len
);
817 printf(" DIALING_NO_LEN(%u)", ntohs(ptr
->dialing_no_len
));
818 TCHECK(ptr
->dialed_no
);
819 printf(" DIALED_NO(%.64s)", ptr
->dialed_no
);
820 TCHECK(ptr
->dialing_no
);
821 printf(" DIALING_NO(%.64s)", ptr
->dialing_no
);
822 TCHECK(ptr
->subaddr
);
823 pptp_subaddr_print(&ptr
->subaddr
[0]);
832 pptp_icrp_print(const u_char
*dat
)
834 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
836 TCHECK(ptr
->call_id
);
837 pptp_call_id_print(&ptr
->call_id
);
838 TCHECK(ptr
->peer_call_id
);
839 pptp_peer_call_id_print(&ptr
->peer_call_id
);
840 TCHECK(ptr
->result_code
);
841 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
842 TCHECK(ptr
->err_code
);
843 pptp_err_code_print(&ptr
->err_code
);
844 TCHECK(ptr
->recv_winsiz
);
845 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
846 TCHECK(ptr
->pkt_proc_delay
);
847 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
848 TCHECK(ptr
->reserved1
);
857 pptp_iccn_print(const u_char
*dat
)
859 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
861 TCHECK(ptr
->peer_call_id
);
862 pptp_peer_call_id_print(&ptr
->peer_call_id
);
863 TCHECK(ptr
->reserved1
);
864 TCHECK(ptr
->conn_speed
);
865 pptp_conn_speed_print(&ptr
->conn_speed
);
866 TCHECK(ptr
->recv_winsiz
);
867 pptp_recv_winsiz_print(&ptr
->recv_winsiz
);
868 TCHECK(ptr
->pkt_proc_delay
);
869 pptp_pkt_proc_delay_print(&ptr
->pkt_proc_delay
);
870 TCHECK(ptr
->framing_type
);
871 pptp_framing_type_print(&ptr
->framing_type
);
880 pptp_ccrq_print(const u_char
*dat
)
882 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
884 TCHECK(ptr
->call_id
);
885 pptp_call_id_print(&ptr
->call_id
);
886 TCHECK(ptr
->reserved1
);
895 pptp_cdn_print(const u_char
*dat
)
897 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
899 TCHECK(ptr
->call_id
);
900 pptp_call_id_print(&ptr
->call_id
);
901 TCHECK(ptr
->result_code
);
902 pptp_result_code_print(&ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
903 TCHECK(ptr
->err_code
);
904 pptp_err_code_print(&ptr
->err_code
);
905 TCHECK(ptr
->cause_code
);
906 pptp_cause_code_print(&ptr
->cause_code
);
907 TCHECK(ptr
->reserved1
);
908 TCHECK(ptr
->call_stats
);
909 printf(" CALL_STATS(%.128s)", ptr
->call_stats
);
918 pptp_wen_print(const u_char
*dat
)
920 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
922 TCHECK(ptr
->peer_call_id
);
923 pptp_peer_call_id_print(&ptr
->peer_call_id
);
924 TCHECK(ptr
->reserved1
);
925 TCHECK(ptr
->crc_err
);
926 printf(" CRC_ERR(%lu)", (unsigned long)ntohl(ptr
->crc_err
));
927 TCHECK(ptr
->framing_err
);
928 printf(" FRAMING_ERR(%lu)", (unsigned long)ntohl(ptr
->framing_err
));
929 TCHECK(ptr
->hardware_overrun
);
930 printf(" HARDWARE_OVERRUN(%lu)",
931 (unsigned long)ntohl(ptr
->hardware_overrun
));
932 TCHECK(ptr
->buffer_overrun
);
933 printf(" BUFFER_OVERRUN(%lu)",
934 (unsigned long)ntohl(ptr
->buffer_overrun
));
935 TCHECK(ptr
->timeout_err
);
936 printf(" TIMEOUT_ERR(%lu)", (unsigned long)ntohl(ptr
->timeout_err
));
937 TCHECK(ptr
->align_err
);
938 printf(" ALIGN_ERR(%lu)", (unsigned long)ntohl(ptr
->align_err
));
947 pptp_sli_print(const u_char
*dat
)
949 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
951 TCHECK(ptr
->peer_call_id
);
952 pptp_peer_call_id_print(&ptr
->peer_call_id
);
953 TCHECK(ptr
->reserved1
);
954 TCHECK(ptr
->send_accm
);
955 printf(" SEND_ACCM(0x%08lx)", (unsigned long)ntohl(ptr
->send_accm
));
956 TCHECK(ptr
->recv_accm
);
957 printf(" RECV_ACCM(0x%08lx)", (unsigned long)ntohl(ptr
->recv_accm
));
966 pptp_print(const u_char
*dat
, u_int length
)
968 const struct pptp_hdr
*hdr
;
970 u_int16_t ctrl_msg_type
;
974 hdr
= (struct pptp_hdr
*)dat
;
978 printf(" Length=%u", ntohs(hdr
->length
));
980 TCHECK(hdr
->msg_type
);
982 switch(ntohs(hdr
->msg_type
)) {
983 case PPTP_MSG_TYPE_CTRL
:
986 case PPTP_MSG_TYPE_MGMT
:
990 printf(" UNKNOWN-MSG-TYPE");
995 TCHECK(hdr
->magic_cookie
);
996 mc
= ntohl(hdr
->magic_cookie
);
997 if (mc
!= PPTP_MAGIC_COOKIE
) {
998 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
1000 if (vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
1001 printf(" Magic-Cookie=%08x", mc
);
1003 TCHECK(hdr
->ctrl_msg_type
);
1004 ctrl_msg_type
= ntohs(hdr
->ctrl_msg_type
);
1005 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
1006 printf(" CTRL_MSGTYPE=%s",
1007 pptp_message_type_string
[ctrl_msg_type
]);
1009 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
1011 TCHECK(hdr
->reserved0
);
1015 switch(ctrl_msg_type
) {
1016 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1017 pptp_sccrq_print(dat
);
1019 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1020 pptp_sccrp_print(dat
);
1022 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1023 pptp_stopccrq_print(dat
);
1025 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1026 pptp_stopccrp_print(dat
);
1028 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1029 pptp_echorq_print(dat
);
1031 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1032 pptp_echorp_print(dat
);
1034 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1035 pptp_ocrq_print(dat
);
1037 case PPTP_CTRL_MSG_TYPE_OCRP
:
1038 pptp_ocrp_print(dat
);
1040 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1041 pptp_icrq_print(dat
);
1043 case PPTP_CTRL_MSG_TYPE_ICRP
:
1044 pptp_icrp_print(dat
);
1046 case PPTP_CTRL_MSG_TYPE_ICCN
:
1047 pptp_iccn_print(dat
);
1049 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1050 pptp_ccrq_print(dat
);
1052 case PPTP_CTRL_MSG_TYPE_CDN
:
1053 pptp_cdn_print(dat
);
1055 case PPTP_CTRL_MSG_TYPE_WEN
:
1056 pptp_wen_print(dat
);
1058 case PPTP_CTRL_MSG_TYPE_SLI
:
1059 pptp_sli_print(dat
);