New port udpcast version 20040531: A file transfer tool using

ethernet's multicast
This commit is contained in:
Mario Sergio Fujikawa Ferreira 2004-07-20 22:11:31 +00:00
parent fdf5e9f29a
commit c19ae258f8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=114311
15 changed files with 383 additions and 0 deletions

View file

@ -14,6 +14,7 @@
SUBDIR += rtptools SUBDIR += rtptools
SUBDIR += sdr SUBDIR += sdr
SUBDIR += speak_freely SUBDIR += speak_freely
SUBDIR += udpcast
SUBDIR += vat SUBDIR += vat
SUBDIR += vic SUBDIR += vic
SUBDIR += wb SUBDIR += wb

60
mbone/udpcast/Makefile Normal file
View file

@ -0,0 +1,60 @@
# New ports collection makefile for: udpcast
# Date created: Mon Jul 19 19:10:56 UTC 2004
# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= udpcast
PORTVERSION= 0.${RELEASE_DATE}
CATEGORIES= mbone sysutils
MASTER_SITES= http://udpcast.linux.lu/current/
DISTNAME= ${PORTNAME}-${RELEASE_DATE}
MAINTAINER= lioux@FreeBSD.org
COMMENT= A file transfer tool using ethernet's multicast
USE_REINPLACE= yes
USE_GETOPT_LONG=yes
USE_GMAKE= yes
WRKSRC= ${WRKDIR}/${PORTNAME}
RELEASE_DATE= 20040531
PROGRAM_SBIN_FILES= udp-receiver udp-sender
PLIST_FILES= sbin/udp-receiver \
sbin/udp-sender
PORTDOCS= Changelog.txt cmd.html
MAN1= udp-receiver.1 udp-sender.1
post-patch:
@${REINPLACE_CMD} -E \
-e 's|<malloc.h>|<stdlib.h>|' \
${WRKSRC}/libbb_udpcast.h
do-configure:
# C{C,FLAGS}, PTHREAD_* safeness
@${REINPLACE_CMD} -E \
-e 's|gcc|${CC}|' \
-e 's|^(CFLAGS[[:space:]]*=.+)$$|\1 ${CFLAGS} ${CPPFLAGS} ${PTHREAD_CFLAGS}|' \
-e 's|^(LDFLAGS[[:space:]]*=.+)$$|\1 ${LDFLAGS}|' \
-e 's|-lpthread|${PTHREAD_LIBS}|g' \
${BUILD_WRKSRC}/${MAKEFILE}
do-install:
.ifndef(NOPORTDOCS)
. for file in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
. endfor
.endif
.for file in ${PROGRAM_SBIN_FILES}
@${INSTALL_PROGRAM} ${WRKSRC}/${file} ${PREFIX}/sbin/
.endfor
.for file in ${MAN1}
@${INSTALL_MAN} ${WRKSRC}/${file} ${MANPREFIX}/man/man1/
.endfor
.include <bsd.port.mk>

2
mbone/udpcast/distinfo Normal file
View file

@ -0,0 +1,2 @@
MD5 (udpcast-20040531.tar.gz) = e965fae35ae7450098c29984d3997344
SIZE (udpcast-20040531.tar.gz) = 67213

View file

@ -0,0 +1,10 @@
--- participants.h.orig Tue Jul 20 13:49:28 2004
+++ participants.h Tue Jul 20 13:49:40 2004
@@ -3,6 +3,7 @@
#define MAX_CLIENTS 1024
+#include <sys/types.h>
#include <sys/socket.h>
typedef struct participantsDb *participantsDb_t;

View file

