Some minor bugfixes for netlogon
[obnox/wireshark/wip.git] / packet-ucp.c
index b552c7e1f8d1efc2f8f6ef86f9554a0a30df3904..aa2f6b111358eed822ad29361283758efd69b166 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Universal Computer Protocol dissection
  * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl>
  *
- * $Id: packet-ucp.c,v 1.5 2001/11/05 21:41:33 guy Exp $
+ * $Id: packet-ucp.c,v 1.14 2002/03/10 03:07:16 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -54,7 +54,7 @@
 # include "snprintf.h"
 #endif
 
-#include "packet.h"
+#include <epan/packet.h>
 /* #include "packet-ucp.h" */                  /* We autoregister      */
 
 /* Prototypes  */
@@ -681,6 +681,7 @@ ucp_mktime(char *datestr)
     r_time.tm_min  = 10 * (datestr[8] - '0') + (datestr[9] - '0');
     if (datestr[10])
        r_time.tm_sec  = 10 * (datestr[10] - '0') + (datestr[11] - '0');
+    r_time.tm_isdst = -1;
     return mktime(&r_time);
 }
 
@@ -1538,9 +1539,6 @@ dissect_ucp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
     guint8      O_R;           /* Request or response                  */
 
-    if (!proto_is_protocol_enabled(proto_ucp))
-       return FALSE;           /* UCP was disabled     */
-
     /* This runs atop TCP, so we are guaranteed that there is at least one
        byte in the tvbuff. */
     if (tvb_get_guint8(tvb, 0) != UCP_STX)
@@ -1596,18 +1594,18 @@ dissect_ucp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     OT  = 10 * OT + (tvb_get_guint8(tvb, UCP_OT_OFFSET + 1) - '0');
 
     /* Make entries in Protocol column and Info column on summary display */
-    if (check_col(pinfo->fd, COL_PROTOCOL))
-           col_set_str(pinfo->fd, COL_PROTOCOL, "UCP");
+    if (check_col(pinfo->cinfo, COL_PROTOCOL))
+           col_set_str(pinfo->cinfo, COL_PROTOCOL, "UCP");
 
-    if (check_col(pinfo->fd, COL_INFO)) {
-       col_clear(pinfo->fd, COL_INFO);
-       col_append_fstr(pinfo->fd, COL_INFO, "%s (%s)",
+    if (check_col(pinfo->cinfo, COL_INFO)) {
+       col_clear(pinfo->cinfo, COL_INFO);
+       col_append_fstr(pinfo->cinfo, COL_INFO, "%s (%s)",
                     val_to_str(OT,  vals_hdr_OT,  "unknown operation"),
                     match_strval(O_R, vals_hdr_O_R));
        if (result == UCP_SHORTENED)
-           col_append_str(pinfo->fd, COL_INFO, " [short packet]");
+           col_append_str(pinfo->cinfo, COL_INFO, " [short packet]");
        else if (result == UCP_INV_CHK)
-           col_append_str(pinfo->fd, COL_INFO, " [checksum invalid]");
+           col_append_str(pinfo->cinfo, COL_INFO, " [checksum invalid]");
     }
 
     /* In the interest of speed, if "tree" is NULL, don't do any work not
@@ -1615,8 +1613,7 @@ dissect_ucp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     if (tree) {
 
        /* create display subtree for the protocol */
-       ti = proto_tree_add_item(tree, proto_ucp, tvb, 0,
-                                tvb_length(tvb), FALSE);
+       ti = proto_tree_add_item(tree, proto_ucp, tvb, 0, -1, FALSE);
 
        ucp_tree = proto_item_add_subtree(ti, ett_ucp);
        /*
@@ -2104,7 +2101,7 @@ proto_register_ucp(void)
        },
        { &hf_ucp_parm_NT,
            { "NT", "ucp.parm.NT",
-             FT_STRING, BASE_NONE, NULL, 0x00,
+             FT_UINT8, BASE_DEC, VALS(vals_parm_NT), 0x00,
              "Notification type.",
              HFILL
            }
@@ -2503,13 +2500,17 @@ proto_register_ucp(void)
 void
 proto_reg_handoff_ucp(void)
 {
+    dissector_handle_t ucp_handle;
+
     /*
      * UCP can be spoken on any port so, when not on a specific port, try this
      * one whenever TCP is spoken.
      */
     heur_dissector_add("tcp", dissect_ucp_heur, proto_ucp);
+
     /*
-     * Also register as one that can be assigned to a TCP conversation.
+     * Also register as one that can be selected by a TCP port number.
      */
-    conv_dissector_add("tcp", dissect_ucp, proto_ucp);
+    ucp_handle = create_dissector_handle(dissect_ucp, proto_ucp);
+    dissector_add_handle("tcp.port", ucp_handle);
 }