ports/64596: New port: sysutils/openobex library for applications to use the OBEX protocol

Guido Falsi mad at madpilot.net
Mon Mar 22 23:20:15 UTC 2004


>Number:         64596
>Category:       ports
>Synopsis:       New port: sysutils/openobex library for applications to use the OBEX protocol
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 22 15:20:15 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Guido Falsi
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
none
>Environment:
System: FreeBSD wedge.madpilot.net 5.2-CURRENT FreeBSD 5.2-CURRENT #11: Mon Mar 8 17:18:47 CET 2004 root at wedge.madpilot.net:/usr/obj/usr/src/sys/WEDGE i386

>Description:

a library to support the OBEX protocol to transfer files mainly to mobile devices via IrDA or bluetooth.

bluetooth tested on 5.2-current, I'm sorry I don't have any IrDA hardware to test.

is needed by the other port I will commit shortly "obexapp"

>How-To-Repeat:

>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	openobex
#	openobex/Makefile
#	openobex/distinfo
#	openobex/pkg-descr
#	openobex/pkg-plist
#	openobex/files
#	openobex/files/patch-src-obex.c
#	openobex/files/patch-aclocal.m4
#	openobex/files/patch-configure.in
#	openobex/files/patch-src-obex_transport.h
#	openobex/files/patch-src-obex_main.c
#	openobex/files/patch-src-btobex.c
#
echo c - openobex
mkdir -p openobex > /dev/null 2>&1
echo x - openobex/Makefile
sed 's/^X//' >openobex/Makefile << 'END-of-openobex/Makefile'
X# New ports collection makefile for:	openobex
X# Date created:				15 March 2004
X# Whom:					Guido Falsi <mad at madpilot.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	openobex
XPORTVERSION=	1.0.1
XCATEGORIES=	sysutils net
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	${PORTNAME}
X
XMAINTAINER=	mad at madpilot.net
XCOMMENT=	Open Source implementation of the OBEX protocol
X
XUSE_AUTOCONF=	yes
XUSE_AUTOMAKE=	yes
XUSE_GMAKE=	yes
XINSTALLS_SHLIB=	yes
XUSE_LIBTOOL=	yes
X
X.include <bsd.port.mk>
END-of-openobex/Makefile
echo x - openobex/distinfo
sed 's/^X//' >openobex/distinfo << 'END-of-openobex/distinfo'
XMD5 (openobex-1.0.1.tar.gz) = 3742666bb98259face76be49b73ea89d
END-of-openobex/distinfo
echo x - openobex/pkg-descr
sed 's/^X//' >openobex/pkg-descr << 'END-of-openobex/pkg-descr'
XThe overall goal of this project is to make an open source
Ximplementation of the Object Exchange (OBEX) protocol. OBEX is a
Xsession protocol and can best be described as a binary HTTP protocol.
X
XWWW:	http://openobex.sourceforge.net/
X
X- Guido Falsi <mad at madpilot.net>
END-of-openobex/pkg-descr
echo x - openobex/pkg-plist
sed 's/^X//' >openobex/pkg-plist << 'END-of-openobex/pkg-plist'
Xbin/openobex-config
Xinclude/openobex/obex.h
Xinclude/openobex/obex_const.h
Xlib/libopenobex-1.0.so
Xlib/libopenobex-1.0.so.1
Xlib/libopenobex.a
Xlib/libopenobex.la
Xlib/libopenobex.so
Xshare/aclocal/openobex.m4
X at dirrm include/openobex
END-of-openobex/pkg-plist
echo c - openobex/files
mkdir -p openobex/files > /dev/null 2>&1
echo x - openobex/files/patch-src-obex.c
sed 's/^X//' >openobex/files/patch-src-obex.c << 'END-of-openobex/files/patch-src-obex.c'
X--- src/obex.c.orig	Mon Mar 22 18:16:53 2004
X+++ src/obex.c	Mon Mar 22 18:21:35 2004
X@@ -990,7 +990,11 @@
X 
X #ifdef HAVE_BLUETOOTH
X 	if(src == NULL)
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+		src = NG_HCI_BDADDR_ANY;
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 		src = BDADDR_ANY;
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 	btobex_prepare_listen(self, src, channel);
X 	return obex_transport_listen(self);
X #else
X@@ -1019,7 +1023,11 @@
X 
X #ifdef HAVE_BLUETOOTH
X 	if(src == NULL)
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+		src = NG_HCI_BDADDR_ANY;
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 		src = BDADDR_ANY;
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 	btobex_prepare_connect(self, src, dst, channel);
X 	return obex_transport_connect_request(self);
X #else
END-of-openobex/files/patch-src-obex.c
echo x - openobex/files/patch-aclocal.m4
sed 's/^X//' >openobex/files/patch-aclocal.m4 << 'END-of-openobex/files/patch-aclocal.m4'
X--- aclocal.m4.orig	Mon Mar 22 16:19:39 2004
X+++ aclocal.m4	Mon Mar 22 16:22:51 2004
X@@ -67,6 +67,35 @@
X 	BLUETOOTH_HOOK([],failure)
X ])
X 
X+dnl adding a check for FreeBSD blutooth netgraph support.
X+
X+AC_DEFUN([FREEBSD_BLUETOOTH_HOOK],[
X+	AC_MSG_CHECKING([for the FreeBSD/netgraph bluetooth support])
X+	echo
X+	AC_CACHE_CHECK(for the struct sockaddr_rfcomm in <netgraph/.../ng_btsocket.h>, ac_cv_have_sockaddr_rfcomm,
X+	[AC_TRY_COMPILE([#include <sys/types.h>
X+			#include <sys/socket.h>
X+			#include <bitstring.h>
X+			#include <netgraph/bluetooth/include/ng_hci.h>
X+			#include <netgraph/bluetooth/include/ng_l2cap.h>
X+			#include <netgraph/bluetooth/include/ng_btsocket.h>],
X+		[struct sockaddr_rfcomm rc;],
X+		ac_cv_have_sockaddr_rfcomm=yes,
X+		ac_cv_have_sockaddr_rfcomm=no)])
X+
X+	if test $ac_cv_have_sockaddr_rfcomm = yes; then
X+		AC_DEFINE(HAVE_BLUETOOTH)
X+		AC_DEFINE(HAVE_BLUETOOTH_NETGRAPH,1,[Compile on FreeBSD])
X+		USE_BLUETOOTH="yes"
X+		AC_CHECK_LIB(bluetooth, bt_aton,
X+		    [LIBS="$LIBS -lbluetooth" AC_DEFINE(HAVE_BT_ATON,1,[Define to 1 if you have the \`bt_aton' function.])])
X+	fi
X+])
X+
X+AC_DEFUN([FREEBSD_BLUETOOTH_CHECK], [
X+	FREEBSD_BLUETOOTH_HOOK([],failure)
X+])
X+
X # Do all the work for Automake.  This macro actually does too much --
X # some checks are only needed if your package does certain things.
X # But this isn't really a big deal.
END-of-openobex/files/patch-aclocal.m4
echo x - openobex/files/patch-configure.in
sed 's/^X//' >openobex/files/patch-configure.in << 'END-of-openobex/files/patch-configure.in'
X--- configure.in.orig	Sun Mar  7 17:07:07 2004
X+++ configure.in	Sun Mar  7 17:07:20 2004
X@@ -39,6 +39,7 @@
X 
X IRDA_CHECK
X BLUETOOTH_CHECK
X+FREEBSD_BLUETOOTH_CHECK
X 
X dnl Configure debug facilities
X AC_ARG_WITH(debug,[  --with-debug=level      Debug level],
END-of-openobex/files/patch-configure.in
echo x - openobex/files/patch-src-obex_transport.h
sed 's/^X//' >openobex/files/patch-src-obex_transport.h << 'END-of-openobex/files/patch-src-obex_transport.h'
X--- src/obex_transport.h.orig	Mon Mar 22 18:02:08 2004
X+++ src/obex_transport.h	Mon Mar 22 18:05:08 2004
X@@ -40,8 +40,12 @@
X #include "irda_wrap.h"
X #endif /*HAVE_IRDA*/
X #ifdef HAVE_BLUETOOTH
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+#include <bluetooth.h>
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X #include <bluetooth/bluetooth.h>
X #include <bluetooth/rfcomm.h>
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X #endif /*HAVE_BLUETOOTH*/
X 
X #include "obex_main.h"
X@@ -52,7 +56,11 @@
X #endif /*HAVE_IRDA*/
X 	struct sockaddr_in   inet;
X #ifdef HAVE_BLUETOOTH
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	struct sockaddr_rfcomm   rfcomm;
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	struct sockaddr_rc   rfcomm;
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X #endif /*HAVE_BLUETOOTH*/
X } saddr_t;
X 
X@@ -76,7 +84,4 @@
X int obex_transport_read(obex_t *self, int count, uint8_t *buf, int buflen);
X 
X 
X-#endif OBEX_TRANSPORT_H
X-
X-
X-
X+#endif /*OBEX_TRANSPORT_H*/
END-of-openobex/files/patch-src-obex_transport.h
echo x - openobex/files/patch-src-obex_main.c
sed 's/^X//' >openobex/files/patch-src-obex_main.c << 'END-of-openobex/files/patch-src-obex_main.c'
X--- src/obex_main.c.orig	Mon Mar 22 18:25:05 2004
X+++ src/obex_main.c	Mon Mar 22 18:27:55 2004
X@@ -46,7 +46,11 @@
X #include <stdio.h>
X 
X #ifdef HAVE_BLUETOOTH
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+#include <bluetooth.h>
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X #include <bluetooth/bluetooth.h>
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X #endif /*HAVE_BLUETOOTH*/
X 
X #endif /* _WIN32 */
X@@ -79,7 +83,11 @@
X 
X #ifdef HAVE_BLUETOOTH
X 	if (domain == AF_BLUETOOTH)
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+		proto = BLUETOOTH_PROTO_RFCOMM;
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 		proto = BTPROTO_RFCOMM;
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X #endif /*HAVE_BLUETOOTH*/
X 
X 	fd = socket(domain, SOCK_STREAM, proto);
END-of-openobex/files/patch-src-obex_main.c
echo x - openobex/files/patch-src-btobex.c
sed 's/^X//' >openobex/files/patch-src-btobex.c << 'END-of-openobex/files/patch-src-btobex.c'
X--- src/btobex.c.orig	Mon Mar 22 18:31:43 2004
X+++ src/btobex.c	Mon Mar 22 18:44:46 2004
X@@ -46,8 +46,12 @@
X #include <netinet/in.h>
X #include <sys/socket.h>
X 
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+#include <bluetooth.h>
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X #include <bluetooth/bluetooth.h>
X #include <bluetooth/rfcomm.h>
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 
X #endif /* _WIN32 */
X 
X@@ -65,6 +69,15 @@
X void btobex_prepare_connect(obex_t *self, bdaddr_t *src, bdaddr_t *dst, uint8_t channel)
X {
X #ifndef _WIN32
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	self->trans.self.rfcomm.rfcomm_family = AF_BLUETOOTH;
X+	bacpy(&self->trans.self.rfcomm.rfcomm_bdaddr, src);
X+	self->trans.self.rfcomm.rfcomm_channel = 0;
X+
X+	self->trans.peer.rfcomm.rfcomm_family = AF_BLUETOOTH;
X+	bacpy(&self->trans.peer.rfcomm.rfcomm_bdaddr, dst);
X+	self->trans.peer.rfcomm.rfcomm_channel = channel;
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	self->trans.self.rfcomm.rc_family = AF_BLUETOOTH;
X 	bacpy(&self->trans.self.rfcomm.rc_bdaddr, src);
X 	self->trans.self.rfcomm.rc_channel = 0;
X@@ -72,6 +85,7 @@
X 	self->trans.peer.rfcomm.rc_family = AF_BLUETOOTH;
X 	bacpy(&self->trans.peer.rfcomm.rc_bdaddr, dst);
X 	self->trans.peer.rfcomm.rc_channel = channel;
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X #endif /* _WIN32 */
X }
X 
X@@ -85,9 +99,15 @@
X {
X #ifndef _WIN32
X 	/* Bind local service */
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	self->trans.self.rfcomm.rfcomm_family = AF_BLUETOOTH;
X+	bacpy(&self->trans.self.rfcomm.rfcomm_bdaddr, src);
X+	self->trans.self.rfcomm.rfcomm_channel = channel;
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	self->trans.self.rfcomm.rc_family = AF_BLUETOOTH;
X 	bacpy(&self->trans.self.rfcomm.rc_bdaddr, src);
X 	self->trans.self.rfcomm.rc_channel = channel;
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X #endif /* _WIN32 */
X }
X 
X@@ -108,9 +128,15 @@
X 		return -1;
X 	}
X 	
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm, 
X+		 sizeof(struct sockaddr_rfcomm)))
X+	{
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm, 
X 		 sizeof(struct sockaddr_rc)))
X 	{
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 		DEBUG(0, "Error doing bind\n");
X 		goto out_freesock;
X 	}
X@@ -142,7 +168,11 @@
X int btobex_accept(obex_t *self)
X {
X #ifndef _WIN32
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	int addrlen = sizeof(struct sockaddr_rfcomm);
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	int addrlen = sizeof(struct sockaddr_rc);
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 	//int mtu;
X 	//int len = sizeof(int);
X 
X@@ -180,16 +210,26 @@
X 			return -1;
X 	}
X 
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm,
X+		   sizeof(struct sockaddr_rfcomm));
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	ret = bind(self->fd, (struct sockaddr*) &self->trans.self.rfcomm,
X 		   sizeof(struct sockaddr_rc));
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 
X 	if (ret < 0) {
X 		DEBUG(4, "ret=%d\n", ret);
X 		goto out_freesock;
X 	}
X 
X+#ifdef HAVE_BLUETOOTH_NETGRAPH
X+	ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm,
X+		      sizeof(struct sockaddr_rfcomm));
X+#else /*HAVE_BLUETOOTH_NETGRAPH*/
X 	ret = connect(self->fd, (struct sockaddr*) &self->trans.peer.rfcomm,
X 		      sizeof(struct sockaddr_rc));
X+#endif /*HAVE_BLUETOOTH_NETGRAPH*/
X 	if (ret < 0) {
X 		DEBUG(4, "ret=%d\n", ret);
X 		goto out_freesock;
END-of-openobex/files/patch-src-btobex.c
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list