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 /* \summary: Point-to-Point Tunnelling Protocol (PPTP) printer */
26 /* specification: RFC 2637 */
32 #include <netdissect-stdinc.h>
34 #include "netdissect.h"
37 static const char tstr
[] = " [|pptp]";
39 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
40 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
41 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
43 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
44 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
45 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
46 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
47 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
48 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
49 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
50 #define PPTP_CTRL_MSG_TYPE_OCRP 8
51 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
52 #define PPTP_CTRL_MSG_TYPE_ICRP 10
53 #define PPTP_CTRL_MSG_TYPE_ICCN 11
54 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
55 #define PPTP_CTRL_MSG_TYPE_CDN 13
56 #define PPTP_CTRL_MSG_TYPE_WEN 14
57 #define PPTP_CTRL_MSG_TYPE_SLI 15
59 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
60 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
62 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
63 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
65 static const char *pptp_message_type_string
[] = {
66 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
67 "SCCRQ", /* 1 Start-Control-Connection-Request */
68 "SCCRP", /* 2 Start-Control-Connection-Reply */
69 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
70 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
71 "ECHORQ", /* 5 Echo Request */
72 "ECHORP", /* 6 Echo Reply */
74 "OCRQ", /* 7 Outgoing-Call-Request */
75 "OCRP", /* 8 Outgoing-Call-Reply */
76 "ICRQ", /* 9 Incoming-Call-Request */
77 "ICRP", /* 10 Incoming-Call-Reply */
78 "ICCN", /* 11 Incoming-Call-Connected */
79 "CCRQ", /* 12 Call-Clear-Request */
80 "CDN", /* 13 Call-Disconnect-Notify */
82 "WEN", /* 14 WAN-Error-Notify */
84 "SLI" /* 15 Set-Link-Info */
85 #define PPTP_MAX_MSGTYPE_INDEX 16
88 /* common for all PPTP control messages */
92 nd_uint32_t magic_cookie
;
93 nd_uint16_t ctrl_msg_type
;
94 nd_uint8_t reserved0
[2];
97 struct pptp_msg_sccrq
{
98 nd_uint16_t proto_ver
;
99 nd_uint16_t reserved1
;
100 nd_uint32_t framing_cap
;
101 nd_uint32_t bearer_cap
;
102 nd_uint16_t max_channel
;
103 nd_uint16_t firm_rev
;
104 nd_byte hostname
[64];
108 struct pptp_msg_sccrp
{
109 nd_uint16_t proto_ver
;
110 nd_uint8_t result_code
;
112 nd_uint32_t framing_cap
;
113 nd_uint32_t bearer_cap
;
114 nd_uint16_t max_channel
;
115 nd_uint16_t firm_rev
;
116 nd_byte hostname
[64];
120 struct pptp_msg_stopccrq
{
122 nd_byte reserved1
[1];
123 nd_byte reserved2
[2];
126 struct pptp_msg_stopccrp
{
127 nd_uint8_t result_code
;
129 nd_byte reserved1
[2];
132 struct pptp_msg_echorq
{
136 struct pptp_msg_echorp
{
138 nd_uint8_t result_code
;
140 nd_byte reserved1
[2];
143 struct pptp_msg_ocrq
{
145 nd_uint16_t call_ser
;
148 nd_uint32_t bearer_type
;
149 nd_uint32_t framing_type
;
150 nd_uint16_t recv_winsiz
;
151 nd_uint16_t pkt_proc_delay
;
152 nd_uint16_t phone_no_len
;
153 nd_uint16_t reserved1
;
154 nd_byte phone_no
[64];
158 struct pptp_msg_ocrp
{
160 nd_uint16_t peer_call_id
;
161 nd_uint8_t result_code
;
163 nd_uint16_t cause_code
;
164 nd_uint32_t conn_speed
;
165 nd_uint16_t recv_winsiz
;
166 nd_uint16_t pkt_proc_delay
;
167 nd_uint32_t phy_chan_id
;
170 struct pptp_msg_icrq
{
172 nd_uint16_t call_ser
;
173 nd_uint32_t bearer_type
;
174 nd_uint32_t phy_chan_id
;
175 nd_uint16_t dialed_no_len
;
176 nd_uint16_t dialing_no_len
;
177 nd_byte dialed_no
[64]; /* DNIS */
178 nd_byte dialing_no
[64]; /* CLID */
182 struct pptp_msg_icrp
{
184 nd_uint16_t peer_call_id
;
185 nd_uint8_t result_code
;
187 nd_uint16_t recv_winsiz
;
188 nd_uint16_t pkt_proc_delay
;
189 nd_byte reserved1
[2];
192 struct pptp_msg_iccn
{
193 nd_uint16_t peer_call_id
;
194 nd_uint16_t reserved1
;
195 nd_uint32_t conn_speed
;
196 nd_uint16_t recv_winsiz
;
197 nd_uint16_t pkt_proc_delay
;
198 nd_uint32_t framing_type
;
201 struct pptp_msg_ccrq
{
203 nd_uint16_t reserved1
;
206 struct pptp_msg_cdn
{
208 nd_uint8_t result_code
;
210 nd_uint16_t cause_code
;
211 nd_uint16_t reserved1
;
212 nd_byte call_stats
[128];
215 struct pptp_msg_wen
{
216 nd_uint16_t peer_call_id
;
217 nd_byte reserved1
[2];
219 nd_uint32_t framing_err
;
220 nd_uint32_t hardware_overrun
;
221 nd_uint32_t buffer_overrun
;
222 nd_uint32_t timeout_err
;
223 nd_uint32_t align_err
;
226 struct pptp_msg_sli
{
227 nd_uint16_t peer_call_id
;
228 nd_uint16_t reserved1
;
229 nd_uint32_t send_accm
;
230 nd_uint32_t recv_accm
;
233 /* attributes that appear more than once in above messages:
237 --------------------------------------
238 2 uint32_t bearer_cap;
239 2 uint32_t bearer_type;
242 2 uint16_t cause_code;
243 2 uint32_t conn_speed;
246 2 uint32_t framing_cap;
247 2 uint32_t framing_type;
248 2 u_char hostname[64];
250 2 uint16_t max_channel;
251 5 uint16_t peer_call_id;
252 2 uint32_t phy_chan_id;
253 4 uint16_t pkt_proc_delay;
254 2 uint16_t proto_ver;
255 4 uint16_t recv_winsiz;
257 9 uint16_t reserved1;
258 6 uint8_t result_code;
259 2 u_char subaddr[64];
262 so I will prepare print out functions for these attributes (except for
266 /******************************************/
267 /* Attribute-specific print out functions */
268 /******************************************/
270 /* In these attribute-specific print-out functions, it't not necessary
271 to do ND_TCHECK because they are already checked in the caller of
275 pptp_bearer_cap_print(netdissect_options
*ndo
,
276 const nd_uint32_t
*bearer_cap
)
278 ND_PRINT(" BEARER_CAP(%s%s)",
279 EXTRACT_BE_U_4(*bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
? "D" : "",
280 EXTRACT_BE_U_4(*bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
? "A" : "");
283 static const struct tok pptp_btype_str
[] = {
284 { 1, "A" }, /* Analog */
285 { 2, "D" }, /* Digital */
291 pptp_bearer_type_print(netdissect_options
*ndo
,
292 const nd_uint32_t
*bearer_type
)
294 ND_PRINT(" BEARER_TYPE(%s)",
295 tok2str(pptp_btype_str
, "?", EXTRACT_BE_U_4(*bearer_type
)));
299 pptp_call_id_print(netdissect_options
*ndo
,
300 const nd_uint16_t
*call_id
)
302 ND_PRINT(" CALL_ID(%u)", EXTRACT_BE_U_2(*call_id
));
306 pptp_call_ser_print(netdissect_options
*ndo
,
307 const nd_uint16_t
*call_ser
)
309 ND_PRINT(" CALL_SER_NUM(%u)", EXTRACT_BE_U_2(*call_ser
));
313 pptp_cause_code_print(netdissect_options
*ndo
,
314 const nd_uint16_t
*cause_code
)
316 ND_PRINT(" CAUSE_CODE(%u)", EXTRACT_BE_U_2(*cause_code
));
320 pptp_conn_speed_print(netdissect_options
*ndo
,
321 const nd_uint32_t
*conn_speed
)
323 ND_PRINT(" CONN_SPEED(%u)", EXTRACT_BE_U_4(*conn_speed
));
326 static const struct tok pptp_errcode_str
[] = {
328 { 1, "Not-Connected" },
331 { 4, "No-Resource" },
332 { 5, "Bad-Call-ID" },
338 pptp_err_code_print(netdissect_options
*ndo
,
339 const nd_uint8_t
*err_code
)
341 ND_PRINT(" ERR_CODE(%u", EXTRACT_U_1(*err_code
));
342 if (ndo
->ndo_vflag
) {
343 ND_PRINT(":%s", tok2str(pptp_errcode_str
, "?", EXTRACT_U_1(*err_code
)));
349 pptp_firm_rev_print(netdissect_options
*ndo
,
350 const nd_uint16_t
*firm_rev
)
352 ND_PRINT(" FIRM_REV(%u)", EXTRACT_BE_U_2(*firm_rev
));
356 pptp_framing_cap_print(netdissect_options
*ndo
,
357 const nd_uint32_t
*framing_cap
)
359 ND_PRINT(" FRAME_CAP(");
360 if (EXTRACT_BE_U_4(*framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
361 ND_PRINT("A"); /* Async */
363 if (EXTRACT_BE_U_4(*framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
364 ND_PRINT("S"); /* Sync */
369 static const struct tok pptp_ftype_str
[] = {
370 { 1, "A" }, /* Async */
371 { 2, "S" }, /* Sync */
372 { 3, "E" }, /* Either */
377 pptp_framing_type_print(netdissect_options
*ndo
,
378 const nd_uint32_t
*framing_type
)
380 ND_PRINT(" FRAME_TYPE(%s)",
381 tok2str(pptp_ftype_str
, "?", EXTRACT_BE_U_4(*framing_type
)));
385 pptp_hostname_print(netdissect_options
*ndo
,
386 const u_char
*hostname
)
388 ND_PRINT(" HOSTNAME(%.64s)", hostname
);
392 pptp_id_print(netdissect_options
*ndo
,
393 const nd_uint32_t
*id
)
395 ND_PRINT(" ID(%u)", EXTRACT_BE_U_4(*id
));
399 pptp_max_channel_print(netdissect_options
*ndo
,
400 const nd_uint16_t
*max_channel
)
402 ND_PRINT(" MAX_CHAN(%u)", EXTRACT_BE_U_2(*max_channel
));
406 pptp_peer_call_id_print(netdissect_options
*ndo
,
407 const nd_uint16_t
*peer_call_id
)
409 ND_PRINT(" PEER_CALL_ID(%u)", EXTRACT_BE_U_2(*peer_call_id
));
413 pptp_phy_chan_id_print(netdissect_options
*ndo
,
414 const nd_uint32_t
*phy_chan_id
)
416 ND_PRINT(" PHY_CHAN_ID(%u)", EXTRACT_BE_U_4(*phy_chan_id
));
420 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
421 const nd_uint16_t
*pkt_proc_delay
)
423 ND_PRINT(" PROC_DELAY(%u)", EXTRACT_BE_U_2(*pkt_proc_delay
));
427 pptp_proto_ver_print(netdissect_options
*ndo
,
428 const nd_uint16_t
*proto_ver
)
430 ND_PRINT(" PROTO_VER(%u.%u)", /* Version.Revision */
431 EXTRACT_BE_U_2(*proto_ver
) >> 8,
432 EXTRACT_BE_U_2(*proto_ver
) & 0xff);
436 pptp_recv_winsiz_print(netdissect_options
*ndo
,
437 const nd_uint16_t
*recv_winsiz
)
439 ND_PRINT(" RECV_WIN(%u)", EXTRACT_BE_U_2(*recv_winsiz
));
442 static const struct tok pptp_scrrp_str
[] = {
443 { 1, "Successful channel establishment" },
444 { 2, "General error" },
445 { 3, "Command channel already exists" },
446 { 4, "Requester is not authorized to establish a command channel" },
447 { 5, "The protocol version of the requester is not supported" },
451 static const struct tok pptp_echorp_str
[] = {
453 { 2, "General Error" },
457 static const struct tok pptp_ocrp_str
[] = {
459 { 2, "General Error" },
462 { 5, "No Dial Tone" },
464 { 7, "Do Not Accept" },
468 static const struct tok pptp_icrp_str
[] = {
470 { 2, "General Error" },
471 { 3, "Do Not Accept" },
475 static const struct tok pptp_cdn_str
[] = {
476 { 1, "Lost Carrier" },
477 { 2, "General Error" },
478 { 3, "Admin Shutdown" },
484 pptp_result_code_print(netdissect_options
*ndo
,
485 const nd_uint8_t
*result_code
, int ctrl_msg_type
)
487 ND_PRINT(" RESULT_CODE(%u", EXTRACT_U_1(*result_code
));
488 if (ndo
->ndo_vflag
) {
489 const struct tok
*dict
=
490 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_SCCRP
? pptp_scrrp_str
:
491 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_StopCCRP
? pptp_echorp_str
:
492 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ECHORP
? pptp_echorp_str
:
493 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_OCRP
? pptp_ocrp_str
:
494 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ICRP
? pptp_icrp_str
:
495 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_CDN
? pptp_cdn_str
:
496 NULL
; /* assertion error */
498 ND_PRINT(":%s", tok2str(dict
, "?", EXTRACT_U_1(*result_code
)));
504 pptp_subaddr_print(netdissect_options
*ndo
,
505 const u_char
*subaddr
)
507 ND_PRINT(" SUB_ADDR(%.64s)", subaddr
);
511 pptp_vendor_print(netdissect_options
*ndo
,
512 const u_char
*vendor
)
514 ND_PRINT(" VENDOR(%.64s)", vendor
);
517 /************************************/
518 /* PPTP message print out functions */
519 /************************************/
521 pptp_sccrq_print(netdissect_options
*ndo
,
524 const struct pptp_msg_sccrq
*ptr
= (const struct pptp_msg_sccrq
*)dat
;
526 ND_TCHECK(ptr
->proto_ver
);
527 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
528 ND_TCHECK(ptr
->reserved1
);
529 ND_TCHECK(ptr
->framing_cap
);
530 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
531 ND_TCHECK(ptr
->bearer_cap
);
532 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
533 ND_TCHECK(ptr
->max_channel
);
534 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
535 ND_TCHECK(ptr
->firm_rev
);
536 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
537 ND_TCHECK(ptr
->hostname
);
538 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
539 ND_TCHECK(ptr
->vendor
);
540 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
545 ND_PRINT("%s", tstr
);
549 pptp_sccrp_print(netdissect_options
*ndo
,
552 const struct pptp_msg_sccrp
*ptr
= (const struct pptp_msg_sccrp
*)dat
;
554 ND_TCHECK(ptr
->proto_ver
);
555 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
556 ND_TCHECK(ptr
->result_code
);
557 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
558 ND_TCHECK(ptr
->err_code
);
559 pptp_err_code_print(ndo
, &ptr
->err_code
);
560 ND_TCHECK(ptr
->framing_cap
);
561 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
562 ND_TCHECK(ptr
->bearer_cap
);
563 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
564 ND_TCHECK(ptr
->max_channel
);
565 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
566 ND_TCHECK(ptr
->firm_rev
);
567 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
568 ND_TCHECK(ptr
->hostname
);
569 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
570 ND_TCHECK(ptr
->vendor
);
571 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
576 ND_PRINT("%s", tstr
);
580 pptp_stopccrq_print(netdissect_options
*ndo
,
583 const struct pptp_msg_stopccrq
*ptr
= (const struct pptp_msg_stopccrq
*)dat
;
585 ND_TCHECK(ptr
->reason
);
586 ND_PRINT(" REASON(%u", EXTRACT_U_1(ptr
->reason
));
587 if (ndo
->ndo_vflag
) {
588 switch (EXTRACT_U_1(ptr
->reason
)) {
593 ND_PRINT(":Stop-Protocol");
596 ND_PRINT(":Stop-Local-Shutdown");
604 ND_TCHECK(ptr
->reserved1
);
605 ND_TCHECK(ptr
->reserved2
);
610 ND_PRINT("%s", tstr
);
614 pptp_stopccrp_print(netdissect_options
*ndo
,
617 const struct pptp_msg_stopccrp
*ptr
= (const struct pptp_msg_stopccrp
*)dat
;
619 ND_TCHECK(ptr
->result_code
);
620 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
621 ND_TCHECK(ptr
->err_code
);
622 pptp_err_code_print(ndo
, &ptr
->err_code
);
623 ND_TCHECK(ptr
->reserved1
);
628 ND_PRINT("%s", tstr
);
632 pptp_echorq_print(netdissect_options
*ndo
,
635 const struct pptp_msg_echorq
*ptr
= (const struct pptp_msg_echorq
*)dat
;
638 pptp_id_print(ndo
, &ptr
->id
);
643 ND_PRINT("%s", tstr
);
647 pptp_echorp_print(netdissect_options
*ndo
,
650 const struct pptp_msg_echorp
*ptr
= (const struct pptp_msg_echorp
*)dat
;
653 pptp_id_print(ndo
, &ptr
->id
);
654 ND_TCHECK(ptr
->result_code
);
655 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
656 ND_TCHECK(ptr
->err_code
);
657 pptp_err_code_print(ndo
, &ptr
->err_code
);
658 ND_TCHECK(ptr
->reserved1
);
663 ND_PRINT("%s", tstr
);
667 pptp_ocrq_print(netdissect_options
*ndo
,
670 const struct pptp_msg_ocrq
*ptr
= (const struct pptp_msg_ocrq
*)dat
;
672 ND_TCHECK(ptr
->call_id
);
673 pptp_call_id_print(ndo
, &ptr
->call_id
);
674 ND_TCHECK(ptr
->call_ser
);
675 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
676 ND_TCHECK(ptr
->min_bps
);
677 ND_PRINT(" MIN_BPS(%u)", EXTRACT_BE_U_4(ptr
->min_bps
));
678 ND_TCHECK(ptr
->max_bps
);
679 ND_PRINT(" MAX_BPS(%u)", EXTRACT_BE_U_4(ptr
->max_bps
));
680 ND_TCHECK(ptr
->bearer_type
);
681 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
682 ND_TCHECK(ptr
->framing_type
);
683 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
684 ND_TCHECK(ptr
->recv_winsiz
);
685 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
686 ND_TCHECK(ptr
->pkt_proc_delay
);
687 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
688 ND_TCHECK(ptr
->phone_no_len
);
689 ND_PRINT(" PHONE_NO_LEN(%u)", EXTRACT_BE_U_2(ptr
->phone_no_len
));
690 ND_TCHECK(ptr
->reserved1
);
691 ND_TCHECK(ptr
->phone_no
);
692 ND_PRINT(" PHONE_NO(%.64s)", ptr
->phone_no
);
693 ND_TCHECK(ptr
->subaddr
);
694 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
699 ND_PRINT("%s", tstr
);
703 pptp_ocrp_print(netdissect_options
*ndo
,
706 const struct pptp_msg_ocrp
*ptr
= (const struct pptp_msg_ocrp
*)dat
;
708 ND_TCHECK(ptr
->call_id
);
709 pptp_call_id_print(ndo
, &ptr
->call_id
);
710 ND_TCHECK(ptr
->peer_call_id
);
711 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
712 ND_TCHECK(ptr
->result_code
);
713 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
714 ND_TCHECK(ptr
->err_code
);
715 pptp_err_code_print(ndo
, &ptr
->err_code
);
716 ND_TCHECK(ptr
->cause_code
);
717 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
718 ND_TCHECK(ptr
->conn_speed
);
719 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
720 ND_TCHECK(ptr
->recv_winsiz
);
721 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
722 ND_TCHECK(ptr
->pkt_proc_delay
);
723 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
724 ND_TCHECK(ptr
->phy_chan_id
);
725 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
730 ND_PRINT("%s", tstr
);
734 pptp_icrq_print(netdissect_options
*ndo
,
737 const struct pptp_msg_icrq
*ptr
= (const struct pptp_msg_icrq
*)dat
;
739 ND_TCHECK(ptr
->call_id
);
740 pptp_call_id_print(ndo
, &ptr
->call_id
);
741 ND_TCHECK(ptr
->call_ser
);
742 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
743 ND_TCHECK(ptr
->bearer_type
);
744 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
745 ND_TCHECK(ptr
->phy_chan_id
);
746 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
747 ND_TCHECK(ptr
->dialed_no_len
);
748 ND_PRINT(" DIALED_NO_LEN(%u)", EXTRACT_BE_U_2(ptr
->dialed_no_len
));
749 ND_TCHECK(ptr
->dialing_no_len
);
750 ND_PRINT(" DIALING_NO_LEN(%u)", EXTRACT_BE_U_2(ptr
->dialing_no_len
));
751 ND_TCHECK(ptr
->dialed_no
);
752 ND_PRINT(" DIALED_NO(%.64s)", ptr
->dialed_no
);
753 ND_TCHECK(ptr
->dialing_no
);
754 ND_PRINT(" DIALING_NO(%.64s)", ptr
->dialing_no
);
755 ND_TCHECK(ptr
->subaddr
);
756 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
761 ND_PRINT("%s", tstr
);
765 pptp_icrp_print(netdissect_options
*ndo
,
768 const struct pptp_msg_icrp
*ptr
= (const struct pptp_msg_icrp
*)dat
;
770 ND_TCHECK(ptr
->call_id
);
771 pptp_call_id_print(ndo
, &ptr
->call_id
);
772 ND_TCHECK(ptr
->peer_call_id
);
773 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
774 ND_TCHECK(ptr
->result_code
);
775 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
776 ND_TCHECK(ptr
->err_code
);
777 pptp_err_code_print(ndo
, &ptr
->err_code
);
778 ND_TCHECK(ptr
->recv_winsiz
);
779 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
780 ND_TCHECK(ptr
->pkt_proc_delay
);
781 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
782 ND_TCHECK(ptr
->reserved1
);
787 ND_PRINT("%s", tstr
);
791 pptp_iccn_print(netdissect_options
*ndo
,
794 const struct pptp_msg_iccn
*ptr
= (const struct pptp_msg_iccn
*)dat
;
796 ND_TCHECK(ptr
->peer_call_id
);
797 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
798 ND_TCHECK(ptr
->reserved1
);
799 ND_TCHECK(ptr
->conn_speed
);
800 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
801 ND_TCHECK(ptr
->recv_winsiz
);
802 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
803 ND_TCHECK(ptr
->pkt_proc_delay
);
804 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
805 ND_TCHECK(ptr
->framing_type
);
806 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
811 ND_PRINT("%s", tstr
);
815 pptp_ccrq_print(netdissect_options
*ndo
,
818 const struct pptp_msg_ccrq
*ptr
= (const struct pptp_msg_ccrq
*)dat
;
820 ND_TCHECK(ptr
->call_id
);
821 pptp_call_id_print(ndo
, &ptr
->call_id
);
822 ND_TCHECK(ptr
->reserved1
);
827 ND_PRINT("%s", tstr
);
831 pptp_cdn_print(netdissect_options
*ndo
,
834 const struct pptp_msg_cdn
*ptr
= (const struct pptp_msg_cdn
*)dat
;
836 ND_TCHECK(ptr
->call_id
);
837 pptp_call_id_print(ndo
, &ptr
->call_id
);
838 ND_TCHECK(ptr
->result_code
);
839 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
840 ND_TCHECK(ptr
->err_code
);
841 pptp_err_code_print(ndo
, &ptr
->err_code
);
842 ND_TCHECK(ptr
->cause_code
);
843 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
844 ND_TCHECK(ptr
->reserved1
);
845 ND_TCHECK(ptr
->call_stats
);
846 ND_PRINT(" CALL_STATS(%.128s)", ptr
->call_stats
);
851 ND_PRINT("%s", tstr
);
855 pptp_wen_print(netdissect_options
*ndo
,
858 const struct pptp_msg_wen
*ptr
= (const struct pptp_msg_wen
*)dat
;
860 ND_TCHECK(ptr
->peer_call_id
);
861 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
862 ND_TCHECK(ptr
->reserved1
);
863 ND_TCHECK(ptr
->crc_err
);
864 ND_PRINT(" CRC_ERR(%u)", EXTRACT_BE_U_4(ptr
->crc_err
));
865 ND_TCHECK(ptr
->framing_err
);
866 ND_PRINT(" FRAMING_ERR(%u)", EXTRACT_BE_U_4(ptr
->framing_err
));
867 ND_TCHECK(ptr
->hardware_overrun
);
868 ND_PRINT(" HARDWARE_OVERRUN(%u)", EXTRACT_BE_U_4(ptr
->hardware_overrun
));
869 ND_TCHECK(ptr
->buffer_overrun
);
870 ND_PRINT(" BUFFER_OVERRUN(%u)", EXTRACT_BE_U_4(ptr
->buffer_overrun
));
871 ND_TCHECK(ptr
->timeout_err
);
872 ND_PRINT(" TIMEOUT_ERR(%u)", EXTRACT_BE_U_4(ptr
->timeout_err
));
873 ND_TCHECK(ptr
->align_err
);
874 ND_PRINT(" ALIGN_ERR(%u)", EXTRACT_BE_U_4(ptr
->align_err
));
879 ND_PRINT("%s", tstr
);
883 pptp_sli_print(netdissect_options
*ndo
,
886 const struct pptp_msg_sli
*ptr
= (const struct pptp_msg_sli
*)dat
;
888 ND_TCHECK(ptr
->peer_call_id
);
889 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
890 ND_TCHECK(ptr
->reserved1
);
891 ND_TCHECK(ptr
->send_accm
);
892 ND_PRINT(" SEND_ACCM(0x%08x)", EXTRACT_BE_U_4(ptr
->send_accm
));
893 ND_TCHECK(ptr
->recv_accm
);
894 ND_PRINT(" RECV_ACCM(0x%08x)", EXTRACT_BE_U_4(ptr
->recv_accm
));
899 ND_PRINT("%s", tstr
);
903 pptp_print(netdissect_options
*ndo
,
906 const struct pptp_hdr
*hdr
;
908 uint16_t ctrl_msg_type
;
912 hdr
= (const struct pptp_hdr
*)dat
;
914 ND_TCHECK(hdr
->length
);
915 if (ndo
->ndo_vflag
) {
916 ND_PRINT(" Length=%u", EXTRACT_BE_U_2(hdr
->length
));
918 ND_TCHECK(hdr
->msg_type
);
919 if (ndo
->ndo_vflag
) {
920 switch(EXTRACT_BE_U_2(hdr
->msg_type
)) {
921 case PPTP_MSG_TYPE_CTRL
:
922 ND_PRINT(" CTRL-MSG");
924 case PPTP_MSG_TYPE_MGMT
:
925 ND_PRINT(" MGMT-MSG");
928 ND_PRINT(" UNKNOWN-MSG-TYPE");
933 ND_TCHECK(hdr
->magic_cookie
);
934 mc
= EXTRACT_BE_U_4(hdr
->magic_cookie
);
935 if (mc
!= PPTP_MAGIC_COOKIE
) {
936 ND_PRINT(" UNEXPECTED Magic-Cookie!!(%08x)", mc
);
938 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
939 ND_PRINT(" Magic-Cookie=%08x", mc
);
941 ND_TCHECK(hdr
->ctrl_msg_type
);
942 ctrl_msg_type
= EXTRACT_BE_U_2(hdr
->ctrl_msg_type
);
943 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
944 ND_PRINT(" CTRL_MSGTYPE=%s",
945 pptp_message_type_string
[ctrl_msg_type
]);
947 ND_PRINT(" UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
);
949 ND_TCHECK(hdr
->reserved0
);
953 switch(ctrl_msg_type
) {
954 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
955 pptp_sccrq_print(ndo
, dat
);
957 case PPTP_CTRL_MSG_TYPE_SCCRP
:
958 pptp_sccrp_print(ndo
, dat
);
960 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
961 pptp_stopccrq_print(ndo
, dat
);
963 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
964 pptp_stopccrp_print(ndo
, dat
);
966 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
967 pptp_echorq_print(ndo
, dat
);
969 case PPTP_CTRL_MSG_TYPE_ECHORP
:
970 pptp_echorp_print(ndo
, dat
);
972 case PPTP_CTRL_MSG_TYPE_OCRQ
:
973 pptp_ocrq_print(ndo
, dat
);
975 case PPTP_CTRL_MSG_TYPE_OCRP
:
976 pptp_ocrp_print(ndo
, dat
);
978 case PPTP_CTRL_MSG_TYPE_ICRQ
:
979 pptp_icrq_print(ndo
, dat
);
981 case PPTP_CTRL_MSG_TYPE_ICRP
:
982 pptp_icrp_print(ndo
, dat
);
984 case PPTP_CTRL_MSG_TYPE_ICCN
:
985 pptp_iccn_print(ndo
, dat
);
987 case PPTP_CTRL_MSG_TYPE_CCRQ
:
988 pptp_ccrq_print(ndo
, dat
);
990 case PPTP_CTRL_MSG_TYPE_CDN
:
991 pptp_cdn_print(ndo
, dat
);
993 case PPTP_CTRL_MSG_TYPE_WEN
:
994 pptp_wen_print(ndo
, dat
);
996 case PPTP_CTRL_MSG_TYPE_SLI
:
997 pptp_sli_print(ndo
, dat
);
1007 ND_PRINT("%s", tstr
);