Add stun server and client
git-svn-id: svn://svn.openwrt.org/openwrt/packages@14206 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
191febd43c
commit
64101f661c
83
net/stun/Makefile
Normal file
83
net/stun/Makefile
Normal file
@ -0,0 +1,83 @@
|
||||
#
|
||||
# Copyright (C) 2008 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=stund
|
||||
PKG_VERSION:=0.96
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)_Aug13.tgz
|
||||
PKG_SOURCE_URL:=@SF/stun
|
||||
PKG_MD5SUM:=3273abb1a6f299f4e611b658304faefa
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/stun/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+uclibcxx
|
||||
URL:=http://sourceforge.net/projects/stun
|
||||
endef
|
||||
|
||||
define Package/stun/Default/description
|
||||
The STUN protocol (Simple Traversal of UDP through NATs) is described in the
|
||||
IETF RFC 3489, available at http://www.ietf.org/rfc/rfc3489.txt. It's used to
|
||||
help clients behind NAT to tunnel incoming calls through. This server is the
|
||||
counterpart to help the client identify the NAT and have it open the proper
|
||||
ports for it.
|
||||
endef
|
||||
|
||||
define Package/stund
|
||||
$(call Package/stun/Default)
|
||||
TITLE:=STUN server
|
||||
endef
|
||||
|
||||
define Package/stund/description
|
||||
$(call Package/stun/Default/description)
|
||||
endef
|
||||
|
||||
define Package/stun-client
|
||||
$(call Package/stun/Default)
|
||||
TITLE:=STUN test client
|
||||
endef
|
||||
|
||||
define Package/stun-client/description
|
||||
$(call Package/stun/Default/description)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CXX="$(TARGET_CXX)" \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
CXXFLAGS="$$$$CXXFLAGS -fno-builtin -fno-rtti -nostdinc++" \
|
||||
CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/uClibc++ -I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
|
||||
LDFLAGS="$$$$LDFLAGS -L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib -L$(TOOLCHAIN_DIR)/usr/lib \
|
||||
-nodefaultlibs -luClibc++ -lgcc" \
|
||||
all
|
||||
endef
|
||||
|
||||
|
||||
define Package/stund/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/server $(1)/usr/sbin/stund
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/stund.init $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/stund.config $(1)/etc/config/stund
|
||||
endef
|
||||
|
||||
define Package/stun-client/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/client $(1)/usr/sbin/stun-client
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,stund))
|
||||
$(eval $(call BuildPackage,stun-client))
|
5
net/stun/files/stund.config
Normal file
5
net/stun/files/stund.config
Normal file
@ -0,0 +1,5 @@
|
||||
config stund
|
||||
option primaryip ''
|
||||
option secondaryip ''
|
||||
option primaryport '3478'
|
||||
option secondaryport '3479'
|
18
net/stun/files/stund.init
Normal file
18
net/stun/files/stund.init
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2009 OpenWrt.org
|
||||
START=70
|
||||
|
||||
start() {
|
||||
config_load "6stund"
|
||||
|
||||
config_get PRIMIP primaryip
|
||||
config_get SECIP secondaryip
|
||||
config_get PRIMPORT primaryport
|
||||
config_get SECPORT secondaryport
|
||||
|
||||
/usr/sbin/stund -b -h $PRIMIP -a $SECIP -p $PRIMPORT -o $SECPORT
|
||||
}
|
||||
|
||||
stop() {
|
||||
killall -9 stund
|
||||
}
|
27
net/stun/patches/001-fix_non_i386.patch
Normal file
27
net/stun/patches/001-fix_non_i386.patch
Normal file
@ -0,0 +1,27 @@
|
||||
#! /bin/sh /usr/share/dpatch/dpatch-run
|
||||
## fix_non_i386.dpatch by Kilian Krause <kilian@debian.org>
|
||||
##
|
||||
## All lines beginning with `## DP:' are a description of the patch.
|
||||
## DP: Remove i386-only code analogous to twinkle
|
||||
@DPATCH@
|
||||
diff -urNad stun-0.96~/stun.cxx stun-0.96/stun.cxx
|
||||
--- stun-0.96~/stun.cxx 2005-08-14 00:39:03.000000000 +0000
|
||||
+++ stun-0.96/stun.cxx 2006-01-03 00:54:33.000000000 +0000
|
||||
@@ -669,16 +669,8 @@
|
||||
tick = hightick;
|
||||
tick <<= 32;
|
||||
tick |= lowtick;
|
||||
-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
|
||||
- asm("rdtsc" : "=A" (tick));
|
||||
-#elif defined (__SUNPRO_CC) || defined( __sparc__ )
|
||||
- tick = gethrtime();
|
||||
-#elif defined(__MACH__)
|
||||
- int fd=open("/dev/random",O_RDONLY);
|
||||
- read(fd,&tick,sizeof(tick));
|
||||
- closesocket(fd);
|
||||
#else
|
||||
-# error Need some way to seed the random number generator
|
||||
+ tick = time(NULL);
|
||||
#endif
|
||||
int seed = int(tick);
|
||||
#ifdef WIN32
|
Loading…
x
Reference in New Issue
Block a user