Browse Source

wanpipe-3.2.2.tgz

master
Harald Welte 8 months ago
parent
commit
d814cbc161
  1. 58
      ChangeLog.stable
  2. 34
      Makefile
  3. 225
      Makefile.old
  4. 253
      Setup
  5. 2
      api/Makefile
  6. 10
      api/aft/Makefile
  7. BIN
      api/aft/aft_api
  8. 6
      api/aft/aft_api.c
  9. BIN
      api/aft/aft_api_events
  10. 8
      api/aft/aft_api_events.c
  11. BIN
      api/aft/aft_echo
  12. 316
      api/aft/aft_echo.c
  13. BIN
      api/aft/aft_integrity
  14. 421
      api/aft/aft_integrity.c
  15. BIN
      api/chdlc/chdlc_echo
  16. BIN
      api/lib/hdlc/wanpipe_hdlc.o
  17. 18
      api/lib/lib_api.c
  18. 18
      api/lib/lib_api.h
  19. 88
      api/libsangoma/.deps/libsangoma_la-libsangoma.Plo
  20. 2
      api/libsangoma/Makefile
  21. 9
      api/libsangoma/config.log
  22. 8
      api/libsangoma/config.status
  23. 22
      api/libsangoma/libsangoma.c
  24. 6
      api/tdmapi/Makefile
  25. BIN
      api/tdmapi/aft_tdm_hdlc_test
  26. BIN
      api/tdmapi/aft_tdm_voice_api
  27. 2
      api/tdmapi/aft_tdm_voice_api.c
  28. BIN
      api/tdmapi/aft_tdm_voice_api_dtmf
  29. 254
      api/tdmapi/aft_tdm_voice_api_dtmf.c
  30. BIN
      api/tdmapi/aft_tdm_voice_api_rbs
  31. 2
      api/tdmapi/aft_tdm_voice_api_rbs.c
  32. BIN
      api/tdmapi/aft_tdm_voice_api_rm_dtmf
  33. 445
      api/tdmapi/aft_tdm_voice_api_rm_dtmf.c
  34. BIN
      api/tdmapi/aft_tdm_voice_api_rxhook
  35. 448
      api/tdmapi/aft_tdm_voice_api_rxhook.c
  36. 1
      api/wanec_apilib
  37. 2
      deb_control/wanpipe.deb
  38. 9
      kbuild/Makefile
  39. 14
      kbuild/Makefile.wanec
  40. 8
      patches/copy_modules.sh
  41. 16
      patches/kdrivers/include/sdla_aft_te1.h
  42. 4
      patches/kdrivers/include/sdla_front_end.h
  43. 22
      patches/kdrivers/include/sdla_te1.h
  44. 16
      patches/kdrivers/include/sdla_te1_ds.h
  45. 8
      patches/kdrivers/include/sdlasfm.h
  46. 4
      patches/kdrivers/include/wanpipe.h
  47. 1
      patches/kdrivers/include/wanpipe_cfg.h
  48. 5
      patches/kdrivers/include/wanpipe_common.h
  49. 2431
      patches/kdrivers/include/wanpipe_common.h~
  50. 4
      patches/kdrivers/include/wanpipe_debug.h
  51. 4
      patches/kdrivers/include/wanpipe_defines.h
  52. 2
      patches/kdrivers/include/wanpipe_lip.h
  53. 684
      patches/kdrivers/include/wanpipe_lip.h~
  54. 6
      patches/kdrivers/include/wanpipe_version.h
  55. 2
      patches/kdrivers/include/wanrouter.h
  56. 1
      patches/kdrivers/src/lip/wanpipe_lip_bh.c
  57. 237
      patches/kdrivers/src/lip/wanpipe_lip_bh.c~
  58. 3
      patches/kdrivers/src/lip/wanpipe_lip_iface.c
  59. 1538
      patches/kdrivers/src/lip/wanpipe_lip_iface.c~
  60. 612
      patches/kdrivers/src/lip/wanpipe_lip_netdev.c~
  61. 5
      patches/kdrivers/src/net/Makefile
  62. 62
      patches/kdrivers/src/net/Module.symvers
  63. 8
      patches/kdrivers/src/net/aft_a104.c
  64. 642
      patches/kdrivers/src/net/sdla_8te1.c
  65. 46
      patches/kdrivers/src/net/sdla_aft_te1.c
  66. 10971
      patches/kdrivers/src/net/sdla_aft_te1.c~
  67. 3
      patches/kdrivers/src/net/sdla_aft_te3.c
  68. 15
      patches/kdrivers/src/net/sdla_bitstrm.c
  69. 15
      patches/kdrivers/src/net/sdla_chdlc.c
  70. 11
      patches/kdrivers/src/net/sdla_fr.c
  71. 10
      patches/kdrivers/src/net/sdla_ppp.c
  72. 99
      patches/kdrivers/src/net/sdla_tdmv.c
  73. 2409
      patches/kdrivers/src/net/sdla_tdmv.c~
  74. 40
      patches/kdrivers/src/net/sdla_te1.c
  75. 76
      patches/kdrivers/src/net/sdla_xilinx.c
  76. 32
      patches/kdrivers/src/net/sdladrv.c
  77. 8
      patches/kdrivers/src/net/sdladrv_fe.c
  78. 13
      patches/kdrivers/src/net/wanpipe_multppp.c
  79. BIN
      patches/kdrivers/src/wan_aften/wan_aften_src.o
  80. BIN
      patches/kdrivers/src/wan_aften/wanpipe_linux_iface.o
  81. 157
      patches/kdrivers/src/wanrouter/.af_wanpipe_src.o.d
  82. BIN
      patches/kdrivers/src/wanrouter/af_wanpipe_datascope.o
  83. BIN
      patches/kdrivers/src/wanrouter/af_wanpipe_src.o
  84. BIN
      patches/kdrivers/src/wanrouter/waniface.o
  85. BIN
      patches/kdrivers/src/wanrouter/wanmain.o
  86. BIN
      patches/kdrivers/src/wanrouter/wanproc.o
  87. 4
      patches/kdrivers/wanec/.tmp_versions/wanec.mod
  88. 14
      patches/kdrivers/wanec/Makefile.Kbuild.Linux
  89. 28
      patches/kdrivers/wanec/modinfo/wanec.mod.c
  90. 2
      patches/kdrivers/wanec/wanec.mod.c
  91. 15
      patches/kdrivers/wanec/wanec_cmd.c
  92. 19
      patches/sangoma-zaptel-patch.sh
  93. 110
      rpmspec/wanpipe-mod.spec
  94. 116
      rpmspec/wanpipe-util.spec
  95. 117
      rpmspec/wanpipe.spec
  96. 1007
      samples/diff
  97. 24
      samples/wanrouter
  98. 2986
      samples/wanrouter.org
  99. 56
      ssmg/sangoma_mgd.trunk/.svn/all-wcprops
  100. 100
      ssmg/sangoma_mgd.trunk/.svn/entries
  101. Some files were not shown because too many files have changed in this diff Show More

