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)
28 #include <netdissect-stdinc.h>
30 #include "netdissect.h"
33 static const char tstr
[] = " [|pptp]";
35 #define PPTP_MSG_TYPE_CTRL 1 /* Control Message */
36 #define PPTP_MSG_TYPE_MGMT 2 /* Management Message (currently not used */
37 #define PPTP_MAGIC_COOKIE 0x1a2b3c4d /* for sanity check */
39 #define PPTP_CTRL_MSG_TYPE_SCCRQ 1
40 #define PPTP_CTRL_MSG_TYPE_SCCRP 2
41 #define PPTP_CTRL_MSG_TYPE_StopCCRQ 3
42 #define PPTP_CTRL_MSG_TYPE_StopCCRP 4
43 #define PPTP_CTRL_MSG_TYPE_ECHORQ 5
44 #define PPTP_CTRL_MSG_TYPE_ECHORP 6
45 #define PPTP_CTRL_MSG_TYPE_OCRQ 7
46 #define PPTP_CTRL_MSG_TYPE_OCRP 8
47 #define PPTP_CTRL_MSG_TYPE_ICRQ 9
48 #define PPTP_CTRL_MSG_TYPE_ICRP 10
49 #define PPTP_CTRL_MSG_TYPE_ICCN 11
50 #define PPTP_CTRL_MSG_TYPE_CCRQ 12
51 #define PPTP_CTRL_MSG_TYPE_CDN 13
52 #define PPTP_CTRL_MSG_TYPE_WEN 14
53 #define PPTP_CTRL_MSG_TYPE_SLI 15
55 #define PPTP_FRAMING_CAP_ASYNC_MASK 0x00000001 /* Aynchronous */
56 #define PPTP_FRAMING_CAP_SYNC_MASK 0x00000002 /* Synchronous */
58 #define PPTP_BEARER_CAP_ANALOG_MASK 0x00000001 /* Analog */
59 #define PPTP_BEARER_CAP_DIGITAL_MASK 0x00000002 /* Digital */
61 static const char *pptp_message_type_string
[] = {
62 "NOT_DEFINED", /* 0 Not defined in the RFC2637 */
63 "SCCRQ", /* 1 Start-Control-Connection-Request */
64 "SCCRP", /* 2 Start-Control-Connection-Reply */
65 "StopCCRQ", /* 3 Stop-Control-Connection-Request */
66 "StopCCRP", /* 4 Stop-Control-Connection-Reply */
67 "ECHORQ", /* 5 Echo Request */
68 "ECHORP", /* 6 Echo Reply */
70 "OCRQ", /* 7 Outgoing-Call-Request */
71 "OCRP", /* 8 Outgoing-Call-Reply */
72 "ICRQ", /* 9 Incoming-Call-Request */
73 "ICRP", /* 10 Incoming-Call-Reply */
74 "ICCN", /* 11 Incoming-Call-Connected */
75 "CCRQ", /* 12 Call-Clear-Request */
76 "CDN", /* 13 Call-Disconnect-Notify */
78 "WEN", /* 14 WAN-Error-Notify */
80 "SLI" /* 15 Set-Link-Info */
81 #define PPTP_MAX_MSGTYPE_INDEX 16
84 /* common for all PPTP control messages */
88 uint32_t magic_cookie
;
89 uint16_t ctrl_msg_type
;
93 struct pptp_msg_sccrq
{
104 struct pptp_msg_sccrp
{
108 uint32_t framing_cap
;
110 uint16_t max_channel
;
116 struct pptp_msg_stopccrq
{
122 struct pptp_msg_stopccrp
{
128 struct pptp_msg_echorq
{
132 struct pptp_msg_echorp
{
139 struct pptp_msg_ocrq
{
144 uint32_t bearer_type
;
145 uint32_t framing_type
;
146 uint16_t recv_winsiz
;
147 uint16_t pkt_proc_delay
;
148 uint16_t phone_no_len
;
154 struct pptp_msg_ocrp
{
156 uint16_t peer_call_id
;
161 uint16_t recv_winsiz
;
162 uint16_t pkt_proc_delay
;
163 uint32_t phy_chan_id
;
166 struct pptp_msg_icrq
{
169 uint32_t bearer_type
;
170 uint32_t phy_chan_id
;
171 uint16_t dialed_no_len
;
172 uint16_t dialing_no_len
;
173 u_char dialed_no
[64]; /* DNIS */
174 u_char dialing_no
[64]; /* CLID */
178 struct pptp_msg_icrp
{
180 uint16_t peer_call_id
;
183 uint16_t recv_winsiz
;
184 uint16_t pkt_proc_delay
;
188 struct pptp_msg_iccn
{
189 uint16_t peer_call_id
;
192 uint16_t recv_winsiz
;
193 uint16_t pkt_proc_delay
;
194 uint32_t framing_type
;
197 struct pptp_msg_ccrq
{
202 struct pptp_msg_cdn
{
208 u_char call_stats
[128];
211 struct pptp_msg_wen
{
212 uint16_t peer_call_id
;
215 uint32_t framing_err
;
216 uint32_t hardware_overrun
;
217 uint32_t buffer_overrun
;
218 uint32_t timeout_err
;
222 struct pptp_msg_sli
{
223 uint16_t peer_call_id
;
229 /* attributes that appear more than once in above messages:
233 --------------------------------------
234 2 uint32_t bearer_cap;
235 2 uint32_t bearer_type;
238 2 uint16_t cause_code;
239 2 uint32_t conn_speed;
242 2 uint32_t framing_cap;
243 2 uint32_t framing_type;
244 2 u_char hostname[64];
246 2 uint16_t max_channel;
247 5 uint16_t peer_call_id;
248 2 uint32_t phy_chan_id;
249 4 uint16_t pkt_proc_delay;
250 2 uint16_t proto_ver;
251 4 uint16_t recv_winsiz;
253 9 uint16_t reserved1;
254 6 uint8_t result_code;
255 2 u_char subaddr[64];
258 so I will prepare print out functions for these attributes (except for
262 /******************************************/
263 /* Attribute-specific print out functions */
264 /******************************************/
266 /* In these attribute-specific print-out functions, it't not necessary
267 to do ND_TCHECK because they are already checked in the caller of
271 pptp_bearer_cap_print(netdissect_options
*ndo
,
272 const uint32_t *bearer_cap
)
274 ND_PRINT((ndo
, " BEARER_CAP(%s%s)",
275 EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_DIGITAL_MASK
? "D" : "",
276 EXTRACT_32BITS(bearer_cap
) & PPTP_BEARER_CAP_ANALOG_MASK
? "A" : ""));
279 static const struct tok pptp_btype_str
[] = {
280 { 1, "A" }, /* Analog */
281 { 2, "D" }, /* Digital */
287 pptp_bearer_type_print(netdissect_options
*ndo
,
288 const uint32_t *bearer_type
)
290 ND_PRINT((ndo
, " BEARER_TYPE(%s)",
291 tok2str(pptp_btype_str
, "?", EXTRACT_32BITS(bearer_type
))));
295 pptp_call_id_print(netdissect_options
*ndo
,
296 const uint16_t *call_id
)
298 ND_PRINT((ndo
, " CALL_ID(%u)", EXTRACT_16BITS(call_id
)));
302 pptp_call_ser_print(netdissect_options
*ndo
,
303 const uint16_t *call_ser
)
305 ND_PRINT((ndo
, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser
)));
309 pptp_cause_code_print(netdissect_options
*ndo
,
310 const uint16_t *cause_code
)
312 ND_PRINT((ndo
, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code
)));
316 pptp_conn_speed_print(netdissect_options
*ndo
,
317 const uint32_t *conn_speed
)
319 ND_PRINT((ndo
, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed
)));
322 static const struct tok pptp_errcode_str
[] = {
324 { 1, "Not-Connected" },
327 { 4, "No-Resource" },
328 { 5, "Bad-Call-ID" },
334 pptp_err_code_print(netdissect_options
*ndo
,
335 const uint8_t *err_code
)
337 ND_PRINT((ndo
, " ERR_CODE(%u", *err_code
));
338 if (ndo
->ndo_vflag
) {
339 ND_PRINT((ndo
, ":%s", tok2str(pptp_errcode_str
, "?", *err_code
)));
341 ND_PRINT((ndo
, ")"));
345 pptp_firm_rev_print(netdissect_options
*ndo
,
346 const uint16_t *firm_rev
)
348 ND_PRINT((ndo
, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev
)));
352 pptp_framing_cap_print(netdissect_options
*ndo
,
353 const uint32_t *framing_cap
)
355 ND_PRINT((ndo
, " FRAME_CAP("));
356 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_ASYNC_MASK
) {
357 ND_PRINT((ndo
, "A")); /* Async */
359 if (EXTRACT_32BITS(framing_cap
) & PPTP_FRAMING_CAP_SYNC_MASK
) {
360 ND_PRINT((ndo
, "S")); /* Sync */
362 ND_PRINT((ndo
, ")"));
365 static const struct tok pptp_ftype_str
[] = {
366 { 1, "A" }, /* Async */
367 { 2, "S" }, /* Sync */
368 { 3, "E" }, /* Either */
373 pptp_framing_type_print(netdissect_options
*ndo
,
374 const uint32_t *framing_type
)
376 ND_PRINT((ndo
, " FRAME_TYPE(%s)",
377 tok2str(pptp_ftype_str
, "?", EXTRACT_32BITS(framing_type
))));
381 pptp_hostname_print(netdissect_options
*ndo
,
382 const u_char
*hostname
)
384 ND_PRINT((ndo
, " HOSTNAME(%.64s)", hostname
));
388 pptp_id_print(netdissect_options
*ndo
,
391 ND_PRINT((ndo
, " ID(%u)", EXTRACT_32BITS(id
)));
395 pptp_max_channel_print(netdissect_options
*ndo
,
396 const uint16_t *max_channel
)
398 ND_PRINT((ndo
, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel
)));
402 pptp_peer_call_id_print(netdissect_options
*ndo
,
403 const uint16_t *peer_call_id
)
405 ND_PRINT((ndo
, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id
)));
409 pptp_phy_chan_id_print(netdissect_options
*ndo
,
410 const uint32_t *phy_chan_id
)
412 ND_PRINT((ndo
, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id
)));
416 pptp_pkt_proc_delay_print(netdissect_options
*ndo
,
417 const uint16_t *pkt_proc_delay
)
419 ND_PRINT((ndo
, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay
)));
423 pptp_proto_ver_print(netdissect_options
*ndo
,
424 const uint16_t *proto_ver
)
426 ND_PRINT((ndo
, " PROTO_VER(%u.%u)", /* Version.Revision */
427 EXTRACT_16BITS(proto_ver
) >> 8,
428 EXTRACT_16BITS(proto_ver
) & 0xff));
432 pptp_recv_winsiz_print(netdissect_options
*ndo
,
433 const uint16_t *recv_winsiz
)
435 ND_PRINT((ndo
, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz
)));
438 static const struct tok pptp_scrrp_str
[] = {
439 { 1, "Successful channel establishment" },
440 { 2, "General error" },
441 { 3, "Command channel already exists" },
442 { 4, "Requester is not authorized to establish a command channel" },
443 { 5, "The protocol version of the requester is not supported" },
447 static const struct tok pptp_echorp_str
[] = {
449 { 2, "General Error" },
453 static const struct tok pptp_ocrp_str
[] = {
455 { 2, "General Error" },
458 { 5, "No Dial Tone" },
460 { 7, "Do Not Accept" },
464 static const struct tok pptp_icrp_str
[] = {
466 { 2, "General Error" },
467 { 3, "Do Not Accept" },
471 static const struct tok pptp_cdn_str
[] = {
472 { 1, "Lost Carrier" },
473 { 2, "General Error" },
474 { 3, "Admin Shutdown" },
480 pptp_result_code_print(netdissect_options
*ndo
,
481 const uint8_t *result_code
, int ctrl_msg_type
)
483 ND_PRINT((ndo
, " RESULT_CODE(%u", *result_code
));
484 if (ndo
->ndo_vflag
) {
485 const struct tok
*dict
=
486 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_SCCRP
? pptp_scrrp_str
:
487 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_StopCCRP
? pptp_echorp_str
:
488 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ECHORP
? pptp_echorp_str
:
489 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_OCRP
? pptp_ocrp_str
:
490 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_ICRP
? pptp_icrp_str
:
491 ctrl_msg_type
== PPTP_CTRL_MSG_TYPE_CDN
? pptp_cdn_str
:
492 NULL
; /* assertion error */
494 ND_PRINT((ndo
, ":%s", tok2str(dict
, "?", *result_code
)));
496 ND_PRINT((ndo
, ")"));
500 pptp_subaddr_print(netdissect_options
*ndo
,
501 const u_char
*subaddr
)
503 ND_PRINT((ndo
, " SUB_ADDR(%.64s)", subaddr
));
507 pptp_vendor_print(netdissect_options
*ndo
,
508 const u_char
*vendor
)
510 ND_PRINT((ndo
, " VENDOR(%.64s)", vendor
));
513 /************************************/
514 /* PPTP message print out functions */
515 /************************************/
517 pptp_sccrq_print(netdissect_options
*ndo
,
520 const struct pptp_msg_sccrq
*ptr
= (const struct pptp_msg_sccrq
*)dat
;
522 ND_TCHECK(ptr
->proto_ver
);
523 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
524 ND_TCHECK(ptr
->reserved1
);
525 ND_TCHECK(ptr
->framing_cap
);
526 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
527 ND_TCHECK(ptr
->bearer_cap
);
528 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
529 ND_TCHECK(ptr
->max_channel
);
530 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
531 ND_TCHECK(ptr
->firm_rev
);
532 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
533 ND_TCHECK(ptr
->hostname
);
534 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
535 ND_TCHECK(ptr
->vendor
);
536 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
541 ND_PRINT((ndo
, "%s", tstr
));
545 pptp_sccrp_print(netdissect_options
*ndo
,
548 const struct pptp_msg_sccrp
*ptr
= (const struct pptp_msg_sccrp
*)dat
;
550 ND_TCHECK(ptr
->proto_ver
);
551 pptp_proto_ver_print(ndo
, &ptr
->proto_ver
);
552 ND_TCHECK(ptr
->result_code
);
553 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_SCCRP
);
554 ND_TCHECK(ptr
->err_code
);
555 pptp_err_code_print(ndo
, &ptr
->err_code
);
556 ND_TCHECK(ptr
->framing_cap
);
557 pptp_framing_cap_print(ndo
, &ptr
->framing_cap
);
558 ND_TCHECK(ptr
->bearer_cap
);
559 pptp_bearer_cap_print(ndo
, &ptr
->bearer_cap
);
560 ND_TCHECK(ptr
->max_channel
);
561 pptp_max_channel_print(ndo
, &ptr
->max_channel
);
562 ND_TCHECK(ptr
->firm_rev
);
563 pptp_firm_rev_print(ndo
, &ptr
->firm_rev
);
564 ND_TCHECK(ptr
->hostname
);
565 pptp_hostname_print(ndo
, &ptr
->hostname
[0]);
566 ND_TCHECK(ptr
->vendor
);
567 pptp_vendor_print(ndo
, &ptr
->vendor
[0]);
572 ND_PRINT((ndo
, "%s", tstr
));
576 pptp_stopccrq_print(netdissect_options
*ndo
,
579 const struct pptp_msg_stopccrq
*ptr
= (const struct pptp_msg_stopccrq
*)dat
;
581 ND_TCHECK(ptr
->reason
);
582 ND_PRINT((ndo
, " REASON(%u", ptr
->reason
));
583 if (ndo
->ndo_vflag
) {
584 switch (ptr
->reason
) {
586 ND_PRINT((ndo
, ":None"));
589 ND_PRINT((ndo
, ":Stop-Protocol"));
592 ND_PRINT((ndo
, ":Stop-Local-Shutdown"));
595 ND_PRINT((ndo
, ":?"));
599 ND_PRINT((ndo
, ")"));
600 ND_TCHECK(ptr
->reserved1
);
601 ND_TCHECK(ptr
->reserved2
);
606 ND_PRINT((ndo
, "%s", tstr
));
610 pptp_stopccrp_print(netdissect_options
*ndo
,
613 const struct pptp_msg_stopccrp
*ptr
= (const struct pptp_msg_stopccrp
*)dat
;
615 ND_TCHECK(ptr
->result_code
);
616 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_StopCCRP
);
617 ND_TCHECK(ptr
->err_code
);
618 pptp_err_code_print(ndo
, &ptr
->err_code
);
619 ND_TCHECK(ptr
->reserved1
);
624 ND_PRINT((ndo
, "%s", tstr
));
628 pptp_echorq_print(netdissect_options
*ndo
,
631 const struct pptp_msg_echorq
*ptr
= (const struct pptp_msg_echorq
*)dat
;
634 pptp_id_print(ndo
, &ptr
->id
);
639 ND_PRINT((ndo
, "%s", tstr
));
643 pptp_echorp_print(netdissect_options
*ndo
,
646 const struct pptp_msg_echorp
*ptr
= (const struct pptp_msg_echorp
*)dat
;
649 pptp_id_print(ndo
, &ptr
->id
);
650 ND_TCHECK(ptr
->result_code
);
651 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ECHORP
);
652 ND_TCHECK(ptr
->err_code
);
653 pptp_err_code_print(ndo
, &ptr
->err_code
);
654 ND_TCHECK(ptr
->reserved1
);
659 ND_PRINT((ndo
, "%s", tstr
));
663 pptp_ocrq_print(netdissect_options
*ndo
,
666 const struct pptp_msg_ocrq
*ptr
= (const struct pptp_msg_ocrq
*)dat
;
668 ND_TCHECK(ptr
->call_id
);
669 pptp_call_id_print(ndo
, &ptr
->call_id
);
670 ND_TCHECK(ptr
->call_ser
);
671 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
672 ND_TCHECK(ptr
->min_bps
);
673 ND_PRINT((ndo
, " MIN_BPS(%u)", EXTRACT_32BITS(&ptr
->min_bps
)));
674 ND_TCHECK(ptr
->max_bps
);
675 ND_PRINT((ndo
, " MAX_BPS(%u)", EXTRACT_32BITS(&ptr
->max_bps
)));
676 ND_TCHECK(ptr
->bearer_type
);
677 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
678 ND_TCHECK(ptr
->framing_type
);
679 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
680 ND_TCHECK(ptr
->recv_winsiz
);
681 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
682 ND_TCHECK(ptr
->pkt_proc_delay
);
683 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
684 ND_TCHECK(ptr
->phone_no_len
);
685 ND_PRINT((ndo
, " PHONE_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->phone_no_len
)));
686 ND_TCHECK(ptr
->reserved1
);
687 ND_TCHECK(ptr
->phone_no
);
688 ND_PRINT((ndo
, " PHONE_NO(%.64s)", ptr
->phone_no
));
689 ND_TCHECK(ptr
->subaddr
);
690 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
695 ND_PRINT((ndo
, "%s", tstr
));
699 pptp_ocrp_print(netdissect_options
*ndo
,
702 const struct pptp_msg_ocrp
*ptr
= (const struct pptp_msg_ocrp
*)dat
;
704 ND_TCHECK(ptr
->call_id
);
705 pptp_call_id_print(ndo
, &ptr
->call_id
);
706 ND_TCHECK(ptr
->peer_call_id
);
707 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
708 ND_TCHECK(ptr
->result_code
);
709 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_OCRP
);
710 ND_TCHECK(ptr
->err_code
);
711 pptp_err_code_print(ndo
, &ptr
->err_code
);
712 ND_TCHECK(ptr
->cause_code
);
713 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
714 ND_TCHECK(ptr
->conn_speed
);
715 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
716 ND_TCHECK(ptr
->recv_winsiz
);
717 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
718 ND_TCHECK(ptr
->pkt_proc_delay
);
719 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
720 ND_TCHECK(ptr
->phy_chan_id
);
721 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
726 ND_PRINT((ndo
, "%s", tstr
));
730 pptp_icrq_print(netdissect_options
*ndo
,
733 const struct pptp_msg_icrq
*ptr
= (const struct pptp_msg_icrq
*)dat
;
735 ND_TCHECK(ptr
->call_id
);
736 pptp_call_id_print(ndo
, &ptr
->call_id
);
737 ND_TCHECK(ptr
->call_ser
);
738 pptp_call_ser_print(ndo
, &ptr
->call_ser
);
739 ND_TCHECK(ptr
->bearer_type
);
740 pptp_bearer_type_print(ndo
, &ptr
->bearer_type
);
741 ND_TCHECK(ptr
->phy_chan_id
);
742 pptp_phy_chan_id_print(ndo
, &ptr
->phy_chan_id
);
743 ND_TCHECK(ptr
->dialed_no_len
);
744 ND_PRINT((ndo
, " DIALED_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialed_no_len
)));
745 ND_TCHECK(ptr
->dialing_no_len
);
746 ND_PRINT((ndo
, " DIALING_NO_LEN(%u)", EXTRACT_16BITS(&ptr
->dialing_no_len
)));
747 ND_TCHECK(ptr
->dialed_no
);
748 ND_PRINT((ndo
, " DIALED_NO(%.64s)", ptr
->dialed_no
));
749 ND_TCHECK(ptr
->dialing_no
);
750 ND_PRINT((ndo
, " DIALING_NO(%.64s)", ptr
->dialing_no
));
751 ND_TCHECK(ptr
->subaddr
);
752 pptp_subaddr_print(ndo
, &ptr
->subaddr
[0]);
757 ND_PRINT((ndo
, "%s", tstr
));
761 pptp_icrp_print(netdissect_options
*ndo
,
764 const struct pptp_msg_icrp
*ptr
= (const struct pptp_msg_icrp
*)dat
;
766 ND_TCHECK(ptr
->call_id
);
767 pptp_call_id_print(ndo
, &ptr
->call_id
);
768 ND_TCHECK(ptr
->peer_call_id
);
769 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
770 ND_TCHECK(ptr
->result_code
);
771 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_ICRP
);
772 ND_TCHECK(ptr
->err_code
);
773 pptp_err_code_print(ndo
, &ptr
->err_code
);
774 ND_TCHECK(ptr
->recv_winsiz
);
775 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
776 ND_TCHECK(ptr
->pkt_proc_delay
);
777 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
778 ND_TCHECK(ptr
->reserved1
);
783 ND_PRINT((ndo
, "%s", tstr
));
787 pptp_iccn_print(netdissect_options
*ndo
,
790 const struct pptp_msg_iccn
*ptr
= (const struct pptp_msg_iccn
*)dat
;
792 ND_TCHECK(ptr
->peer_call_id
);
793 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
794 ND_TCHECK(ptr
->reserved1
);
795 ND_TCHECK(ptr
->conn_speed
);
796 pptp_conn_speed_print(ndo
, &ptr
->conn_speed
);
797 ND_TCHECK(ptr
->recv_winsiz
);
798 pptp_recv_winsiz_print(ndo
, &ptr
->recv_winsiz
);
799 ND_TCHECK(ptr
->pkt_proc_delay
);
800 pptp_pkt_proc_delay_print(ndo
, &ptr
->pkt_proc_delay
);
801 ND_TCHECK(ptr
->framing_type
);
802 pptp_framing_type_print(ndo
, &ptr
->framing_type
);
807 ND_PRINT((ndo
, "%s", tstr
));
811 pptp_ccrq_print(netdissect_options
*ndo
,
814 const struct pptp_msg_ccrq
*ptr
= (const struct pptp_msg_ccrq
*)dat
;
816 ND_TCHECK(ptr
->call_id
);
817 pptp_call_id_print(ndo
, &ptr
->call_id
);
818 ND_TCHECK(ptr
->reserved1
);
823 ND_PRINT((ndo
, "%s", tstr
));
827 pptp_cdn_print(netdissect_options
*ndo
,
830 const struct pptp_msg_cdn
*ptr
= (const struct pptp_msg_cdn
*)dat
;
832 ND_TCHECK(ptr
->call_id
);
833 pptp_call_id_print(ndo
, &ptr
->call_id
);
834 ND_TCHECK(ptr
->result_code
);
835 pptp_result_code_print(ndo
, &ptr
->result_code
, PPTP_CTRL_MSG_TYPE_CDN
);
836 ND_TCHECK(ptr
->err_code
);
837 pptp_err_code_print(ndo
, &ptr
->err_code
);
838 ND_TCHECK(ptr
->cause_code
);
839 pptp_cause_code_print(ndo
, &ptr
->cause_code
);
840 ND_TCHECK(ptr
->reserved1
);
841 ND_TCHECK(ptr
->call_stats
);
842 ND_PRINT((ndo
, " CALL_STATS(%.128s)", ptr
->call_stats
));
847 ND_PRINT((ndo
, "%s", tstr
));
851 pptp_wen_print(netdissect_options
*ndo
,
854 const struct pptp_msg_wen
*ptr
= (const struct pptp_msg_wen
*)dat
;
856 ND_TCHECK(ptr
->peer_call_id
);
857 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
858 ND_TCHECK(ptr
->reserved1
);
859 ND_TCHECK(ptr
->crc_err
);
860 ND_PRINT((ndo
, " CRC_ERR(%u)", EXTRACT_32BITS(&ptr
->crc_err
)));
861 ND_TCHECK(ptr
->framing_err
);
862 ND_PRINT((ndo
, " FRAMING_ERR(%u)", EXTRACT_32BITS(&ptr
->framing_err
)));
863 ND_TCHECK(ptr
->hardware_overrun
);
864 ND_PRINT((ndo
, " HARDWARE_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->hardware_overrun
)));
865 ND_TCHECK(ptr
->buffer_overrun
);
866 ND_PRINT((ndo
, " BUFFER_OVERRUN(%u)", EXTRACT_32BITS(&ptr
->buffer_overrun
)));
867 ND_TCHECK(ptr
->timeout_err
);
868 ND_PRINT((ndo
, " TIMEOUT_ERR(%u)", EXTRACT_32BITS(&ptr
->timeout_err
)));
869 ND_TCHECK(ptr
->align_err
);
870 ND_PRINT((ndo
, " ALIGN_ERR(%u)", EXTRACT_32BITS(&ptr
->align_err
)));
875 ND_PRINT((ndo
, "%s", tstr
));
879 pptp_sli_print(netdissect_options
*ndo
,
882 const struct pptp_msg_sli
*ptr
= (const struct pptp_msg_sli
*)dat
;
884 ND_TCHECK(ptr
->peer_call_id
);
885 pptp_peer_call_id_print(ndo
, &ptr
->peer_call_id
);
886 ND_TCHECK(ptr
->reserved1
);
887 ND_TCHECK(ptr
->send_accm
);
888 ND_PRINT((ndo
, " SEND_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->send_accm
)));
889 ND_TCHECK(ptr
->recv_accm
);
890 ND_PRINT((ndo
, " RECV_ACCM(0x%08x)", EXTRACT_32BITS(&ptr
->recv_accm
)));
895 ND_PRINT((ndo
, "%s", tstr
));
899 pptp_print(netdissect_options
*ndo
,
902 const struct pptp_hdr
*hdr
;
904 uint16_t ctrl_msg_type
;
906 ND_PRINT((ndo
, ": pptp"));
908 hdr
= (const struct pptp_hdr
*)dat
;
910 ND_TCHECK(hdr
->length
);
911 if (ndo
->ndo_vflag
) {
912 ND_PRINT((ndo
, " Length=%u", EXTRACT_16BITS(&hdr
->length
)));
914 ND_TCHECK(hdr
->msg_type
);
915 if (ndo
->ndo_vflag
) {
916 switch(EXTRACT_16BITS(&hdr
->msg_type
)) {
917 case PPTP_MSG_TYPE_CTRL
:
918 ND_PRINT((ndo
, " CTRL-MSG"));
920 case PPTP_MSG_TYPE_MGMT
:
921 ND_PRINT((ndo
, " MGMT-MSG"));
924 ND_PRINT((ndo
, " UNKNOWN-MSG-TYPE"));
929 ND_TCHECK(hdr
->magic_cookie
);
930 mc
= EXTRACT_32BITS(&hdr
->magic_cookie
);
931 if (mc
!= PPTP_MAGIC_COOKIE
) {
932 ND_PRINT((ndo
, " UNEXPECTED Magic-Cookie!!(%08x)", mc
));
934 if (ndo
->ndo_vflag
|| mc
!= PPTP_MAGIC_COOKIE
) {
935 ND_PRINT((ndo
, " Magic-Cookie=%08x", mc
));
937 ND_TCHECK(hdr
->ctrl_msg_type
);
938 ctrl_msg_type
= EXTRACT_16BITS(&hdr
->ctrl_msg_type
);
939 if (ctrl_msg_type
< PPTP_MAX_MSGTYPE_INDEX
) {
940 ND_PRINT((ndo
, " CTRL_MSGTYPE=%s",
941 pptp_message_type_string
[ctrl_msg_type
]));
943 ND_PRINT((ndo
, " UNKNOWN_CTRL_MSGTYPE(%u)", ctrl_msg_type
));
945 ND_TCHECK(hdr
->reserved0
);
949 switch(ctrl_msg_type
) {
950 case PPTP_CTRL_MSG_TYPE_SCCRQ
:
951 pptp_sccrq_print(ndo
, dat
);
953 case PPTP_CTRL_MSG_TYPE_SCCRP
:
954 pptp_sccrp_print(ndo
, dat
);
956 case PPTP_CTRL_MSG_TYPE_StopCCRQ
:
957 pptp_stopccrq_print(ndo
, dat
);
959 case PPTP_CTRL_MSG_TYPE_StopCCRP
:
960 pptp_stopccrp_print(ndo
, dat
);
962 case PPTP_CTRL_MSG_TYPE_ECHORQ
:
963 pptp_echorq_print(ndo
, dat
);
965 case PPTP_CTRL_MSG_TYPE_ECHORP
:
966 pptp_echorp_print(ndo
, dat
);
968 case PPTP_CTRL_MSG_TYPE_OCRQ
:
969 pptp_ocrq_print(ndo
, dat
);
971 case PPTP_CTRL_MSG_TYPE_OCRP
:
972 pptp_ocrp_print(ndo
, dat
);
974 case PPTP_CTRL_MSG_TYPE_ICRQ
:
975 pptp_icrq_print(ndo
, dat
);
977 case PPTP_CTRL_MSG_TYPE_ICRP
:
978 pptp_icrp_print(ndo
, dat
);
980 case PPTP_CTRL_MSG_TYPE_ICCN
:
981 pptp_iccn_print(ndo
, dat
);
983 case PPTP_CTRL_MSG_TYPE_CCRQ
:
984 pptp_ccrq_print(ndo
, dat
);
986 case PPTP_CTRL_MSG_TYPE_CDN
:
987 pptp_cdn_print(ndo
, dat
);
989 case PPTP_CTRL_MSG_TYPE_WEN
:
990 pptp_wen_print(ndo
, dat
);
992 case PPTP_CTRL_MSG_TYPE_SLI
:
993 pptp_sli_print(ndo
, dat
);
1003 ND_PRINT((ndo
, "%s", tstr
));