Removed trailing whitespaces from .h and .c files using the
[obnox/wireshark/wip.git] / packet-h261.c
index c59969fba2587cef1b4ff89eb196811725fc8b93..4755a5ca1fc9e96a8b960651318aeb3dfd2c1d0c 100644 (file)
@@ -1,14 +1,15 @@
 /* packet-h261.c
  *
  * Routines for ITU-T Recommendation H.261 dissection
+ *
+ * $Id: packet-h261.c,v 1.16 2002/08/02 23:35:50 jmayer Exp $
  * 
  * Copyright 2000, Philips Electronics N.V.
  * Andreas Sikkema <andreas.sikkema@philips.com>
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
- *
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #endif
 
 #include <glib.h>
-#include "packet.h"
-
-#ifdef HAVE_SYS_TYPES_H
-#  include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#  include <netinet/in.h>
-#endif
+#include <epan/packet.h>
 
 #include <stdio.h>
 #include <string.h>
 
-#include "packet-h261.h"
-
 /* H.261 header fields             */
 static int proto_h261          = -1;
 static int hf_h261_sbit        = -1;
@@ -69,29 +60,28 @@ static int hf_h261_data        = -1;
 /* H.261 fields defining a sub tree */
 static gint ett_h261           = -1;
 
-void
+static void
 dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
 {
        proto_item *ti            = NULL;
        proto_tree *h261_tree     = NULL;
        unsigned int offset       = 0;
 
-       if ( check_col( pinfo->fd, COL_PROTOCOL ) )   {
-               col_add_str( pinfo->fd, COL_PROTOCOL, "H.261" );
+       if ( check_col( pinfo->cinfo, COL_PROTOCOL ) )   {
+               col_set_str( pinfo->cinfo, COL_PROTOCOL, "H.261" );
        }
        
-       if ( check_col( pinfo->fd, COL_INFO) ) {
-               col_add_str( pinfo->fd, COL_INFO, "H.261 message");
+       if ( check_col( pinfo->cinfo, COL_INFO) ) {
+               col_set_str( pinfo->cinfo, COL_INFO, "H.261 message");
        }
 
        if ( tree ) {
-               /* Using fd->pkt_len here instead of END_OF_FRAME. This variable is changed in dissect_rtp()! */
-               ti = proto_tree_add_item( tree, proto_h261, tvb, offset, tvb_length( tvb ), FALSE );
+               ti = proto_tree_add_item( tree, proto_h261, tvb, offset, -1, FALSE );
                h261_tree = proto_item_add_subtree( ti, ett_h261 );
                /* SBIT 1st octet, 3 bits */
                proto_tree_add_uint( h261_tree, hf_h261_sbit, tvb, offset, 1, tvb_get_guint8( tvb, offset ) >> 5 );
                /* EBIT 1st octet, 3 bits */
-               proto_tree_add_item( h261_tree, hf_h261_ebit, tvb, offset, 1, ( tvb_get_guint8( tvb, offset )  << 3 ) >> 5 );
+               proto_tree_add_uint( h261_tree, hf_h261_ebit, tvb, offset, 1, ( tvb_get_guint8( tvb, offset )  << 3 ) >> 5 );
                /* I flag, 1 bit */
                proto_tree_add_boolean( h261_tree, hf_h261_ibit, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 2 );
                /* V flag, 1 bit */
@@ -107,19 +97,19 @@ dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree )
                offset++;
 
                /* QUANT 3rd octet, 5 bits (starting at bit 2!) */
-               proto_tree_add_uint( h261_tree, hf_h261_mbap, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 124 );
-               /* HMDV 3rd octet 2 bits, 4th octet 3 bits */
-               proto_tree_add_uint( h261_tree, hf_h261_mbap, tvb, offset, 1,
+               proto_tree_add_uint( h261_tree, hf_h261_quant, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 124 );
+               /* HMVD 3rd octet 2 bits, 4th octet 3 bits */
+               proto_tree_add_uint( h261_tree, hf_h261_hmvd, tvb, offset, 1,
                    ( ( tvb_get_guint8( tvb, offset ) << 4) >> 4 )
                     + ( tvb_get_guint8( tvb, offset ) >> 5 ) );
                offset++;
 
                /* VMVD 4th octet, last 5 bits */
-               proto_tree_add_uint( h261_tree, hf_h261_mbap, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 31 );
+               proto_tree_add_uint( h261_tree, hf_h261_vmvd, tvb, offset, 1, tvb_get_guint8( tvb, offset ) & 31 );
                offset++;
 
                /* The rest of the packet is the H.261 stream */
-               proto_tree_add_bytes( h261_tree, hf_h261_data, tvb, offset, tvb_length_remaining( tvb, offset ), tvb_get_ptr( tvb, offset, tvb_length_remaining( tvb, offset ) ) );
+               proto_tree_add_item( h261_tree, hf_h261_data, tvb, offset, -1, FALSE );
        }
 }
 
@@ -137,7 +127,7 @@ proto_register_h261(void)
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -149,7 +139,7 @@ proto_register_h261(void)
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -161,7 +151,7 @@ proto_register_h261(void)
                                BASE_NONE, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -173,7 +163,7 @@ proto_register_h261(void)
                                BASE_NONE, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -185,7 +175,7 @@ proto_register_h261(void)
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -197,7 +187,7 @@ proto_register_h261(void)
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -209,19 +199,19 @@ proto_register_h261(void)
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
                        &hf_h261_hmvd,
                        { 
-                               "Horizontal motion vctor data", 
+                               "Horizontal motion vector data", 
                                "h261.hmvd", 
                                FT_UINT8, 
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -233,7 +223,7 @@ proto_register_h261(void)
                                BASE_DEC, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
                { 
@@ -245,7 +235,7 @@ proto_register_h261(void)
                                BASE_NONE, 
                                NULL, 
                                0x0,
-                               "" 
+                               "", HFILL 
                        }
                },
 };
@@ -256,7 +246,10 @@ proto_register_h261(void)
        };
 
 
-       proto_h261 = proto_register_protocol("ITU-T Recommendation H.261", "h261");
+       proto_h261 = proto_register_protocol("ITU-T Recommendation H.261",
+           "H.261", "h261");
        proto_register_field_array(proto_h261, hf, array_length(hf));
        proto_register_subtree_array(ett, array_length(ett));
+
+       register_dissector("h261", dissect_h261, proto_h261);
 }