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)
24 #define NETDISSECT_REWORKED
29 #include <tcpdump-stdinc.h>
31 #include "interface.h"
34 static const char tstr
[] = " [|pptp]";
36 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
37 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
38 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
40 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
41 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
42 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
43 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
44 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
45 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
46 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
47 #define PPTP_CTRL_MSG_TYPE_OCRP 8
48 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
49 #define PPTP_CTRL_MSG_TYPE_ICRP 10
50 #define PPTP_CTRL_MSG_TYPE_ICCN 11
51 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
52 #define PPTP_CTRL_MSG_TYPE_CDN 13
53 #define PPTP_CTRL_MSG_TYPE_WEN 14
54 #define PPTP_CTRL_MSG_TYPE_SLI 15
56 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
57 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
59 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
60 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
62 static const char *pptp_message_type_string
[] = {
63 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
64 "SCCRQ", /* 1 Start-Control-Connection-Request */
65 "SCCRP", /* 2 Start-Control-Connection-Reply */
66 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
67 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
68 "ECHORQ", /* 5 Echo Request */
69 "ECHORP", /* 6 Echo Reply */
71 "OCRQ", /* 7 Outgoing-Call-Request */
72 "OCRP", /* 8 Outgoing-Call-Reply */
73 "ICRQ", /* 9 Incoming-Call-Request */
74 "ICRP", /* 10 Incoming-Call-Reply */
75 "ICCN", /* 11 Incoming-Call-Connected */
76 "CCRQ", /* 12 Call-Clear-Request */
77 "CDN", /* 13 Call-Disconnect-Notify */
79 "WEN", /* 14 WAN-Error-Notify */
81 "SLI" /* 15 Set-Link-Info */
82 #define PPTP_MAX_MSGTYPE_INDEX 16
85 /* common for all PPTP control messages */
89 u_int32_t magic_cookie
;
90 u_int16_t ctrl_msg_type
;
94 struct pptp_msg_sccrq
{
97 u_int32_t framing_cap
;
99 u_int16_t max_channel
;
105 struct pptp_msg_sccrp
{
107 u_int8_t result_code
;
109 u_int32_t framing_cap
;
110 u_int32_t bearer_cap
;
111 u_int16_t max_channel
;
117 struct pptp_msg_stopccrq
{
123 struct pptp_msg_stopccrp
{
124 u_int8_t result_code
;
129 struct pptp_msg_echorq
{
133 struct pptp_msg_echorp
{
135 u_int8_t result_code
;
140 struct pptp_msg_ocrq
{
145 u_int32_t bearer_type
;
146 u_int32_t framing_type
;
147 u_int16_t recv_winsiz
;
148 u_int16_t pkt_proc_delay
;
149 u_int16_t phone_no_len
;
155 struct pptp_msg_ocrp
{
157 u_int16_t peer_call_id
;
158 u_int8_t result_code
;
160 u_int16_t cause_code
;
161 u_int32_t conn_speed
;
162 u_int16_t recv_winsiz
;
163 u_int16_t pkt_proc_delay
;
164 u_int32_t phy_chan_id
;
167 struct pptp_msg_icrq
{
170 u_int32_t bearer_type
;
171 u_int32_t phy_chan_id
;
172 u_int16_t dialed_no_len
;
173 u_int16_t dialing_no_len
;
174 u_char dialed_no
[64]; /* DNIS */
175 u_char dialing_no
[64]; /* CLID */
179 struct pptp_msg_icrp
{
181 u_int16_t peer_call_id
;
182 u_int8_t result_code
;
184 u_int16_t recv_winsiz
;
185 u_int16_t pkt_proc_delay
;
189 struct pptp_msg_iccn
{
190 u_int16_t peer_call_id
;
192 u_int32_t conn_speed
;
193 u_int16_t recv_winsiz
;
194 u_int16_t pkt_proc_delay
;
195 u_int32_t framing_type
;
198 struct pptp_msg_ccrq
{
203 struct pptp_msg_cdn
{
205 u_int8_t result_code
;
207 u_int16_t cause_code
;
209 u_char call_stats
[128];
212 struct pptp_msg_wen
{
213 u_int16_t peer_call_id
;
216 u_int32_t framing_err
;
217 u_int32_t hardware_overrun
;
218 u_int32_t buffer_overrun
;
219 u_int32_t timeout_err
;
223 struct pptp_msg_sli
{
224 u_int16_t peer_call_id
;
230 /* attributes that appear more than once in above messages:
234 --------------------------------------
235 2 u_int32_t bearer_cap;
236 2 u_int32_t bearer_type;
238 2 u_int16_t call_ser;
239 2 u_int16_t cause_code;
240 2 u_int32_t conn_speed;
242 2 u_int16_t firm_rev;
243 2 u_int32_t framing_cap;
244 2 u_int32_t framing_type;
245 2 u_char hostname[64];
247 2 u_int16_t max_channel;
248 5 u_int16_t peer_call_id;
249 2 u_int32_t phy_chan_id;
250 4 u_int16_t pkt_proc_delay;
251 2 u_int16_t proto_ver;
252 4 u_int16_t recv_winsiz;
253 2 u_int8_t reserved1;
254 9 u_int16_t reserved1;
255 6 u_int8_t result_code;
256 2 u_char subaddr[64];
259 so I will prepare print out functions for these attributes (except for
263 /******************************************/
264 /* Attribute-specific print out functions */
265 /******************************************/
267 /* In these attribute-specific print-out functions, it't not necessary
268 to do ND_TCHECK because they are already checked in the caller of
272 pptp_bearer_cap_print(netdissect_options
*ndo
,
273 const u_int32_t
*bearer_cap
)
275 ND_PRINT((ndo
, " BEARER_CAP("));
276 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
) {
277 ND_PRINT((ndo
, "D"));
279 if (EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
) {
280 ND_PRINT((ndo
, "A"));
282 ND_PRINT((ndo
, ")"));
286 pptp_bearer_type_print(netdissect_options
*ndo
,
287 const u_int32_t
*bearer_type
)
289 ND_PRINT((ndo
, " BEARER_TYPE("));
290 switch (EXTRACT_32BITS(bearer_type
)) {
292 ND_PRINT((ndo
, "A")); /* Analog */
295 ND_PRINT((ndo
, "D")); /* Digital */
298 ND_PRINT((ndo
, "Any"));
301 ND_PRINT((ndo
, "?"));
304 ND_PRINT((ndo
, ")"));
308 pptp_call_id_print(netdissect_options
*ndo
,
309 const u_int16_t
*call_id
)
311 ND_PRINT((ndo
, " CALL_ID(%u)", EXTRACT_16BITS(call_id
)));
315 pptp_call_ser_print(netdissect_options
*ndo
,
316 const u_int16_t
*call_ser
)
318 ND_PRINT((ndo
, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
)));
322 pptp_cause_code_print(netdissect_options
*ndo
,
323 const u_int16_t
*cause_code
)
325 ND_PRINT((ndo
, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
)));
329 pptp_conn_speed_print(netdissect_options
*ndo
,
330 const u_int32_t
*conn_speed
)
332 ND_PRINT((ndo
, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
)));
336 pptp_err_code_print(netdissect_options
*ndo
,
337 const u_int8_t
*err_code
)
339 ND_PRINT((ndo
, " ERR_CODE(%u", *err_code
));
340 if (ndo
->ndo_vflag
) {
343 ND_PRINT((ndo
, ":None"));
346 ND_PRINT((ndo
, ":Not-Connected"));
349 ND_PRINT((ndo
, ":Bad-Format"));
352 ND_PRINT((ndo
, ":Bad-Valude"));
355 ND_PRINT((ndo
, ":No-Resource"));
358 ND_PRINT((ndo
, ":Bad-Call-ID"));
361 ND_PRINT((ndo
, ":PAC-Error"));
364 ND_PRINT((ndo
, ":?"));
368 ND_PRINT((ndo
, ")"));
372 pptp_firm_rev_print(netdissect_options
*ndo
,
373 const u_int16_t
*firm_rev
)
375 ND_PRINT((ndo
, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
)));
379 pptp_framing_cap_print(netdissect_options
*ndo
,
380 const u_int32_t
*framing_cap
)
382 ND_PRINT((ndo
, " FRAME_CAP("));
383 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
384 ND_PRINT((ndo
, "A")); /* Async */
386 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
387 ND_PRINT((ndo
, "S")); /* Sync */
389 ND_PRINT((ndo
, ")"));
393 pptp_framing_type_print(netdissect_options
*ndo
,
394 const u_int32_t
*framing_type
)
396 ND_PRINT((ndo
, " FRAME_TYPE("));
397 switch (EXTRACT_32BITS(framing_type
)) {
399 ND_PRINT((ndo
, "A")); /* Async */
402 ND_PRINT((ndo
, "S")); /* Sync */
405 ND_PRINT((ndo
, "E")); /* Either */
408 ND_PRINT((ndo
, "?"));
411 ND_PRINT((ndo
, ")"));
415 pptp_hostname_print(netdissect_options
*ndo
,
416 const u_char
*hostname
)
418 ND_PRINT((ndo
, " HOSTNAME(%.64s)", hostname
));
422 pptp_id_print(netdissect_options
*ndo
,
425 ND_PRINT((ndo
, " ID(%u)", EXTRACT_32BITS(id
)));
429 pptp_max_channel_print(netdissect_options
*ndo
,
430 const u_int16_t
*max_channel
)
432 ND_PRINT((ndo
, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
)));
436 pptp_peer_call_id_print(netdissect_options
*ndo
,
437 const u_int16_t
*peer_call_id
)
439 ND_PRINT((ndo
, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
)));
443 pptp_phy_chan_id_print(netdissect_options
*ndo
,
444 const u_int32_t
*phy_chan_id
)
446 ND_PRINT((ndo
, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
)));
450 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
451 const u_int16_t
*pkt_proc_delay
)
453 ND_PRINT((ndo
, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
)));
457 pptp_proto_ver_print(netdissect_options
*ndo
,
458 const u_int16_t
*proto_ver
)
460 ND_PRINT((ndo
, " PROTO_VER(%u.%u)", /* Version.Revision */
461 EXTRACT_16BITS(proto_ver
) >> 8,
462 EXTRACT_16BITS(proto_ver
) & 0xff));
466 pptp_recv_winsiz_print(netdissect_options
*ndo
,
467 const u_int16_t
*recv_winsiz
)
469 ND_PRINT((ndo
, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
)));
473 pptp_result_code_print(netdissect_options
*ndo
,
474 const u_int8_t
*result_code
, int ctrl_msg_type
)
476 ND_PRINT((ndo
, " RESULT_CODE(%u", *result_code
));
477 if (ndo
->ndo_vflag
) {
478 switch (ctrl_msg_type
) {
479 case PPTP_CTRL_MSG_TYPE_SCCRP
:
480 switch (*result_code
) {
482 ND_PRINT((ndo
, ":Successful channel establishment"));
485 ND_PRINT((ndo
, ":General error"));
488 ND_PRINT((ndo
, ":Command channel already exists"));
491 ND_PRINT((ndo
, ":Requester is not authorized to establish a command channel"));
494 ND_PRINT((ndo
, ":The protocol version of the requester is not supported"));
497 ND_PRINT((ndo
, ":?"));
501 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
502 case PPTP_CTRL_MSG_TYPE_ECHORP
:
503 switch (*result_code
) {
505 ND_PRINT((ndo
, ":OK"));
508 ND_PRINT((ndo
, ":General Error"));
511 ND_PRINT((ndo
, ":?"));
515 case PPTP_CTRL_MSG_TYPE_OCRP
:
516 switch (*result_code
) {
518 ND_PRINT((ndo
, ":Connected"));
521 ND_PRINT((ndo
, ":General Error"));
524 ND_PRINT((ndo
, ":No Carrier"));
527 ND_PRINT((ndo
, ":Busy"));
530 ND_PRINT((ndo
, ":No Dial Tone"));
533 ND_PRINT((ndo
, ":Time-out"));
536 ND_PRINT((ndo
, ":Do Not Accept"));
539 ND_PRINT((ndo
, ":?"));
543 case PPTP_CTRL_MSG_TYPE_ICRP
:
544 switch (*result_code
) {
546 ND_PRINT((ndo
, ":Connect"));
549 ND_PRINT((ndo
, ":General Error"));
552 ND_PRINT((ndo
, ":Do Not Accept"));
555 ND_PRINT((ndo
, ":?"));
559 case PPTP_CTRL_MSG_TYPE_CDN
:
560 switch (*result_code
) {
562 ND_PRINT((ndo
, ":Lost Carrier"));
565 ND_PRINT((ndo
, ":General Error"));
568 ND_PRINT((ndo
, ":Admin Shutdown"));
571 ND_PRINT((ndo
, ":Request"));
574 ND_PRINT((ndo
, ":?"));
579 /* assertion error */
583 ND_PRINT((ndo
, ")"));
587 pptp_subaddr_print(netdissect_options
*ndo
,
588 const u_char
*subaddr
)
590 ND_PRINT((ndo
, " SUB_ADDR(%.64s)", subaddr
));
594 pptp_vendor_print(netdissect_options
*ndo
,
595 const u_char
*vendor
)
597 ND_PRINT((ndo
, " VENDOR(%.64s)", vendor
));
600 /************************************/
601 /* PPTP message print out functions */
602 /************************************/
604 pptp_sccrq_print(netdissect_options
*ndo
,
607 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
609 ND_TCHECK(ptr
->proto_ver
);
610 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
611 ND_TCHECK(ptr
->reserved1
);
612 ND_TCHECK(ptr
->framing_cap
);
613 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
614 ND_TCHECK(ptr
->bearer_cap
);
615 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
616 ND_TCHECK(ptr
->max_channel
);
617 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
618 ND_TCHECK(ptr
->firm_rev
);
619 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
620 ND_TCHECK(ptr
->hostname
);
621 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
622 ND_TCHECK(ptr
->vendor
);
623 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
628 ND_PRINT((ndo
, "%s", tstr
));
632 pptp_sccrp_print(netdissect_options
*ndo
,
635 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
637 ND_TCHECK(ptr
->proto_ver
);
638 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
639 ND_TCHECK(ptr
->result_code
);
640 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
641 ND_TCHECK(ptr
->err_code
);
642 pptp_err_code_print(ndo
, &ptr
->err_code
);
643 ND_TCHECK(ptr
->framing_cap
);
644 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
645 ND_TCHECK(ptr
->bearer_cap
);
646 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
647 ND_TCHECK(ptr
->max_channel
);
648 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
649 ND_TCHECK(ptr
->firm_rev
);
650 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
651 ND_TCHECK(ptr
->hostname
);
652 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
653 ND_TCHECK(ptr
->vendor
);
654 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
659 ND_PRINT((ndo
, "%s", tstr
));
663 pptp_stopccrq_print(netdissect_options
*ndo
,
666 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
668 ND_TCHECK(ptr
->reason
);
669 ND_PRINT((ndo
, " REASON(%u", ptr
->reason
));
670 if (ndo
->ndo_vflag
) {
671 switch (ptr
->reason
) {
673 ND_PRINT((ndo
, ":None"));
676 ND_PRINT((ndo
, ":Stop-Protocol"));
679 ND_PRINT((ndo
, ":Stop-Local-Shutdown"));
682 ND_PRINT((ndo
, ":?"));
686 ND_PRINT((ndo
, ")"));
687 ND_TCHECK(ptr
->reserved1
);
688 ND_TCHECK(ptr
->reserved2
);
693 ND_PRINT((ndo
, "%s", tstr
));
697 pptp_stopccrp_print(netdissect_options
*ndo
,
700 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
702 ND_TCHECK(ptr
->result_code
);
703 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
704 ND_TCHECK(ptr
->err_code
);
705 pptp_err_code_print(ndo
, &ptr
->err_code
);
706 ND_TCHECK(ptr
->reserved1
);
711 ND_PRINT((ndo
, "%s", tstr
));
715 pptp_echorq_print(netdissect_options
*ndo
,
718 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
721 pptp_id_print(ndo
, &ptr
->id
);
726 ND_PRINT((ndo
, "%s", tstr
));
730 pptp_echorp_print(netdissect_options
*ndo
,
733 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
736 pptp_id_print(ndo
, &ptr
->id
);
737 ND_TCHECK(ptr
->result_code
);
738 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
739 ND_TCHECK(ptr
->err_code
);
740 pptp_err_code_print(ndo
, &ptr
->err_code
);
741 ND_TCHECK(ptr
->reserved1
);
746 ND_PRINT((ndo
, "%s", tstr
));
750 pptp_ocrq_print(netdissect_options
*ndo
,
753 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
755 ND_TCHECK(ptr
->call_id
);
756 pptp_call_id_print(ndo
, &ptr
->call_id
);
757 ND_TCHECK(ptr
->call_ser
);
758 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
759 ND_TCHECK(ptr
->min_bps
);
760 ND_PRINT((ndo
, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
)));
761 ND_TCHECK(ptr
->max_bps
);
762 ND_PRINT((ndo
, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
)));
763 ND_TCHECK(ptr
->bearer_type
);
764 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
765 ND_TCHECK(ptr
->framing_type
);
766 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
767 ND_TCHECK(ptr
->recv_winsiz
);
768 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
769 ND_TCHECK(ptr
->pkt_proc_delay
);
770 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
771 ND_TCHECK(ptr
->phone_no_len
);
772 ND_PRINT((ndo
, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
)));
773 ND_TCHECK(ptr
->reserved1
);
774 ND_TCHECK(ptr
->phone_no
);
775 ND_PRINT((ndo
, " PHONE_NO(%.64s)", ptr
->phone_no
));
776 ND_TCHECK(ptr
->subaddr
);
777 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
782 ND_PRINT((ndo
, "%s", tstr
));
786 pptp_ocrp_print(netdissect_options
*ndo
,
789 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
791 ND_TCHECK(ptr
->call_id
);
792 pptp_call_id_print(ndo
, &ptr
->call_id
);
793 ND_TCHECK(ptr
->peer_call_id
);
794 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
795 ND_TCHECK(ptr
->result_code
);
796 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
797 ND_TCHECK(ptr
->err_code
);
798 pptp_err_code_print(ndo
, &ptr
->err_code
);
799 ND_TCHECK(ptr
->cause_code
);
800 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
801 ND_TCHECK(ptr
->conn_speed
);
802 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
803 ND_TCHECK(ptr
->recv_winsiz
);
804 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
805 ND_TCHECK(ptr
->pkt_proc_delay
);
806 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
807 ND_TCHECK(ptr
->phy_chan_id
);
808 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
813 ND_PRINT((ndo
, "%s", tstr
));
817 pptp_icrq_print(netdissect_options
*ndo
,
820 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
822 ND_TCHECK(ptr
->call_id
);
823 pptp_call_id_print(ndo
, &ptr
->call_id
);
824 ND_TCHECK(ptr
->call_ser
);
825 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
826 ND_TCHECK(ptr
->bearer_type
);
827 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
828 ND_TCHECK(ptr
->phy_chan_id
);
829 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
830 ND_TCHECK(ptr
->dialed_no_len
);
831 ND_PRINT((ndo
, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
)));
832 ND_TCHECK(ptr
->dialing_no_len
);
833 ND_PRINT((ndo
, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
)));
834 ND_TCHECK(ptr
->dialed_no
);
835 ND_PRINT((ndo
, " DIALED_NO(%.64s)", ptr
->dialed_no
));
836 ND_TCHECK(ptr
->dialing_no
);
837 ND_PRINT((ndo
, " DIALING_NO(%.64s)", ptr
->dialing_no
));
838 ND_TCHECK(ptr
->subaddr
);
839 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
844 ND_PRINT((ndo
, "%s", tstr
));
848 pptp_icrp_print(netdissect_options
*ndo
,
851 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
853 ND_TCHECK(ptr
->call_id
);
854 pptp_call_id_print(ndo
, &ptr
->call_id
);
855 ND_TCHECK(ptr
->peer_call_id
);
856 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
857 ND_TCHECK(ptr
->result_code
);
858 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
859 ND_TCHECK(ptr
->err_code
);
860 pptp_err_code_print(ndo
, &ptr
->err_code
);
861 ND_TCHECK(ptr
->recv_winsiz
);
862 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
863 ND_TCHECK(ptr
->pkt_proc_delay
);
864 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
865 ND_TCHECK(ptr
->reserved1
);
870 ND_PRINT((ndo
, "%s", tstr
));
874 pptp_iccn_print(netdissect_options
*ndo
,
877 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
879 ND_TCHECK(ptr
->peer_call_id
);
880 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
881 ND_TCHECK(ptr
->reserved1
);
882 ND_TCHECK(ptr
->conn_speed
);
883 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
884 ND_TCHECK(ptr
->recv_winsiz
);
885 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
886 ND_TCHECK(ptr
->pkt_proc_delay
);
887 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
888 ND_TCHECK(ptr
->framing_type
);
889 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
894 ND_PRINT((ndo
, "%s", tstr
));
898 pptp_ccrq_print(netdissect_options
*ndo
,
901 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
903 ND_TCHECK(ptr
->call_id
);
904 pptp_call_id_print(ndo
, &ptr
->call_id
);
905 ND_TCHECK(ptr
->reserved1
);
910 ND_PRINT((ndo
, "%s", tstr
));
914 pptp_cdn_print(netdissect_options
*ndo
,
917 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
919 ND_TCHECK(ptr
->call_id
);
920 pptp_call_id_print(ndo
, &ptr
->call_id
);
921 ND_TCHECK(ptr
->result_code
);
922 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
923 ND_TCHECK(ptr
->err_code
);
924 pptp_err_code_print(ndo
, &ptr
->err_code
);
925 ND_TCHECK(ptr
->cause_code
);
926 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
927 ND_TCHECK(ptr
->reserved1
);
928 ND_TCHECK(ptr
->call_stats
);
929 ND_PRINT((ndo
, " CALL_STATS(%.128s)", ptr
->call_stats
));
934 ND_PRINT((ndo
, "%s", tstr
));
938 pptp_wen_print(netdissect_options
*ndo
,
941 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
943 ND_TCHECK(ptr
->peer_call_id
);
944 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
945 ND_TCHECK(ptr
->reserved1
);
946 ND_TCHECK(ptr
->crc_err
);
947 ND_PRINT((ndo
, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
)));
948 ND_TCHECK(ptr
->framing_err
);
949 ND_PRINT((ndo
, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
)));
950 ND_TCHECK(ptr
->hardware_overrun
);
951 ND_PRINT((ndo
, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
)));
952 ND_TCHECK(ptr
->buffer_overrun
);
953 ND_PRINT((ndo
, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
)));
954 ND_TCHECK(ptr
->timeout_err
);
955 ND_PRINT((ndo
, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
)));
956 ND_TCHECK(ptr
->align_err
);
957 ND_PRINT((ndo
, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
)));
962 ND_PRINT((ndo
, "%s", tstr
));
966 pptp_sli_print(netdissect_options
*ndo
,
969 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
971 ND_TCHECK(ptr
->peer_call_id
);
972 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
973 ND_TCHECK(ptr
->reserved1
);
974 ND_TCHECK(ptr
->send_accm
);
975 ND_PRINT((ndo
, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
)));
976 ND_TCHECK(ptr
->recv_accm
);
977 ND_PRINT((ndo
, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
)));
982 ND_PRINT((ndo
, "%s", tstr
));
986 pptp_print(netdissect_options
*ndo
,
989 const struct pptp_hdr
*hdr
;
991 u_int16_t ctrl_msg_type
;
993 ND_PRINT((ndo
, ": pptp"));
995 hdr
= (struct pptp_hdr
*)dat
;
997 ND_TCHECK(hdr
->length
);
998 if (ndo
->ndo_vflag
) {
999 ND_PRINT((ndo
, " Length=%u", EXTRACT_16BITS(&hdr
->length
)));
1001 ND_TCHECK(hdr
->msg_type
);
1002 if (ndo
->ndo_vflag
) {
1003 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
1004 case PPTP_MSG_TYPE_CTRL
:
1005 ND_PRINT((ndo
, " CTRL-MSG"));
1007 case PPTP_MSG_TYPE_MGMT
:
1008 ND_PRINT((ndo
, " MGMT-MSG"));
1011 ND_PRINT((ndo
, " UNKNOWN-MSG-TYPE"));
1016 ND_TCHECK(hdr
->magic_cookie
);
1017 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
1018 if (mc
!= PPTP_MAGIC_COOKIE
) {
1019 ND_PRINT((ndo
, " UNEXPECTED Magic-Cookie!!(%08x)", mc
));
1021 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
1022 ND_PRINT((ndo
, " Magic-Cookie=%08x", mc
));
1024 ND_TCHECK(hdr
->ctrl_msg_type
);
1025 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
1026 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
1027 ND_PRINT((ndo
, " CTRL_MSGTYPE=%s",
1028 pptp_message_type_string
[ctrl_msg_type
]));
1030 ND_PRINT((ndo
, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
));
1032 ND_TCHECK(hdr
->reserved0
);
1036 switch(ctrl_msg_type
) {
1037 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
1038 pptp_sccrq_print(ndo
, dat
);
1040 case PPTP_CTRL_MSG_TYPE_SCCRP
:
1041 pptp_sccrp_print(ndo
, dat
);
1043 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
1044 pptp_stopccrq_print(ndo
, dat
);
1046 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
1047 pptp_stopccrp_print(ndo
, dat
);
1049 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
1050 pptp_echorq_print(ndo
, dat
);
1052 case PPTP_CTRL_MSG_TYPE_ECHORP
:
1053 pptp_echorp_print(ndo
, dat
);
1055 case PPTP_CTRL_MSG_TYPE_OCRQ
:
1056 pptp_ocrq_print(ndo
, dat
);
1058 case PPTP_CTRL_MSG_TYPE_OCRP
:
1059 pptp_ocrp_print(ndo
, dat
);
1061 case PPTP_CTRL_MSG_TYPE_ICRQ
:
1062 pptp_icrq_print(ndo
, dat
);
1064 case PPTP_CTRL_MSG_TYPE_ICRP
:
1065 pptp_icrp_print(ndo
, dat
);
1067 case PPTP_CTRL_MSG_TYPE_ICCN
:
1068 pptp_iccn_print(ndo
, dat
);
1070 case PPTP_CTRL_MSG_TYPE_CCRQ
:
1071 pptp_ccrq_print(ndo
, dat
);
1073 case PPTP_CTRL_MSG_TYPE_CDN
:
1074 pptp_cdn_print(ndo
, dat
);
1076 case PPTP_CTRL_MSG_TYPE_WEN
:
1077 pptp_wen_print(ndo
, dat
);
1079 case PPTP_CTRL_MSG_TYPE_SLI
:
1080 pptp_sli_print(ndo
, dat
);
1090 ND_PRINT((ndo
, "%s", tstr
));