@ -0,0 +1,38 @@
--- socklib.c.orig Sat Feb 21 13:58:37 2004
+++ socklib.c Tue Jul 20 17:58:51 2004
@@ -16,6 +16,8 @@
#include "log.h"
#include "socklib.h"
+#undef SIOCGIFINDEX
+
#ifdef LOSSTEST
/**
* Packet loss/swap testing...
@@ -289,7 +291,7 @@
int setTtl(int sock, int ttl) {
/* set the socket to broadcast */
- return setsockopt(sock, SOL_IP, IP_MULTICAST_TTL, &ttl, sizeof(int));
+ return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(int));
}
#ifdef SIOCGIFINDEX
@@ -334,7 +336,7 @@
int r;
fillMreq(sock, ifname, addr, &mreq);
- r = setsockopt(sock, SOL_IP, code, &mreq, sizeof(mreq));
+ r = setsockopt(sock, IPPROTO_IP, code, &mreq, sizeof(mreq));
if(r < 0) {
perror(message);
exit(1);
@@ -366,7 +368,7 @@
int setMcastDestination(int sock, char *ifname, struct sockaddr *addr) {
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__FreeBSD__)
int r;
struct sockaddr interface_addr;
struct in_addr if_addr;

View file

@ -0,0 +1,11 @@
--- statistics.c.orig Tue Jul 20 10:46:11 2004
+++ statistics.c Tue Jul 20 12:00:59 2004
@@ -37,7 +37,7 @@
static void printFilePosition(int fd) {
#ifndef __CYGWIN__
if(fd != -1) {
- loff_t offset = lseek64(fd, 0, SEEK_CUR);
+ off_t offset = lseek(fd, 0, SEEK_CUR);
printLongNum(offset);
}
#endif

View file

@ -0,0 +1,60 @@
--- udpr-negotiate.c.orig Sat Feb 21 14:08:49 2004
+++ udpr-negotiate.c Tue Jul 20 13:44:05 2004
@@ -2,6 +2,10 @@
#include <unistd.h>
#include <errno.h>
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
#include "log.h"
#include "socklib.h"
#include "udpcast.h"
@@ -16,6 +20,10 @@
# define O_BINARY 0
#endif
+#ifdef __FreeBSD__
+struct client_config client_config_on_exit_hack;
+#endif
+
static int sendConnectReq(struct client_config *client_config,
struct net_config *net_config,
int haveServerAddress) {
@@ -48,6 +56,12 @@
sendDisconnect(exitStatus, (struct client_config *) args);
}
+#ifdef __FreeBSD__
+static void sendDisconnectWrapper_on_exit_handler() {
+ sendDisconnectWrapper(0, &client_config_on_exit_hack);
+}
+#endif
+
void sendDisconnect(int exitStatus,
struct client_config *client_config) {
int endianness = client_config->endianness;
@@ -144,7 +158,7 @@
if(disk_config->fileName != NULL) {
int oflags = O_CREAT | O_WRONLY;
if(!(disk_config->flags & FLAG_NOSYNC)) {
- oflags |= O_SYNC;
+ oflags |= O_FSYNC;
}
outFile = open(disk_config->fileName, oflags | O_BINARY, 0644);
if(outFile < 0) {
@@ -333,7 +347,13 @@
pipedOutFile = openPipe(client_config.toServer, outFile, disk_config,
&pipePid);
#ifndef __CYGWIN__
+# ifdef __FreeBSD__
+ client_config_on_exit_hack = client_config;
+
+ atexit(sendDisconnectWrapper_on_exit_handler);
+# else
on_exit(sendDisconnectWrapper, &client_config);
+# endif
#endif
{
struct fifo fifo;

10
mbone/udpcast/pkg-descr Normal file
View file

@ -0,0 +1,10 @@
[ excerpt taken from developer's www site ]
UDPcast is a file transfer tool that can send data simultaneously
to many destinations on a LAN. This can for instance be used to
install entire classrooms of PC's at once. The advantage of UDPcast
over using other methods (nfs, ftp, whatever) is that UDPcast uses
Ethernet's multicast abilities: it won't take longer to install 15
machines than it would to install just 2.
WWW: http://udpcast.linux.lu/

60
net/udpcast/Makefile Normal file
View file

@ -0,0 +1,60 @@
# New ports collection makefile for: udpcast
# Date created: Mon Jul 19 19:10:56 UTC 2004
# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= udpcast
PORTVERSION= 0.${RELEASE_DATE}
CATEGORIES= mbone sysutils
MASTER_SITES= http://udpcast.linux.lu/current/
DISTNAME= ${PORTNAME}-${RELEASE_DATE}
MAINTAINER= lioux@FreeBSD.org
COMMENT= A file transfer tool using ethernet's multicast
USE_REINPLACE= yes
USE_GETOPT_LONG=yes
USE_GMAKE= yes
WRKSRC= ${WRKDIR}/${PORTNAME}
RELEASE_DATE= 20040531
PROGRAM_SBIN_FILES= udp-receiver udp-sender
PLIST_FILES= sbin/udp-receiver \
sbin/udp-sender
PORTDOCS= Changelog.txt cmd.html
MAN1= udp-receiver.1 udp-sender.1
post-patch:
@${REINPLACE_CMD} -E \
-e 's|<malloc.h>|<stdlib.h>|' \
${WRKSRC}/libbb_udpcast.h
do-configure:
# C{C,FLAGS}, PTHREAD_* safeness
@${REINPLACE_CMD} -E \
-e 's|gcc|${CC}|' \
-e 's|^(CFLAGS[[:space:]]*=.+)$$|\1 ${CFLAGS} ${CPPFLAGS} ${PTHREAD_CFLAGS}|' \
-e 's|^(LDFLAGS[[:space:]]*=.+)$$|\1 ${LDFLAGS}|' \
-e 's|-lpthread|${PTHREAD_LIBS}|g' \
${BUILD_WRKSRC}/${MAKEFILE}
do-install:
.ifndef(NOPORTDOCS)
. for file in ${PORTDOCS}
@${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
. endfor
.endif
.for file in ${PROGRAM_SBIN_FILES}
@${INSTALL_PROGRAM} ${WRKSRC}/${file} ${PREFIX}/sbin/
.endfor
.for file in ${MAN1}
@${INSTALL_MAN} ${WRKSRC}/${file} ${MANPREFIX}/man/man1/
.endfor
.include <bsd.port.mk>

2
net/udpcast/distinfo Normal file
View file

@ -0,0 +1,2 @@
MD5 (udpcast-20040531.tar.gz) = e965fae35ae7450098c29984d3997344
SIZE (udpcast-20040531.tar.gz) = 67213

View file

@ -0,0 +1,10 @@
--- participants.h.orig Tue Jul 20 13:49:28 2004
+++ participants.h Tue Jul 20 13:49:40 2004
@@ -3,6 +3,7 @@
#define MAX_CLIENTS 1024
+#include <sys/types.h>
#include <sys/socket.h>
typedef struct participantsDb *participantsDb_t;

View file

@ -0,0 +1,38 @@
--- socklib.c.orig Sat Feb 21 13:58:37 2004
+++ socklib.c Tue Jul 20 17:58:51 2004
@@ -16,6 +16,8 @@
#include "log.h"
#include "socklib.h"
+#undef SIOCGIFINDEX
+
#ifdef LOSSTEST
/**
* Packet loss/swap testing...
@@ -289,7 +291,7 @@
int setTtl(int sock, int ttl) {
/* set the socket to broadcast */
- return setsockopt(sock, SOL_IP, IP_MULTICAST_TTL, &ttl, sizeof(int));
+ return setsockopt(sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(int));
}
#ifdef SIOCGIFINDEX
@@ -334,7 +336,7 @@
int r;
fillMreq(sock, ifname, addr, &mreq);
- r = setsockopt(sock, SOL_IP, code, &mreq, sizeof(mreq));
+ r = setsockopt(sock, IPPROTO_IP, code, &mreq, sizeof(mreq));
if(r < 0) {
perror(message);
exit(1);
@@ -366,7 +368,7 @@
int setMcastDestination(int sock, char *ifname, struct sockaddr *addr) {
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__FreeBSD__)
int r;
struct sockaddr interface_addr;
struct in_addr if_addr;

View file

@ -0,0 +1,11 @@
--- statistics.c.orig Tue Jul 20 10:46:11 2004
+++ statistics.c Tue Jul 20 12:00:59 2004
@@ -37,7 +37,7 @@
static void printFilePosition(int fd) {
#ifndef __CYGWIN__
if(fd != -1) {
- loff_t offset = lseek64(fd, 0, SEEK_CUR);
+ off_t offset = lseek(fd, 0, SEEK_CUR);
printLongNum(offset);
}
#endif

View file

@ -0,0 +1,60 @@
--- udpr-negotiate.c.orig Sat Feb 21 14:08:49 2004
+++ udpr-negotiate.c Tue Jul 20 13:44:05 2004
@@ -2,6 +2,10 @@
#include <unistd.h>
#include <errno.h>
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
+
#include "log.h"
#include "socklib.h"
#include "udpcast.h"
@@ -16,6 +20,10 @@
# define O_BINARY 0
#endif
+#ifdef __FreeBSD__
+struct client_config client_config_on_exit_hack;
+#endif
+
static int sendConnectReq(struct client_config *client_config,
struct net_config *net_config,
int haveServerAddress) {
@@ -48,6 +56,12 @@
sendDisconnect(exitStatus, (struct client_config *) args);
}
+#ifdef __FreeBSD__
+static void sendDisconnectWrapper_on_exit_handler() {
+ sendDisconnectWrapper(0, &client_config_on_exit_hack);
+}
+#endif
+
void sendDisconnect(int exitStatus,
struct client_config *client_config) {
int endianness = client_config->endianness;
@@ -144,7 +158,7 @@
if(disk_config->fileName != NULL) {
int oflags = O_CREAT | O_WRONLY;
if(!(disk_config->flags & FLAG_NOSYNC)) {
- oflags |= O_SYNC;
+ oflags |= O_FSYNC;
}
outFile = open(disk_config->fileName, oflags | O_BINARY, 0644);
if(outFile < 0) {
@@ -333,7 +347,13 @@
pipedOutFile = openPipe(client_config.toServer, outFile, disk_config,
&pipePid);
#ifndef __CYGWIN__
+# ifdef __FreeBSD__
+ client_config_on_exit_hack = client_config;
+
+ atexit(sendDisconnectWrapper_on_exit_handler);
+# else
on_exit(sendDisconnectWrapper, &client_config);
+# endif
#endif
{
struct fifo fifo;

10
net/udpcast/pkg-descr Normal file
View file

@ -0,0 +1,10 @@
[ excerpt taken from developer's www site ]
UDPcast is a file transfer tool that can send data simultaneously
to many destinations on a LAN. This can for instance be used to
install entire classrooms of PC's at once. The advantage of UDPcast
over using other methods (nfs, ftp, whatever) is that UDPcast uses
Ethernet's multicast abilities: it won't take longer to install 15
machines than it would to install just 2.
WWW: http://udpcast.linux.lu/