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 */
30 #include <netdissect-stdinc.h>
32 #include "netdissect.h"
35 static const char tstr
[] = " [|pptp]";
37 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
38 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
39 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
41 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
42 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
43 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
44 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
45 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
46 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
47 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
48 #define PPTP_CTRL_MSG_TYPE_OCRP 8
49 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
50 #define PPTP_CTRL_MSG_TYPE_ICRP 10
51 #define PPTP_CTRL_MSG_TYPE_ICCN 11
52 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
53 #define PPTP_CTRL_MSG_TYPE_CDN 13
54 #define PPTP_CTRL_MSG_TYPE_WEN 14
55 #define PPTP_CTRL_MSG_TYPE_SLI 15
57 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
58 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
60 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
61 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
63 static const char *pptp_message_type_string
[] = {
64 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
65 "SCCRQ", /* 1 Start-Control-Connection-Request */
66 "SCCRP", /* 2 Start-Control-Connection-Reply */
67 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
68 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
69 "ECHORQ", /* 5 Echo Request */
70 "ECHORP", /* 6 Echo Reply */
72 "OCRQ", /* 7 Outgoing-Call-Request */
73 "OCRP", /* 8 Outgoing-Call-Reply */
74 "ICRQ", /* 9 Incoming-Call-Request */
75 "ICRP", /* 10 Incoming-Call-Reply */
76 "ICCN", /* 11 Incoming-Call-Connected */
77 "CCRQ", /* 12 Call-Clear-Request */
78 "CDN", /* 13 Call-Disconnect-Notify */
80 "WEN", /* 14 WAN-Error-Notify */
82 "SLI" /* 15 Set-Link-Info */
83 #define PPTP_MAX_MSGTYPE_INDEX 16
86 /* common for all PPTP control messages */
90 uint32_t magic_cookie
;
91 uint16_t ctrl_msg_type
;
95 struct pptp_msg_sccrq
{
100 uint16_t max_channel
;
106 struct pptp_msg_sccrp
{
110 uint32_t framing_cap
;
112 uint16_t max_channel
;
118 struct pptp_msg_stopccrq
{
124 struct pptp_msg_stopccrp
{
130 struct pptp_msg_echorq
{
134 struct pptp_msg_echorp
{
141 struct pptp_msg_ocrq
{
146 uint32_t bearer_type
;
147 uint32_t framing_type
;
148 uint16_t recv_winsiz
;
149 uint16_t pkt_proc_delay
;
150 uint16_t phone_no_len
;
156 struct pptp_msg_ocrp
{
158 uint16_t peer_call_id
;
163 uint16_t recv_winsiz
;
164 uint16_t pkt_proc_delay
;
165 uint32_t phy_chan_id
;
168 struct pptp_msg_icrq
{
171 uint32_t bearer_type
;
172 uint32_t phy_chan_id
;
173 uint16_t dialed_no_len
;
174 uint16_t dialing_no_len
;
175 u_char dialed_no
[64]; /* DNIS */
176 u_char dialing_no
[64]; /* CLID */
180 struct pptp_msg_icrp
{
182 uint16_t peer_call_id
;
185 uint16_t recv_winsiz
;
186 uint16_t pkt_proc_delay
;
190 struct pptp_msg_iccn
{
191 uint16_t peer_call_id
;
194 uint16_t recv_winsiz
;
195 uint16_t pkt_proc_delay
;
196 uint32_t framing_type
;
199 struct pptp_msg_ccrq
{
204 struct pptp_msg_cdn
{
210 u_char call_stats
[128];
213 struct pptp_msg_wen
{
214 uint16_t peer_call_id
;
217 uint32_t framing_err
;
218 uint32_t hardware_overrun
;
219 uint32_t buffer_overrun
;
220 uint32_t timeout_err
;
224 struct pptp_msg_sli
{
225 uint16_t peer_call_id
;
231 /* attributes that appear more than once in above messages:
235 --------------------------------------
236 2 uint32_t bearer_cap;
237 2 uint32_t bearer_type;
240 2 uint16_t cause_code;
241 2 uint32_t conn_speed;
244 2 uint32_t framing_cap;
245 2 uint32_t framing_type;
246 2 u_char hostname[64];
248 2 uint16_t max_channel;
249 5 uint16_t peer_call_id;
250 2 uint32_t phy_chan_id;
251 4 uint16_t pkt_proc_delay;
252 2 uint16_t proto_ver;
253 4 uint16_t recv_winsiz;
255 9 uint16_t reserved1;
256 6 uint8_t result_code;
257 2 u_char subaddr[64];
260 so I will prepare print out functions for these attributes (except for
264 /******************************************/
265 /* Attribute-specific print out functions */
266 /******************************************/
268 /* In these attribute-specific print-out functions, it't not necessary
269 to do ND_TCHECK because they are already checked in the caller of
273 pptp_bearer_cap_print(netdissect_options
*ndo
,
274 const uint32_t *bearer_cap
)
276 ND_PRINT((ndo
, " BEARER_CAP(%s%s)",
277 EXTRACT_BE_U_4(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
? "D" : "",
278 EXTRACT_BE_U_4(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
? "A" : ""));
281 static const struct tok pptp_btype_str
[] = {
282 { 1, "A" }, /* Analog */
283 { 2, "D" }, /* Digital */
289 pptp_bearer_type_print(netdissect_options
*ndo
,
290 const uint32_t *bearer_type
)
292 ND_PRINT((ndo
, " BEARER_TYPE(%s)",
293 tok2str(pptp_btype_str
, "?", EXTRACT_BE_U_4(bearer_type
))));
297 pptp_call_id_print(netdissect_options
*ndo
,
298 const uint16_t *call_id
)
300 ND_PRINT((ndo
, " CALL_ID(%u)", EXTRACT_BE_U_2(call_id
)));
304 pptp_call_ser_print(netdissect_options
*ndo
,
305 const uint16_t *call_ser
)
307 ND_PRINT((ndo
, " CALL_SER_NUM(%u)", EXTRACT_BE_U_2(call_ser
)));
311 pptp_cause_code_print(netdissect_options
*ndo
,
312 const uint16_t *cause_code
)
314 ND_PRINT((ndo
, " CAUSE_CODE(%u)", EXTRACT_BE_U_2(cause_code
)));
318 pptp_conn_speed_print(netdissect_options
*ndo
,
319 const uint32_t *conn_speed
)
321 ND_PRINT((ndo
, " CONN_SPEED(%u)", EXTRACT_BE_U_4(conn_speed
)));
324 static const struct tok pptp_errcode_str
[] = {
326 { 1, "Not-Connected" },
329 { 4, "No-Resource" },
330 { 5, "Bad-Call-ID" },
336 pptp_err_code_print(netdissect_options
*ndo
,
337 const uint8_t *err_code
)
339 ND_PRINT((ndo
, " ERR_CODE(%u", *err_code
));
340 if (ndo
->ndo_vflag
) {
341 ND_PRINT((ndo
, ":%s", tok2str(pptp_errcode_str
, "?", EXTRACT_U_1(err_code
))));
343 ND_PRINT((ndo
, ")"));
347 pptp_firm_rev_print(netdissect_options
*ndo
,
348 const uint16_t *firm_rev
)
350 ND_PRINT((ndo
, " FIRM_REV(%u)", EXTRACT_BE_U_2(firm_rev
)));
354 pptp_framing_cap_print(netdissect_options
*ndo
,
355 const uint32_t *framing_cap
)
357 ND_PRINT((ndo
, " FRAME_CAP("));
358 if (EXTRACT_BE_U_4(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
359 ND_PRINT((ndo
, "A")); /* Async */
361 if (EXTRACT_BE_U_4(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
362 ND_PRINT((ndo
, "S")); /* Sync */
364 ND_PRINT((ndo
, ")"));
367 static const struct tok pptp_ftype_str
[] = {
368 { 1, "A" }, /* Async */
369 { 2, "S" }, /* Sync */
370 { 3, "E" }, /* Either */
375 pptp_framing_type_print(netdissect_options
*ndo
,
376 const uint32_t *framing_type
)
378 ND_PRINT((ndo
, " FRAME_TYPE(%s)",
379 tok2str(pptp_ftype_str
, "?", EXTRACT_BE_U_4(framing_type
))));
383 pptp_hostname_print(netdissect_options
*ndo
,
384 const u_char
*hostname
)
386 ND_PRINT((ndo
, " HOSTNAME(%.64s)", hostname
));
390 pptp_id_print(netdissect_options
*ndo
,
393 ND_PRINT((ndo
, " ID(%u)", EXTRACT_BE_U_4(id
)));
397 pptp_max_channel_print(netdissect_options
*ndo
,
398 const uint16_t *max_channel
)
400 ND_PRINT((ndo
, " MAX_CHAN(%u)", EXTRACT_BE_U_2(max_channel
)));
404 pptp_peer_call_id_print(netdissect_options
*ndo
,
405 const uint16_t *peer_call_id
)
407 ND_PRINT((ndo
, " PEER_CALL_ID(%u)", EXTRACT_BE_U_2(peer_call_id
)));
411 pptp_phy_chan_id_print(netdissect_options
*ndo
,
412 const uint32_t *phy_chan_id
)
414 ND_PRINT((ndo
, " PHY_CHAN_ID(%u)", EXTRACT_BE_U_4(phy_chan_id
)));
418 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
419 const uint16_t *pkt_proc_delay
)
421 ND_PRINT((ndo
, " PROC_DELAY(%u)", EXTRACT_BE_U_2(pkt_proc_delay
)));
425 pptp_proto_ver_print(netdissect_options
*ndo
,
426 const uint16_t *proto_ver
)
428 ND_PRINT((ndo
, " PROTO_VER(%u.%u)", /* Version.Revision */
429 EXTRACT_BE_U_2(proto_ver
) >> 8,
430 EXTRACT_BE_U_2(proto_ver
) & 0xff));
434 pptp_recv_winsiz_print(netdissect_options
*ndo
,
435 const uint16_t *recv_winsiz
)
437 ND_PRINT((ndo
, " RECV_WIN(%u)", EXTRACT_BE_U_2(recv_winsiz
)));
440 static const struct tok pptp_scrrp_str
[] = {
441 { 1, "Successful channel establishment" },
442 { 2, "General error" },
443 { 3, "Command channel already exists" },
444 { 4, "Requester is not authorized to establish a command channel" },
445 { 5, "The protocol version of the requester is not supported" },
449 static const struct tok pptp_echorp_str
[] = {
451 { 2, "General Error" },
455 static const struct tok pptp_ocrp_str
[] = {
457 { 2, "General Error" },
460 { 5, "No Dial Tone" },
462 { 7, "Do Not Accept" },
466 static const struct tok pptp_icrp_str
[] = {
468 { 2, "General Error" },
469 { 3, "Do Not Accept" },
473 static const struct tok pptp_cdn_str
[] = {
474 { 1, "Lost Carrier" },
475 { 2, "General Error" },
476 { 3, "Admin Shutdown" },
482 pptp_result_code_print(netdissect_options
*ndo
,
483 const uint8_t *result_code
, int ctrl_msg_type
)
485 ND_PRINT((ndo
, " RESULT_CODE(%u", *result_code
));
486 if (ndo
->ndo_vflag
) {
487 const struct tok
*dict
=
488 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_SCCRP
? pptp_scrrp_str
:
489 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_StopCCRP
? pptp_echorp_str
:
490 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ECHORP
? pptp_echorp_str
:
491 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_OCRP
? pptp_ocrp_str
:
492 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ICRP
? pptp_icrp_str
:
493 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_CDN
? pptp_cdn_str
:
494 NULL
; /* assertion error */
496 ND_PRINT((ndo
, ":%s", tok2str(dict
, "?", EXTRACT_U_1(result_code
))));
498 ND_PRINT((ndo
, ")"));
502 pptp_subaddr_print(netdissect_options
*ndo
,
503 const u_char
*subaddr
)
505 ND_PRINT((ndo
, " SUB_ADDR(%.64s)", subaddr
));
509 pptp_vendor_print(netdissect_options
*ndo
,
510 const u_char
*vendor
)
512 ND_PRINT((ndo
, " VENDOR(%.64s)", vendor
));
515 /************************************/
516 /* PPTP message print out functions */
517 /************************************/
519 pptp_sccrq_print(netdissect_options
*ndo
,
522 const struct pptp_msg_sccrq
*ptr
= (const struct pptp_msg_sccrq
*)dat
;
524 ND_TCHECK(ptr
->proto_ver
);
525 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
526 ND_TCHECK(ptr
->reserved1
);
527 ND_TCHECK(ptr
->framing_cap
);
528 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
529 ND_TCHECK(ptr
->bearer_cap
);
530 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
531 ND_TCHECK(ptr
->max_channel
);
532 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
533 ND_TCHECK(ptr
->firm_rev
);
534 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
535 ND_TCHECK(ptr
->hostname
);
536 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
537 ND_TCHECK(ptr
->vendor
);
538 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
543 ND_PRINT((ndo
, "%s", tstr
));
547 pptp_sccrp_print(netdissect_options
*ndo
,
550 const struct pptp_msg_sccrp
*ptr
= (const struct pptp_msg_sccrp
*)dat
;
552 ND_TCHECK(ptr
->proto_ver
);
553 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
554 ND_TCHECK(ptr
->result_code
);
555 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
556 ND_TCHECK(ptr
->err_code
);
557 pptp_err_code_print(ndo
, &ptr
->err_code
);
558 ND_TCHECK(ptr
->framing_cap
);
559 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
560 ND_TCHECK(ptr
->bearer_cap
);
561 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
562 ND_TCHECK(ptr
->max_channel
);
563 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
564 ND_TCHECK(ptr
->firm_rev
);
565 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
566 ND_TCHECK(ptr
->hostname
);
567 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
568 ND_TCHECK(ptr
->vendor
);
569 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
574 ND_PRINT((ndo
, "%s", tstr
));
578 pptp_stopccrq_print(netdissect_options
*ndo
,
581 const struct pptp_msg_stopccrq
*ptr
= (const struct pptp_msg_stopccrq
*)dat
;
583 ND_TCHECK(ptr
->reason
);
584 ND_PRINT((ndo
, " REASON(%u", ptr
->reason
));
585 if (ndo
->ndo_vflag
) {
586 switch (ptr
->reason
) {
588 ND_PRINT((ndo
, ":None"));
591 ND_PRINT((ndo
, ":Stop-Protocol"));
594 ND_PRINT((ndo
, ":Stop-Local-Shutdown"));
597 ND_PRINT((ndo
, ":?"));
601 ND_PRINT((ndo
, ")"));
602 ND_TCHECK(ptr
->reserved1
);
603 ND_TCHECK(ptr
->reserved2
);
608 ND_PRINT((ndo
, "%s", tstr
));
612 pptp_stopccrp_print(netdissect_options
*ndo
,
615 const struct pptp_msg_stopccrp
*ptr
= (const struct pptp_msg_stopccrp
*)dat
;
617 ND_TCHECK(ptr
->result_code
);
618 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
619 ND_TCHECK(ptr
->err_code
);
620 pptp_err_code_print(ndo
, &ptr
->err_code
);
621 ND_TCHECK(ptr
->reserved1
);
626 ND_PRINT((ndo
, "%s", tstr
));
630 pptp_echorq_print(netdissect_options
*ndo
,
633 const struct pptp_msg_echorq
*ptr
= (const struct pptp_msg_echorq
*)dat
;
636 pptp_id_print(ndo
, &ptr
->id
);
641 ND_PRINT((ndo
, "%s", tstr
));
645 pptp_echorp_print(netdissect_options
*ndo
,
648 const struct pptp_msg_echorp
*ptr
= (const struct pptp_msg_echorp
*)dat
;
651 pptp_id_print(ndo
, &ptr
->id
);
652 ND_TCHECK(ptr
->result_code
);
653 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
654 ND_TCHECK(ptr
->err_code
);
655 pptp_err_code_print(ndo
, &ptr
->err_code
);
656 ND_TCHECK(ptr
->reserved1
);
661 ND_PRINT((ndo
, "%s", tstr
));
665 pptp_ocrq_print(netdissect_options
*ndo
,
668 const struct pptp_msg_ocrq
*ptr
= (const struct pptp_msg_ocrq
*)dat
;
670 ND_TCHECK(ptr
->call_id
);
671 pptp_call_id_print(ndo
, &ptr
->call_id
);
672 ND_TCHECK(ptr
->call_ser
);
673 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
674 ND_TCHECK(ptr
->min_bps
);
675 ND_PRINT((ndo
, " MIN_BPS(%u)", EXTRACT_BE_U_4(&ptr
->min_bps
)));
676 ND_TCHECK(ptr
->max_bps
);
677 ND_PRINT((ndo
, " MAX_BPS(%u)", EXTRACT_BE_U_4(&ptr
->max_bps
)));
678 ND_TCHECK(ptr
->bearer_type
);
679 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
680 ND_TCHECK(ptr
->framing_type
);
681 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
682 ND_TCHECK(ptr
->recv_winsiz
);
683 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
684 ND_TCHECK(ptr
->pkt_proc_delay
);
685 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
686 ND_TCHECK(ptr
->phone_no_len
);
687 ND_PRINT((ndo
, " PHONE_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr
->phone_no_len
)));
688 ND_TCHECK(ptr
->reserved1
);
689 ND_TCHECK(ptr
->phone_no
);
690 ND_PRINT((ndo
, " PHONE_NO(%.64s)", ptr
->phone_no
));
691 ND_TCHECK(ptr
->subaddr
);
692 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
697 ND_PRINT((ndo
, "%s", tstr
));
701 pptp_ocrp_print(netdissect_options
*ndo
,
704 const struct pptp_msg_ocrp
*ptr
= (const struct pptp_msg_ocrp
*)dat
;
706 ND_TCHECK(ptr
->call_id
);
707 pptp_call_id_print(ndo
, &ptr
->call_id
);
708 ND_TCHECK(ptr
->peer_call_id
);
709 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
710 ND_TCHECK(ptr
->result_code
);
711 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
712 ND_TCHECK(ptr
->err_code
);
713 pptp_err_code_print(ndo
, &ptr
->err_code
);
714 ND_TCHECK(ptr
->cause_code
);
715 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
716 ND_TCHECK(ptr
->conn_speed
);
717 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
718 ND_TCHECK(ptr
->recv_winsiz
);
719 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
720 ND_TCHECK(ptr
->pkt_proc_delay
);
721 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
722 ND_TCHECK(ptr
->phy_chan_id
);
723 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
728 ND_PRINT((ndo
, "%s", tstr
));
732 pptp_icrq_print(netdissect_options
*ndo
,
735 const struct pptp_msg_icrq
*ptr
= (const struct pptp_msg_icrq
*)dat
;
737 ND_TCHECK(ptr
->call_id
);
738 pptp_call_id_print(ndo
, &ptr
->call_id
);
739 ND_TCHECK(ptr
->call_ser
);
740 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
741 ND_TCHECK(ptr
->bearer_type
);
742 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
743 ND_TCHECK(ptr
->phy_chan_id
);
744 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
745 ND_TCHECK(ptr
->dialed_no_len
);
746 ND_PRINT((ndo
, " DIALED_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr
->dialed_no_len
)));
747 ND_TCHECK(ptr
->dialing_no_len
);
748 ND_PRINT((ndo
, " DIALING_NO_LEN(%u)", EXTRACT_BE_U_2(&ptr
->dialing_no_len
)));
749 ND_TCHECK(ptr
->dialed_no
);
750 ND_PRINT((ndo
, " DIALED_NO(%.64s)", ptr
->dialed_no
));
751 ND_TCHECK(ptr
->dialing_no
);
752 ND_PRINT((ndo
, " DIALING_NO(%.64s)", ptr
->dialing_no
));
753 ND_TCHECK(ptr
->subaddr
);
754 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
759 ND_PRINT((ndo
, "%s", tstr
));
763 pptp_icrp_print(netdissect_options
*ndo
,
766 const struct pptp_msg_icrp
*ptr
= (const struct pptp_msg_icrp
*)dat
;
768 ND_TCHECK(ptr
->call_id
);
769 pptp_call_id_print(ndo
, &ptr
->call_id
);
770 ND_TCHECK(ptr
->peer_call_id
);
771 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
772 ND_TCHECK(ptr
->result_code
);
773 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
774 ND_TCHECK(ptr
->err_code
);
775 pptp_err_code_print(ndo
, &ptr
->err_code
);
776 ND_TCHECK(ptr
->recv_winsiz
);
777 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
778 ND_TCHECK(ptr
->pkt_proc_delay
);
779 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
780 ND_TCHECK(ptr
->reserved1
);
785 ND_PRINT((ndo
, "%s", tstr
));
789 pptp_iccn_print(netdissect_options
*ndo
,
792 const struct pptp_msg_iccn
*ptr
= (const struct pptp_msg_iccn
*)dat
;
794 ND_TCHECK(ptr
->peer_call_id
);
795 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
796 ND_TCHECK(ptr
->reserved1
);
797 ND_TCHECK(ptr
->conn_speed
);
798 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
799 ND_TCHECK(ptr
->recv_winsiz
);
800 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
801 ND_TCHECK(ptr
->pkt_proc_delay
);
802 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
803 ND_TCHECK(ptr
->framing_type
);
804 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
809 ND_PRINT((ndo
, "%s", tstr
));
813 pptp_ccrq_print(netdissect_options
*ndo
,
816 const struct pptp_msg_ccrq
*ptr
= (const struct pptp_msg_ccrq
*)dat
;
818 ND_TCHECK(ptr
->call_id
);
819 pptp_call_id_print(ndo
, &ptr
->call_id
);
820 ND_TCHECK(ptr
->reserved1
);
825 ND_PRINT((ndo
, "%s", tstr
));
829 pptp_cdn_print(netdissect_options
*ndo
,
832 const struct pptp_msg_cdn
*ptr
= (const struct pptp_msg_cdn
*)dat
;
834 ND_TCHECK(ptr
->call_id
);
835 pptp_call_id_print(ndo
, &ptr
->call_id
);
836 ND_TCHECK(ptr
->result_code
);
837 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
838 ND_TCHECK(ptr
->err_code
);
839 pptp_err_code_print(ndo
, &ptr
->err_code
);
840 ND_TCHECK(ptr
->cause_code
);
841 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
842 ND_TCHECK(ptr
->reserved1
);
843 ND_TCHECK(ptr
->call_stats
);
844 ND_PRINT((ndo
, " CALL_STATS(%.128s)", ptr
->call_stats
));
849 ND_PRINT((ndo
, "%s", tstr
));
853 pptp_wen_print(netdissect_options
*ndo
,
856 const struct pptp_msg_wen
*ptr
= (const struct pptp_msg_wen
*)dat
;
858 ND_TCHECK(ptr
->peer_call_id
);
859 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
860 ND_TCHECK(ptr
->reserved1
);
861 ND_TCHECK(ptr
->crc_err
);
862 ND_PRINT((ndo
, " CRC_ERR(%u)", EXTRACT_BE_U_4(&ptr
->crc_err
)));
863 ND_TCHECK(ptr
->framing_err
);
864 ND_PRINT((ndo
, " FRAMING_ERR(%u)", EXTRACT_BE_U_4(&ptr
->framing_err
)));
865 ND_TCHECK(ptr
->hardware_overrun
);
866 ND_PRINT((ndo
, " HARDWARE_OVERRUN(%u)", EXTRACT_BE_U_4(&ptr
->hardware_overrun
)));
867 ND_TCHECK(ptr
->buffer_overrun
);
868 ND_PRINT((ndo
, " BUFFER_OVERRUN(%u)", EXTRACT_BE_U_4(&ptr
->buffer_overrun
)));
869 ND_TCHECK(ptr
->timeout_err
);
870 ND_PRINT((ndo
, " TIMEOUT_ERR(%u)", EXTRACT_BE_U_4(&ptr
->timeout_err
)));
871 ND_TCHECK(ptr
->align_err
);
872 ND_PRINT((ndo
, " ALIGN_ERR(%u)", EXTRACT_BE_U_4(&ptr
->align_err
)));
877 ND_PRINT((ndo
, "%s", tstr
));
881 pptp_sli_print(netdissect_options
*ndo
,
884 const struct pptp_msg_sli
*ptr
= (const struct pptp_msg_sli
*)dat
;
886 ND_TCHECK(ptr
->peer_call_id
);
887 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
888 ND_TCHECK(ptr
->reserved1
);
889 ND_TCHECK(ptr
->send_accm
);
890 ND_PRINT((ndo
, " SEND_ACCM(0x%08x)", EXTRACT_BE_U_4(&ptr
->send_accm
)));
891 ND_TCHECK(ptr
->recv_accm
);
892 ND_PRINT((ndo
, " RECV_ACCM(0x%08x)", EXTRACT_BE_U_4(&ptr
->recv_accm
)));
897 ND_PRINT((ndo
, "%s", tstr
));
901 pptp_print(netdissect_options
*ndo
,
904 const struct pptp_hdr
*hdr
;
906 uint16_t ctrl_msg_type
;
908 ND_PRINT((ndo
, ": pptp"));
910 hdr
= (const struct pptp_hdr
*)dat
;
912 ND_TCHECK(hdr
->length
);
913 if (ndo
->ndo_vflag
) {
914 ND_PRINT((ndo
, " Length=%u", EXTRACT_BE_U_2(&hdr
->length
)));
916 ND_TCHECK(hdr
->msg_type
);
917 if (ndo
->ndo_vflag
) {
918 switch(EXTRACT_BE_U_2(&hdr
->msg_type
)) {
919 case PPTP_MSG_TYPE_CTRL
:
920 ND_PRINT((ndo
, " CTRL-MSG"));
922 case PPTP_MSG_TYPE_MGMT
:
923 ND_PRINT((ndo
, " MGMT-MSG"));
926 ND_PRINT((ndo
, " UNKNOWN-MSG-TYPE"));
931 ND_TCHECK(hdr
->magic_cookie
);
932 mc
= EXTRACT_BE_U_4(&hdr
->magic_cookie
);
933 if (mc
!= PPTP_MAGIC_COOKIE
) {
934 ND_PRINT((ndo
, " UNEXPECTED Magic-Cookie!!(%08x)", mc
));
936 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
937 ND_PRINT((ndo
, " Magic-Cookie=%08x", mc
));
939 ND_TCHECK(hdr
->ctrl_msg_type
);
940 ctrl_msg_type
= EXTRACT_BE_U_2(&hdr
->ctrl_msg_type
);
941 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
942 ND_PRINT((ndo
, " CTRL_MSGTYPE=%s",
943 pptp_message_type_string
[ctrl_msg_type
]));
945 ND_PRINT((ndo
, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
));
947 ND_TCHECK(hdr
->reserved0
);
951 switch(ctrl_msg_type
) {
952 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
953 pptp_sccrq_print(ndo
, dat
);
955 case PPTP_CTRL_MSG_TYPE_SCCRP
:
956 pptp_sccrp_print(ndo
, dat
);
958 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
959 pptp_stopccrq_print(ndo
, dat
);
961 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
962 pptp_stopccrp_print(ndo
, dat
);
964 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
965 pptp_echorq_print(ndo
, dat
);
967 case PPTP_CTRL_MSG_TYPE_ECHORP
:
968 pptp_echorp_print(ndo
, dat
);
970 case PPTP_CTRL_MSG_TYPE_OCRQ
:
971 pptp_ocrq_print(ndo
, dat
);
973 case PPTP_CTRL_MSG_TYPE_OCRP
:
974 pptp_ocrp_print(ndo
, dat
);
976 case PPTP_CTRL_MSG_TYPE_ICRQ
:
977 pptp_icrq_print(ndo
, dat
);
979 case PPTP_CTRL_MSG_TYPE_ICRP
:
980 pptp_icrp_print(ndo
, dat
);
982 case PPTP_CTRL_MSG_TYPE_ICCN
:
983 pptp_iccn_print(ndo
, dat
);
985 case PPTP_CTRL_MSG_TYPE_CCRQ
:
986 pptp_ccrq_print(ndo
, dat
);
988 case PPTP_CTRL_MSG_TYPE_CDN
:
989 pptp_cdn_print(ndo
, dat
);
991 case PPTP_CTRL_MSG_TYPE_WEN
:
992 pptp_wen_print(ndo
, dat
);
994 case PPTP_CTRL_MSG_TYPE_SLI
:
995 pptp_sli_print(ndo
, dat
);
1005 ND_PRINT((ndo
, "%s", tstr
));