]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pptp.c
Add program_name field in the netdissect_options structure
[tcpdump] / print-pptp.c
index eae6bde3487f8e178c487a60d82f6392272d8d11..58b1c56cf533f28e69aa7cbe828dfde22f163ca5 100644 (file)
  * PPTP support contributed by Motonori Shindo ([email protected])
  */
 
-#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <tcpdump-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "extract.h"
 
 static const char tstr[] = " [|pptp]";
@@ -84,147 +83,147 @@ static const char *pptp_message_type_string[] = {
 
 /* common for all PPTP control messages */
 struct pptp_hdr {
-       u_int16_t length;
-       u_int16_t msg_type;
-       u_int32_t magic_cookie;
-       u_int16_t ctrl_msg_type;
-       u_int16_t reserved0;
+       uint16_t length;
+       uint16_t msg_type;
+       uint32_t magic_cookie;
+       uint16_t ctrl_msg_type;
+       uint16_t reserved0;
 };
 
 struct pptp_msg_sccrq {
-       u_int16_t proto_ver;
-       u_int16_t reserved1;
-       u_int32_t framing_cap;
-       u_int32_t bearer_cap;
-       u_int16_t max_channel;
-       u_int16_t firm_rev;
+       uint16_t proto_ver;
+       uint16_t reserved1;
+       uint32_t framing_cap;
+       uint32_t bearer_cap;
+       uint16_t max_channel;
+       uint16_t firm_rev;
        u_char hostname[64];
        u_char vendor[64];
 };
 
 struct pptp_msg_sccrp {
-       u_int16_t proto_ver;
-       u_int8_t result_code;
-       u_int8_t err_code;
-       u_int32_t framing_cap;
-       u_int32_t bearer_cap;
-       u_int16_t max_channel;
-       u_int16_t firm_rev;
+       uint16_t proto_ver;
+       uint8_t result_code;
+       uint8_t err_code;
+       uint32_t framing_cap;
+       uint32_t bearer_cap;
+       uint16_t max_channel;
+       uint16_t firm_rev;
        u_char hostname[64];
        u_char vendor[64];
 };
 
 struct pptp_msg_stopccrq {
-       u_int8_t reason;
-       u_int8_t reserved1;
-       u_int16_t reserved2;
+       uint8_t reason;
+       uint8_t reserved1;
+       uint16_t reserved2;
 };
 
 struct pptp_msg_stopccrp {
-       u_int8_t result_code;
-       u_int8_t err_code;
-       u_int16_t reserved1;
+       uint8_t result_code;
+       uint8_t err_code;
+       uint16_t reserved1;
 };
 
 struct pptp_msg_echorq {
-       u_int32_t id;
+       uint32_t id;
 };
 
 struct pptp_msg_echorp {
-       u_int32_t id;
-       u_int8_t result_code;
-       u_int8_t err_code;
-       u_int16_t reserved1;
+       uint32_t id;
+       uint8_t result_code;
+       uint8_t err_code;
+       uint16_t reserved1;
 };
 
 struct pptp_msg_ocrq {
-       u_int16_t call_id;
-       u_int16_t call_ser;
-       u_int32_t min_bps;
-       u_int32_t max_bps;
-       u_int32_t bearer_type;
-       u_int32_t framing_type;
-       u_int16_t recv_winsiz;
-       u_int16_t pkt_proc_delay;
-       u_int16_t phone_no_len;
-       u_int16_t reserved1;
+       uint16_t call_id;
+       uint16_t call_ser;
+       uint32_t min_bps;
+       uint32_t max_bps;
+       uint32_t bearer_type;
+       uint32_t framing_type;
+       uint16_t recv_winsiz;
+       uint16_t pkt_proc_delay;
+       uint16_t phone_no_len;
+       uint16_t reserved1;
        u_char phone_no[64];
        u_char subaddr[64];
 };
 
 struct pptp_msg_ocrp {
-       u_int16_t call_id;
-       u_int16_t peer_call_id;
-       u_int8_t result_code;
-       u_int8_t err_code;
-       u_int16_t cause_code;
-       u_int32_t conn_speed;
-       u_int16_t recv_winsiz;
-       u_int16_t pkt_proc_delay;
-       u_int32_t phy_chan_id;
+       uint16_t call_id;
+       uint16_t peer_call_id;
+       uint8_t result_code;
+       uint8_t err_code;
+       uint16_t cause_code;
+       uint32_t conn_speed;
+       uint16_t recv_winsiz;
+       uint16_t pkt_proc_delay;
+       uint32_t phy_chan_id;
 };
 
 struct pptp_msg_icrq {
-       u_int16_t call_id;
-       u_int16_t call_ser;
-       u_int32_t bearer_type;
-       u_int32_t phy_chan_id;
-       u_int16_t dialed_no_len;
-       u_int16_t dialing_no_len;
+       uint16_t call_id;
+       uint16_t call_ser;
+       uint32_t bearer_type;
+       uint32_t phy_chan_id;
+       uint16_t dialed_no_len;
+       uint16_t dialing_no_len;
        u_char dialed_no[64];           /* DNIS */
        u_char dialing_no[64];          /* CLID */
        u_char subaddr[64];
 };
 
 struct pptp_msg_icrp {
-       u_int16_t call_id;
-       u_int16_t peer_call_id;
-       u_int8_t result_code;
-       u_int8_t err_code;
-       u_int16_t recv_winsiz;
-       u_int16_t pkt_proc_delay;
-       u_int16_t reserved1;
+       uint16_t call_id;
+       uint16_t peer_call_id;
+       uint8_t result_code;
+       uint8_t err_code;
+       uint16_t recv_winsiz;
+       uint16_t pkt_proc_delay;
+       uint16_t reserved1;
 };
 
 struct pptp_msg_iccn {
-       u_int16_t peer_call_id;
-       u_int16_t reserved1;
-       u_int32_t conn_speed;
-       u_int16_t recv_winsiz;
-       u_int16_t pkt_proc_delay;
-       u_int32_t framing_type;
+       uint16_t peer_call_id;
+       uint16_t reserved1;
+       uint32_t conn_speed;
+       uint16_t recv_winsiz;
+       uint16_t pkt_proc_delay;
+       uint32_t framing_type;
 };
 
 struct pptp_msg_ccrq {
-       u_int16_t call_id;
-       u_int16_t reserved1;
+       uint16_t call_id;
+       uint16_t reserved1;
 };
 
 struct pptp_msg_cdn {
-       u_int16_t call_id;
-       u_int8_t result_code;
-       u_int8_t err_code;
-       u_int16_t cause_code;
-       u_int16_t reserved1;
+       uint16_t call_id;
+       uint8_t result_code;
+       uint8_t err_code;
+       uint16_t cause_code;
+       uint16_t reserved1;
        u_char call_stats[128];
 };
 
 struct pptp_msg_wen {
-       u_int16_t peer_call_id;
-       u_int16_t reserved1;
-       u_int32_t crc_err;
-       u_int32_t framing_err;
-       u_int32_t hardware_overrun;
-       u_int32_t buffer_overrun;
-       u_int32_t timeout_err;
-       u_int32_t align_err;
+       uint16_t peer_call_id;
+       uint16_t reserved1;
+       uint32_t crc_err;
+       uint32_t framing_err;
+       uint32_t hardware_overrun;
+       uint32_t buffer_overrun;
+       uint32_t timeout_err;
+       uint32_t align_err;
 };
 
 struct pptp_msg_sli {
-       u_int16_t peer_call_id;
-       u_int16_t reserved1;
-       u_int32_t send_accm;
-       u_int32_t recv_accm;
+       uint16_t peer_call_id;
+       uint16_t reserved1;
+       uint32_t send_accm;
+       uint32_t recv_accm;
 };
 
 /* attributes that appear more than once in above messages:
@@ -232,27 +231,27 @@ struct pptp_msg_sli {
    Number of
    occurence    attributes
   --------------------------------------
-      2         u_int32_t bearer_cap;
-      2         u_int32_t bearer_type;
-      6         u_int16_t call_id;
-      2         u_int16_t call_ser;
-      2         u_int16_t cause_code;
-      2         u_int32_t conn_speed;
-      6         u_int8_t err_code;
-      2         u_int16_t firm_rev;
-      2         u_int32_t framing_cap;
-      2         u_int32_t framing_type;
+      2         uint32_t bearer_cap;
+      2         uint32_t bearer_type;
+      6         uint16_t call_id;
+      2         uint16_t call_ser;
+      2         uint16_t cause_code;
+      2         uint32_t conn_speed;
+      6         uint8_t err_code;
+      2         uint16_t firm_rev;
+      2         uint32_t framing_cap;
+      2         uint32_t framing_type;
       2         u_char hostname[64];
-      2         u_int32_t id;
-      2         u_int16_t max_channel;
-      5         u_int16_t peer_call_id;
-      2         u_int32_t phy_chan_id;
-      4         u_int16_t pkt_proc_delay;
-      2         u_int16_t proto_ver;
-      4         u_int16_t recv_winsiz;
-      2         u_int8_t reserved1;
-      9         u_int16_t reserved1;
-      6         u_int8_t result_code;
+      2         uint32_t id;
+      2         uint16_t max_channel;
+      5         uint16_t peer_call_id;
+      2         uint32_t phy_chan_id;
+      4         uint16_t pkt_proc_delay;
+      2         uint16_t proto_ver;
+      4         uint16_t recv_winsiz;
+      2         uint8_t reserved1;
+      9         uint16_t reserved1;
+      6         uint8_t result_code;
       2         u_char subaddr[64];
       2         u_char vendor[64];
 
@@ -270,114 +269,88 @@ struct pptp_msg_sli {
 
 static void
 pptp_bearer_cap_print(netdissect_options *ndo,
-                      const u_int32_t *bearer_cap)
+                      const uint32_t *bearer_cap)
 {
-       ND_PRINT((ndo, " BEARER_CAP("));
-       if (EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK) {
-                ND_PRINT((ndo, "D"));
-        }
-        if (EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK) {
-                ND_PRINT((ndo, "A"));
-        }
-       ND_PRINT((ndo, ")"));
+       ND_PRINT((ndo, " BEARER_CAP(%s%s)",
+                 EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "",
+                 EXTRACT_32BITS(bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""));
 }
 
+static const struct tok pptp_btype_str[] = {
+       { 1, "A"   }, /* Analog */
+       { 2, "D"   }, /* Digital */
+       { 3, "Any" },
+       { 0, NULL }
+};
+
 static void
 pptp_bearer_type_print(netdissect_options *ndo,
-                       const u_int32_t *bearer_type)
+                       const uint32_t *bearer_type)
 {
-       ND_PRINT((ndo, " BEARER_TYPE("));
-       switch (EXTRACT_32BITS(bearer_type)) {
-       case 1:
-               ND_PRINT((ndo, "A"));   /* Analog */
-               break;
-       case 2:
-               ND_PRINT((ndo, "D"));   /* Digital */
-               break;
-       case 3:
-               ND_PRINT((ndo, "Any"));
-               break;
-       default:
-               ND_PRINT((ndo, "?"));
-               break;
-        }
-       ND_PRINT((ndo, ")"));
+       ND_PRINT((ndo, " BEARER_TYPE(%s)",
+                 tok2str(pptp_btype_str, "?", EXTRACT_32BITS(bearer_type))));
 }
 
 static void
 pptp_call_id_print(netdissect_options *ndo,
-                   const u_int16_t *call_id)
+                   const uint16_t *call_id)
 {
        ND_PRINT((ndo, " CALL_ID(%u)", EXTRACT_16BITS(call_id)));
 }
 
 static void
 pptp_call_ser_print(netdissect_options *ndo,
-                    const u_int16_t *call_ser)
+                    const uint16_t *call_ser)
 {
        ND_PRINT((ndo, " CALL_SER_NUM(%u)", EXTRACT_16BITS(call_ser)));
 }
 
 static void
 pptp_cause_code_print(netdissect_options *ndo,
-                      const u_int16_t *cause_code)
+                      const uint16_t *cause_code)
 {
        ND_PRINT((ndo, " CAUSE_CODE(%u)", EXTRACT_16BITS(cause_code)));
 }
 
 static void
 pptp_conn_speed_print(netdissect_options *ndo,
-                      const u_int32_t *conn_speed)
+                      const uint32_t *conn_speed)
 {
        ND_PRINT((ndo, " CONN_SPEED(%u)", EXTRACT_32BITS(conn_speed)));
 }
 
