/* packet-rtcp.c
*
- * $Id: packet-rtcp.c,v 1.20 2001/09/03 08:10:46 guy Exp $
+ * $Id: packet-rtcp.c,v 1.22 2001/09/08 00:43:51 guy Exp $
*
* Routines for RTCP dissection
* RTCP = Real-time Transport Control Protocol
static address fake_addr;
static int heur_init = FALSE;
-static char rtcp_proto[] = "RTCP";
-
static gboolean dissect_rtcp_heur( tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree );
-void rtcp_add_address( const unsigned char* ip_addr, int prt )
+void rtcp_add_address( packet_info *pinfo, const unsigned char* ip_addr,
+ int prt )
{
address src_addr;
- conversation_t* pconv = ( conversation_t* ) NULL;
+ conversation_t* pconv;
+
+ /*
+ * If this isn't the first time this packet has been processed,
+ * we've already done this work, so we don't need to do it
+ * again.
+ */
+ if (pinfo->fd->flags.visited)
+ return;
src_addr.type = AT_IPv4;
src_addr.len = 4;
/*
* If not, add
+ * XXX - use wildcard address and port B?
*/
if ( ! pconv ) {
- conversation_new( &src_addr, &fake_addr, PT_UDP, (guint32) prt,
- (guint32) 0, (void*) rtcp_proto, 0 );
+ pconv = conversation_new( &src_addr, &fake_addr, PT_UDP,
+ (guint32) prt, (guint32) 0, 0 );
+ conversation_add_proto_data(pconv, proto_rtcp, NULL);
}
}
/*
- * An RTCP conversation always contains data
+ * An RTCP conversation always has a data item for RTCP.
+ * (Its existence is sufficient to indicate that this is an RTCP
+ * conversation.)
*/
- if ( pconv->data == NULL )
- return FALSE;
-
- /*
- * An RTCP conversation data always contains "RTCP"
- */
- if ( strcmp( pconv->data, rtcp_proto ) != 0 )
+ if (conversation_get_proto_data(pconv, proto_rtcp) == NULL)
return FALSE;
/*
proto_register_field_array(proto_rtcp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
+ register_dissector("rtcp", dissect_rtcp, proto_rtcp);
+
#if 0
register_init_routine( &rtcp_init );
#endif