58
ChangeLog.stable

@ -4,9 +4,65 @@ WANPIPE
Linux Voice TDM/WAN Router Package
------------------------------------------------------------------------------
Author: Nenad Corbic <ncorbic@sangoma.com>
Copyright (c) 1995-2007 Sangoma Technologies Inc.
Copyright (c) 1995-2008 Sangoma Technologies Inc.
------------------------------------------------------------------------------
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2
========================================================================
- AFT Maxim Front end update
Implemented graceful recovery on short circuit.
- AFT Driver update
Added a check for TDM IRQ timeout.
On some machines its possible for TDM IRQ to timeout.
- SMG updated
Fixed wancfg_smg
MTU not properly set on ports 2 and up
Voice only ports were not being added to startup sequence
Updated for callweaver
- Added Zaptel 1.4 HW HDLC Support
No Sangoma zaptel patch needed with Zaptel 1.4
- Added HWEC Noise flag in wanpipe config file
- Updated SMG
- Updated E1 Unframed on Maxim Cards
- Updates for AFT PMC and MAXIM framers
PMC - lowered LOS sensitivity
Fixes fake up/down state changes on
started inactive lines.
MAXIM - lowered sensistivy
Fixes cable cross talk on 8 port cards.
- Enabled Unframed E1
- Enabled Tri-State Mode
- Fixed loopback commands
- Fixed HWEC_PERSIST_DISABLE
This option was broken in previous release
This option lets Asterisk control HWEC
on each call start/stop.
By default all hwec channels are enabled on
device startup.
- Updated SMG/SS7
- Updated loopback commands for AFT Maxim cards
- Updated for AstLinux
The make file can now build all WAN and Voice Protocols
- Fixed add_timer warnings for ALL AFT cards
Caused when a port is left in unconnected state.
- Updated legacy protocols for new front end architecture
- Updated Setup script
* Wed Oct 6 2007 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.1
=====================================================================

34
Makefile

@ -59,19 +59,25 @@ EXTRA_UTIL_FLAGS = -I$(PWD)/$(WINCLUDE) -I$(KDIR)/include/ -I$(INSTALLPREFIX)/in
EXTRA_UTIL_FLAGS += -I$(PWD)/patches/kdrivers/wanec -I$(PWD)/patches/kdrivers/wanec/oct6100_api/include
ENABLE_WANPIPEMON_ZAP=NO
ZAPHDLC_PRIV=/etc/wanpipe/.zaphdlc
RM = @rm -rf
JUNK = *~ *.bak DEADJOE
#Check if zaptel exists
ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
ZAPDIR_PRIV=$(ZAPDIR)
ENABLE_WANPIPEMON_ZAP=YES
EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
ZAP_OPTS= --zaptel-path=$(ZAPDIR)
ZAP_PROT=TDM
else
ZAP_OPTS=
ZAP_PROT=
ZAPDIR_PRIV=
ENABLE_WANPIPEMON_ZAP=NO
endif
RM = @rm -rf
JUNK = *~ *.bak DEADJOE
# First pass, kernel Makefile reads module objects
@ -83,11 +89,25 @@ else
#This will check for zaptel, kenrel source and build utilites and kernel modules
#within local directory structure
all: _checkzap _checksrc all_util all_kmod
#Build with all binaries
all: _checkzap _checksrc all_bin_kmod all_util
#Build only source (NO WAN protocols)
all_src: _checkzap _checksrc all_kmod all_util
#Build only kernel modules
all_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(WAN_DIR) EXTRA_FLAGS="$(EXTRA_CFLAGS) $(shell cat ./patches/kfeatures)" ZAPDIR=$(ZAPDIR_PRIV) HOMEDIR=$(PWD) modules
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(WAN_DIR) EXTRA_FLAGS="$(EXTRA_CFLAGS) $(shell cat ./patches/kfeatures)" ZAPDIR=$(ZAPDIR_PRIV) ZAPHDLC=$(ZAPHDLC_PRIV) HOMEDIR=$(PWD) modules
all_bin_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver
@if [ -e $(PWD)/ast_build_dir ]; then \
rm -rf $(PWD)/ast_build_dir; \
fi
@mkdir -p $(PWD)/ast_build_dir
./Setup drivers --builddir=$(PWD)/ast_build_dir --with-linux=$(KDIR) $(ZAP_OPTS) --usr-cc=$(CC) --protocol=DEF-$(ZAP_PROT) --no-zaptel-compile --noautostart --arch=$(ARCH) --silent
@eval "./patches/copy_modules.sh $(PWD)/ast_build_dir $(WAN_DIR)"
#Clean utilites and kernel modules
@ -163,11 +183,13 @@ install_kmod:
install -m 644 -D $(WAN_DIR)/sdladrv.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/sdladrv.${MODTYPE}
install -m 644 -D $(WAN_DIR)/wanpipe.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe.${MODTYPE}
@rm -f $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}
@if [ -f $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} ]; then \
@if [ -e $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} ]; then \
echo "install -m 644 -D $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}"; \
install -m 644 -D $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}; \
fi
@rm -f $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE};
@if [ -f $(WAN_DIR)/wanpipe_lip.${MODTYPE} ]; then \
@if [ -e $(WAN_DIR)/wanpipe_lip.${MODTYPE} ]; then \
echo "install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}"; \
install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}; \
fi
@eval "./patches/rundepmod.sh"

225
Makefile.old

