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 uint32_t magic_cookie
;
90 uint16_t ctrl_msg_type
;
94 struct pptp_msg_sccrq
{
105 struct pptp_msg_sccrp
{
109 uint32_t framing_cap
;
111 uint16_t max_channel
;
117 struct pptp_msg_stopccrq
{
123 struct pptp_msg_stopccrp
{
129 struct pptp_msg_echorq
{
133 struct pptp_msg_echorp
{
140 struct pptp_msg_ocrq
{
145 uint32_t bearer_type
;
146 uint32_t framing_type
;
147 uint16_t recv_winsiz
;
148 uint16_t pkt_proc_delay
;
149 uint16_t phone_no_len
;
155 struct pptp_msg_ocrp
{
157 uint16_t peer_call_id
;
162 uint16_t recv_winsiz
;
163 uint16_t pkt_proc_delay
;
164 uint32_t phy_chan_id
;
167 struct pptp_msg_icrq
{
170 uint32_t bearer_type
;
171 uint32_t phy_chan_id
;
172 uint16_t dialed_no_len
;
173 uint16_t dialing_no_len
;
174 u_char dialed_no
[64]; /* DNIS */
175 u_char dialing_no
[64]; /* CLID */
179 struct pptp_msg_icrp
{
181 uint16_t peer_call_id
;
184 uint16_t recv_winsiz
;
185 uint16_t pkt_proc_delay
;
189 struct pptp_msg_iccn
{
190 uint16_t peer_call_id
;
193 uint16_t recv_winsiz
;
194 uint16_t pkt_proc_delay
;
195 uint32_t framing_type
;
198 struct pptp_msg_ccrq
{
203 struct pptp_msg_cdn
{
209 u_char call_stats
[128];
212 struct pptp_msg_wen
{
213 uint16_t peer_call_id
;
216 uint32_t framing_err
;
217 uint32_t hardware_overrun
;
218 uint32_t buffer_overrun
;
219 uint32_t timeout_err
;
223 struct pptp_msg_sli
{
224 uint16_t peer_call_id
;
230 /* attributes that appear more than once in above messages:
234 --------------------------------------
235 2 uint32_t bearer_cap;
236 2 uint32_t bearer_type;
239 2 uint16_t cause_code;
240 2 uint32_t conn_speed;
243 2 uint32_t framing_cap;
244 2 uint32_t framing_type;
245 2 u_char hostname[64];
247 2 uint16_t max_channel;
248 5 uint16_t peer_call_id;
249 2 uint32_t phy_chan_id;
250 4 uint16_t pkt_proc_delay;
251 2 uint16_t proto_ver;
252 4 uint16_t recv_winsiz;
254 9 uint16_t reserved1;
255 6 uint8_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 uint32_t *bearer_cap
)
275 ND_PRINT((ndo
, " BEARER_CAP(%s%s)",
276 EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
? "D" : "",
277 EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
? "A" : ""));
280 static const struct tok pptp_btype_str
[] = {
281 { 1, "A" }, /* Analog */
282 { 2, "D" }, /* Digital */
288 pptp_bearer_type_print(netdissect_options
*ndo
,
289 const uint32_t *bearer_type
)
291 ND_PRINT((ndo
, " BEARER_TYPE(%s)",
292 tok2str(pptp_btype_str
, "?", EXTRACT_32BITS(bearer_type
))));
296 pptp_call_id_print(netdissect_options
*ndo
,
297 const uint16_t *call_id
)
299 ND_PRINT((ndo
, " CALL_ID(%u)", EXTRACT_16BITS(call_id
)));
303 pptp_call_ser_print(netdissect_options
*ndo
,
304 const uint16_t *call_ser
)
306 ND_PRINT((ndo
, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
)));
310 pptp_cause_code_print(netdissect_options
*ndo
,
311 const uint16_t *cause_code
)
313 ND_PRINT((ndo
, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
)));
317 pptp_conn_speed_print(netdissect_options
*ndo
,
318 const uint32_t *conn_speed
)
320 ND_PRINT((ndo
, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
)));
323 static const struct tok pptp_errcode_str
[] = {
325 { 1, "Not-Connected" },
328 { 4, "No-Resource" },
329 { 5, "Bad-Call-ID" },
335 pptp_err_code_print(netdissect_options
*ndo
,
336 const uint8_t *err_code
)
338 ND_PRINT((ndo
, " ERR_CODE(%u", *err_code
));
339 if (ndo
->ndo_vflag
) {
340 ND_PRINT((ndo
, ":%s", tok2str(pptp_errcode_str
, "?", *err_code
)));
342 ND_PRINT((ndo
, ")"));
346 pptp_firm_rev_print(netdissect_options
*ndo
,
347 const uint16_t *firm_rev
)
349 ND_PRINT((ndo
, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
)));
353 pptp_framing_cap_print(netdissect_options
*ndo
,
354 const uint32_t *framing_cap
)
356 ND_PRINT((ndo
, " FRAME_CAP("));
357 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
358 ND_PRINT((ndo
, "A")); /* Async */
360 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
361 ND_PRINT((ndo
, "S")); /* Sync */
363 ND_PRINT((ndo
, ")"));
366 static const struct tok pptp_ftype_str
[] = {
367 { 1, "A" }, /* Async */
368 { 2, "S" }, /* Sync */
369 { 3, "E" }, /* Either */
374 pptp_framing_type_print(netdissect_options
*ndo
,
375 const uint32_t *framing_type
)
377 ND_PRINT((ndo
, " FRAME_TYPE(%s)",
378 tok2str(pptp_ftype_str
, "?", EXTRACT_32BITS(framing_type
))));
382 pptp_hostname_print(netdissect_options
*ndo
,
383 const u_char
*hostname
)
385 ND_PRINT((ndo
, " HOSTNAME(%.64s)", hostname
));
389 pptp_id_print(netdissect_options
*ndo
,
392 ND_PRINT((ndo
, " ID(%u)", EXTRACT_32BITS(id
)));
396 pptp_max_channel_print(netdissect_options
*ndo
,
397 const uint16_t *max_channel
)
399 ND_PRINT((ndo
, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
)));
403 pptp_peer_call_id_print(netdissect_options
*ndo
,
404 const uint16_t *peer_call_id
)
406 ND_PRINT((ndo
, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
)));
410 pptp_phy_chan_id_print(netdissect_options
*ndo
,
411 const uint32_t *phy_chan_id
)
413 ND_PRINT((ndo
, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
)));
417 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
418 const uint16_t *pkt_proc_delay
)
420 ND_PRINT((ndo
, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
)));
424 pptp_proto_ver_print(netdissect_options
*ndo
,
425 const uint16_t *proto_ver
)
427 ND_PRINT((ndo
, " PROTO_VER(%u.%u)", /* Version.Revision */
428 EXTRACT_16BITS(proto_ver
) >> 8,
429 EXTRACT_16BITS(proto_ver
) & 0xff));
433 pptp_recv_winsiz_print(netdissect_options
*ndo
,
434 const uint16_t *recv_winsiz
)
436 ND_PRINT((ndo
, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
)));
439 static const struct tok pptp_scrrp_str
[] = {
440 { 1, "Successful channel establishment" },
441 { 2, "General error" },
442 { 3, "Command channel already exists" },
443 { 4, "Requester is not authorized to establish a command channel" },
444 { 5, "The protocol version of the requester is not supported" },
448 static const struct tok pptp_echorp_str
[] = {
450 { 2, "General Error" },
454 static const struct tok pptp_ocrp_str
[] = {
456 { 2, "General Error" },
459 { 5, "No Dial Tone" },
461 { 7, "Do Not Accept" },
465 static const struct tok pptp_icrp_str
[] = {
467 { 2, "General Error" },
468 { 3, "Do Not Accept" },
472 static const struct tok pptp_cdn_str
[] = {
473 { 1, "Lost Carrier" },
474 { 2, "General Error" },
475 { 3, "Admin Shutdown" },
481 pptp_result_code_print(netdissect_options
*ndo
,
482 const uint8_t *result_code
, int ctrl_msg_type
)
484 ND_PRINT((ndo
, " RESULT_CODE(%u", *result_code
));
485 if (ndo
->ndo_vflag
) {
486 const struct tok
*dict
=
487 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_SCCRP
? pptp_scrrp_str
:
488 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_StopCCRP
? pptp_echorp_str
:
489 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ECHORP
? pptp_echorp_str
:
490 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_OCRP
? pptp_ocrp_str
:
491 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ICRP
? pptp_icrp_str
:
492 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_CDN
? pptp_cdn_str
:
493 NULL
; /* assertion error */
495 ND_PRINT((ndo
, ":%s", tok2str(dict
, "?", *result_code
)));
497 ND_PRINT((ndo
, ")"));
501 pptp_subaddr_print(netdissect_options
*ndo
,
502 const u_char
*subaddr
)
504 ND_PRINT((ndo
, " SUB_ADDR(%.64s)", subaddr
));
508 pptp_vendor_print(netdissect_options
*ndo
,
509 const u_char
*vendor
)
511 ND_PRINT((ndo
, " VENDOR(%.64s)", vendor
));
514 /************************************/
515 /* PPTP message print out functions */
516 /************************************/
518 pptp_sccrq_print(netdissect_options
*ndo
,
521 struct pptp_msg_sccrq
*ptr
= (struct pptp_msg_sccrq
*)dat
;
523 ND_TCHECK(ptr
->proto_ver
);
524 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
525 ND_TCHECK(ptr
->reserved1
);
526 ND_TCHECK(ptr
->framing_cap
);
527 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
528 ND_TCHECK(ptr
->bearer_cap
);
529 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
530 ND_TCHECK(ptr
->max_channel
);
531 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
532 ND_TCHECK(ptr
->firm_rev
);
533 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
534 ND_TCHECK(ptr
->hostname
);
535 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
536 ND_TCHECK(ptr
->vendor
);
537 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
542 ND_PRINT((ndo
, "%s", tstr
));
546 pptp_sccrp_print(netdissect_options
*ndo
,
549 struct pptp_msg_sccrp
*ptr
= (struct pptp_msg_sccrp
*)dat
;
551 ND_TCHECK(ptr
->proto_ver
);
552 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
553 ND_TCHECK(ptr
->result_code
);
554 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
555 ND_TCHECK(ptr
->err_code
);
556 pptp_err_code_print(ndo
, &ptr
->err_code
);
557 ND_TCHECK(ptr
->framing_cap
);
558 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
559 ND_TCHECK(ptr
->bearer_cap
);
560 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
561 ND_TCHECK(ptr
->max_channel
);
562 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
563 ND_TCHECK(ptr
->firm_rev
);
564 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
565 ND_TCHECK(ptr
->hostname
);
566 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
567 ND_TCHECK(ptr
->vendor
);
568 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
573 ND_PRINT((ndo
, "%s", tstr
));
577 pptp_stopccrq_print(netdissect_options
*ndo
,
580 struct pptp_msg_stopccrq
*ptr
= (struct pptp_msg_stopccrq
*)dat
;
582 ND_TCHECK(ptr
->reason
);
583 ND_PRINT((ndo
, " REASON(%u", ptr
->reason
));
584 if (ndo
->ndo_vflag
) {
585 switch (ptr
->reason
) {
587 ND_PRINT((ndo
, ":None"));
590 ND_PRINT((ndo
, ":Stop-Protocol"));
593 ND_PRINT((ndo
, ":Stop-Local-Shutdown"));
596 ND_PRINT((ndo
, ":?"));
600 ND_PRINT((ndo
, ")"));
601 ND_TCHECK(ptr
->reserved1
);
602 ND_TCHECK(ptr
->reserved2
);
607 ND_PRINT((ndo
, "%s", tstr
));
611 pptp_stopccrp_print(netdissect_options
*ndo
,
614 struct pptp_msg_stopccrp
*ptr
= (struct pptp_msg_stopccrp
*)dat
;
616 ND_TCHECK(ptr
->result_code
);
617 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
618 ND_TCHECK(ptr
->err_code
);
619 pptp_err_code_print(ndo
, &ptr
->err_code
);
620 ND_TCHECK(ptr
->reserved1
);
625 ND_PRINT((ndo
, "%s", tstr
));
629 pptp_echorq_print(netdissect_options
*ndo
,
632 struct pptp_msg_echorq
*ptr
= (struct pptp_msg_echorq
*)dat
;
635 pptp_id_print(ndo
, &ptr
->id
);
640 ND_PRINT((ndo
, "%s", tstr
));
644 pptp_echorp_print(netdissect_options
*ndo
,
647 struct pptp_msg_echorp
*ptr
= (struct pptp_msg_echorp
*)dat
;
650 pptp_id_print(ndo
, &ptr
->id
);
651 ND_TCHECK(ptr
->result_code
);
652 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
653 ND_TCHECK(ptr
->err_code
);
654 pptp_err_code_print(ndo
, &ptr
->err_code
);
655 ND_TCHECK(ptr
->reserved1
);
660 ND_PRINT((ndo
, "%s", tstr
));
664 pptp_ocrq_print(netdissect_options
*ndo
,
667 struct pptp_msg_ocrq
*ptr
= (struct pptp_msg_ocrq
*)dat
;
669 ND_TCHECK(ptr
->call_id
);
670 pptp_call_id_print(ndo
, &ptr
->call_id
);
671 ND_TCHECK(ptr
->call_ser
);
672 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
673 ND_TCHECK(ptr
->min_bps
);
674 ND_PRINT((ndo
, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
)));
675 ND_TCHECK(ptr
->max_bps
);
676 ND_PRINT((ndo
, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
)));
677 ND_TCHECK(ptr
->bearer_type
);
678 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
679 ND_TCHECK(ptr
->framing_type
);
680 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
681 ND_TCHECK(ptr
->recv_winsiz
);
682 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
683 ND_TCHECK(ptr
->pkt_proc_delay
);
684 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
685 ND_TCHECK(ptr
->phone_no_len
);
686 ND_PRINT((ndo
, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
)));
687 ND_TCHECK(ptr
->reserved1
);
688 ND_TCHECK(ptr
->phone_no
);
689 ND_PRINT((ndo
, " PHONE_NO(%.64s)", ptr
->phone_no
));
690 ND_TCHECK(ptr
->subaddr
);
691 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
696 ND_PRINT((ndo
, "%s", tstr
));
700 pptp_ocrp_print(netdissect_options
*ndo
,
703 struct pptp_msg_ocrp
*ptr
= (struct pptp_msg_ocrp
*)dat
;
705 ND_TCHECK(ptr
->call_id
);
706 pptp_call_id_print(ndo
, &ptr
->call_id
);
707 ND_TCHECK(ptr
->peer_call_id
);
708 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
709 ND_TCHECK(ptr
->result_code
);
710 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
711 ND_TCHECK(ptr
->err_code
);
712 pptp_err_code_print(ndo
, &ptr
->err_code
);
713 ND_TCHECK(ptr
->cause_code
);
714 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
715 ND_TCHECK(ptr
->conn_speed
);
716 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
717 ND_TCHECK(ptr
->recv_winsiz
);
718 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
719 ND_TCHECK(ptr
->pkt_proc_delay
);
720 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
721 ND_TCHECK(ptr
->phy_chan_id
);
722 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
727 ND_PRINT((ndo
, "%s", tstr
));
731 pptp_icrq_print(netdissect_options
*ndo
,
734 struct pptp_msg_icrq
*ptr
= (struct pptp_msg_icrq
*)dat
;
736 ND_TCHECK(ptr
->call_id
);
737 pptp_call_id_print(ndo
, &ptr
->call_id
);
738 ND_TCHECK(ptr
->call_ser
);
739 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
740 ND_TCHECK(ptr
->bearer_type
);
741 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
742 ND_TCHECK(ptr
->phy_chan_id
);
743 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
744 ND_TCHECK(ptr
->dialed_no_len
);
745 ND_PRINT((ndo
, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
)));
746 ND_TCHECK(ptr
->dialing_no_len
);
747 ND_PRINT((ndo
, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
)));
748 ND_TCHECK(ptr
->dialed_no
);
749 ND_PRINT((ndo
, " DIALED_NO(%.64s)", ptr
->dialed_no
));
750 ND_TCHECK(ptr
->dialing_no
);
751 ND_PRINT((ndo
, " DIALING_NO(%.64s)", ptr
->dialing_no
));
752 ND_TCHECK(ptr
->subaddr
);
753 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
758 ND_PRINT((ndo
, "%s", tstr
));
762 pptp_icrp_print(netdissect_options
*ndo
,
765 struct pptp_msg_icrp
*ptr
= (struct pptp_msg_icrp
*)dat
;
767 ND_TCHECK(ptr
->call_id
);
768 pptp_call_id_print(ndo
, &ptr
->call_id
);
769 ND_TCHECK(ptr
->peer_call_id
);
770 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
771 ND_TCHECK(ptr
->result_code
);
772 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
773 ND_TCHECK(ptr
->err_code
);
774 pptp_err_code_print(ndo
, &ptr
->err_code
);
775 ND_TCHECK(ptr
->recv_winsiz
);
776 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
777 ND_TCHECK(ptr
->pkt_proc_delay
);
778 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
779 ND_TCHECK(ptr
->reserved1
);
784 ND_PRINT((ndo
, "%s", tstr
));
788 pptp_iccn_print(netdissect_options
*ndo
,
791 struct pptp_msg_iccn
*ptr
= (struct pptp_msg_iccn
*)dat
;
793 ND_TCHECK(ptr
->peer_call_id
);
794 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
795 ND_TCHECK(ptr
->reserved1
);
796 ND_TCHECK(ptr
->conn_speed
);
797 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
798 ND_TCHECK(ptr
->recv_winsiz
);
799 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
800 ND_TCHECK(ptr
->pkt_proc_delay
);
801 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
802 ND_TCHECK(ptr
->framing_type
);
803 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
808 ND_PRINT((ndo
, "%s", tstr
));
812 pptp_ccrq_print(netdissect_options
*ndo
,
815 struct pptp_msg_ccrq
*ptr
= (struct pptp_msg_ccrq
*)dat
;
817 ND_TCHECK(ptr
->call_id
);
818 pptp_call_id_print(ndo
, &ptr
->call_id
);
819 ND_TCHECK(ptr
->reserved1
);
824 ND_PRINT((ndo
, "%s", tstr
));
828 pptp_cdn_print(netdissect_options
*ndo
,
831 struct pptp_msg_cdn
*ptr
= (struct pptp_msg_cdn
*)dat
;
833 ND_TCHECK(ptr
->call_id
);
834 pptp_call_id_print(ndo
, &ptr
->call_id
);
835 ND_TCHECK(ptr
->result_code
);
836 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
837 ND_TCHECK(ptr
->err_code
);
838 pptp_err_code_print(ndo
, &ptr
->err_code
);
839 ND_TCHECK(ptr
->cause_code
);
840 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
841 ND_TCHECK(ptr
->reserved1
);
842 ND_TCHECK(ptr
->call_stats
);
843 ND_PRINT((ndo
, " CALL_STATS(%.128s)", ptr
->call_stats
));
848 ND_PRINT((ndo
, "%s", tstr
));
852 pptp_wen_print(netdissect_options
*ndo
,
855 struct pptp_msg_wen
*ptr
= (struct pptp_msg_wen
*)dat
;
857 ND_TCHECK(ptr
->peer_call_id
);
858 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
859 ND_TCHECK(ptr
->reserved1
);
860 ND_TCHECK(ptr
->crc_err
);
861 ND_PRINT((ndo
, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
)));
862 ND_TCHECK(ptr
->framing_err
);
863 ND_PRINT((ndo
, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
)));
864 ND_TCHECK(ptr
->hardware_overrun
);
865 ND_PRINT((ndo
, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
)));
866 ND_TCHECK(ptr
->buffer_overrun
);
867 ND_PRINT((ndo
, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
)));
868 ND_TCHECK(ptr
->timeout_err
);
869 ND_PRINT((ndo
, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
)));
870 ND_TCHECK(ptr
->align_err
);
871 ND_PRINT((ndo
, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
)));
876 ND_PRINT((ndo
, "%s", tstr
));
880 pptp_sli_print(netdissect_options
*ndo
,
883 struct pptp_msg_sli
*ptr
= (struct pptp_msg_sli
*)dat
;
885 ND_TCHECK(ptr
->peer_call_id
);
886 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
887 ND_TCHECK(ptr
->reserved1
);
888 ND_TCHECK(ptr
->send_accm
);
889 ND_PRINT((ndo
, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
)));
890 ND_TCHECK(ptr
->recv_accm
);
891 ND_PRINT((ndo
, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
)));
896 ND_PRINT((ndo
, "%s", tstr
));
900 pptp_print(netdissect_options
*ndo
,
903 const struct pptp_hdr
*hdr
;
905 uint16_t ctrl_msg_type
;
907 ND_PRINT((ndo
, ": pptp"));
909 hdr
= (struct pptp_hdr
*)dat
;
911 ND_TCHECK(hdr
->length
);
912 if (ndo
->ndo_vflag
) {
913 ND_PRINT((ndo
, " Length=%u", EXTRACT_16BITS(&hdr
->length
)));
915 ND_TCHECK(hdr
->msg_type
);
916 if (ndo
->ndo_vflag
) {
917 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
918 case PPTP_MSG_TYPE_CTRL
:
919 ND_PRINT((ndo
, " CTRL-MSG"));
921 case PPTP_MSG_TYPE_MGMT
:
922 ND_PRINT((ndo
, " MGMT-MSG"));
925 ND_PRINT((ndo
, " UNKNOWN-MSG-TYPE"));
930 ND_TCHECK(hdr
->magic_cookie
);
931 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
932 if (mc
!= PPTP_MAGIC_COOKIE
) {
933 ND_PRINT((ndo
, " UNEXPECTED Magic-Cookie!!(%08x)", mc
));
935 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
936 ND_PRINT((ndo
, " Magic-Cookie=%08x", mc
));
938 ND_TCHECK(hdr
->ctrl_msg_type
);
939 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
940 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
941 ND_PRINT((ndo
, " CTRL_MSGTYPE=%s",
942 pptp_message_type_string
[ctrl_msg_type
]));
944 ND_PRINT((ndo
, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
));
946 ND_TCHECK(hdr
->reserved0
);
950 switch(ctrl_msg_type
) {
951 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
952 pptp_sccrq_print(ndo
, dat
);
954 case PPTP_CTRL_MSG_TYPE_SCCRP
:
955 pptp_sccrp_print(ndo
, dat
);
957 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
958 pptp_stopccrq_print(ndo
, dat
);
960 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
961 pptp_stopccrp_print(ndo
, dat
);
963 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
964 pptp_echorq_print(ndo
, dat
);
966 case PPTP_CTRL_MSG_TYPE_ECHORP
:
967 pptp_echorp_print(ndo
, dat
);
969 case PPTP_CTRL_MSG_TYPE_OCRQ
:
970 pptp_ocrq_print(ndo
, dat
);
972 case PPTP_CTRL_MSG_TYPE_OCRP
:
973 pptp_ocrp_print(ndo
, dat
);
975 case PPTP_CTRL_MSG_TYPE_ICRQ
:
976 pptp_icrq_print(ndo
, dat
);
978 case PPTP_CTRL_MSG_TYPE_ICRP
:
979 pptp_icrp_print(ndo
, dat
);
981 case PPTP_CTRL_MSG_TYPE_ICCN
:
982 pptp_iccn_print(ndo
, dat
);
984 case PPTP_CTRL_MSG_TYPE_CCRQ
:
985 pptp_ccrq_print(ndo
, dat
);
987 case PPTP_CTRL_MSG_TYPE_CDN
:
988 pptp_cdn_print(ndo
, dat
);
990 case PPTP_CTRL_MSG_TYPE_WEN
:
991 pptp_wen_print(ndo
, dat
);
993 case PPTP_CTRL_MSG_TYPE_SLI
:
994 pptp_sli_print(ndo
, dat
);
1004 ND_PRINT((ndo
, "%s", tstr
));