[Sumover-dev] [svn commit] r4413 - in common/trunk: . src tests

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Mon Apr 13 05:58:27 BST 2009


Author: douglask
Date: Mon Apr 13 05:58:19 2009
New Revision: 4413

Modified:
   common/trunk/configure.in
   common/trunk/doc/Makefile.in
   common/trunk/src/Makefile.in
   common/trunk/src/rtp.c
   common/trunk/src/rtp.h
   common/trunk/tests/test_net_udp.c

Log:
Add support for DESTDIR env variable in Makefile install rule.

Header files are now installed in $prefix/include/uclmmbase/ like they are in the FreeBSD and Debian/Ubuntu packages.

Merged code from ANL SWIG based python wrapper:
  http://fl-cvs.mcs.anl.gov/viewcvs/viewcvs.cgi/common/
but ignored some changes such as src/mbus.c as it would have broken existing API

Merged tests/test_net_udp.c patch from FreeBSD ports


Modified: common/trunk/configure.in
==============================================================================
--- common/trunk/configure.in	(original)
+++ common/trunk/configure.in	Mon Apr 13 05:58:19 2009
@@ -8,7 +8,7 @@
 
 AC_PROG_CC
 AC_PROG_CPP
-AC_PROG_RANLIB
+AC_PROG_INSTALL
 
 AC_HEADER_STDC
 AC_HEADER_SYS_WAIT

Modified: common/trunk/doc/Makefile.in
==============================================================================
--- common/trunk/doc/Makefile.in	(original)
+++ common/trunk/doc/Makefile.in	Mon Apr 13 05:58:19 2009
@@ -10,7 +10,7 @@
 CODE_SRCS=$(CODE_DIR)/*.c $(CODE_DIR)/*.h
 
 html: sgml $(SGML_TOPLEVEL)
-	-mkdir html
+	-test -d html || mkdir html
 	-cd html && gtkdoc-mkhtml $(MODULE) ../$(SGML_TOPLEVEL)
 
 sgml: tmpl
@@ -22,6 +22,8 @@
 scan: $(CODE_SRCS)
 	gtkdoc-scan --module=$(MODULE) --source-dir=$(CODE_DIR)
 
+install:
+
 clean:
 	-rm -f *.bak sgml/*.bak *unused.txt
 
@@ -34,4 +36,5 @@
 	-rm -rf *undocumented.txt
 	-rm -rf uclmmbase-docs.sgml
 
-.PHONY: html sgml tmpl clean distclean
+.PHONY: html sgml tmpl install clean distclean
+

Modified: common/trunk/src/Makefile.in
==============================================================================
--- common/trunk/src/Makefile.in	(original)
+++ common/trunk/src/Makefile.in	Mon Apr 13 05:58:19 2009
@@ -7,6 +7,7 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 libdir=@libdir@
+includedir=@includedir@
 
 DEFS   = @DEFS@
 CFLAGS = @CFLAGS@ $(DEFS)
@@ -15,7 +16,7 @@
 LDFLAGS= @LDFLAGS@
 RANLIB = @RANLIB@
 LIBTOOL= @LIBTOOL@
-INSTALL= $(top_builddir)/install-sh -c
+INSTALL= @INSTALL@
 
 OBJS = crypt_random.o debug.o md5.o memory.o net_udp.o qfDES.o util.o hmac.o  \
        base64.o ntp.o rtp.o drand48.o mbus_parser.o mbus_config.o mbus_addr.o \
@@ -35,8 +36,12 @@
 	sed -e 's/.*/#define CCL_VERSION "v&"/' $? > version.h
 
 install: all
-	$(LIBTOOL) --mode=install $(INSTALL) libuclmmbase.la $(libdir)
-	for header in *.h; do $(INSTALL) $$header @prefix@/include/common/$(header); done
+	test -d $(DESTDIR)$(includedir)/uclmmbase || \
+		$(INSTALL) -d $(DESTDIR)$(includedir)/uclmmbase
+	test -d "$(DESTDIR)$(libdir)" || \
+		$(INSTALL) -d "$(DESTDIR)$(libdir)"
+	$(LIBTOOL) --mode=install $(INSTALL) libuclmmbase.la $(DESTDIR)$(libdir)
+	for header in *.h; do $(INSTALL) $$header $(DESTDIR)$(includedir)/uclmmbase/$(header); done
 
 .c.o:
 	$(CC) $(CFLAGS) $(INC) -c $<
@@ -51,4 +56,3 @@
 distclean:	clean
 	-rm -f Makefile config.status config.cache uclconf.h
 
-