+static const struct tok pptp_errcode_str[] = {
+       { 0, "None"          },
+       { 1, "Not-Connected" },
+       { 2, "Bad-Format"    },
+       { 3, "Bad-Value"     },
+       { 4, "No-Resource"   },
+       { 5, "Bad-Call-ID"   },
+       { 6, "PAC-Error"     },
+       { 0, NULL }
+};
+
 static void
 pptp_err_code_print(netdissect_options *ndo,
-                    const u_int8_t *err_code)
+                    const uint8_t *err_code)
 {
        ND_PRINT((ndo, " ERR_CODE(%u", *err_code));
        if (ndo->ndo_vflag) {
-               switch (*err_code) {
-               case 0:
-                       ND_PRINT((ndo, ":None"));
-                       break;
-               case 1:
-                       ND_PRINT((ndo, ":Not-Connected"));
-                       break;
-               case 2:
-                       ND_PRINT((ndo, ":Bad-Format"));
-                       break;
-               case 3:
-                       ND_PRINT((ndo, ":Bad-Valude"));
-                       break;
-               case 4:
-                       ND_PRINT((ndo, ":No-Resource"));
-                       break;
-               case 5:
-                       ND_PRINT((ndo, ":Bad-Call-ID"));
-                       break;
-               case 6:
-                       ND_PRINT((ndo, ":PAC-Error"));
-                       break;
-               default:
-                       ND_PRINT((ndo, ":?"));
-                       break;
-               }
+               ND_PRINT((ndo, ":%s", tok2str(pptp_errcode_str, "?", *err_code)));
        }
        ND_PRINT((ndo, ")"));
 }
 
 static void
 pptp_firm_rev_print(netdissect_options *ndo,
-                    const u_int16_t *firm_rev)
+                    const uint16_t *firm_rev)
 {
        ND_PRINT((ndo, " FIRM_REV(%u)", EXTRACT_16BITS(firm_rev)));
 }
 
 static void
 pptp_framing_cap_print(netdissect_options *ndo,
-                       const u_int32_t *framing_cap)
+                       const uint32_t *framing_cap)
 {
        ND_PRINT((ndo, " FRAME_CAP("));
        if (EXTRACT_32BITS(framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) {
@@ -389,26 +362,19 @@ pptp_framing_cap_print(netdissect_options *ndo,
        ND_PRINT((ndo, ")"));
 }
 
+static const struct tok pptp_ftype_str[] = {
+       { 1, "A" }, /* Async */
+       { 2, "S" }, /* Sync */
+       { 3, "E" }, /* Either */
+       { 0, NULL }
+};
+
 static void
 pptp_framing_type_print(netdissect_options *ndo,
-                        const u_int32_t *framing_type)
+                        const uint32_t *framing_type)
 {
-       ND_PRINT((ndo, " FRAME_TYPE("));
-       switch (EXTRACT_32BITS(framing_type)) {
-       case 1:
-               ND_PRINT((ndo, "A"));           /* Async */
-               break;
-       case 2:
-               ND_PRINT((ndo, "S"));           /* Sync */
-               break;
-       case 3:
-               ND_PRINT((ndo, "E"));           /* Either */
-               break;
-       default:
-               ND_PRINT((ndo, "?"));
-               break;
-       }
-       ND_PRINT((ndo, ")"));
+       ND_PRINT((ndo, " FRAME_TYPE(%s)",
+                 tok2str(pptp_ftype_str, "?", EXTRACT_32BITS(framing_type))));
 }
 
 static void
@@ -420,42 +386,42 @@ pptp_hostname_print(netdissect_options *ndo,
 
 static void
 pptp_id_print(netdissect_options *ndo,
-              const u_int32_t *id)
+              const uint32_t *id)
 {
        ND_PRINT((ndo, " ID(%u)", EXTRACT_32BITS(id)));
 }
 
 static void
 pptp_max_channel_print(netdissect_options *ndo,
-                       const u_int16_t *max_channel)
+                       const uint16_t *max_channel)
 {
        ND_PRINT((ndo, " MAX_CHAN(%u)", EXTRACT_16BITS(max_channel)));
 }
 
 static void
 pptp_peer_call_id_print(netdissect_options *ndo,
-                        const u_int16_t *peer_call_id)
+                        const uint16_t *peer_call_id)
 {
        ND_PRINT((ndo, " PEER_CALL_ID(%u)", EXTRACT_16BITS(peer_call_id)));
 }
 
 static void
 pptp_phy_chan_id_print(netdissect_options *ndo,
-                       const u_int32_t *phy_chan_id)
+                       const uint32_t *phy_chan_id)
 {
        ND_PRINT((ndo, " PHY_CHAN_ID(%u)", EXTRACT_32BITS(phy_chan_id)));
 }
 
 static void
 pptp_pkt_proc_delay_print(netdissect_options *ndo,
-                          const u_int16_t *pkt_proc_delay)
+                          const uint16_t *pkt_proc_delay)
 {
        ND_PRINT((ndo, " PROC_DELAY(%u)", EXTRACT_16BITS(pkt_proc_delay)));
 }
 
 static void
 pptp_proto_ver_print(netdissect_options *ndo,
-                     const u_int16_t *proto_ver)
+                     const uint16_t *proto_ver)
 {
        ND_PRINT((ndo, " PROTO_VER(%u.%u)",     /* Version.Revision */
               EXTRACT_16BITS(proto_ver) >> 8,
@@ -464,121 +430,68 @@ pptp_proto_ver_print(netdissect_options *ndo,
 
 static void
 pptp_recv_winsiz_print(netdissect_options *ndo,
-                       const u_int16_t *recv_winsiz)
+                       const uint16_t *recv_winsiz)
 {
        ND_PRINT((ndo, " RECV_WIN(%u)", EXTRACT_16BITS(recv_winsiz)));
 }
 
+static const struct tok pptp_scrrp_str[] = {
+       { 1, "Successful channel establishment"                           },
+       { 2, "General error"                                              },
+       { 3, "Command channel already exists"                             },
+       { 4, "Requester is not authorized to establish a command channel" },
+       { 5, "The protocol version of the requester is not supported"     },
+       { 0, NULL }
+};
+
+static const struct tok pptp_echorp_str[] = {
+       { 1, "OK" },
+       { 2, "General Error" },
+       { 0, NULL }
+};
+
+static const struct tok pptp_ocrp_str[] = {
+       { 1, "Connected"     },
+       { 2, "General Error" },
+       { 3, "No Carrier"    },
+       { 4, "Busy"          },
+       { 5, "No Dial Tone"  },
+       { 6, "Time-out"      },
+       { 7, "Do Not Accept" },
+       { 0, NULL }
+};
+
+static const struct tok pptp_icrp_str[] = {
+       { 1, "Connect"       },
+       { 2, "General Error" },
+       { 3, "Do Not Accept" },
+       { 0, NULL }
+};
+
+static const struct tok pptp_cdn_str[] = {
+       { 1, "Lost Carrier"   },
+       { 2, "General Error"  },
+       { 3, "Admin Shutdown" },
+       { 4, "Request"        },
+       { 0, NULL }
+};
+
 static void
 pptp_result_code_print(netdissect_options *ndo,
-                       const u_int8_t *result_code, int ctrl_msg_type)
+                       const uint8_t *result_code, int ctrl_msg_type)
 {
        ND_PRINT((ndo, " RESULT_CODE(%u", *result_code));
        if (ndo->ndo_vflag) {
-               switch (ctrl_msg_type) {
-               case PPTP_CTRL_MSG_TYPE_SCCRP:
-                       switch (*result_code) {
-                       case 1:
-                               ND_PRINT((ndo, ":Successful channel establishment"));
-                               break;
-                       case 2:
-                               ND_PRINT((ndo, ":General error"));
-                               break;
-                       case 3:
-                               ND_PRINT((ndo, ":Command channel already exists"));
-                               break;
-                       case 4:
-                               ND_PRINT((ndo, ":Requester is not authorized to establish a command channel"));
-                               break;
-                       case 5:
-                               ND_PRINT((ndo, ":The protocol version of the requester is not supported"));
-                               break;
-                       default:
-                               ND_PRINT((ndo, ":?"));
-                               break;
-                       }
-                       break;
-               case PPTP_CTRL_MSG_TYPE_StopCCRP:
-               case PPTP_CTRL_MSG_TYPE_ECHORP:
-                       switch (*result_code) {
-                       case 1:
-                               ND_PRINT((ndo, ":OK"));
-                               break;
-                       case 2:
-                               ND_PRINT((ndo, ":General Error"));
-                               break;
-                       default:
-                               ND_PRINT((ndo, ":?"));
-                               break;
-                       }
-                       break;
-               case PPTP_CTRL_MSG_TYPE_OCRP:
-                       switch (*result_code) {
-                       case 1:
-                               ND_PRINT((ndo, ":Connected"));
-                               break;
-                       case 2:
-                               ND_PRINT((ndo, ":General Error"));
-                               break;
-                       case 3:
-                               ND_PRINT((ndo, ":No Carrier"));
-                               break;
-                       case 4:
-                               ND_PRINT((ndo, ":Busy"));
-                               break;
-                       case 5:
-                               ND_PRINT((ndo, ":No Dial Tone"));
-                               break;
-                       case 6:
-                               ND_PRINT((ndo, ":Time-out"));
-                               break;
-                       case 7:
-                               ND_PRINT((ndo, ":Do Not Accept"));
-                               break;
-                       default:
-                               ND_PRINT((ndo, ":?"));
-                               break;
-                       }
-                       break;
-               case PPTP_CTRL_MSG_TYPE_ICRP:
-                       switch (*result_code) {
-                       case 1:
-                               ND_PRINT((ndo, ":Connect"));
-                               break;
-                       case 2:
-                               ND_PRINT((ndo, ":General Error"));
-                               break;
-                       case 3:
-                               ND_PRINT((ndo, ":Do Not Accept"));
-                               break;
-                       default:
-                               ND_PRINT((ndo, ":?"));
-                               break;
-                       }
-                       break;
-               case PPTP_CTRL_MSG_TYPE_CDN:
-                       switch (*result_code) {
-                       case 1:
-                               ND_PRINT((ndo, ":Lost Carrier"));
-                               break;
-                       case 2:
-                               ND_PRINT((ndo, ":General Error"));
-                               break;
-                       case 3:
-                               ND_PRINT((ndo, ":Admin Shutdown"));
-                               break;
-                       case 4:
-                               ND_PRINT((ndo, ":Request"));
-                               break;
-                       default:
-                               ND_PRINT((ndo, ":?"));
-                               break;
-                       }
-                       break;
-               default:
-                       /* assertion error */
-                       break;
-               }
+               const struct tok *dict =
+                       ctrl_msg_type == PPTP_CTRL_MSG_TYPE_SCCRP    ? pptp_scrrp_str :
+                       ctrl_msg_type == PPTP_CTRL_MSG_TYPE_StopCCRP ? pptp_echorp_str :
+                       ctrl_msg_type == PPTP_CTRL_MSG_TYPE_ECHORP   ? pptp_echorp_str :
+                       ctrl_msg_type == PPTP_CTRL_MSG_TYPE_OCRP     ? pptp_ocrp_str :
+                       ctrl_msg_type == PPTP_CTRL_MSG_TYPE_ICRP     ? pptp_icrp_str :
+                       ctrl_msg_type == PPTP_CTRL_MSG_TYPE_CDN      ? pptp_cdn_str :
+                       NULL; /* assertion error */
+               if (dict != NULL)
+                       ND_PRINT((ndo, ":%s", tok2str(dict, "?", *result_code)));
        }
        ND_PRINT((ndo, ")"));
 }
@@ -604,7 +517,7 @@ static void
 pptp_sccrq_print(netdissect_options *ndo,
                  const u_char *dat)
 {
-       struct pptp_msg_sccrq *ptr = (struct pptp_msg_sccrq *)dat;
+       const struct pptp_msg_sccrq *ptr = (const struct pptp_msg_sccrq *)dat;
 
        ND_TCHECK(ptr->proto_ver);
        pptp_proto_ver_print(ndo, &ptr->proto_ver);
@@ -632,7 +545,7 @@ static void
 pptp_sccrp_print(netdissect_options *ndo,
                  const u_char *dat)
 {
-       struct pptp_msg_sccrp *ptr = (struct pptp_msg_sccrp *)dat;
+       const struct pptp_msg_sccrp *ptr = (const struct pptp_msg_sccrp *)dat;
 
        ND_TCHECK(ptr->proto_ver);
        pptp_proto_ver_print(ndo, &ptr->proto_ver);
@@ -663,7 +576,7 @@ static void
 pptp_stopccrq_print(netdissect_options *ndo,
                     const u_char *dat)
 {
-       struct pptp_msg_stopccrq *ptr = (struct pptp_msg_stopccrq *)dat;
+       const struct pptp_msg_stopccrq *ptr = (const struct pptp_msg_stopccrq *)dat;
 
        ND_TCHECK(ptr->reason);
        ND_PRINT((ndo, " REASON(%u", ptr->reason));
@@ -697,7 +610,7 @@ static void
 pptp_stopccrp_print(netdissect_options *ndo,
                     const u_char *dat)
 {
-       struct pptp_msg_stopccrp *ptr = (struct pptp_msg_stopccrp *)dat;
+       const struct pptp_msg_stopccrp *ptr = (const struct pptp_msg_stopccrp *)dat;
 
        ND_TCHECK(ptr->result_code);
        pptp_result_code_print(ndo, &ptr->result_code, PPTP_CTRL_MSG_TYPE_StopCCRP);
@@ -715,7 +628,7 @@ static void
 pptp_echorq_print(netdissect_options *ndo,
                   const u_char *dat)
 {
-       struct pptp_msg_echorq *ptr = (struct pptp_msg_echorq *)dat;
+       const struct pptp_msg_echorq *ptr = (const struct pptp_msg_echorq *)dat;
 
        ND_TCHECK(ptr->id);
        pptp_id_print(ndo, &ptr->id);
@@ -730,7 +643,7 @@ static void
 pptp_echorp_print(netdissect_options *ndo,
                   const u_char *dat)
 {
-       struct pptp_msg_echorp *ptr = (struct pptp_msg_echorp *)dat;
+       const struct pptp_msg_echorp *ptr = (const struct pptp_msg_echorp *)dat;
 
        ND_TCHECK(ptr->id);
        pptp_id_print(ndo, &ptr->id);
@@ -750,7 +663,7 @@ static void
 pptp_ocrq_print(netdissect_options *ndo,
                 const u_char *dat)
 {
-       struct pptp_msg_ocrq *ptr = (struct pptp_msg_ocrq *)dat;
+       const struct pptp_msg_ocrq *ptr = (const struct pptp_msg_ocrq *)dat;
 
        ND_TCHECK(ptr->call_id);
        pptp_call_id_print(ndo, &ptr->call_id);
@@ -786,7 +699,7 @@ static void
 pptp_ocrp_print(netdissect_options *ndo,
                 const u_char *dat)
 {
-       struct pptp_msg_ocrp *ptr = (struct pptp_msg_ocrp *)dat;
+       const struct pptp_msg_ocrp *ptr = (const struct pptp_msg_ocrp *)dat;
 
        ND_TCHECK(ptr->call_id);
        pptp_call_id_print(ndo, &ptr->call_id);
@@ -817,7 +730,7 @@ static void
 pptp_icrq_print(netdissect_options *ndo,
                 const u_char *dat)
 {
-       struct pptp_msg_icrq *ptr = (struct pptp_msg_icrq *)dat;
+       const struct pptp_msg_icrq *ptr = (const struct pptp_msg_icrq *)dat;
 
        ND_TCHECK(ptr->call_id);
        pptp_call_id_print(ndo, &ptr->call_id);
@@ -848,7 +761,7 @@ static void
 pptp_icrp_print(netdissect_options *ndo,
                 const u_char *dat)
 {
-       struct pptp_msg_icrp *ptr = (struct pptp_msg_icrp *)dat;
+       const struct pptp_msg_icrp *ptr = (const struct pptp_msg_icrp *)dat;
 
        ND_TCHECK(ptr->call_id);
        pptp_call_id_print(ndo, &ptr->call_id);
@@ -874,7 +787,7 @@ static void
 pptp_iccn_print(netdissect_options *ndo,
                 const u_char *dat)
 {
-       struct pptp_msg_iccn *ptr = (struct pptp_msg_iccn *)dat;
+       const struct pptp_msg_iccn *ptr = (const struct pptp_msg_iccn *)dat;
 
        ND_TCHECK(ptr->peer_call_id);
        pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
@@ -898,7 +811,7 @@ static void
 pptp_ccrq_print(netdissect_options *ndo,
                 const u_char *dat)
 {
-       struct pptp_msg_ccrq *ptr = (struct pptp_msg_ccrq *)dat;
+       const struct pptp_msg_ccrq *ptr = (const struct pptp_msg_ccrq *)dat;
 
        ND_TCHECK(ptr->call_id);
        pptp_call_id_print(ndo, &ptr->call_id);
@@ -914,7 +827,7 @@ static void
 pptp_cdn_print(netdissect_options *ndo,
                const u_char *dat)
 {
-       struct pptp_msg_cdn *ptr = (struct pptp_msg_cdn *)dat;
+       const struct pptp_msg_cdn *ptr = (const struct pptp_msg_cdn *)dat;
 
        ND_TCHECK(ptr->call_id);
        pptp_call_id_print(ndo, &ptr->call_id);
@@ -938,7 +851,7 @@ static void
 pptp_wen_print(netdissect_options *ndo,
                const u_char *dat)
 {
-       struct pptp_msg_wen *ptr = (struct pptp_msg_wen *)dat;
+       const struct pptp_msg_wen *ptr = (const struct pptp_msg_wen *)dat;
 
        ND_TCHECK(ptr->peer_call_id);
        pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
@@ -966,7 +879,7 @@ static void
 pptp_sli_print(netdissect_options *ndo,
                const u_char *dat)
 {
-       struct pptp_msg_sli *ptr = (struct pptp_msg_sli *)dat;
+       const struct pptp_msg_sli *ptr = (const struct pptp_msg_sli *)dat;
 
        ND_TCHECK(ptr->peer_call_id);
        pptp_peer_call_id_print(ndo, &ptr->peer_call_id);
@@ -987,12 +900,12 @@ pptp_print(netdissect_options *ndo,
            const u_char *dat)
 {
        const struct pptp_hdr *hdr;
-       u_int32_t mc;
-       u_int16_t ctrl_msg_type;
+       uint32_t mc;
+       uint16_t ctrl_msg_type;
 
        ND_PRINT((ndo, ": pptp"));
 
-       hdr = (struct pptp_hdr *)dat;
+       hdr = (const struct pptp_hdr *)dat;
 
        ND_TCHECK(hdr->length);
        if (ndo->ndo_vflag) {