-Wmissing-prototypes
[metze/wireshark/wip.git] / asn1 / smrse / packet-smrse-template.c
index 08b885a82a858c1f3524f77e56692e61dc5ce30e..51d15312c1b0124a9ab9e3fff905c440e78e1bdc 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
 #include <glib.h>
 #include <epan/packet.h>
 #include <epan/asn1.h>
 
-#include <stdio.h>
-#include <string.h>
-
 #include "packet-ber.h"
 #include "packet-smrse.h"
 
 
 #define TCP_PORT_SMRSE 4321
 
+void proto_register_smrse(void);
+void proto_reg_handoff_smrse(void);
+
 /* Initialize the protocol and registered fields */
-int proto_smrse = -1;
+static int proto_smrse = -1;
 static int hf_smrse_reserved = -1;
 static int hf_smrse_tag = -1;
 static int hf_smrse_length = -1;
@@ -74,18 +72,16 @@ static const value_string tag_vals[] = {
 };
 
 static int
-dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
+dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void *data _U_)
 {
        proto_item *item = NULL;
        proto_tree *tree = NULL;
        guint8 reserved, tag;
-       guint16 length;
        int offset=0;
        asn1_ctx_t asn1_ctx;
        asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
 
        reserved=tvb_get_guint8(tvb, 0);
-       length=tvb_get_ntohs(tvb,1);
        tag=tvb_get_guint8(tvb, 3);
 
        if( reserved!= 126 )
@@ -94,17 +90,17 @@ dissect_smrse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
                return 0;
 
        if(parent_tree){
-               item = proto_tree_add_item(parent_tree, proto_smrse, tvb, 0, -1, FALSE);
+               item = proto_tree_add_item(parent_tree, proto_smrse, tvb, 0, -1, ENC_NA);
                tree = proto_item_add_subtree(item, ett_smrse);
        }
 
        col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMRSE");
        if (check_col(pinfo->cinfo, COL_INFO))
-               col_add_fstr(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x"));
+               col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tag, tag_vals,"Unknown Tag:0x%02x"));
 
-       proto_tree_add_item(tree, hf_smrse_reserved, tvb, 0, 1, FALSE);
-       proto_tree_add_item(tree, hf_smrse_length, tvb, 1, 2, FALSE);
-       proto_tree_add_item(tree, hf_smrse_tag, tvb, 3, 1, FALSE);
+       proto_tree_add_item(tree, hf_smrse_reserved, tvb, 0, 1, ENC_BIG_ENDIAN);
+       proto_tree_add_item(tree, hf_smrse_length, tvb, 1, 2, ENC_BIG_ENDIAN);
+       proto_tree_add_item(tree, hf_smrse_tag, tvb, 3, 1, ENC_BIG_ENDIAN);
 
        switch(tag){
        case 1:
@@ -186,6 +182,6 @@ void proto_reg_handoff_smrse(void) {
   dissector_handle_t smrse_handle;
 
   smrse_handle = new_create_dissector_handle(dissect_smrse, proto_smrse);
-  dissector_add("tcp.port",TCP_PORT_SMRSE, smrse_handle);
+  dissector_add_uint("tcp.port",TCP_PORT_SMRSE, smrse_handle);
 }