@ -0,0 +1,225 @@
#
# Makefile WANPIPE WAN Router Installation/Removal Makefile
#
# Copyright (c) 2007, Sangoma Technologies Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
# ----------------------------------------------------------------------------
# Author: Nenad Corbic <ncorbic@sangoma.com>
#
PWD=$(shell pwd)
KBUILD_VERBOSE=0
#Default zaptel directory to be overwritten by user
ifndef ZAPDIR
ZAPDIR=/usr/src/zaptel
endif
#Kernel version and location
ifndef KVER
KVER=$(shell uname -r)
endif
ifndef KMOD
KMOD=/lib/modules/$(KVER)
endif
ifndef KDIR
KDIR=$(KMOD)/build
endif
ifndef KINSTDIR
KINSTDIR=$(KMOD)/kernel
endif
ifndef ARCH
ARCH=$(shell uname -m)
endif
INSTALLPREFIX=
#Local wanpipe includes
WINCLUDE=patches/kdrivers/include
HWECINC=patches/kdrivers/wanec/oct6100_api
KMODDIR=patches/kdrivers
#Location of wanpipe source in release
WAN_DIR=$(PWD)/$(KMODDIR)/src/net
WANEC_DIR=$(PWD)/$(KMODDIR)/wanec
MODTYPE=ko
#Setup include path and extra cflags
EXTRA_CFLAGS := -I$(PWD)/$(WINCLUDE) -I$(PWD)/$(WINCLUDE)/annexg -I$(PWD)/patches/kdrivers/wanec -D__LINUX__
EXTRA_CFLAGS += -I$(WANEC_DIR) -I$(WANEC_DIR)/oct6100_api -I$(WANEC_DIR)/oct6100_api/include
EXTRA_CFLAGS += -I$(KDIR)/include/linux -I$(ZAPDIR)
#Setup utility extra flags and include path
EXTRA_UTIL_FLAGS = -I$(PWD)/$(WINCLUDE) -I$(KDIR)/include/ -I$(INSTALLPREFIX)/include -I$(INSTALLPREFIX)/usr/include
EXTRA_UTIL_FLAGS += -I$(PWD)/patches/kdrivers/wanec -I$(PWD)/patches/kdrivers/wanec/oct6100_api/include
ENABLE_WANPIPEMON_ZAP=NO
#Check if zaptel exists
ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
ZAPDIR_PRIV=$(ZAPDIR)
ENABLE_WANPIPEMON_ZAP=YES
EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
else
ZAPDIR_PRIV=
ENABLE_WANPIPEMON_ZAP=NO
endif
RM = @rm -rf
JUNK = *~ *.bak DEADJOE
# First pass, kernel Makefile reads module objects
ifneq ($(KERNELRELEASE),)
obj-m := sdladrv.o wanrouter.o wanpipe.o wanpipe_syncppp.o wanec.o
# Second pass, the actual build.
else
#This will check for zaptel, kenrel source and build utilites and kernel modules
#within local directory structure
all: _checkzap _checksrc all_util all_kmod
#Build only kernel modules
all_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver
$(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(WAN_DIR) EXTRA_FLAGS="$(EXTRA_CFLAGS) $(shell cat ./patches/kfeatures)" ZAPDIR=$(ZAPDIR_PRIV) HOMEDIR=$(PWD) modules
#Clean utilites and kernel modules
clean: clean_util _cleanoldwanpipe
$(MAKE) -C $(KDIR) SUBDIRS=$(WAN_DIR) clean
@find patches/kdrivers -name '.*.cmd' | xargs rm -f
#Clean old wanpipe headers from linux include
_cleanoldwanpipe: _checksrc
@eval "./patches/build_links.sh"
@eval "./patches/clean_old_wanpipe.sh $(WINCLUDE) $(KDIR)/include/linux"
#Check for linux headers
_checksrc:
@if [ ! -e $(KDIR) ]; then \
echo " Error linux headers/source not found: $(KDIR) !"; \
echo ; \
exit 1; \
fi
@if [ ! -e $(KDIR)/.config ]; then \
echo " Error linux headers/source not configured: missing $(KDIR)/.config !"; \
echo ; \
exit 1; \
fi
@if [ ! -e $(KDIR)/include ]; then \
echo " Error linux headers/source incomplete: missing $(KDIR)/include dir !"; \
echo ; \
exit 1; \
fi
_check_kver:
@eval "./patches/kern_i_private_check.sh $(KDIR)"
@echo > ./patches/kfeatures;
@if [ -e ./patches/i_private_found ]; then \
echo "-DWANPIPE_USE_I_PRIVATE " >> ./patches/kfeatures; \
fi
#Check for zaptel
_checkzap:
@echo
@echo " +--------- Wanpipe Build Info --------------+"
@echo
@if [ ! -e $(ZAPDIR)/zaptel.h ]; then \
echo " Compiling Wanpipe without ZAPTEL Support!"; \
ZAPDIR_PRIV=; \
ENABLE_WANPIPEMON_ZAP=NO; \
else \
echo " Compiling Wanpipe with ZAPTEL Support!"; \
echo " Zaptel Dir: $(ZAPDIR)"; \
echo; \
eval "$(PWD)/patches/sangoma-zaptel-patch.sh $(ZAPDIR)"; \
ZAPDIR_PRIV=$(ZAPDIR); \
ENABLE_WANPIPEMON_ZAP=YES; \
echo ; \
echo "Please recompile and reinstall ZAPTEL after installation"; \
fi
@echo
@echo " +-------------------------------------------+"
@echo
@sleep 2;
#Install all utilities etc and modules
install: install_util install_etc install_kmod install_inc
#Install kernel modules only
install_kmod:
install -m 644 -D $(WAN_DIR)/wanrouter.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanrouter.${MODTYPE}
install -m 644 -D $(WAN_DIR)/af_wanpipe.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/af_wanpipe.${MODTYPE}
install -m 644 -D $(WAN_DIR)/wanec.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanec.${MODTYPE}
install -m 644 -D $(WAN_DIR)/wan_aften.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wan_aften.${MODTYPE}
install -m 644 -D $(WAN_DIR)/sdladrv.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/sdladrv.${MODTYPE}
install -m 644 -D $(WAN_DIR)/wanpipe.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe.${MODTYPE}
@rm -f $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}
@if [ -f $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} ]; then \
install -m 644 -D $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}; \
fi
@rm -f $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE};
@if [ -f $(WAN_DIR)/wanpipe_lip.${MODTYPE} ]; then \
install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}; \
fi
@eval "./patches/rundepmod.sh"
endif
#Compile utilities only
all_util:
$(MAKE) -C util all EXTRA_FLAGS="$(EXTRA_UTIL_FLAGS)" SYSINC="$(PWD)/$(WINCLUDE) -I $(PWD)/api/libsangoma/include" CC=$(CC) \
PREFIX=$(INSTALLPREFIX) HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" ARCH=$(ARCH)
$(MAKE) -C util all_wancfg EXTRA_FLAGS="$(EXTRA_UTIL_FLAGS)" SYSINC="$(PWD)/$(WINCLUDE) -I$(PWD)/api/libsangoma/include" CC=$(CC) \
PREFIX=$(INSTALLPREFIX) HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" HOSTCFLAGS="$(EXTRA_UTIL_FLAGS)" ARCH=$(ARCH)
#Clean utilities only
clean_util:
$(MAKE) -C util clean SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX)
#Install utilities only
install_util:
$(MAKE) -C util install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX)
#Install etc files
install_etc:
@if [ ! -e $(INSTALLPREFIX)/etc/wanpipe ]; then \
mkdir -p $(INSTALLPREFIX)/etc/wanpipe; \
fi
@if [ ! -e $(INSTALLPREFIX)/etc/wanpipe/wanrouter.rc ]; then \
install -D -m 644 samples/wanrouter.rc $(INSTALLPREFIX)/etc/wanpipe/wanrouter.rc; \
fi
@if [ ! -e $(INSTALLPREFIX)/etc/wanpipe/lib ]; then \
mkdir -p $(INSTALLPREFIX)/etc/wanpipe/lib; \
fi
@\cp -f util/wancfg_legacy/lib/* $(INSTALLPREFIX)/etc/wanpipe/lib/
@\cp -rf firmware $(INSTALLPREFIX)/etc/wanpipe/
@if [ ! -f $(INSTALLPREFIX)/etc/wanpipe/interfaces ]; then \
mkdir -p $(INSTALLPREFIX)/etc/wanpipe/interfaces; \
fi
@\cp -rf samples $(INSTALLPREFIX)/etc/wanpipe
@if [ ! -d $(INSTALLPREFIX)/etc/wanpipe/scripts ]; then \
mkdir -p $(INSTALLPREFIX)/etc/wanpipe/scripts; \
fi
@\cp -rf wan_ec $(INSTALLPREFIX)/etc/wanpipe/
@install -D -m 755 samples/wanrouter $(INSTALLPREFIX)/usr/sbin/wanrouter
@echo
@echo "Wanpipe etc installed in $(INSTALLPREFIX)/etc/wanpipe";
@echo
install_inc:
@if [ -e $(INSTALLPREFIX)/usr/include/wanpipe ]; then \
\rm -rf $(INSTALLPREFIX)/usr/include/wanpipe; \
fi
@\mkdir -p $(INSTALLPREFIX)/usr/include/wanpipe
@\cp -f $(PWD)/patches/kdrivers/include/*.h $(INSTALLPREFIX)/usr/include/wanpipe/
@\cp -rf $(PWD)/patches/kdrivers/wanec/oct6100_api/include/ $(INSTALLPREFIX)/usr/include/wanpipe/oct6100_api
@\cp -rf $(PWD)/patches/kdrivers/wanec/*.h $(INSTALLPREFIX)/usr/include/wanpipe/

253
Setup

@ -9,6 +9,7 @@
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
# ----------------------------------------------------------------------------
# Oct 26, 2007 Konrad Hammel Updated minor start script bug
# Nov 27, 2005 David Rokhvarg Added Echo Debugging option
# Mar 18, 2002 Nenad Corbic Added BSCSTRM protocol
# Mar 01, 2002 Nenad Corbic Added option to split rpm build into
@ -268,7 +269,7 @@ banner()
clearscr
echo -e "\t----------------------------------------------------------"
echo -e "\t WANPIPE v$PROD_VER Installation Script"
echo -e "\t Copyright (c) 1995-2007, Sangoma Technologies Inc."
echo -e "\t Copyright (c) 1995-2008, Sangoma Technologies Inc."
echo -e "\t----------------------------------------------------------"
echo ""
return 0
@ -538,8 +539,6 @@ prepare()
missing_packages=$missing_packages"libtermcap-devel "
fi
echo -n "Checking for yacc..."
echo -n "Checking for yacc..."
eval "type yacc 2> /dev/null > /dev/null"
if [ $? -eq 0 ]; then
@ -1456,7 +1455,7 @@ create_mataconf()
fi
if [ -f /etc/wanpipe/wanrouter.rc ]; then
if [ -f $ROOT/etc/wanpipe/wanrouter.rc ]; then
. /etc/wanpipe/wanrouter.rc
fi
@ -1570,7 +1569,60 @@ ENDOFTEXT
# ----------------------------------------------------------------------------
# Install initialization scripts.
# ----------------------------------------------------------------------------
install_init()
{
if [ "$PKG_NAME" = "wanpipe-lite" ]; then
return 0
fi
if [ $NO_AUTO_START -eq 1 ]; then
return 0;
fi
banner
cat << ENDOFTEXT
WANPIPE BOOTSTRAP CONFIGURATION
Your system uses System V -style initialization scripts. You have an option
to add router start-up script to those scripts so that the router will start
automatically when system enters multi-user mode and shut down when it enters
single-user mode or when it is halted.
i.e. By selecting this option WANPIPE will startup on system bootup and
stop on system shutdown.
ENDOFTEXT
getyn "Would you like to install WANPIPE start-up scripts?" || return 0
cd $PROD_HOME/util/wancfg_zaptel
eval "./wancfg_zaptel.pl --silent --install_boot_script"
if [ $? -ne 0 ]; then
echo "Failed to install boot scripts"
fi
if [ "$TDM_PROT" = "YES" ]; then
getyn "Would you like to auto-execute ztcfg after wanrouter start?" || return 0
if [ ! -d $WAN_CONF_DIR/scripts ]; then
eval "\mkdir -p $WAN_CONF_DIR/scripts >/dev/null 2>/dev/null"
fi
eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $WAN_CONF_DIR/scripts/start > /dev/null 2> /dev/null"
if [ ! -f $WAN_CONF_DIR/scripts/start ]; then
echo "Error: Could not copy auto-ztcfg script"
fi
fi
cd $PROD_HOME
}
# ----------------------------------------------------------------------------
# Old Install initialization scripts.
# ----------------------------------------------------------------------------
install_init_old()
{
if [ "$PKG_NAME" = "wanpipe-lite" ]; then
return 0
@ -1642,8 +1694,8 @@ ENDOFTEXT
getyn "Would you like to auto-execute ztcfg after wanrouter start?" || return 0
if [ ! -d $WAN_CONF_DIR/scripts ]; then
eval "\mkdir -p $WAN_CONF_DIR/scripts >/dev/null 2>/dev/null"
fi
eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $WAN_CONF_DIR/scripts/start >/dev/null 2>/dev/null"
fi
eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $WAN_CONF_DIR/scripts/start > /dev/null 2> /dev/null"
if [ ! -f $WAN_CONF_DIR/scripts/start ]; then
echo "Error: Could not copy auto-ztcfg script"
fi
@ -1922,8 +1974,15 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
cd $PROD_HOME/api
if [ $superuser = "YES" ] && [ -z $ROOT ]; then
eval "find /usr/local/lib -name 'libsangoma*' > /dev/null 2>/dev/null"
if [ $? -eq 0 ]; then
eval "find /usr/local/lib -name 'libsangoma*' | xargs rm > /dev/null 2>/dev/null"
fi
fi
cd libsangoma
eval "./configure --prefix=$ROOT/usr/include >> $CMP_LOG 2>> $CMP_LOG"
eval "./configure --prefix=$ROOT/usr >> $CMP_LOG 2>> $CMP_LOG"
eval "make clean >> $CMP_LOG 2>> $CMP_LOG"
eval "make CC=$CC SYSINC=$SOURCEDIR/include >> $CMP_LOG 2>> $CMP_LOG"
if [ $? -eq 0 ]; then
@ -1934,33 +1993,10 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
fi
eval "make install >> $CMP_LOG 2>> $CMP_LOG"
if [ $superuser = "YES" ] && [ -z $ROOT ]; then
eval "ldconfig > /dev/null 2> /dev/null"
fi
if [ $superuser = "YES" ]; then
if [ -d /etc/ld.so.conf.d ]; then
if [ ! -e $ROOT/etc/ld.so.conf.d/ ]; then
\mkdir -p $ROOT/etc/ld.so.conf.d/
fi
\cp -f libsangoma.so.conf $ROOT/etc/ld.so.conf.d/
if [ $superuser = "YES" ]; then
eval "ldconfig"
fi
elif [ -f /etc/ld.so.conf ]; then
if [ $superuser = "YES" ]; then
cat /etc/ld.so.conf libsangoma.so.conf > ldconf.$$
mv ldconf.$$ /etc/ld.so.conf
eval "ldconfig"
fi
else
echo
echo "Warning: LD Conf files not found in /etc directory"
echo "Please add /usr/local/lib to the LD_LIBRARY_PATH"
echo
eval "ldconfig"
pause
fi
fi
echo
echo -n "Compiling WANPIPE API Development Utilities ..."
@ -2240,12 +2276,12 @@ function build_kernel_module()
local_link=$local_link" $file.o "
done
echo "make MODULE_NAME=$modname OBJS=\"$ofiles\" CC=$CC KDIR=$SOURCEDIR \
echo "make MODULE_NAME=$modname OBJS=\"$ofiles\" SUBDIRS=$PWD CC=$CC KDIR=$SOURCEDIR \
EXTRA_CFLAGS=\"-D__LINUX__ $PROTOCOL_DEFINES $extra_flags \"" >> $CMP_BUILD
chmod 755 $CMP_BUILD
make MODULE_NAME=$modname OBJS="$ofiles" CC=$CC KBUILD_VERBOSE=$KBUILD_VERBOSE KDIR=$SOURCEDIR \
make MODULE_NAME=$modname OBJS="$ofiles" CC=$CC SUBDIRS=$PWD KBUILD_VERBOSE=$KBUILD_VERBOSE KDIR=$SOURCEDIR \
EXTRA_CFLAGS="-D__LINUX__ $PROTOCOL_DEFINES $extra_flags " >> $CMP_LOG 2>> $CMP_LOG
if [ $? -ne 0 ]; then
@ -2345,7 +2381,7 @@ function build_wanec_module ()
local files="wanec_iface wanec_cmd wanec_utils wanec_dev $BTDIR/octapi_bt0 $LARGMATHDIR/octapi_largmath $LLMANDIR/octapi_llman $OCTAPIMIDIR/oct6100_mask_interrupts $OCTAPIDIR/oct6100_adpcm_chan $OCTAPIDIR/oct6100_channel $OCTAPIDIR/oct6100_chip_open $OCTAPIDIR/oct6100_chip_stats $OCTAPIDIR/oct6100_conf_bridge $OCTAPIDIR/oct6100_debug $OCTAPIDIR/oct6100_events $OCTAPIDIR/oct6100_interrupts $OCTAPIDIR/oct6100_memory $OCTAPIDIR/oct6100_miscellaneous $OCTAPIDIR/oct6100_mixer $OCTAPIDIR/oct6100_phasing_tsst $OCTAPIDIR/oct6100_playout_buf $OCTAPIDIR/oct6100_remote_debug $OCTAPIDIR/oct6100_tlv $OCTAPIDIR/oct6100_tone_detection $OCTAPIDIR/oct6100_tsi_cnct $OCTAPIDIR/oct6100_tsst $OCTAPIDIR/oct6100_user "
eval "make clean > /dev/null 2> /dev/null"
eval "make SUBDIRS=$PWD clean >> $CMP_BUILD 2>> $CMP_BUILD"
if [ $KERN_VER -eq 24 ]; then
if [ -e wanectmp ]; then
@ -2496,10 +2532,10 @@ function select_compilation_mode()
3. TDM Voice (Zaptel) + WAN Protocol Support
4. SMG (SS7) (Default for Asterisk SMG/SS7 install)
4. SMG (SS7) (Default for Asterisk/CallWeaver SMG/SS7 install)
5. SMG (SS7) + TDM Voice (Zaptel)
Default for: Asterisk SS7 + PRI
Default for: Asterisk/CallWeaver SS7 + PRI
6. TDM API
Protocols: TDM API on AFT adapters:
@ -3197,6 +3233,13 @@ ENDOFTEXT
#Find out our processor type. This is needed to properly
#compile our modules.
echo -n "Checking current processor type ..."
if [ -e $SOURCEDIR/include/linux/autoconf.h ]; then
grep "CONFIG_ARCH \"" $SOURCEDIR/include/linux/autoconf.h > /dev/null
if [ $? -eq 0 ] ; then
ARCH=`grep "CONFIG_ARCH \"" $SOURCEDIR/include/linux/autoconf.h | cut -d '"' -f2`
fi
fi
if [ -z $ARCH ]; then
ARCH=`uname -m`
fi
@ -4371,94 +4414,49 @@ function install_ssmg ()
echo "Installing Sangoma Media Gateway Daemon..."
cd lib/libteletone/
eval "./configure; make clean; make; make install " > /dev/null
eval "./configure --prefix=$ROOT/usr; make clean; make CC=$CC; make install " > /dev/null
if [ $? -ne 0 ]; then
echo "FAILED"
return 1
fi
eval "ldconfig"
cd $PROD_HOME/$SSMG_DIR
# Let smg install script install SMG components
#=======================================================
# cd sangoma_mgd.trunk
#
# eval "make clean > /dev/null; make > /dev/null "
# if [ $? -ne 0 ]; then
# echo "FAILED"
# return 1
# fi
# eval "make install > /dev/null "
#
# echo "Installing Sangoma Media Gateway Daemon...DONE"
# eval "type asterisk > /dev/null 2> /dev/null"
# if [ $? -ne 0 ]; then
# echo "Error: Asterisk not installed!"
# echo "Please install Asterisk first then retry SSMG installation!"
# return 1
# fi
# echo
# echo "Installing Chan Woomera into Asterisk..."
# echo
# install_chan_woomera
# if [ $? -ne 0 ]; then
# echo "Error: Failed to install chan_woomera into Asterisk!"
# echo "Check that Asterisk is installed or Call Sangoma Tech Support"
# echo
# return 1
# fi
#=========================================================
if [ $superuser = "YES" ]; then
eval "ldconfig"
fi
cd $PROD_HOME/$SSMG_DIR
cd sangoma_mgd.trunk
if [ ! -f /etc/asterisk/woomera.conf ]; then
cp woomera.conf /etc/asterisk
fi
echo "Installing Chan Woomera into Asterisk...DONE"
echo
if [ ! -f /usr/sbin/smgss7_ctrl ]; then
cp smgss7_ctrl /usr/sbin/
fi
getyn "Add Woomera config in Asterisk Extensions and Iax Conf"
if [ $? -ne 0 ]; then
return 0;
fi
if [ -f /etc/asterisk/extensions.conf ]; then
eval "grep -i woomera /etc/asterisk/extensions.conf 2> /dev/null > /dev/null"
if [ -f $ROOT/etc/asterisk/extensions.conf ]; then
eval "grep -i woomera $ROOT/etc/asterisk/extensions.conf 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
cat /etc/asterisk/extensions.conf ./conf/woomera_ext.conf > conf.$$
mv conf.$$ /etc/asterisk/extensions.conf
cat $ROOT/etc/asterisk/extensions.conf ./conf/woomera_ext.conf > conf.$$
mv conf.$$ $ROOT/etc/asterisk/extensions.conf
echo "Asterisk extensions.conf file updated with woomera config"
else
echo "Asterisk extensions.conf already updated"
fi
else
echo "Warning: Asterisk extensions.conf file not found!"
fi
if [ -f /etc/asterisk/iax.conf ]; then
eval "grep -i ss7 /etc/asterisk/iax.conf 2> /dev/null > /dev/null"
if [ -f $ROOT/etc/asterisk/iax.conf ]; then
eval "grep -i ss7 $ROOT/etc/asterisk/iax.conf 2> /dev/null > /dev/null"
if [ $? -ne 0 ]; then
cat /etc/asterisk/iax.conf ./conf/woomera_iax.conf > conf.$$
mv conf.$$ /etc/asterisk/iax.conf
cat $ROOT/etc/asterisk/iax.conf ./conf/woomera_iax.conf > conf.$$
mv conf.$$ $ROOT/etc/asterisk/iax.conf
echo "Asterisk iax.conf file updated with ss7 guest config"
else
echo "Asterisk iax.conf already updated"
fi
else
echo "Warning: Asterisk extensions.conf file not found!"
fi
pause
return 0
@ -4512,6 +4510,7 @@ function install_all ()
echo "Installing sample api code in $ROOT/etc/wanpipe/api"
\cp -rf api $ROOT/etc/wanpipe
\cp -rf samples $ROOT/etc/wanpipe
\cp -rf util/wanec_apilib /etc/wanpipe/api
if [ ! -d $ROOT/etc/wanpipe/scripts ]; then
@ -5374,8 +5373,13 @@ function find_zap_dirs ()
echo
echo "Looking for zaptel directory in /usr/src ..."
echo "-------------------------------------------"
if [ "$zapdirs" = "" ]; then
zapdirs=`find /usr/src -maxdepth 2 -name 'zaptel*' | xargs `
if [ -d "/usr/src/zaptel" ]; then
zapdirs="/usr/src/zaptel "$zapdirs
fi
fi
unset zapdir_array;
@ -5383,7 +5387,6 @@ function find_zap_dirs ()
if [ -f $PROD_HOME/zaptel/zaptel.path ]; then
zapextradir=`cat $PROD_HOME/zaptel/zaptel.path`
fi
cnt=1
for dir in $zapdirs
do
@ -5391,7 +5394,11 @@ function find_zap_dirs ()
continue
fi
if [ ! -f $dir/zaptel.h ]; then
if [ ! -f $dir/zaptel.h ];then
continue;
fi
if [ "$dir" = "/usr/src/zaptel" ] && [ $cnt -ne 1 ]; then
continue;
fi
@ -5401,6 +5408,7 @@ function find_zap_dirs ()
cnt=$((cnt+1))
done
if [ $cnt -eq 1 ]; then
echo
echo "No zaptel dirs found in /usr/src "
@ -5432,7 +5440,8 @@ function find_zap_dirs ()
# echo "d2: Download Latest 1.2"
# echo "d4: Download Latest 1.4"
echo "(ctrl-c to Exit)"
echo -n "Please select working zaptel directory [1-9][m]: "
echo -n "Please select working zaptel directory [1-$((cnt-1))][m]: "
response=1
@ -5859,13 +5868,28 @@ ENDOFTEXT
fi
eval "grep ZT_DCHAN_TX_V2 $ZAPTEL_INSTALL_DIR/* 2> /dev/null > /dev/null"
if [ $? -eq 0 ]; then
TDM_DCHAN="(DCHAN)"
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN"
echo "Sangoma DCHAN Patch detected in zaptel"
fi
#Check for new zaptel hw hdlc option
if [ -f $ZAPTEL_INSTALL_DIR/zaptel-base.c ]; then
eval "grep hdlc_hard_xmit $ZAPTEL_INSTALL_DIR/zaptel-base.c > /dev/null 2> /dev/null"
if [ $? -eq 0 ] ; then
echo "Native Zaptel HW HDLC Support Detected - No patch required"
echo "Zaptel source unmodified"
TDM_DCHAN="(DCHAN)"
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL "
fi
fi
#Check if dchan patch is already enabled
if [ "$TDM_DCHAN" = "" ]; then
eval "grep ZT_DCHAN_TX_V2 $ZAPTEL_INSTALL_DIR/* 2> /dev/null > /dev/null"
if [ $? -eq 0 ]; then
TDM_DCHAN="(DCHAN)"
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN"
echo "Sangoma DCHAN Patch detected in zaptel"
zaptel_modified=1
fi
fi
if [ "$TDM_DCHAN" = "" ]; then
echo
@ -5881,9 +5905,11 @@ ENDOFTEXT
TDM_DCHAN="(DCHAN)"
echo " Zaptel DCHAN Patch successful"
echo
zaptel_modified=1
elif [ $result -eq 1 ]; then
TDM_DCHAN="(DCHAN)"
echo
zaptel_modified=1
else
echo "Zaptel Update Failed!"
echo
@ -5959,7 +5985,6 @@ ENDOFTEXT
fi
TDM_PROT=YES
zaptel_modified=1;
if [ $zaptel_modified ] && [ $zaptel_modified -eq 1 ] && [ "$ZAPTEL_COMPILE_DISABLE" = "NO" ]; then
echo
getyn "Recompile/reinstall Zaptel (recommended) ?"
@ -6296,11 +6321,11 @@ KERNEL_UNAME=`uname -r`
PKG_NAME=wanpipe
DISTR_NAME="WANPIPE"
PROD=wanrouter
PROD_VER=3.2.1
PROD_VER=3.2.2
PROD_HOME=`pwd`
META_CONF=$PROD_HOME/$PROD.rc
WAN_CONF_DIR=/etc/wanpipe
META_CONF=$WAN_CONF_DIR/$PROD.rc
WAN_INTR_DIR=$PROD_HOME/interfaces
WAN_CONF_DIR=$PROD_HOME
PROD_CONF=$WAN_CONF_DIR/wanpipe1.conf
PROD_PATCH=$PROD_HOME/patches
PROD_INIT=/usr/sbin/
@ -6919,15 +6944,17 @@ you know what you are doing :)
exit 1
fi
$PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --no-zaptel-compile --zaptel-path=$ZAPTEL_INSTALL_DIR
if [ $TDM_PROT = "YES" ]; then
$PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --no-zaptel-compile --zaptel-path=$ZAPTEL_INSTALL_DIR --usr-cc=$CC
else
$PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --usr-cc=$CC
fi
if [ $? -ne 0 ]; then
echo "Error: WANPIPE Installation Failed!"
exit 1;
fi
if [ "$setup_cmd" = "buildrpm" ]; then
compile_aft_firmware_util
detect_rpm_build_utility
@ -7101,7 +7128,7 @@ prepare || exit 1
apply_patches || exit 1
compile_drivers || exit 1
install_init || exit 1
install_config || exit 1
install_config || exit 1
compile_src || exit 1
install_all
install_ssmg

2
api/Makefile

@ -26,6 +26,6 @@ clean:
make -C fr clean
make -C bitstrm clean
make -C bisync clean
make -C tdm_api clean
make -C tdmapi clean
make -C lib/hdlc clean
# make -C ss7 clean

10
api/aft/Makefile

@ -16,7 +16,7 @@ SYSINC=/usr/src/linux/include
endif
VPATH = $(SYSINC)
DIR_EC_APILIB=/common/wantools/wanec_apilib
DIR_EC_APILIB=../wanec_apilib
SRC_EC_APILIB=$(DIR_EC_APILIB)/wanec_api.c $(DIR_EC_APILIB)/wanec_api_lib.c
INC_EC_APILIB=-I/usr/include/wanpipe/oct6100_api -I$(DIR_EC_APILIB)
@ -26,6 +26,8 @@ CFLAGS += -I/usr/include/wanpipe
TARGETS=aft_api
TARGETS+= aft_api_events
TARGETS+= aft_integrity
TARGETS+= aft_echo
#TARGETS+= aft_api_ss7
#TARGETS+= aft_api_check
#TARGETS+= aft_tdm_api
@ -50,5 +52,11 @@ aft_tdm_api: aft_tdm_api.c ../lib/lib_api.c
aft_api_ss7: aft_api_ss7.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
aft_integrity: aft_integrity.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
aft_echo: aft_echo.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
clean:
rm -f $(TARGETS)

BIN
api/aft/aft_api

Binary file not shown.

6
api/aft/aft_api.c

@ -90,8 +90,8 @@ int MakeConnection(void)
printf("\nConnecting to card %s, interface %s prot %x\n", card_name, if_name,htons(PVC_PROT));
strcpy( sa.sll_device, if_name);
strcpy( sa.sll_card, card_name);
strcpy( (char*)sa.sll_device, if_name);
strcpy( (char*)sa.sll_card, card_name);
sa.sll_protocol = htons(PVC_PROT);
sa.sll_family=AF_WANPIPE;
@ -543,7 +543,7 @@ int main(int argc, char* argv[])
proceed=init_args(argc,argv);
if (proceed != WAN_TRUE){
usage(argv[0]);
usage((unsigned char*)argv[0]);
return -1;
}

BIN
api/aft/aft_api_events

Binary file not shown.

8
api/aft/aft_api_events.c

@ -85,8 +85,8 @@ int MakeConnection(void)
printf("\nConnecting to card %s, interface %s prot %x\n", card_name, if_name,htons(PVC_PROT));
strcpy( sa.sll_device, if_name);
strcpy( sa.sll_card, card_name);
strcpy( (char*)sa.sll_device, if_name);
strcpy( (char*)sa.sll_card, card_name);
sa.sll_protocol = htons(PVC_PROT);
sa.sll_family=AF_WANPIPE;
@ -234,6 +234,7 @@ tone_try_again:
return 0;
}
#if 0
static int ringdetect_event_ctrl(u_int8_t mode, int channel, int tone)
{
api_tx_hdr_t api_tx_hdr;
@ -258,6 +259,7 @@ ringdetect_try_again:
return 0;
}
#endif
static int event_decode(api_rx_hdr_t *rx_hdr)
{
@ -727,7 +729,7 @@ int main(int argc, char* argv[])
proceed=init_args(argc,argv);
if (proceed != WAN_TRUE){
usage(argv[0]);
usage((unsigned char*)argv[0]);
return -1;
}

BIN
api/aft/aft_echo

Binary file not shown.

316
api/aft/aft_echo.c

@ -0,0 +1,316 @@
/*****************************************************************************
* chdlc_api.c CHDLC API: Receive Module
*
* Author(s): Gideon Hack & Nenad Corbic <ncorbic@sangoma.com>
*
* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
* Description:
*
* The chdlc_api.c utility will bind to a socket to a chdlc network
* interface, and continously tx and rx packets to an from the sockets.
*
* This example has been written for a single interface in mind,
* where the same process handles tx and rx data.
*
* A real world example, should use different processes to handle
* tx and rx spearately.
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/if_wanpipe.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/wanpipe.h>
#include <linux/sdla_aft_te1.h>
#include "lib_api.h"
#define FALSE 0
#define TRUE 1
#define LGTH_CRC_BYTES 0
#define MAX_TX_DATA 5000 /* Size of tx data */
#define MAX_RX_DATA MAX_TX_DATA
#define SOCK_TIMEOUT 1
/*===================================================
* Golobal data
*==================================================*/
unsigned char HDLC_streaming = FALSE;
unsigned short Rx_lgth;
unsigned char Rx_data[MAX_RX_DATA];
unsigned char Tx_data[MAX_TX_DATA];
int sock;
/*===================================================
* Function Prototypes
*==================================================*/
int MakeConnection(void);
void handle_socket( void);
/*===================================================
* MakeConnection
*
* o Create a Socket
* o Bind a socket to a wanpipe network interface
* (Interface name is supplied by the user)
*==================================================*/
int MakeConnection(void)
{
struct wan_sockaddr_ll sa;
memset(&sa,0,sizeof(struct wan_sockaddr_ll));
errno = 0;
sock = socket(AF_WANPIPE, SOCK_RAW, 0);
if( sock < 0 ) {
perror("Socket");
return(FALSE);
} /* if */
printf("\nConnecting to router %s, interface %s\n", card_name, if_name);
strcpy( (char*)sa.sll_device, if_name);
strcpy( (char*)sa.sll_card, card_name);
sa.sll_protocol = htons(PVC_PROT);
sa.sll_family=AF_WANPIPE;
if(bind(sock, (struct sockaddr *)&sa, sizeof(struct wan_sockaddr_ll)) < 0){
perror("bind");
printf("Failed to bind a socket to %s interface\n",if_name);
exit(0);
}
printf("Socket bound to %s\n\n",if_name);
return(TRUE);
}
/*===========================================================
* handle_socket
*
* o Tx/Rx data to and from the socket
* o Cast received data to an api_rx_element_t data type
* o The received packet contains 16 bytes header
*
* ------------------------------------------
* | 16 bytes | X bytes ...
* ------------------------------------------
* Header Data
*
* RX DATA:
* --------
* Each rx data packet contains the 16 byte header!
*
* o Rx 16 byte data structure:
*
* typedef struct {
* unsigned char error_flag PACKED;
* unsigned short time_stamp PACKED;
* unsigned char reserved[13] PACKED;
* } api_rx_hdr_t;
*
* typedef struct {
* api_rx_hdr_t api_rx_hdr PACKED;
* void * data PACKED;
* } api_rx_element_t;
*
* error_flag:
* bit 0: incoming frame was aborted
* bit 1: incoming frame has a CRC error
* bit 2: incoming frame has an overrun eror
*
* time_stamp:
* absolute time value in ms.
*
* TX_DATA:
* --------
* Each tx data packet MUST contain a 16 byte header!
*
* o Tx 16 byte data structure
*
* typedef struct {
* unsigned char attr PACKED;
* unsigned char reserved[15] PACKED;
* } api_tx_hdr_t;
*
* typedef struct {
* api_tx_hdr_t api_tx_hdr PACKED;
* void * data PACKED;
* } api_tx_element_t;
*
* Currently the chdlc device driver doesn't use any of
* the above fields. Thus, the user can set the 16 bytes
* to ZERO.
*
*/
void handle_socket(void)
{
unsigned int Rx_count,Tx_count,Tx_length;
api_tx_element_t * api_tx_el;
fd_set ready,write,oob;
int err;
struct timeval tv;
tv.tv_usec = 0;
tv.tv_sec = SOCK_TIMEOUT;
Rx_count = 0;
Tx_count = 0;
Tx_length = tx_size;
printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i RxCnt=%i\n",
read_enable,write_enable,tx_cnt,tx_size,tx_delay,rx_cnt);
/* If running HDLC_STREAMING then the received CRC bytes
* will be passed to the application as part of the
* received data.
*/
api_tx_el = (api_tx_element_t*)&Tx_data[0];
memset(&Tx_data[0],0,MAX_TX_DATA);
while (1) {
err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0);
printf("Interface %s state is %s (%d)\n",
if_name,
(err == 0) ? "CONNECTED" :
(err == 1) ? "DISCONNECTED" :
"CONNECTING",err);
if (err < 0) {
printf("Error interface down %s sock disconnected! (%s)\n",
if_name,strerror(errno));
return;
}
if (err > 0) {
printf("Waiting for interface %s to come up!\n",if_name);
sleep(10);
} else {
break;
}
}
for(;;) {
FD_ZERO(&ready);
FD_ZERO(&write);
FD_ZERO(&oob);
FD_SET(sock,&oob);
FD_SET(sock,&ready);
tv.tv_usec = 0;
tv.tv_sec = SOCK_TIMEOUT;
if (write_enable){
FD_SET(sock,&write);
}
fflush(stdout);
err= select(sock + 1,&ready, NULL, &oob, NULL);
if (err < 0) {
printf("Error: inteface down: %s socket disconnected %s\n",
if_name,strerror(errno));
break;
} else if (err == 0) {
/* Timeout do something */
} else {
if (FD_ISSET(sock,&oob)){
err = recv(sock, Rx_data, MAX_RX_DATA, MSG_OOB);
if(err < 0 ) {
printf("Failed to receive OOB %i , %i\n", Rx_count, err);
err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0);
printf("Sock state is %s\n",
(err == 0) ? "CONNECTED" :
(err == 1) ? "DISCONNECTED" :
"CONNECTING");
break;
}
printf("Got OOB exception: Link Down !\n");
break;
}
if (FD_ISSET(sock,&ready)){
err = recv(sock, Rx_data, MAX_RX_DATA, 0);
/* err indicates bytes received */
if (err > 0){
Rx_count++;
err = send(sock, Rx_data, err, 0);
Tx_count++;
printf("Rx Len=%i Rx=%i Tx=%i : Echo Ok\r",
err-sizeof(api_rx_hdr_t), Tx_count,Rx_count);
} else {
printf("\nError receiving data\n");
break;
}
}
}
}
close (sock);
}
/***************************************************************
* Main:
*
* o Make a socket connection to the driver.
* o Call handle_socket() to read/write the socket
*
**************************************************************/
int main(int argc, char* argv[])
{
int proceed;
proceed=init_args(argc,argv);
if (proceed != WAN_TRUE){
usage((unsigned char*)argv[0]);
return -1;
}
proceed = MakeConnection();
if(proceed == WAN_TRUE){
handle_socket();
return 0;
}
return 1;
};