Modified: common/trunk/src/rtp.c
==============================================================================
--- common/trunk/src/rtp.c	(original)
+++ common/trunk/src/rtp.c	Mon Apr 13 05:58:19 2009
@@ -2140,6 +2140,48 @@
 }
 
 /**
+ * rtp_send_rtppacket:
+ * @session: The session pointer (returned by rtp_init())
+ * @packet: Preformatted RTP packet (includes header and payload)
+ * @packet_len: Total length of the RTP packet
+ *
+ * Return value is the number of bytes sent.  -1 if there was an error.
+ **/
+int rtp_send_rtppacket(struct rtp* session, char* packet, unsigned int packet_len)
+{
+	int rc;
+
+	/*
+	 * Usual parameter checking.  At the very least, packet
+	 * must include a header.
+	 *
+	 * TODO? Check the validity of the packet's header or do
+	 * we trust the sender?
+	 */
+
+	if (	(session == NULL) || 
+		(packet == NULL) ||
+		(packet_len > RTP_MAX_PACKET_LEN) ||
+		(packet_len < offsetof(rtp_packet, fields)))
+	{
+		return -1;
+	}
+
+	check_database(session);
+
+	rc = udp_send(session->rtp_socket, packet, packet_len);
+
+	/* Update the RTCP statistics... */
+	session->we_sent     = TRUE;
+	session->rtp_pcount += 1;
+	session->rtp_bcount += packet_len;
+	gettimeofday(&session->last_rtp_send_time, NULL);
+
+	check_database(session);
+	return rc;
+}
+
+/**
  * rtp_send_data:
  * @session: the session pointer (returned by rtp_init())
  * @rtp_ts: The timestamp reflects the sampling instant of the first octet of the RTP data to be sent.  The timestamp is expressed in media units.
@@ -3336,3 +3378,28 @@
 	return session->ttl;
 }
 
+/**
+ * rtp_get_rtp_fd:
+ * @session: The RTP session.
+ *
+ * Retrieves the rtp socket file description of a session.  
+ *
+ * Returns: The integer value of the file descriptor.
+ */
+int rtp_get_rtp_fd(struct rtp *session)
+{
+	return udp_fd(session->rtp_socket);
+}
+
+/**
+ * rtp_get_rtcp_fd:
+ * @session: The RTP session.
+ *
+ * Retrieves the rtcp socket file description of a session.  
+ *
+ * Returns: The integer value of the file descriptor.
+ */
+int rtp_get_rtcp_fd(struct rtp *session)
+{
+	return udp_fd(session->rtcp_socket);
+}

Modified: common/trunk/src/rtp.h
==============================================================================
--- common/trunk/src/rtp.h	(original)
+++ common/trunk/src/rtp.h	Mon Apr 13 05:58:19 2009
@@ -189,8 +189,8 @@
         RTP_OPT_PROMISC =	    1,
         RTP_OPT_WAIT_FOR_RTCP	=   2,
         RTP_OPT_FILTER_MY_PACKETS = 3,
-	RTP_OPT_REUSE_PACKET_BUFS = 4  /* Each data packet is written into the same buffer, */
-	                               /* rather than malloc()ing a new buffer each time.   */
+        RTP_OPT_REUSE_PACKET_BUFS = 4  /* Each data packet is written into the same buffer, */
+                                       /* rather than malloc()ing a new buffer each time.   */
 } rtp_option;
 
 /* API */
@@ -207,7 +207,7 @@
 
 int              rtp_set_umtp_dest(struct rtp *session,
 				   const char *addr,
-                                   uint16_t port,
+				   uint16_t port,
 				   uint16_t src_cookie,
 				   uint16_t dst_cookie);
 
@@ -219,10 +219,13 @@
 
 int 		 rtp_recv(struct rtp *session, 
 			  struct timeval *timeout, uint32_t curr_rtp_ts);
+int 		 rtp_send_rtppacket(struct rtp *session,
+				    char *packet,
+				    unsigned int packet_len);
 int 		 rtp_send_data(struct rtp *session, 
 			       uint32_t rtp_ts, char pt, int m, 
 			       int cc, uint32_t csrc[], 
-                               char *data, int data_len, 
+			       char *data, int data_len, 
 			       char *extn, uint16_t extn_len, uint16_t extn_type);
 #ifndef WIN32
 int              rtp_send_data_iov(struct rtp *session, 
@@ -258,6 +261,9 @@
 
 int		rtp_get_ssrc_count(struct rtp *session);
 
+int		rtp_get_rtp_fd(struct rtp *session);
+int		rtp_get_rtcp_fd(struct rtp *session);
+
 #if defined(__cplusplus)
 }
 #endif

Modified: common/trunk/tests/test_net_udp.c
==============================================================================
--- common/trunk/tests/test_net_udp.c	(original)
+++ common/trunk/tests/test_net_udp.c	Mon Apr 13 05:58:19 2009
@@ -115,6 +115,10 @@
 	hname = udp_host_addr(s1); /* we need this for the unicast test... */
 	udp_exit(s1);
 
+	if (hname == NULL) {
+		printf("fail: cannot resolve our name\n");
+		return;
+	}
 	/**********************************************************************/
 	/* Now we send a packet to ourselves via our real network address...  */
 	printf("UDP/IP networking (IPv4 unicast)....... "); fflush(stdout);



More information about the Sumover-dev mailing list