Removed trailing whitespaces from .h and .c files using the
[obnox/wireshark/wip.git] / packet-smpp.c
index 8b1547d4a75ab712b5e2200779258c666bfef7c4..6df90111b9e11d4faa51991c39fbd40aaf480eb5 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for Short Message Peer to Peer dissection
  * Copyright 2001, Tom Uijldert <tom.uijldert@cmg.nl>
  *
- * $Id: packet-smpp.c,v 1.2 2001/12/04 06:35:51 guy Exp $
+ * $Id: packet-smpp.c,v 1.9 2002/08/13 09:03:23 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include <string.h>
 #include <time.h>
 
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
-#include "packet.h"
-/* #include "packet-smpp.h"    */              /* We autoregister      */
+#include <epan/packet.h>
 
 /* Forward declarations                */
 static void dissect_smpp(tvbuff_t *, packet_info *, proto_tree *t);
@@ -603,6 +590,7 @@ smpp_mktime(char *datestr, time_t *secs, int *nsecs)
     r_time.tm_hour = 10 * (datestr[6] - '0') + (datestr[7] - '0');
     r_time.tm_min  = 10 * (datestr[8] - '0') + (datestr[9] - '0');
     r_time.tm_sec  = 10 * (datestr[10] - '0') + (datestr[11] - '0');
+    r_time.tm_isdst = -1;
     *secs = mktime(&r_time);
     *nsecs = (datestr[12] - '0') * 100000000;
     t_diff = (10 * (datestr[13] - '0') + (datestr[14] - '0')) * 900;
@@ -1355,22 +1343,22 @@ dissect_smpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     sequence_number = tvb_get_ntohl(tvb, offset);
     offset += 4;
     /* 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, "SMPP");
+    if (check_col(pinfo->cinfo, COL_PROTOCOL))
+       col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMPP");
 
-    if (check_col(pinfo->fd, COL_INFO))
+    if (check_col(pinfo->cinfo, COL_INFO))
     {
-       col_clear(pinfo->fd, COL_INFO);
-       col_add_fstr(pinfo->fd, COL_INFO, "SMPP %s",
+       col_clear(pinfo->cinfo, COL_INFO);
+       col_add_fstr(pinfo->cinfo, COL_INFO, "SMPP %s",
                 val_to_str(command_id,vals_command_id,"unknown operation"));
        if (command_id & 0x80000000)
-           col_append_fstr(pinfo->fd, COL_INFO, ": \"%s\"",
+           col_append_fstr(pinfo->cinfo, COL_INFO, ": \"%s\"",
                            val_to_str(command_status, vals_command_status,
                                       "reserved error"));
        if (command_length > tvb_reported_length(tvb))
-           col_append_str(pinfo->fd, COL_INFO, " [short packet]");
+           col_append_str(pinfo->cinfo, COL_INFO, " [short packet]");
        if (command_length < tvb_reported_length(tvb))
-           col_append_str(pinfo->fd, COL_INFO, " [trailing data]");
+           col_append_str(pinfo->cinfo, COL_INFO, " [trailing data]");
     }
 
     /* In the interest of speed, if "tree" is NULL, don't do any work not
@@ -2202,9 +2190,15 @@ proto_reg_handoff_smpp(void)
 
     /*
      * SMPP can be spoken on any port under TCP or X.25
-     * ...how *do* we do that under x.25?
+     * ...how *do* we do that under X.25?
+     *
+     * We can register the heuristic SMPP dissector with X.25, for one
+     * thing.  We don't currently have any mechanism to allow the user
+     * to specify that a given X.25 circuit is to be dissected as SMPP,
+     * however.
      */
     smpp_handle = create_dissector_handle(dissect_smpp, proto_smpp);
     dissector_add_handle("tcp.port", smpp_handle);
     heur_dissector_add("tcp", dissect_smpp_heur, proto_smpp);
+    heur_dissector_add("x.25", dissect_smpp_heur, proto_smpp);
 }