BIN
api/aft/aft_integrity

Binary file not shown.

421
api/aft/aft_integrity.c

@ -0,0 +1,421 @@
/*****************************************************************************
* chdlc_api.c CHDLC API: Receive Module
*
* Author(s): Gideon Hack & Nenad Corbic <ncorbic@sangoma.com>
*
* Copyright: (c) 1995-2001 Sangoma Technologies Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
* ============================================================================
* Description:
*
* The chdlc_api.c utility will bind to a socket to a chdlc network
* interface, and continously tx and rx packets to an from the sockets.
*
* This example has been written for a single interface in mind,
* where the same process handles tx and rx data.
*
* A real world example, should use different processes to handle
* tx and rx spearately.
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <linux/if_wanpipe.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/wanpipe.h>
#include <linux/sdla_aft_te1.h>
#include "lib_api.h"
#define FALSE 0
#define TRUE 1
#define LGTH_CRC_BYTES 0
#define MAX_TX_DATA 5000 /* Size of tx data */
#define MAX_RX_DATA MAX_TX_DATA
#define SOCK_TIMEOUT 1
/*===================================================
* Golobal data
*==================================================*/
unsigned char HDLC_streaming = FALSE;
unsigned short Rx_lgth;
unsigned char Rx_data[MAX_RX_DATA];
unsigned char Tx_data[MAX_TX_DATA];
int sock;
/*===================================================
* Function Prototypes
*==================================================*/
int MakeConnection(void);
void handle_socket( void);
static unsigned char test_data[]={0x00,0x5A, 0xAA, 0xA5