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.9.2.2 2003/11/16 08:51:39 guy Exp $";
34 #include <tcpdump-stdinc.h>
38 #include "interface.h"
41 static char tstr[] = " [|pptp]";
51 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
52 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
53 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
55 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
56 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
57 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
58 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
59 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
60 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
61 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
62 #define PPTP_CTRL_MSG_TYPE_OCRP 8
63 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
64 #define PPTP_CTRL_MSG_TYPE_ICRP 10
65 #define PPTP_CTRL_MSG_TYPE_ICCN 11
66 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
67 #define PPTP_CTRL_MSG_TYPE_CDN 13
68 #define PPTP_CTRL_MSG_TYPE_WEN 14
69 #define PPTP_CTRL_MSG_TYPE_SLI 15
71 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
72 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
74 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
75 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
77 static const char *pptp_message_type_string[] = {
78 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
79 "SCCRQ", /* 1 Start-Control-Connection-Request */
80 "SCCRP", /* 2 Start-Control-Connection-Reply */
81 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
82 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
83 "ECHORQ", /* 5 Echo Request */
84 "ECHORP", /* 6 Echo Reply */
86 "OCRQ", /* 7 Outgoing-Call-Request */
87 "OCRP", /* 8 Outgoing-Call-Reply */
88 "ICRQ", /* 9 Incoming-Call-Request */
89 "ICRP", /* 10 Incoming-Call-Reply */
90 "ICCN", /* 11 Incoming-Call-Connected */
91 "CCRQ", /* 12 Call-Clear-Request */
92 "CDN", /* 13 Call-Disconnect-Notify */
94 "WEN", /* 14 WAN-Error-Notify */
96 "SLI" /* 15 Set-Link-Info */
97 #define PPTP_MAX_MSGTYPE_INDEX 16
100 /* common for all PPTP control messages */
104 u_int32_t magic_cookie;
105 u_int16_t ctrl_msg_type;
109 struct pptp_msg_sccrq {
112 u_int32_t framing_cap;
113 u_int32_t bearer_cap;
114 u_int16_t max_channel;
120 struct pptp_msg_sccrp {
122 u_int8_t result_code;
124 u_int32_t framing_cap;
125 u_int32_t bearer_cap;
126 u_int16_t max_channel;
132 struct pptp_msg_stopccrq {
138 struct pptp_msg_stopccrp {
139 u_int8_t result_code;
144 struct pptp_msg_echorq {
148 struct pptp_msg_echorp {
150 u_int8_t result_code;
155 struct pptp_msg_ocrq {
160 u_int32_t bearer_type;
161 u_int32_t framing_type;
162 u_int16_t recv_winsiz;
163 u_int16_t pkt_proc_delay;
164 u_int16_t phone_no_len;
170 struct pptp_msg_ocrp {
172 u_int16_t peer_call_id;
173 u_int8_t result_code;
175 u_int16_t cause_code;
176 u_int32_t conn_speed;
177 u_int16_t recv_winsiz;
178 u_int16_t pkt_proc_delay;
179 u_int32_t phy_chan_id;
182 struct pptp_msg_icrq {
185 u_int32_t bearer_type;
186 u_int32_t phy_chan_id;
187 u_int16_t dialed_no_len;
188 u_int16_t dialing_no_len;
189 u_char dialed_no[64]; /* DNIS */
190 u_char dialing_no[64]; /* CLID */
194 struct pptp_msg_icrp {
196 u_int16_t peer_call_id;
197 u_int8_t result_code;
199 u_int16_t recv_winsiz;
200 u_int16_t pkt_proc_delay;
204 struct pptp_msg_iccn {
205 u_int16_t peer_call_id;
207 u_int32_t conn_speed;
208 u_int16_t recv_winsiz;
209 u_int16_t pkt_proc_delay;
210 u_int32_t framing_type;
213 struct pptp_msg_ccrq {
218 struct pptp_msg_cdn {
220 u_int8_t result_code;
222 u_int16_t cause_code;
224 u_char call_stats[128];
227 struct pptp_msg_wen {
228 u_int16_t peer_call_id;
231 u_int32_t framing_err;
232 u_int32_t hardware_overrun;
233 u_int32_t buffer_overrun;
234 u_int32_t timeout_err;
238 struct pptp_msg_sli {
239 u_int16_t peer_call_id;
245 /* attributes that appear more than once in above messages:
249 --------------------------------------
250 2 u_int32_t bearer_cap;
251 2 u_int32_t bearer_type;
253 2 u_int16_t call_ser;
254 2 u_int16_t cause_code;
255 2 u_int32_t conn_speed;
257 2 u_int16_t firm_rev;
258 2 u_int32_t framing_cap;
259 2 u_int32_t framing_type;
260 2 u_char hostname[64];
262 2 u_int16_t max_channel;
263 5 u_int16_t peer_call_id;
264 2 u_int32_t phy_chan_id;
265 4 u_int16_t pkt_proc_delay;
266 2 u_int16_t proto_ver;
267 4 u_int16_t recv_winsiz;
268 2 u_int8_t reserved1;
269 9 u_int16_t reserved1;
270 6 u_int8_t result_code;
271 2 u_char subaddr[64];
274 so I will prepare print out functions for these attributes (except for
278 /******************************************/
279 /* Attribute-specific print out functions */
280 /******************************************/
282 /* In these attribute-specific print-out functions, it't not necessary
283 to do TCHECK because they are already checked in the caller of
287 pptp_bearer_cap_print(const u_int32_t *bearer_cap)
289 printf(" BEARER_CAP(");
290 if (EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK) {
293 if (EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK) {
300 pptp_bearer_type_print(const u_int32_t *bearer_type)
302 printf(" BEARER_TYPE(");
303 switch (EXTRACT_32BITS(bearer_type)) {
305 printf("A"); /* Analog */
308 printf("D"); /* Digital */
321 pptp_call_id_print(const u_int16_t *call_id)
323 printf(" CALL_ID(%u)", EXTRACT_16BITS(call_id));
327 pptp_call_ser_print(const u_int16_t *call_ser)
329 printf(" CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser));
333 pptp_cause_code_print(const u_int16_t *cause_code)
335 printf(" CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code));
339 pptp_conn_speed_print(const u_int32_t *conn_speed)
341 printf(" CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed));
345 pptp_err_code_print(const u_int8_t *err_code)
347 printf(" ERR_CODE(%u", *err_code);
354 printf(":Not-Connected");
357 printf(":Bad-Format");
360 printf(":Bad-Valude");
363 printf(":No-Resource");
366 printf(":Bad-Call-ID");
369 printf(":PAC-Error");
380 pptp_firm_rev_print(const u_int16_t *firm_rev)
382 printf(" FIRM_REV(%u)", EXTRACT_16BITS(firm_rev));
386 pptp_framing_cap_print(const u_int32_t *framing_cap)
388 printf(" FRAME_CAP(");
389 if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
390 printf("A"); /* Async */
392 if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) {
393 printf("S"); /* Sync */
399 pptp_framing_type_print(const u_int32_t *framing_type)
401 printf(" FRAME_TYPE(");
402 switch (EXTRACT_32BITS(framing_type)) {
404 printf("A"); /* Async */
407 printf("S"); /* Sync */
410 printf("E"); /* Either */
420 pptp_hostname_print(const u_char *hostname)
422 printf(" HOSTNAME(%.64s)", hostname);
426 pptp_id_print(const u_int32_t *id)
428 printf(" ID(%u)", EXTRACT_32BITS(id));
432 pptp_max_channel_print(const u_int16_t *max_channel)
434 printf(" MAX_CHAN(%u)", EXTRACT_16BITS(max_channel));
438 pptp_peer_call_id_print(const u_int16_t *peer_call_id)
440 printf(" PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id));
444 pptp_phy_chan_id_print(const u_int32_t *phy_chan_id)
446 printf(" PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id));
450 pptp_pkt_proc_delay_print(const u_int16_t *pkt_proc_delay)
452 printf(" PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay));
456 pptp_proto_ver_print(const u_int16_t *proto_ver)
458 printf(" PROTO_VER(%u.%u)", /* Version.Revision */
459 EXTRACT_16BITS(proto_ver) >> 8,
460 EXTRACT_16BITS(proto_ver) & 0xff);
464 pptp_recv_winsiz_print(const u_int16_t *recv_winsiz)
466 printf(" RECV_WIN(%u)", EXTRACT_16BITS(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(%u)", EXTRACT_32BITS(&ptr->min_bps));
747 TCHECK(ptr->max_bps);
748 printf(" MAX_BPS(%u)", EXTRACT_32BITS(&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)", EXTRACT_16BITS(&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)", EXTRACT_16BITS(&ptr->dialed_no_len));
816 TCHECK(ptr->dialing_no_len);
817 printf(" DIALING_NO_LEN(%u)", EXTRACT_16BITS(&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(%u)", EXTRACT_32BITS(&ptr->crc_err));
927 TCHECK(ptr->framing_err);
928 printf(" FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr->framing_err));
929 TCHECK(ptr->hardware_overrun);
930 printf(" HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr->hardware_overrun));
931 TCHECK(ptr->buffer_overrun);
932 printf(" BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr->buffer_overrun));
933 TCHECK(ptr->timeout_err);
934 printf(" TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr->timeout_err));
935 TCHECK(ptr->align_err);
936 printf(" ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr->align_err));
945 pptp_sli_print(const u_char *dat)
947 struct pptp_msg_sli *ptr = (struct pptp_msg_sli *)dat;
949 TCHECK(ptr->peer_call_id);
950 pptp_peer_call_id_print(&ptr->peer_call_id);
951 TCHECK(ptr->reserved1);
952 TCHECK(ptr->send_accm);
953 printf(" SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->send_accm));
954 TCHECK(ptr->recv_accm);
955 printf(" RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr->recv_accm));
964 pptp_print(const u_char *dat)
966 const struct pptp_hdr *hdr;
968 u_int16_t ctrl_msg_type;
972 hdr = (struct pptp_hdr *)dat;
976 printf(" Length=%u", EXTRACT_16BITS(&hdr->length));
978 TCHECK(hdr->msg_type);
980 switch(EXTRACT_16BITS(&hdr->msg_type)) {
981 case PPTP_MSG_TYPE_CTRL:
984 case PPTP_MSG_TYPE_MGMT:
988 printf(" UNKNOWN-MSG-TYPE");
993 TCHECK(hdr->magic_cookie);
994 mc = EXTRACT_32BITS(&hdr->magic_cookie);
995 if (mc != PPTP_MAGIC_COOKIE) {
996 printf(" UNEXPECTED Magic-Cookie!!(%08x)", mc);
998 if (vflag || mc != PPTP_MAGIC_COOKIE) {
999 printf(" Magic-Cookie=%08x", mc);
1001 TCHECK(hdr->ctrl_msg_type);
1002 ctrl_msg_type = EXTRACT_16BITS(&hdr->ctrl_msg_type);
1003 if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) {
1004 printf(" CTRL_MSGTYPE=%s",
1005 pptp_message_type_string[ctrl_msg_type]);
1007 printf(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type);
1009 TCHECK(hdr->reserved0);
1013 switch(ctrl_msg_type) {
1014 case PPTP_CTRL_MSG_TYPE_SCCRQ:
1015 pptp_sccrq_print(dat);
1017 case PPTP_CTRL_MSG_TYPE_SCCRP:
1018 pptp_sccrp_print(dat);
1020 case PPTP_CTRL_MSG_TYPE_StopCCRQ:
1021 pptp_stopccrq_print(dat);
1023 case PPTP_CTRL_MSG_TYPE_StopCCRP:
1024 pptp_stopccrp_print(dat);
1026 case PPTP_CTRL_MSG_TYPE_ECHORQ:
1027 pptp_echorq_print(dat);
1029 case PPTP_CTRL_MSG_TYPE_ECHORP:
1030 pptp_echorp_print(dat);
1032 case PPTP_CTRL_MSG_TYPE_OCRQ:
1033 pptp_ocrq_print(dat);
1035 case PPTP_CTRL_MSG_TYPE_OCRP:
1036 pptp_ocrp_print(dat);
1038 case PPTP_CTRL_MSG_TYPE_ICRQ:
1039 pptp_icrq_print(dat);
1041 case PPTP_CTRL_MSG_TYPE_ICRP:
1042 pptp_icrp_print(dat);
1044 case PPTP_CTRL_MSG_TYPE_ICCN:
1045 pptp_iccn_print(dat);
1047 case PPTP_CTRL_MSG_TYPE_CCRQ:
1048 pptp_ccrq_print(dat);
1050 case PPTP_CTRL_MSG_TYPE_CDN:
1051 pptp_cdn_print(dat);
1053 case PPTP_CTRL_MSG_TYPE_WEN:
1054 pptp_wen_print(dat);
1056 case PPTP_CTRL_MSG_TYPE_SLI:
1057 pptp_sli_print(dat);