wanpipe-2.3.4-10.tgz

This commit is contained in:
Harald Welte 2021-12-29 17:59:00 +01:00
parent 294cf0af0c
commit e2881e7e26
1769 changed files with 509951 additions and 17766 deletions

BIN
.Setup.swo Normal file

Binary file not shown.

561
ChangeLog.stable Normal file
View File

@ -0,0 +1,561 @@
------------------------------------------------------------------------------
WANPIPE
Linux Voice TDM/WAN Router Package
------------------------------------------------------------------------------
Author: Nenad Corbic <ncorbic@sangoma.com>
Copyright (c) 1995-2007 Sangoma Technologies Inc.
------------------------------------------------------------------------------
* Thu Jun 13 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-10
===============================================================
- Support for AFT 54K DDS hardware
- Support for New A301 T3/E3 Card
- Updated Maxim (A101/2/4/8) Front end
On port shutdown properly reset the port.
This will solve instances where on port
shutdown, the remote end stays up.
- Updated Setup for patching Zaptel 1.2.17
- Analog Network Sync Feature
Synchronize Analog card to a clock of a
Digital T1/E1 port using external cable.
Improves Faxing performance!
For more info:
http://wiki.sangoma.com/t1e1analogfaxing
* Wed May 17 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-9
====================================================================
- Updated Zaptel 1.2.17 DCHAN Patch
- Hardware A101D and A101DX Support
- Added Maxim register debug in wanpipemon
- Update to SMG
* Wed Apr 23 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-8
====================================================================
- Important: AFT TDMV (ZAPTEL) Fix
A race condition existed on wanrouter startup.
If echo canceler startup delayed the startup long enough,
for T1/E1 line to come up, it was possible that zaptel
alarms would not be cleared.
- Important: AFT T1/E1 Front End update.
The AFT cards will not disable communications for minor
T1/E1 alarms. This has caused problems in the passed because
AFT cards were too strict in interpreting T1/E1 alarms.
- Added AFT/56K Line Loop Test feature in wanpipemon
After enabling digital loopback run line test to test
the device.:
wanpipemon -i w1g1 -c Tadlb
wanpipemon -i w1g1 -c Tlt
This option can be used with any T1/E1 AFT card as well as 56K,
with any wanpipe configuration.
- Hardware support for new AFT 301 Card.
The new T3 card has been redesigned to use common main board as
the rest of the AFT family. However, the driver remains identical.
- AFT T1/E1 Improved CAS Signaling Support
- Allow original A102 config to work with A102d cards.
- TDM API updated for unlimited number of /dev/wptdm devices.
- Updated the Hardware Echo Canceler with Noise suppression.
- New TDM Zaptel/TDM API installation Makefile to be used by linux power users.
Options:
make #buils all utilities and kernel modules
make install #installs utilities modules etc
- Fixed DCHAN patch for zaptel 1.2.13
KNOWS ISSUES:
-------------
- All cards with Maxim/Dallas front end chips do not support RBS signalling.
These include: A102d/A108d and new A104d with maxim/dallas chips.
The fix is in new beta 3.1.0 release.
* Wed Jan 31 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-7
====================================================================
- Removed a sanity check from AFT drivers
This check was added in 2.3.4-5 release.
Due to some imporant fixes in 2.3.4-5 this release was
rushed, and things like this happen. Sorry :)
* Wed Jan 31 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-6
====================================================================
- Bugfix for AFT Hardware Echo Voice cards
Bug introduced in 2.3.4-5 release.
The new feature "persistent hwec" released in 2.3.4-5 had a bug
that was apprent on wanpipe restarts.
Anyone running 2.3.4-5 release should upgrade.
If you are running 2.3.4-5 in production to fix this problem enable
the following option in [wanpipe] section of wanpipeX.conf.
TDMV_HWEC_PERSIST_DISABLE=YES
And restart all wanpipe cards using: wanrouter restart command.
Note this bug affects all AFT cards with hardware echo cancellation
and release 2.3.4-5.
For more info please contact Sangoma Support.
- Minor cosmetic update to wancfg_zaptel wanpipe/zaptel configurator.
* Mon Jan 22 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-5
====================================================================
- Updated support for A400 Analog card
This release will recognize the new A400
pci card info.
- Updated A200/A400 firmware updater
Takes into account the new A200 and A400 cards.
- AFT A301 T3/E3 Driver Update
Fixed a possible race condition
during startup/shutdown
- AFT A101/2 T1/E1 Driver Update
Fixed a possible race condition
during startup/shutdown
- AFT Hardware Echo Cancellation Persist Mode
The new default Echo Cancellation mode for all AFT cards.
If HWEC is enabled in wanpipe1.conf the Sangoma HWEC will
remain enabled all the time, even if the calls are not up.
Previously Asterisk enabled and disabled echo based on
zapata.conf and call state. This delay however caused minute
echo on call startup. In Persist mode, Sangoma HWEC will
always be enabled, thus users will get perfect quality 100%
of the time.
In order to configure WANPIPE card in NON-PERSIST mode one
has to enable TDMV_HWEC_PERSIST_DISABLE=YES option in [wanpipeX]
section of wanpipeX.conf.
In this mode Asterisk will be responsible for enabling/disabling
hardware echo canceler.
- LIP Layer Bug Fix.
This bug fix affects all WAN protocols for all AFT cards.
The bug was a race condition in startup code.
On a slow enough machine it was possible for an interface
to get stuck in disconnected mode during startup.
- Wanpipe Zaptel Configuration Utility
The new wancfg_zaptel utility is now a default way to
configure Sangoma cards for Zaptel. The wancfg_zaptel utility
will auto detect all Sangoma cards in your machine and create
wanpipe configuration files along with /etc/zaptel.conf. This way
the customer can concentrate on /etc/asterisk/zapata.conf only.
Run: /usr/sbin/wancfg_zaptel <enter>
Wizard like questions will lead you through whole
configuration process.
After wancfg_zaptel following files will be created:
/etc/wanpipe/wanpipe*.conf # All wanpipe config files
/etc/zaptel.con # Fully configured zaptel
* Tue Jan 9 2007 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-4
====================================================================
- Critical Bug fix A200/A400 Analog Cards
Critical bug fix in fxo sanity check control.
All customers that are running stable 2.3.4 release
must upgrade to 2.3.4-4.
- Updates for 2.6.18 and 2.6.19 kernels.
- Critical Bug fix for A108D and A102D cards.
It was possible for the front end interrupt handler to
miss-handle a pending interrupt, which would caused system
instability.
- TDM API Update
Removed Zaptel dependency for A200/A400 cards when
running in TDM API mode only.
* Tue Dec 12 2006 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-3
====================================================================
- Bug fix on A301 T3/E3 Drivers
The T3/E3 card/drivers could get stuck in connected or disconnected
state after which no state changes are reported. Used to happend
on noisy lines.
- Bug Fix in A101/2 Drivers
Mishandling of skb buffers on rx stream could cause
unpredictable behavior on some systems.
This has now been fixed.
- Updated A101/2/4/8 A301 Drivers
Changed the memory allocation scheme in non interrupt context to
use KERNEL instead of ATOMIC. The symptoms were on low
memory system wanrouter start could fail due to memory
allocation error when starting up large number of devices.
- TDM API polling bug fix
By default TDM API application uses rx and tx streams.
However in tx only mode, the select would fail to wakeup.
- A200 A400 Driver Bug Fix
If A200/A400 card are started with NO FXO/FXS modules
a kernel error is possible on some systems.
- Update to TDM API sample Makefiles
added -lm library to compilation
- Updated SMG Drivers
Sangoma SMG 1.7 Chan Woomera 1.6
* Wed Nov 30 2006 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-2
====================================================================
- A200 Sanity Check Bug Fix
This is an IMPORTANT update! This bug fix fixes a bug in FXO
sanity checker that on some machine could cause instability.
- Wanpipemon A200 Voltage Check bug fix.
wanpipemon command was showing over 50V voltage
the sign was not observed.
* Wed Nov 23 2006 Nenad Corbic <ncorbic@sangoma.com> - 2.3.4-1
====================================================================
- This is the first official STABLE release of 2.3.4 branch.
- AFT A104d 64bit bug fix
The AFT A104d T1 channel 24 failed to initialize causing DCHAN
not to come up on 64 bit machines.
- SMG Update
Major optimizations to greatly improve system load and capacity.
Added rx tx gain control from CLI and woomera.conf
Woomera v1.5 SMG v1.6
- Driver update for 2.6.18 kernel.
- Wanpipemon Updates
Updated for A301 drivers.
Minor bug fixes.
- CHDLC Protocol
Fixed up the ignore keepalive
- WANCFG - CHDLC Protocol
Bug fix in chdlc configuration.
* Thu Nov 02 2006 Nenad Corbic <ncorbic@sangoma.com> - beta12-2.3.4
===================================================================
- Further Analog Bug Fixes.
Fixes the problem where fxo module gets stuck during operation.
* Wed Nov 01 2006 Nenad Corbic <ncorbic@sangoma.com> - beta11-2.3.4
===================================================================
- A102D Hardware Support
Updated drivers for A102D Hardware
Minimum A102D firmware version V.28
- Bug fix in Analog A200 driver.
Every once in a while a fxo port would get stuck and fail to
receive any more calls. This has not been fixed.
- Bug fix in Analog A200 driver.
The lasttxhoot state could get stuck in one state.
If you have weird analog A200 issues, please try this release.
- New SMG update
- Setup installation script update
- New A200 voltage statistics in wanpipemon
- New wanrouter hwprobe verbose option
Displays all FXO/FXS modules installed on your system
wanrouter hwprobe verbose
* Fri Oct 13 2006 Nenad Corbic <ncorbic@sangoma.com> - beta10-2.3.4
====================================================================
- A200 Bug fix
Analog software echo cancellation has been broken
in beta8-2.3.4 release. This bug has now been fixed.
This bug does not affect A200d cards with HWEC.
- Setup update
Update in compilation headers that caused wan_ec_client
to fail compilation on some machine.
* Fri Oct 6 2006 Nenad Corbic <ncorbic@sangoma.com> - beta9-2.3.4
- Bug fixes hwec that were introduced in beta8
- Disabled hw dtmf events.
- This release has been tested in production.
* Mon Oct 2 2006 Nenad Corbic <ncorbic@sangoma.com> - beta8-2.3.4
=================================================================
- New A108 HWEC Support
Optimized TDM Drivers for A108
Support for A108 Hardware Echo Cancellation
Support for A108 RefClock between ports.
New Firmware. V27
- New A108 HWEC Support
Optimized TDM Drivers for A108
Support for A108 Hardware Echo Cancellation
Support for A108 RefClock between ports.
New Firmware. V27
- LIP / AFT Layer Latency Optimization (LINUX Only)
By setting txqueuelen using ifconfig to value of 1
the LIP layer will re-configure the protocol and hw layer
for SINGLE tx buffer. This will improve overall latency.
- AFT (A101/2/4/8) Layer Latency Optimization
The SINGLE_TX_BUF=YES option in [w1g1] interface
section, configures the AFT hardware for single hw dma buffer
instead of a DMA chain. This option along with above
LIP layer latency option reduces driver/protocol latency
to theoretical minimum.
NOTE: In WAN/IP applications latency feature will increase
system load.
(5% to 20% depending on system and number of ports used)
* Mon Jul 31 2006 Nenad Corbic <ncorbic@sangoma.com> - beta7-2.3.4
==================================================================
- A200 Driver Bug Fix.
The A200 drivers had PULSE dialing enabled
that can cause call outages on NON-PULSE dialing lines.
This has now been fixed.
- Updates to ./Setup installation script
More documentation in usage.
* Mon Jul 24 2006 Nenad Corbic <ncorbic@sangoma.com> - beta6-2.3.4
==================================================================
- Fixed the AFT HWEC on 64bit kernels.
The bug was caused by using 32bit version of
the octasic API release in beta5-2.3.4.
* Fri Jul 21 2006 Nenad Corbic <ncorbic@sangoma.com> - beta5-2.3.4
==================================================================
- TDM API was broken on A101/2 Cards
It has not been fixed.
- A108D Hardware Support
The new A108D: 8 Port T1/E1 with onboard 246 channel
hardware echo canceller.
- The wanec daemon has been deprecated.
A new wanec kernel module has been created to handle
all octasic commands.
- The hwec release has been deprecated.
The hwec drivers are now part of wanpipe release.
- Bug Fix in A104 and A104D Ref Clock
This bug caused FAX failures when REF Clock option was enabled.
- Updates for 2.6.16 and 2.6.17 kernels
New kernels broke previous wanpipe drivers.
- Frame Relay Update: EEK Support
New Frame relay stack supports Cisco End to End Keepalives
on each DLCI.
- PPP Update: Updated PPP IP negotiation. IPCP was not
working properly agains some routers. This has now
been resolved.
- TDM API: HW DMTF on A104D cards.
The TDM API and regular API interfaces now supports HW DTMF
on A104D and A108D cards.
- Setup update: the --protocols option with --silent option did not
select proper protocols under certail conditions.
./Setup install --protocols=TDM --silent
This option will now compile TDM protocol properly.
- ADSL Update: The ADSL drivers were failing on some machines due
to kfree_skb error under irq. This has now been fixed.
- AFT A104/A108 Driver updated for 64bit kernels with over 4GB
of memory. The NO AUDIO problem on TDM drivers.
The 4GB memory caused DMA corruptions to occur which caused
no AUDIO effect.
- SSMG Product: Sangoma Signal Media Gateway
The ssmg product is now part of standard wanpipe.
It will automatically get installed if XMTP2 drivers are
selected. The SMG product provides SS7 Support to Asterisk.
- LibSangoma: LibSangoma is part of the SSMG product, however
it can be used separately with TDM API to develop custom
TDM applications. Libsangoma is now part of standard wanpipe
release.
* Fri Mar 04 2006 Nenad Corbic <ncorbic@sangoma.com> - beta4-2.3.4
- A108 Hardware Support
Full support for new A108 8 Port T1/E1 Card
- AFT Front End T1/E1 Alarm Update/Polling
On some embedded machines the A104D cards exhibited
unreliable ports i.e. The port would not come up due to
missing interrupts from the front end chip.
The Front End polling mechanism has been updated to solve this problem.
- TDM API Update
Fixed a bug in RX/TX functions.
On some machines the kernel to user copy did not work.
- Updated HWEC and TDMAPI Udev Devices
HWEC UDEV device: /dev/wp1ec (Major: 241)
TDM API UDEV device: /dev/wptdm_s1c1 (Major: 242)
- Setup Installation Script Update
Compilation of Zaptel during installation
UDEV Zaptel updates
UDEV TDM API updates
- AFT-LIP Frame Relay DLCI Statistics
Updated Frame Relay DLCI Statistics.
- AFT-LIP PPP Update
IPCP negotiation failed when connected to some telco.
* Wed Feb 22 2006 Nenad Corbic <ncorbic@sangoma.com> - beta3-2.3.4
- A104D HWEC Update
Bug fix on E1 4th port channel 31 did not work.
- A104D HWEC 64Bit Fix
The A104D HWEC now works on 64bit machines.
Using UDEV /dev/wp1ec device to access hwec chip.
If no UDEV one must create /dev/wp1ec using:
mknod /dev/wp1ec c 2402 1
- AFT Firmware Update Utility
Bug fix. On some systems firmware update failed.
- TDM API Updates
Support on AFT A101/2 Cards
Fixed shutdown problems while channels are opened.
* Wed Feb 15 2006 Nenad Corbic <ncorbic@sangoma.com> - beta2-2.3.4
- The Beta2-2.3.4 is the first official Beta release of 2.3.4.
The 2.3.4 release has been in ALPHA for months and has gone
through major testing process.
- A200 Remora Updates
Updates for 24 port A200 solution
New A200 Firmware Release V05
- A104D Update/Bug Fix
Echo cancellation DSP had problems on
port 4 of A104D card.
- New A104/4D TDM API and libsangoma release
The new TDM API replaces the old TDM API.
Currently the TDM API is only supported on A104 and A104D cards.
The TDM API is compiled by default in wanpipe drivers.
Supports: PRI and RBS functionality.
Sample files: /etc/wanpipe/api/tdm_api
- Libsangoma Release
New libsangoma source is located in
/etc/wanpipe/api/libsangoma directory.
For more info and docs please refer to http://sangoma.editme.com
* Tue Jan 10 2006 Nenad Corbic <ncorbic@sangoma.com> - beta1y-2.3.4
- Driver update for 2.4.30 kernel
- AFT A104 Driver minor update to TDM API
Number of dma packets used in API mode.
To save memory. Not a functional change.
- Update to Setup install script
- Wancfg Update
New option to configure wanpipe config file base on zaptel.conf
syntax: "wancfg zaptel"
* Tue Dec 15 2005 Nenad Corbic <ncorbic@sangoma.com> - beta1x-2.3.4
- Major AFT A200 Analog Updates
Analog Hardware Echo Canceler is now supported
Bug fixes on aLaw lines, noise problems.
- Wancfg Updates
- Updates to Setup installation utility
* Mon Dec 5 2005 Nenad Corbic <ncorbic@sangoma.com> - beta1x-2.3.4
- WanCfg Update
New wancfg option "zaptel" that will create wanpipe
based on /etc/zaptel.conf configuration.
eg:
1. Configure your zaptel first based on hardware
2. Run: wancfg zaptel
To create wanpipe config files based on zaptel.conf
3. Run: wanrouter start
4. Run: ztcfg -vvv
5. Read to start Asterisk
- Setup Update
Added new options in ./Setup for user to specify custom gcc
compiler.
- AFT A200 Updates
Further Analog driver updates.
- AFT Echo Debugging Utility
Used to measure echo spike and debug echo problems.
* Wed Nov 23 2005 Nenad Corbic <ncorbic@sangoma.com> - beta1x-2.3.4
- Bug fix in Analog startup
You can now set ACTIVE_CH=ALL and by default all detected
FXO/FXS Devices will be configured.
- Bug fix in A102 Drivers
When both ports are running, if you stop one
the other one dies.

225
Makefile Normal file
View File

@ -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/

151
README
View File

@ -1,153 +1,12 @@
------------------------------------------------------------------------------
Linux WAN Router Utilities Package
------------------------------------------------------------------------------
Author: Nenad Corbic <ncorbic@sangoma.com>
Copyright (c) 1995-2006 Sangoma Technologies Inc.
Copyright (c) 1995-2007 Sangoma Technologies Inc.
------------------------------------------------------------------------------
INTRODUCTION
Wide Area Networks (WANs) are used to interconnect Local Area Networks (LANs)
and/or stand-alone hosts over vast distances with data transfer rates
significantly higher than those achievable with commonly used dial-up
connections.
Usually an external device called `WAN router' sitting on your local network
or connected to your machine's serial port provides physical connection to
WAN. Although router's job may be as simple as taking your local network
traffic, converting it to WAN format and piping it through the WAN link, these
devices are notoriously expensive, with prices as much as 2 - 5 times higher
then the price of a typical PC box.
Alternatively, considering robustness and multitasking capabilities of Linux,
an internal router can be built (most routers use some sort of stripped down
Unix-like operating system anyway). With a number of relatively inexpensive WAN
interface cards available on the market, a perfectly usable router can be
built for less than half a price of an external router. Yet a Linux box
acting as a router can still be used for other purposes, such as fire-walling,
running FTP, WWW or DNS server, etc.
This kernel module introduces the notion of a WAN Link Driver (WLD) to Linux
operating system and provides generic hardware-independent services for such
drivers. Why can existing Linux network device interface not be used for
this purpose? Well, it can. However, there are a few key differences between
a typical network interface (e.g. Ethernet) and a WAN link.
Many WAN protocols, such as X.25 and frame relay, allow for multiple logical
connections (known as `virtual circuits' in X.25 terminology) over a single
physical link. Each such virtual circuit may (and almost always does) lead
to a different geographical location and, therefore, different network. As a
result, it is the virtual circuit, not the physical link, that represents a
route and, therefore, a network interface in Linux terms.
To further complicate things, virtual circuits are usually volatile in nature
(excluding so called `permanent' virtual circuits or PVCs). With almost no
time required to set up and tear down a virtual circuit, it is highly desirable
to implement on-demand connections in order to minimize network charges. So
unlike a typical network driver, the WAN driver must be able to handle multiple
network interfaces and cope as multiple virtual circuits come into existence
and go away dynamically.
Last, but not least, WAN configuration is much more complex than that of say
Ethernet and may well amount to several dozens of parameters. Some of them
are "link-wide" while others are virtual circuit-specific. The same holds
true for WAN statistics which is by far more extensive and extremely useful
when troubleshooting WAN connections. Extending the ifconfig utility to suit
these needs may be possible, but does not seem quite reasonable. Therefore, a
WAN configuration utility and corresponding application programmer's interface
is needed for this purpose.
Most of these problems are taken care of by this module. Its goal is to
provide a user with more-or-less standard look and feel for all WAN devices and
assist a WAN device driver writer by providing common services, such as:
o User-level interface via /proc file system
o Centralized configuration
o Device management (setup, shutdown, etc.)
o Network interface management (dynamic creation/destruction)
o Protocol encapsulation/decapsulation
To ba able to use the Linux WAN Router you will also need a WAN Tools package
available from
ftp.sangoma.com/pub/linux/current_wanpipe/wanpipe-X.Y.Z.tgz
where vX.Y.Z represent the wanpipe version number.
For technical questions and/or comments please e-mail to ncorbic@sangoma.com.
For general inquiries please contact Sangoma Technologies Inc. by
Hotline: 1-800-388-2475 (USA and Canada, toll free)
Phone: (905) 474-1990 ext: 106
Fax: (905) 474-9223
E-mail: dm@sangoma.com (David Mandelstam)
ncorbic@sangoma.com (Nenad Corbic)
WWW: http://www.sangoma.com
INSTALLATION
Please read the README.install on how to
install the WANPIPE tools and drivers properly.
After installation read README.config on how
to configure and start wanpipe device.
For further information refer to the
doc/ directory.
ftp.sangoma.com/linux/current_wanpipe/doc
COPYRIGHT AND LICENSING INFORMATION
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, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 675 Mass
Ave, Cambridge, MA 02139, USA.
ACKNOWLEDGEMENTS
This product is based on the WANPIPE(tm) Multiprotocol WAN Router developed
by Sangoma Technologies Inc. for Linux 2.0.x and 2.2.x. Success of the WANPIPE
together with the next major release of Linux kernel in summer 1996 commanded
adequate changes to the WANPIPE code to take full advantage of new Linux
features.
Instead of continuing developing proprietary interface tied to Sangoma WAN
cards, we decided to separate all hardware-independent code into a separate
module and defined two levels of interfaces - one for user-level applications
and another for kernel-level WAN drivers. WANPIPE is now implemented as a
WAN driver compliant with the WAN Link Driver interface. Also a general
purpose WAN configuration utility and a set of shell scripts was developed to
support WAN router at the user level.
Many useful ideas concerning hardware-independent interface implementation
were given by Mike McLagan <mike.mclagan@linux.org> and his implementation
of the Frame Relay router and drivers for Sangoma cards (dlci/sdla).
With the new implementation of the APIs being incorporated into the WANPIPE,
a special thank goes to Alan Cox in providing insight into BSD sockets.
Special thanks to all the WANPIPE users who performed field-testing, reported
bugs and made valuable comments and suggestions that help us to improve this
product.
For Latest Documentation Please visit:
Sangoma Wiki
http://sangoma.editme.com
For latest docs please visit Sangoma Wiki
Sangoma Wiki: http://wiki.sangoma.com
------------------------------------------------------------------------------

390
README-1.install Normal file
View File

@ -0,0 +1,390 @@
WANPIPE PACKAGE INSTALLATION/UN-INSTALLATION
============================================
Author: Nenad Corbic
For Lates Docs Please visit
http://wiki.sangoma.com
WANPIPE PACKAGES
================
Wanpipe SOURCE packages are located in:
ftp.sangoma.com/linux/current_wanpipe
Download the latest SOURCE wanpipe release
in ANY directory:
ex: cd /tmp
tar xvfz wanpipe-<version>.tgz
The tar will create the temporary
wanpipe/ directory.
WANPIPE SOURCE PACKAGE Installation
====================================
The 'Setup' script located in temporary wanpipe/
directory should be used to install/un-install
and re-configure all WANPIPE driver and utilities.
The Setup installation script contains numerous
options that can be used to customise wanpipe
installation. Run ./Setup without any arguments
for usage.
Run the Setup script from temporary wanpipe/ directory
(wanpipe directory was created by untaring the source package)
cd wanpipe/
./Setup install
The install option will do the following:
-------
1. Check that all WANPIPE files are accounted for.
2. Check/modify permissions on all WANPIPE files.
3. Prompt the user to Install/Upgrade WANPIPE
drivers into the Linux kernel source.
NOTE: The kernel source must be located
in /usr/src/linux.
Or the linux source directory
must be supplied with '--with-linux' argument.
It is always RECOMMENDED to upgrade/update
the kernel source tree with the latest
wanpipe source.
4. Prompt the user to re-compile all WANPIPE
kernel drivers and install them as modules
in the the current /lib/modules/<kernel-version>
directory.
Compilaton Options: Default or Custom
Default compilation:
option will compile the standard WANPIPE protocols
into the kernel device driver: Frame Relay, PPP, CHDLC
Multi-Port Frame Relay, Multi-Port PPP, and X25(API). "
Custom compilation:
option will offer a menu of all available WAN and
API protocols. The user will be able to enable
protocols individually or all at once,
as desired.
With this option, NO kernel recomilation is
necessary :)
5. Prompt the user to install bootstrap
scripts that will be used to start wanpipe
during boot up.
6. Setup the ENVIRONMENT configuration file that will
contain directory locations of WANPIPE configuration
interface and lock files.
7. Compile all WANPIPE utilities
8. Setup the WANPIPE working environment.
i.e. Install all binary files into
linux file tree.
/etc/wanpipe : config, library, sample
and firmware files.
/usr/sbin : user space, binary
utilites
/lib/modules/<uname-r> : wanpipe kernel
modules
/usr/share/doc/wanpipe : doc files
The last message in the 'Setup install' sequence will
inform you of the next step that you should take
in getting WANPIPE working.
o Read 'README-2.config' on how to configure wanpipe
device
o End of Installation
CUSTOMIZING WANPIPE SOURCE INSTALLATION
=========================================
Installation using the '--silent' option
--------------------------------------
The '--silent' option is available to install wanpipe
without any user interaction:
./Setup install --silent
All defaults will be used!
--------------------------
1. Configuration directory /etc/wanpipe
2. Start wanpipe on boot up
3. Recompile modules for the kenrel source
in /usr/src/linux
Installation using the --builddir option
--------------------------------------
When customising the wanpipe package, it is
useful to install the package into a
virtual directory so not to pollute the
current environment.
This way a user can tar up the temporary
directory and create a custom binary
WANPIPE package.
eg ./Setup install --builddir=/tmp/wanpipe_build
Note: the /tmp/wanpipe_build directory must
exist.
Installation using the --protocol option
--------------------------------------
Standard Wanpipe installatin will only
include MAINSTREAM WAN protocols when building
the kernel modules to cut down on kernel
module size.
Mainstream Protocols:
Frame Relay, PPP, CHDLC, X25, API stack
To enable NON Mainstream protocols specify
extra protocols with the --protocol option.
Non Mainstream Protocols:
BSC : API for Multipoint Bisync
BSCSTRM : API for Bisync Streaming
SS7 : API for Level2 SS7 protocol
EDU : API for Educational software
SDLC : API for SDLC protocol
POS : API for POS (S515/S509) card.
BITSTRM : API for Bitstreaming protocol
eg: ./Setup install --protocol=<List of Protocols>
<List of Protocols> = <PROT>-<PROT>-<PROT>
eg:
Compile in Bitstreaming protocol
./Setup install --protocol=BITSTRM
Compile in BitStreaming and POS and SDLC
./Setup install --protocol=BITSTRM-POS-SDLC
Building a custom RPM
---------------------
./Setup buildrpm <extra options>
All defaults will be used!
--------------------------
1. Configuration directory /etc/wanpipe
2. Start wanpipe on boot up
3. Recompile modules for the kernel source
locatd in /usr/src/linux direcotory,
or directory supplied with --with-linux=<abs path>
argument.
Note: <extra options> start with -- and are defined above.
i.e.
user the --protocol filed to add in extra protocols
into the wanpipe kernel modules.
Refer to README.rpmbuild
WANPIPE Kernel Driver Compile/Update
====================================
This option should be used to update the kernel
source tree with the latest wanpipe drivers
and to compile the wanpipe kernel modules
against the updated kernel source tree.
Run the Setup script in temporary wanpipe/ directory:
ex: cd wanpipe/
./Setup drivers
The drivers option will do the following:
-------
1. Prompt the user to Install/Upgrade Wanpipe
drivers into the Linux kernel source.
NOTE: The kernel source must be located
in /usr/src/linux
It is always RECOMMENDED to upgrade/update
the kernel source tree with the latest
wanpipe source.
2. Prompt the user to re-compile all WANPIPE
kernel drivers and install the as modules
in the the current /lib/modules/<kernel-version>
directory.
Compilaton Options: Default or Custom
Default compilation:
option will compile the standard WANPIPE protocols
into the kernel device driver: Frame Relay, PPP, CHDLC
Multi-Port Frame Relay, Multi-Port PPP, and X25(API). "
Custom compilation:
option will offer a menu of all available WAN and
API protocols. The user will be able to enable
protocols individually or all at once,
as desired.
WANPIPE Utilities Re-Compilation
=================================
This option will re-compile all WANPIPE utilities
in temporary wanpipe/ directory.
NOTE: If this is a first time install you MUST run
the install option: Setup install.
Run the Setup script in temporary wanpipe/ directory:
ex: cd wanpipe/
./Setup utility
The utility option will do the following:
-------
1. Compile all WANPIPE utilities
in temporary wanpipe/ directory
To install utilities into /usr/sbin
directory one must run:
./Setup inst
For more info about Setup command run
./Setup without any arguments for full usage
info.
WANPIPE Un-Install
==================
Run the Setup script in temporary wanpipe/ directory:
ex: cd wanpipe/
./Setup remove
The remove option will do the following:
------
1. Remove all boot strap WANPIPE scripts.
2. Remove all utilities from /usr/sbin,
/etc/wanpipe, /usr/share/doc/wanpipe
directories.
After the 'Setup remove' command, it is safe
to remove the whole temporary wanpipe/ directory.
ex:
rm -rf wanpipe/
WANPIPE RPM PACKAGE Installation
================================
Choosing an RPM:
--------------
o Determine the Linux Distribution:
cat /etc/issue
(eg: RedHat 7.1)
o Determine the Kernel image you are running:
uname -r
(eg: 2.4.2-2 : it is not an smp kernel)
(eg: 2.4.2-2smp : smp kernel)
o Determine the processor type
uname -m
(eg: i686)
o Based on the above information choose an RPM package.
wanpipe-<version>.<linux distrib>.<kernel ver>.<processor>.rpm
eg: ftp.sangoma.com/linux/RPM/redhat/7.1/i686/
wanpipe-2.2.4-3.rh71up.k242-2.i686.rpm
Installing RPM
----------
o List the contents of the rpm
rpm -qipl <wanpipe rpm name>
Make sure that the /lib/modules/<kernel name> directory
matches your current kernel modules directory.
i.e. the output of command 'uname -r' must match the above
<kernel name> directory.
o The rpm must be installed using the --force option, to
override the old modules.
rpm -i --force <wanpipe rpm name>
o Read 'README-2.config' on how to configure wanpipe
device
For further info, refer to WanpipeInstallation.pdf

400
README-2.config Normal file
View File

@ -0,0 +1,400 @@
Wanpipe Configuration
======================
For Latest Info please visit
http://wiki.sangoma.com
ZAPTEL CONFIGURATION
====================
Run: /usr/sbin/wancfg_zaptel
Proceed to configure each
wanpipe device based on your
telco specifications.
For more info visit:
http://wiki.sangoma.com
WAN CONFIGURATION
=================
Before starting WANPIPE, a configuration file (wanpipeN.conf, where
N=1,2,3..etc.)must be created in /etc/wanpipe directory.
This file contains the line, hardware and interface definitions
for the WAN connection.
RELEASE 2.3.2 and on:
The new WANCFG utility has been release. It should
be used to configure standard WAN protocols like:
FR, PPP, CHDLC,
MULTILINK PPP (TTY), TDM_VOICE
HDLC API
ADSL
For both AFT and S514 series cards.
The old WANCFG utility has been renamed to wancfg_legacy.
This utility should be used for all API protocols like:
X25, SDLC, BITSTREAMING ...
The program /usr/sbin/wancfg should be used to create the
configuration file(s). It is a GUI, ncurses based,
configurator that contains all wanpipe options
as well as extended help information on each
option.
In case wancfg is not used, i.e. embedded systems, use
the sample configuration files located in
/etc/wanpipe/samples directory.
Things you should know before starting /usr/sbin/wancfg:
1. Protocol:
Frame Relay, MulitPort Frame Relay,
CHDLC, PPP, MultiPort PPP, ADSL, X25 ...
2. Protocol/IP Info:
Frame Relay: Type of Status Signaling (LMI,
ANSI, or Q.933
Number of DLCI to configure
DLCI numbers
IP info for each DLCI
CHDLC: IP info
PPP: IP info
X25: Maximum packet size
Number of SVCs/PVCs
IP info
ADSL: ATM encapsulation:
Bridged Ethernet LLC over ATM: (PPPoE)
Bridged Ethernet VC over ATM
Classical IP LLC over ATM
Router IP VC over ATM
PPP LLC over ATM
PPP VC over ATM: (PPPoA)
ATM configuration:
VPI and VCI
If not available use the auto
config option to autodetect
these values.
IP Info: (Not needed for PPPoE)
NOTE:
For PPPoE and PPPoA setup please refer to
APPENDIX A below.
ATM: ATM encapsulation:
Bridged Ethernet LLC over ATM: (PPPoE)
Bridged Ethernet VC over ATM
Classical IP LLC over ATM
Router IP VC over ATM
ATM configuration:
VPI and VCI
IP Info: (Not needed for PPPoE)
3. CSU/DSU Info:
T1/E1: Encoding
Framing
Active Channels/Baud Rate
56K: Internal or External Clocking
Internal clocking should only be used
in back to back situations.
Default: External
For the rest of this document, we will assume we are working with the
following ISP/Telco supplied data:
Protocol: Frame Relay
Prot Info:
Num of DLCI's = 2
DLCI=16 and 17
IP Info: DLCI 16
Local =201.1.1.1
PtoP =201.1.1.2
Netmask =255.255.255.0
Gateway =201.1.1.2 (i.e. this is the system
default gateway)
DLCI 17
Local =202.1.1.1
PtoP =202.1.1.2
Netmask =255.255.255.0
Gateway =N/A
WANCFG
======
IMPORTANT:
Use the "ADVANCED" sections only for non
standard configurations, otherwise leave
them default.
1. Start /usr/sbin/wancfg
2. Select Create opton
3. Select Card from Hardware Probe
4. Specify Hardware information:
T1/E1/V35
5. Specify Protocol
FR,PPP,CHDLC,TTY(Multilink PPP) ...
Frame Relay is by default configured
for Auto DLCI. Use the advanced sections
to change this.
6. Network Interface Setup
Specify Operation mode:
WANPIPE: IP mode proceed to specify IP addresss
API: Custom API mode, no IP addresses
Specify IP addresses:
7. Save and exit
For old WANCFG_LEGACY example refer to APPENDIX B below!
Troubleshooting the driver load process
=======================================
After a startup failure run wanrouter debug
option for more information and possible solutions:
wanrouter debug
Syntax Errors:
--------------
All wanpipe configuration file syntax errors are
reported in /var/log/wanrouter
wanrouter conflogs
Driver Messages:
----------------
All wanpipe driver events will be recorded in
/var/log/messages.
Thus if errors occur, first check /var/log/messages
to find out what exactly went wrong
with the drivers startup.
wanrouter messages
or
tail -f /var/log/messages
Once the device is started you should see a
"link connecting" message. This message
indicates that the card was been configured
successfully and that the link is trying to
connect.
Wanpipe Debugger:
-----------------
/usr/sbin/wanpipemon should be used to further debug
hardware, line and protocol problems.
/usr/sbin/wanpipemon -g
Sangoma Tech Support:
---------------------
When reporting problems to Sangoma Tech Support please
dump the current system debug information into
a temporary file and send it via email.
1. wanrouter debug if_name > sangoma_debug_file.txt
(where if_name is wanpipe interface name: eg wp1fr16)
2. Wait for 2-5 minutes
3. Stop the debug by pressing ENTER
4. Email sangoma_debug_file.txt to Sangoma Tech Support
Refer to README-4.debugging
APPENDIX A: ADSL PPPoE and PPPoA Configuration
==========
Refer to README.adsl
APPENDIX B: WANCFG_LEGACY (Old Configurator)
==========
1. Start /usr/sbin/wancfg
2. Select 'Create' option
3. Select a wanpipe device.
If this is a first device select wanpipe1
and hit <SELECT> button.
4. Choose a protocol
In this case choose Frame Relay and hit <BACK>
button.
5. Select Hardware Setup
Probing Hardware:
The top option is "Probe Hardware"
Select this option and press <ENTER>
Select a device. When selecting devices
note the PORT option. Usually PORT=PRI
would be used.
IMPORTANT:
~~~~~~~~~~
After the hardware probe section you will
notice that the next four fields have
been filled out. Thus, adapter type and
PCI info should be skipped.
All other options should normally be left as
DEFAULT unless you have special information.
Exit Hardware Setup
6. Network Interface Setup
The network interface set-up depends on the type of connection.
Instance Frame Relay supports many interfaces, each boud to
a DLCI. Thus, there are questions related to the number of
DLCIs and configuration information for each DLCI.
In the case of Point-to-Point protocols like PPP and CHDLC, there
is only one interface per physical port.
This example is Frame Relay with two DLCIs. The first input is:
"Please specify the number of DLCIs supported on this Frame Relay
connection"
Enter in number 2
For each network interface do the following:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DLCI Number:
Enter in the DLCI number. Note the default number
is always 16.
Interface Name:
The Interface name will also have default value.
You can leave it as is or change it. For instance,
you could change it to ?chicago? or ?toronto?.
IMPORTANT:
~~~~~~~~~
If you are using iptables you might want to change
the default interface name to something like "wan0".
Iptables and Ipchains don't like "_" in interface
name.
e.g.: 'iptables -o wp1_fr16 ...' will give you an error
Operation Mode:
WANPIPE is for IP Routing
BRIDGE is used to attach the network interface to
the kernel bridge
BRIDGE_NODE is used as a remote end of the line that is
connected to a bridge.
API is used for custom API applications.
Custom socket access to driver.
DLCI Protocol Setup:
In this section leave everything as default.
Unless the ISP has specified specific protocol
options such as CIR.
IP Setup:
Put in your IP info as supplied by ISP
Enable Default gateway for the first
interface.
Note: PointoPoint IP refers to the IP address of
the remote router that is connected at
the other end of the sync line.
7. Once all network interfaces are setup
keep hitting the <BACK> button until
Main Menu is reached.
Then select <EXIT> and save the config
file.
The new config file will be located in
/etc/wanpipe directory.
8. Start the device:
wanrouter start wanpipe1
Note: The card doesn't have to be connected to start the wanrouter.

331
README-3.operation Normal file
View File

@ -0,0 +1,331 @@
Wanpipe Operation Manual
========================
For latest info please visit
http://wiki.sangoma.com
At the heart of WANPIPE operation is the 'wanrouter' operation
script. It is used to start/stop/restart and display
WANPIPE current status and environment.
'wanrouter' usage
=================
/usr/sbin/wanrouter <cr>
WANPIPE: WAN Router startup script
Usage: wanrouter: {options} <wanpipe#> <interface>
wanrouter start : Starts all devices specified in
/etc/wanpipe/wanrouter.rc WAN_DEVICES
wanrouter stop : Stops all devices specified in
/etc/wanpipe/wanrouter.rc WAN_DEVICES
wanrouter start wanpipe# : Start a single device
wanrouter stop wanpipe# : Stops a single device
(# can range from 1 to 16)
wanrouter restart : Restart all devices specified in
/etc/wanpipe/wanrouter.rc WAN_DEVICES
wanrouter restart wanpipe# : Restart a single device
(# can range from 1 to 16)
wanrouter start wanpipe# if_name : Start a single interface on device
wanrouter stop wanpipe# if_name : Stops a single interface on device
(# can range from 1 to 16)
wanrouter restart wanpipe# if_name : Restart a single interface on device
(# can range from 1 to 16)
wanrouter list : List all active devices
wanrouter modules : Show wanpipe kernel modules
wanrouter status : Display status for all active devices
wanrouter summary : Summary of config files in /etc/wanpipe
wanrouter hwprobe : Display wanpipe hardware probe info.
wanrouter debug : Check current wanpipe environment.
Wanpipe startup debugging. After a startup error
run this command to get a possible solution
i.e. wanrouter start; wanrouter debug;
wanrouter debug if_name : Display common debugging statistics
In case of line problems save to file, wait 2-5min
and send to Sangoma Tech Support
i.e. wanrouter debug wp1fr16 > debug_file;
wanrouter conflogs : Display wanpipe configuration syntax errors
i.e. /var/log/wanrouter
wanrouter messages : Display wanpipe kernel event messages
i.e. /var/log/messages
wanrouter version : wanpipe version information.
WANPIPE Environment Check
=========================
The wanrouter debug option will check current
wanpipe environment, make sure that kernel modules
do load, and that /var/log/messages and /var/log/wanrouter
logs do not show any errors. It will also try
to give possible solutions.
/usr/sbin/wanrouter debug
Make sure that the new WANPIPE kernel modules have
been installed correcty and that they can be loaded
into the kernel, and the hardware is detected.
/usr/sbin/wanrouter hwprobe
Check that a configuration file exists in /etc/wanpipe
directory.
/usr/sbin/wanrouter summary
Make sure that no WANPIPE devices are currently running
on the system
/usr/sbin/wanrouter list
WANPIPE Startup
===============
Please note that all kernel driver output messages are
located in /var/log/messages file.
Run 'tail -f /var/log/messages' in a separate console
window, to monitor WANPIPE start/stop and operation
messages.
To start/stop/restart WANPIPE devices listed in
/etc/wanpipe/wanrouter.rc file: (default is wanpipe1)
/usr/sbin/wanrouter start
/usr/sbin/wanrouter stop
/usr/sbin/wanrouter restart
To start/stop/restart single wanpipe device: (eg: wanpipe2)
This command is useful when running multiple devices
and would like to operate on a singe device.
/usr/sbin/wanrouter start wanpipe2
/usr/sbin/wanrouter stop wanpipe2
/usr/sbin/wanrouter restart wanpipe2
To start/stop/restart a single network interface from a
/etc/wanpipe/wanpipe1.conf configuration file:
This command is useful when adding an extra frame
relay DLCI. Also to reconfigure a single DLCI.
/usr/sbin/wanrouter start wanpipe2 wp2_fr18
/usr/sbin/wanrouter stop wanpipe2 wp2_fr18
/usr/sbin/wanrouter restart wanpipe2 wp2_fr18
To view current status and configuration of active
devices:
/usr/sbin/wanrouter status
Error Debugging
===============
After a failed wanrouter start command
run:
wanrouter debug
The debug option will identify an error and
offer solutions.
Configuration Syntax Errors:
All configuration file syntax errors, generated
during WANPIPE starup, will be displayed in:
/var/log/wanrouter
(eg: cat /var/log/wanrouter)
Kernel Driver Errors:
All device driver errors and events will be
displayed in:
/var/log/messages
(eg: tail -f /var/log/messages)
Line Errors and Driver Statistics
After a successful WANPIPE startup any extra
debugging, such as line tracing or CSU/DSU
debugging will be done using:
/usr/sbin/wanpipemon -g
For automated Line Error debugging run
/usr/sbin/wanrouter debug <if_name>
where <if_name> is wanpipe interface name.
Sangoma Tech Support:
---------------------
When reporting problems to Sangoma Tech Support please
dump the current system debug information into
a temporary file and send it via email.
1. wanrouter debug if_name > sangoma_debug_file.txt
(where if_name is wanpipe interface name: eg wp1fr16)
2. Wait for 2-5 minutes
3. Stop the debug by pressing ENTER
4. Email sangoma_debug_file.txt to Sangoma Tech Support
Pleae refer to README-4.debugging
Wanpipe Power User Operation
-----------------------------
Wanpipe package contents
========================
1. Wanpipe Kernel Drivers
The drivers are listed in order of
dependency.
sdladrv.o : Hardware Layer
wanrouter.o : Wanpipe Protocol Interface Layer
wanpipe_syncpp.o: Wanpipe PPP/CHDLC Protocol
wanpipe.o : Wanpipe multi-protocol layer
(Frame-Relay,PPP,CHDLC,...)
af_wanpipe.o : Wanpipe API socket layer
2. User space programs
Configuration (/usr/sbin)
wancfg : Wanpipe configuration tool
cfgft1 : Wanpipe FT1 config tool for
S508FT1 and S5143 cards
(For all other cards use wancfg)
Operation (/usr/sbin)
wanconfig : Wanpipe operation tool that
parses the config file and
executed config ioctl() calls to
the kernel driver.
(C program)
wanconfig -a /etc/wanpipe/wan_adsl.list card wanpipe1 up
wanrouter : Wanpipe operation script
used to start/stop/restart
Wanpipe drivers. The wanrouter
script uses the above wanconfig
to start wanpipe as well as
standard "ifconfig" to bring
all necessary interfaces up.
Debugging
wanpipemon : Wanpipe debugging application
used to debug the hardware, drivers
and sync line.
wanpipemon -g
Wanpipe Operation
=================
If a power user desn't want to use
the wanrouter master script. Here is the
break down of the wanpipe startup
sequence:
wanrouter start
1. Load Kernel Modules
insmod sdladrv.o
insmod wanrouter.o
insmod wanpipe_syncppp.o
insmod wanpipe.o
insmod af_wanpipe.o
or
modprobe af_wanpipe
2. Configure and Start Drivers
/usr/sbin/wanconfig -a /etc/wanpipe/wan_adsl.list card wanpipe1 up
3. Start up all network interfaces
ifconfig wan0 <local ip> pointopoint <remote ip> netmask 255.255.255.255
4. Confirmation
tail -f /var/log/messages
Check the events and driver statistics.
cat /proc/net/wanrouter/status
Check driver state

183
README-4.debugging Normal file
View File

@ -0,0 +1,183 @@
Wanpipe Debugging Manual
========================
For latest info please visit
http://wiki.sangoma.com
Automated Debugging:
--------------------
The wanrouter operation script can retrieve the
most common line error statistics that can
give the user a good idea of what is going on
with the line.
/usr/sbin/wanrouter debug if_name
or
/usr/sbin/wanrouter debug if_name > debug_file.txt
(where if_name is the name of wanpipe interface: eg: wp1fr16)
Sangoma Tech Support:
---------------------
When reporting problems to Sangoma Tech Support please
dump the current system debug information into
a temporary file and send it via email.
1. wanrouter debug wp1fr16 > sangoma_debug_file.txt
2. Wait for 2-5 minutes
3. Stop the debug by pressing ENTER
4. Email sangoma_debug_file.txt to Sangoma Tech Support
Wanpipe Debugger
----------------
At the heart of WANPIPE debugging is the 'wanpipemon'
debugging program. It is used to display line
traces, protocol statistics, hardware statistics
and configuration parameters.
/usr/sbin/wanpipemon -g
'wanpipemon' usage
==================
/usr/sbin/wanpipemon
Wanpipemon Verison 1.0
Copyright (C) 2002 - Sangoma Technologies
www.sangoma.com
This may be freely redistributed under the terms of the GNU GPL
Usage: (Options in {} brackets are optional)
#Command prompt Local debugging
wanpipemon -i <interface> -c <command> { -p <protocol> }
#Command prompt Remote debugging
wanpipemon -i <remote IP> -u <port> -c <command> { -p <protocol> }
#GUI interface
wanpipemon -g { -i <interface|IP> -u <port> -p <protocol> }
#Display usage for each protocol
wanpipemon -p [fr|ppp|chdlc|x25|adsl]
#Detailed usage for each option
wanpipemon -h
The 'wanpipemon' utility operates in two modes.
Local debugging:
The 'wanpipemon' utility is located on the same
machine as the WANPIPE card.
Thus, the wanpipemon utility needs only the
interface name (eg: wp1_fr16) to reach the driver.
/usr/sbin/wanpipemon -i wp1_fr16 -c xm
Remote debugging:
The 'wanpipemon' utility is located on a network
(LAN or WAN) and must use the UDP protocol to
reach the WANPIPE card.
In this case an IP and UDP addresses must be
specified, such that the packet will pass through
the WANPIPE driver!
Meaning a POINTOPOINT address must be used instead
of the LOCAL IP address.
The UDP port was specified in WANPIPE configuration
file. (Default=9000)
/usr/sbin/wanpipemon -i 201.1.1.2 -u 9000 -c xm
GUI Mode Operation
==================
The GUI mode is based on ncurses libraries, thus it
will work both in Terminal or Xwindows mode.
/usr/sbin/wanpipemon -g
Without any other arguments the GUI will offer a list
of network interfaces, for local debugging, or will
ask for an IP/UDP address, for remote debugging.
Use menu's to navigate through available commands.
Common Statistics
=================
Modem Status (-c xm):
(wanpipemon -i if_name -c xm)
Must be DCD=HIGH and CTS=HIGH if not there is
ether a cable problem or the sync line is
not turned ON.
Comm Error Stats (-c sc):
(wanpipemon -i if_name -c sc)
Check for CRC and Abort errors. If errors
are incrementing, there is a line issue.
Possible reasons: CSU/DSU misconfiguration
on local or remote side.
Noisy/Bad line.
Line trace (-c tr):
(wanpipemon -i if_name -c tr)
Make sure thare are incoming and outgoing frames.
If frames are outgoing and none incoming:
Frame relay: Check signalling (ANSI, LMI)
Make sure ISP uses IETF or CISCO
data encapsulation.
Other prot: Possible CRC errors in TX
direction. Contact your ISP.
If frames are both incoming and outgoing but
protocol is still down:
Run trace in Interpreted mode (-c ti) and
make sure that the incoming protocol is
indeed the one you are configured for.
Wanpipe Kernel Messages
/usr/sbin/wanrouter messages
or
tail -f /var/log/messages
All line/protocol events will be displayed in
the kernel logs.

View File

@ -1,593 +0,0 @@
Asterisk Open PBC/IVR Project using the Sangoma A101 and A102 cards
===================================================================
For Latest Documenation please visit:
Sangoma Wiki
http://sangoma.editme.com
WANPIPE supports the Asterisk Open PBX/IVR project through an interface
of the Zaptel family of hardware devices. These devices share a common
driver suite, called the ZAPATA Telephony Driver Suite (zaptel).
IMPORTANT
---------
Please read the APPENDIX for IMPORTANT INFO
------------------------------------------------------------------
ASTERISK / ZAPTEL Installation
------------------------------------------------------------------
First install:
zaptel, zapata, libpri and asterisk
software on your system.
The Asterisk distributions can be found at http://www.asterisk.org.
1. Download the LATEST sources from http://www.asterisk.org;
2. Untar zaptel, libpri and asterisk source
in /usr/src directory
3. Proceed with ASTERISK/ZAPTEL installation as per
Asterisk instructions
Install: 1) Zaptel
2) LibPri
3) Asterisk
For each do: make clean
make
make install
Note:
Zaptel kernel drivers must compiled and
installed BEFORE loading WANPIPE drivers.
-----------------------------------------------------------------
WANPIPE Releases
-----------------------------------------------------------------
2.3.3: Latest Wanpipe Release
o New channelized TDMV Driver (A104 Only)
Voice data is channelized and grouped into
8 byte chunks in HARDWARE. Each voice
channel is then DMAed directly into the ZAPTEL
buffers. Thus there is ZERO copy from HARDWARE
to ZAPTEL, resulting in better performance and
scalability.
o New DCHAN PRI Hardware HDLC support:
A104 Supported from beta1-2.3.3 release,
A101/A102 Supported from beta6-2.3.3 release
Instead of using the ZAPTEL software HDLC engine,
WANPIPE drivers use FPGA-based HARDWARE HDLC engine to
handle the PRI HDLC traffic. The HDLC frames are
then passed directly into LIBPRI, resulting
in higher reliability, better performance and scalability.
o New TDMV API (A104 Only)
Customers that develop Voice Applications in User Space,
can now develop using Channelized TDMV API.
The TDMV API works in the same way as standard HDLC API.
Application creates a socket to a network interface and
uses standard system calls to read and write.
However, data received from the TDMV API socket, will be
in 8,16,32 or 63 byte CHUNKS for each configured timeslot.
Thus for full T1 1-23 voice channels the rx data would
look like:
__________________________________
| 8bytes | 8 | | ... | 8 |
----------------------------------
Slot 1 2 3 23
The DCHAN PRI HDLC frames would be received as OOB messages
on the same socket.
OR
The DCHAN PRI HDLC frames could be received using another
socket that is connected to a network interface that is
bound to channel 24.
2.3.2: Stable Wanpipe TDMV Release
o The ORIGINAL TDMV driver for both A101/2 and A104 cards.
TDMV Driver has been optimized for best Echo cancel
performance.
This driver has been fully tested in the field and is
considered stable.
----------------------------------------------------------------
WANPIPE Installation for Asterisk
----------------------------------------------------------------
1. Download the LATEST Wanpipe 2.3.3 Release or Greater!
Note: Wanpipe does not support Asterisk in releases
LOWER than 2.3.2!
ftp.sangoma.com/linux/current_wanpipe
2. Untar wanpipe release in /usr/src/ directory
eg: tar xvfz wanpipe-beta16-2.3.3.tgz
3. Run ./Setup install
Proceed with installation choose YES for each option.
IMPORTANT:
Under compilation mode:
Select Option 2: TDM Only drivers
OR
Select Option 3: TMD and WANPIPE drivers
Select [Y] to Enable TDMV_DCHAN option for Hardware HDLC for
DCHAN PRI.
This option will also PATCH the ZAPTEL driver.
Thus, ZAPTEL MUST be recompiled and installed
after the ./Setup is completed.
Note: ./Setup will automatically patch:
Latest CVS Head
and
Stable 1.0.9 Release (not CVS)
WARNING: ./Setup cannot distinguish between
CVS Head and 1.0.9 CVS releases.
In this case one should manually patch
1.0.9 CVS using 1.0.9 patch in wanpipe/zaptel
directory.
Proceed to compile wanpipe drivers.
Proceed with Defaults for the rest of the compilation.
4. Recompile ZAPTEL AGAIN
If you chose TDMV DHCAN option: Hardware HDLC for DCHAN PRI
./Setup has patched zaptel drivers.
Zaptel drivers must now be re-compiled and re-installed.
Proceed to zaptel/ source directory:
make clean
make
make install
5. To confirm successful installation run:
wanrouter hwprobe
Confirm that Sangoma cards have been found.
------------------------------------------------------------------------
WANPIPE Configuration for the A100 series of cards
------------------------------------------------------------------------
You can use the A101 or A102 cards for both data and voice. The
following describes how to configure the Asterisk system for
voice, with an auxiliary data interface, if needed.
1. Run the configuration utility wancfg.
/usr/sbin/wancfg
Hardware Setup:
Select Hardware: Specify AFT card from hardware probe.
----------------------------
Card Type-------> A104
Physical Medium-> T1
----------------------------
Sepecify Line Type: T1 (Default)
or
E1
Default configuration is complete: Select <BACK>
For Advanced configuration proceed below...
T1/E1 CSU/DSU Advanced Setup (OPTIONAL - non default)
-----------------------------------------------------
Select: Advanced Physical Medium Config
A104/2 TE1 Clock Synchronization (OPTIONAL - non default):
----------------------------------------------------------
TE1 Clock synchronization is used to propagate
a single clock source over the T1/E1 ports on a single card.
Example:
wanpipe1: Port 1 receives T1 Clock from Telco
wanpipe2: Port 2 provides MASTER transmit clock for the link,
synchronized to the clock on Port 1
TE_CLOCK = MASTER #Specify AFT card as Master clock source
FE_REF_CLOCK = 1 #Specify the clock source port
For more information refer to APPENDIX below.
Protocol Setup:
Select Protocol: TDM VOICE
No other options
Interface Setup:
Select: SPAN Number: 1 - Unlimited
The SPAN usually starts with 1
Select: Override Asterisk Echo Enable
Default: NO
This option will DISABLE/Override Asterisk
ECHO Cancellation setting for this SPAN.
Therefore, if you want to DISABLE Echo Cancellation
for this SPAN, ie: ignore what is configured in
zapata.conf, then set this option to YES.
*This is used in switching applications where one SPAN needs echo
cancellation and rest do not.
Select: DCHAN PRI Timeslot:
Hardware HDLC support for DCHAN PRI
A104: Supported from beta5-2.3.3 or greater
Release : beta5-2.3.3 or greater.
Firmware Version: V.11 or greater
A101/2: Supported from beta6-2.3.3 or greater
Release : beta6-2.3.3 or greater.
Firmware Version: All versions (V.24 latest)
Options: 0 : Disable Hardware HDLC on PRI
timeslot.
24 : T1 Line DCHAN is usually on timeslot 24
Enable Hardware HDLC on PRI timeslot. Default 24
16 : E1 Line DHCAN is usually on timeslot 16
Enable Hardware HDLC on PRI timeslot. Default 16
Note: TDMV_DCHAN values are ALWAYS [ 0 | 24 | 16 ]
(Don't confuse this with the Asterisk configuration that uses
values greater than 24/31 for the DCHAN specification)
No other options
------------------------------------------------------------------------
Zaptel configuration
------------------------------------------------------------------------
Download the documentation how to configure Zaptel driver from
(http://www.digium.com/downloads/configuring_zaptel.pdf).
When configuring the Zaptel driver (/etc/zaptel.conf)
1) Select the same span configurations as you used for WANPIPE
(i.e. LBO, framing, coding parameters).
Otherwise the Zaptel configuration is completely
standard, except that if there are data channels that
will be handled by WANPIPE, those channels should be ignored,
and not configured as 'nethdlc'.
2) If you are using multiple WANPIPE devices for Asterisk
For example, an A102 card might be configured as:
wanpipe1 and wanpipe2
then you need to set your starting scripts to start
the wanpipes in the same sequence as defined in zaptel.conf.
Run: wanrouter wanrc
to set the wanpipe startup order.
3) If you are using some channels for DATA
You don't need to set the channel list for this
interface under /etc/zaptel.conf because all data will go
through the separate WANPIPE driver to the kernel.
-------------------------------------------------------------
APPENDIX
-------------------------------------------------------------
1)HOTPLUG Conflicts with WANPIPE
===============================
The HOTPLUG Service should be disabled because it
conflicts with Wanpipe interface startup.
The HOTPLUG can conflict with startup of TDMV drivers.
Possible Solutions:
Insert wanpipe interface name into the hotplug
interface list, and restart hotplug.
vi /etc/hotplug/net.agent
Insert wanpipe interface name into
the ignore list:
...ppp*|lo*|w*)
Where w* relates to all wanpipe interfaces
starting with letter "w"
Restart hotplug agent:
/etc/init.d/hotplug restart
-------------------------------------------------------------------
2) Exec "ztcfg" after wanrouter start
==================================
The "ztcfg" tool must be executed before starting
asterisk. WANPIPE "wanrouter" script has the capability
to execute an external script after "wanrouter start"
command is competed.
The wanrouter looks to /etc/wanpipe/scripts directory
for any configured bash scripts.
1) Create a file called "start" (lower case)
vi start
----------Cut Here----------------
#!/bin/sh
#Make sure that udev/devfs zaptel device
#has come up.
while [ ! -e /dev/zap ];
do
echo "Waiting for zaptel device /dev/zap..."
sleep 2
done
sleep 1
ztcfg -vvvv
----------Cut Here----------------
2) Copy the file "start" into /etc/wanpipe/scripts directory.
(Note: the file doesn't have to have exec privileges)
The script "start" will execute each time the "wanrouter start"
command executes.
Please Refer to README.external_scripts for more info about
wanrouter and external scripts.
------------------------------------------------------------
2) Updating FLASH on AFT Cards
===========================
The AFT FLASH update utility is located in:
wanpipe/util/wan_aftup directory.
The same directory contains the latest AFT
FLASH Firmware BIN files since the release
of the driver.
The latest AFT Firmware bins are located in
ftp.sangoma.com/linux/current_wanpipe/firmware.
To update flash on ANY AFT card do the following:
1) Make sure you have the latest AFT Firmware BIN
The latest file necessary for the current release
will be in the wan_aftup/ directory.
One can also check the ftp site above.
The AFT Binary file must reside in wan_aftup/ directory.
2) Make sure that wanpipe drivers are NOT Loaded
lsmod | grep wanpipe
3) Run ./update_aft_firm.sh
Specify interface name that corresponds to the
AFT card.
Specify the latest AFT Firmware version
Once the flashing is done, select Y to reload firmware.
(This step only reloads flash, not your machine!)
4) Card is ready for normal operation. (No reboot needed)
---------------------------------------------------------------
3) Multiple ZAPTEL Releases AND Wanpipe Crashing
=============================================
On systems, where ZAPTEL has been upgraded from old
releases, it is possible for a kernel module directory
to contain MULTIPLE ZAPTEL drivers.
Old Zaptel install dir: /lib/modules/$(uname -r)/zaptel
New Zpatel install dir: /lib/modules/$(uname -r)/misc
If old zaptel installation was NOT removed, the new installation
would NOT overwrite the old kernel modules. In this case
the OLD modules would continue to be loaded, even though the
new ones were installed.
Check:
The check if this condition exists on your machine run:
modprobe -l | grep zaptel.*o
If multiple zaptel modules are found
the problem must be fixed before starting
WANPIPE !!!.
In this scenario, if a customer starts WANPIPE drivers based
on NEW ZAPTEL sources, the WANPIPE would CRASH !!!
The WANPIPE driver shares structures with ZAPTEL, thus, a
result of mismatched structures is a kernel panic.
Solution:
The solution in this case is to REMOVE the old zaptel modules.
rm -rf /lib/modules/$(uname -r)/zaptel
depmod -a
---------------------------------------------------------------
4) Multiple ZTCFG executions on bootup
====================================
On systems that have zaptel and digium drivers
installed, one must be careful to synchronize
wanpipe, digium and zaptel ztcfg on boot up.
Therefore, wanpipe and digim MUST start before ztcfg
is executed.
Check your /etc/rcS.d startup scripts. Make sure that
the startup numbers S## for zaptel are higher than those
of wanpipe and digium.
---------------------------------------------------------------
5) UDEV Conflicts with ZAPTEL
==========================
UDEV is a user space daemon, which handles all /dev
devices. On startup ZAPTEL schedules creation of
/dev/zap device. It takes about 10 seconds for the
UDEV daemon to create /dev/zap and all its devices after
zaptel has been started (wanrouter start).
On shutdown, ZAPTEL schedules deletion of /dev/zap
device. Again it takes about 1-5seconds for UDEV
daemon to delete /dev/zap device from user space.
A conflict can occur if one quickly starts and then stops
wanpipe/zaptel. In this case UDEV daemon might be in
process of creating /dev/zap devices, while zaptel kernel
driver tries to remove them.
To prevent this please install the wanpipe external
start script referenced in ITEM #2 of the APPENDIX above.
This script will delay wanpipe start until UDEV has
created the /dev/zap devices.
----------------------------------------------------------------
6) A104/2 TE1 Clock Synchronization:
=================================
TE1 Clock synchronization is used to propagate
a single clock source over the T1/E1 ports on a single card.
Example:
wanpipe1->Port 1 receives T1 Clock from Telco
wanpipe2->Port 2 provides MASTER transmit clock for the link,
synchronized to the clock on Port 1
Settings for wanpipe1, Port 1:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using wancfg, configure as slave with TE_CLOCK=NORMAL
Settings for wanpipe2, Port 2:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using wancfg, configure as master with
TE_CLOCK=MASTER
FE_REF_CLOCK=1
The FE_REF_CLOCK parameter refers to the source of the MASTER
clock for this port. On the A104 it can be any of the 4 ports.
On the A102, Port A=1 and Port B=2. Setting FE_REF_CLOCK=0
sets the clock source as the on-board oscillator, disabling
any synchronization.
IMPORTANT: When starting and stopping wanpipe devices make sure
that the wanpipe# that provides the synchronized clock source
is started first and stopped last. This is normally done automatically
by the wanrouter startup script.
If the wanpipe# that provides the synchronized clock source is
stopped, the other devices using the clock source will
behave unpredictably.

File diff suppressed because it is too large Load Diff

1623
Setup

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -16,12 +16,19 @@ SYSINC=/usr/src/linux/include
endif
VPATH = $(SYSINC)
DIR_EC_APILIB=/common/wantools/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)
# Tools options.
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib -I$(SYSINC)
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -DCONFIG_PRODUCT_WANPIPE_TDMV_EC -D_GNUC_ -I../lib -I$(SYSINC)
CFLAGS += -I/usr/include/wanpipe
TARGETS=aft_api
TARGETS+= aft_api_ss7
TARGETS+= aft_api_check
TARGETS+= aft_api_events
#TARGETS+= aft_api_ss7
#TARGETS+= aft_api_check
#TARGETS+= aft_tdm_api
####### RULES ################################################################
@ -31,13 +38,17 @@ all: $(TARGETS)
aft_api: aft_api.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
aft_api_events: aft_api_events.c $(SRC_EC_APILIB) ../lib/lib_api.c
$(CC) $(CFLAGS) $(INC_EC_APILIB) -o $@ $^
aft_api_check: aft_api_check.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
aft_tdm_api: aft_tdm_api.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
aft_api_ss7: aft_api_ss7.c ../lib/lib_api.c
$(CC) $(CFLAGS) -o $@ $^
clean:
rm -f $(TARGETS)

View File

@ -60,6 +60,22 @@ FILE *tx_fd=NULL,*rx_fd=NULL;
* (Interface name is supplied by the user)
*/
void print_packet(unsigned char *buf, int len)
{
int x;
printf("{ | ");
for (x=0;x<len;x++){
if (x && x%24 == 0){
printf("\n ");
}
if (x && x%8 == 0)
printf(" | ");
printf("%02x ",buf[x]);
}
printf("}\n");
}
int MakeConnection(void)
{
struct wan_sockaddr_ll sa;
@ -125,8 +141,6 @@ int sangoma_readmsg_socket(int sock, void *hdrbuf, int hdrlen, void *databuf, in
msg.msg_iovlen=2;
msg.msg_iov=iov;
printf("RECVMSG: \n");
return recvmsg(sock,&msg,flag);
}
@ -152,8 +166,6 @@ int sangoma_sendmsg_socket(int sock, void *hdrbuf, int hdrlen, void *databuf, in
msg.msg_iovlen=2;
msg.msg_iov=iov;
printf("SENDMSG: \n");
return sendmsg(sock,&msg,flag);
}
@ -402,6 +414,10 @@ void handle_socket(void)
++Rx_count;
printf("RECEIVE:\n");
print_packet(&Rx_data[16],Rx_lgth);
if (verbose){
printf("Received %i Olen=%i Length = %i\n",
Rx_count, err,Rx_lgth);
@ -426,6 +442,11 @@ bitstrm_skip_read:
if (FD_ISSET(sock,&write)){
if (Tx_count == 0){
printf("SEND: Len=%i\n",Tx_length);
print_packet(&Tx_data[16],Tx_length);
}
#if 1
err = sangoma_sendmsg_socket(sock,
Tx_data,16,
@ -449,7 +470,7 @@ bitstrm_skip_read:
(err == 1) ? "DISCONNECTED" :
"CONNECTING");
printf("Faild to send %i \n",errno);
printf("Failed to send errno=%i len=%i \n",errno,Tx_length);
perror("Send: ");
break;
}

765
api/aft/aft_api_events.c Normal file
View File

@ -0,0 +1,765 @@
/*****************************************************************************
* aft_api.c AFT T1/E1: HDLC API Sample Code
*
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
*
* Copyright: (c) 2003-2004 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.
* ============================================================================
*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.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 <signal.h>
#include <linux/if.h>
#include <linux/wanpipe_defines.h>
#include <linux/wanpipe_cfg.h>
#include <linux/wanpipe.h>
#include <linux/sdla_aft_te1.h>
#include "lib_api.h"
#include <linux/wanpipe_events.h>
//#include "wanec_iface.h"
#include "wanec_api.h"
#define MAX_TX_DATA 5000 /* Size of tx data */
#define MAX_FRAMES 5000 /* Number of frames to transmit */
#define MAX_RX_DATA 5000
unsigned short Rx_lgth;
unsigned char Rx_data[MAX_RX_DATA];
unsigned char Tx_data[MAX_TX_DATA + sizeof(api_tx_hdr_t)];
/* Prototypes */
int MakeConnection(void);
void handle_socket(int ,char**);
void sig_end(int sigid);
int sock;
FILE *tx_fd=NULL,*rx_fd=NULL;
#define WP_API_EVENT_MAX_RETRY 10
u_int8_t event_type;
int channel, tone_id = 1;
/***************************************************
* 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( WAN_FALSE );
} /* if */
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);
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);
}
{
unsigned int customer_id;
int err = ioctl(sock,SIOC_AFT_CUSTOMER_ID,&customer_id);
if (err){
perror("Customer ID: ");
}else{
printf("Customer ID 0x%X\n",customer_id);
}
}
printf("Socket bound to %s\n\n",if_name);
return( WAN_TRUE );
}
static int dtmf_event_ctrl(u_int8_t mode, int channel)
{
api_tx_hdr_t api_tx_hdr;
int err, cnt=0;
/* Configure DTMF events */
printf("%s DTMF event on channel %d\n",
(mode==WP_API_EVENT_ENABLE) ? "Configure" : "Clear",
channel);
err = wanec_api_dtmf( card_name,
(mode==WP_API_EVENT_ENABLE) ? 1 : 0,
(1 << channel),
WAN_EC_CHANNEL_PORT_SOUT,
WAN_EC_TONE_PRESENT,
1);
if (err){
printf("ERROR: %s: Failed to execute DTMF configuration request!\n",
card_name);
return -EINVAL;
}
/* Enable DTMF events */
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
printf("%s DTMF Event on channel %d...\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable",
channel);
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_DTMF;
api_tx_hdr.wp_api_tx_hdr_event_mode = mode;
api_tx_hdr.wp_api_tx_hdr_event_channel = channel;
dtmf_try_again:
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
if (err < 0){
usleep(10000);
if (cnt++ < WP_API_EVENT_MAX_RETRY) goto dtmf_try_again;
printf("ERROR: Failed to %s DTMF events!\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
return -EINVAL;
}
return 0;
}
static int rxhook_event_ctrl(u_int8_t mode, int channel)
{
api_tx_hdr_t api_tx_hdr;
int err, cnt=0;
/* Enable Rx-hook events */
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
printf("%s Rx-hook Event...\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_RXHOOK;
api_tx_hdr.wp_api_tx_hdr_event_mode = mode;
api_tx_hdr.wp_api_tx_hdr_event_channel = channel;
rxhook_try_again:
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
if (err < 0){
usleep(10000);
if (cnt++ < WP_API_EVENT_MAX_RETRY) goto rxhook_try_again;
printf("ERROR: Failed to %s Rx-hook events (%d)!\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable",
cnt);
return -EINVAL;
}
return 0;
}
static int ring_event_ctrl(u_int8_t mode, int channel)
{
api_tx_hdr_t api_tx_hdr;
int err, cnt=0;
/* Enable Ring events */
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
printf("%s Ring Event...\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_RING;
api_tx_hdr.wp_api_tx_hdr_event_mode = mode;
api_tx_hdr.wp_api_tx_hdr_event_channel = channel;
ring_try_again:
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
if (err < 0){
usleep(10000);
if (cnt++ < WP_API_EVENT_MAX_RETRY) goto ring_try_again;
printf("ERROR: Failed to %s Ring events!\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
return -EINVAL;
}
return 0;
}
static int tone_event_ctrl(u_int8_t mode, int channel, int tone)
{
api_tx_hdr_t api_tx_hdr;
int err, cnt=0;
/* Enable Tone events */
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
printf("%s Tone Event...\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_TONE;
api_tx_hdr.wp_api_tx_hdr_event_mode = mode;
api_tx_hdr.wp_api_tx_hdr_event_tone = tone;
api_tx_hdr.wp_api_tx_hdr_event_channel = channel;
tone_try_again:
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
if (err < 0){
usleep(10000);
if (cnt++ < WP_API_EVENT_MAX_RETRY) goto tone_try_again;
printf("ERROR: Failed to %s Tone events!\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
return -EINVAL;
}
return 0;
}
static int ringdetect_event_ctrl(u_int8_t mode, int channel, int tone)
{
api_tx_hdr_t api_tx_hdr;
int err, cnt=0;
/* Enable Tone events */
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
printf("%s Ring Detect Event...\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_RING_DETECT;
api_tx_hdr.wp_api_tx_hdr_event_mode = mode;
api_tx_hdr.wp_api_tx_hdr_event_channel = channel;
ringdetect_try_again:
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
if (err < 0){
usleep(10000);
if (cnt++ < WP_API_EVENT_MAX_RETRY) goto ringdetect_try_again;
printf("ERROR: Failed to %s Tone events!\n",
(mode==WP_API_EVENT_ENABLE) ? "Enable" : "Disable");
return -EINVAL;
}
return 0;
}
static int event_decode(api_rx_hdr_t *rx_hdr)
{
static int event_cnt = 0;
switch(rx_hdr->event_type){
case WP_API_EVENT_DTMF:
printf("%04d --> DTMF event: %c (%s:%s)\n",
event_cnt++,
rx_hdr->wp_api_rx_hdr_event_dtmf_digit,
(rx_hdr->wp_api_rx_hdr_event_dtmf_port == WAN_EC_CHANNEL_PORT_SOUT) ?
"SOUT" : "ROUT",
(rx_hdr->wp_api_rx_hdr_event_dtmf_type == WAN_EC_TONE_PRESENT) ?
"PRESENT" : "STOP");
break;
case WP_API_EVENT_RXHOOK:
printf("%04d --> Rx-hook: %s\n",
event_cnt++,
(rx_hdr->wp_api_rx_hdr_event_rxhook_state == WP_API_EVENT_RXHOOK_OFF) ?
"Off-hook" :
(rx_hdr->wp_api_rx_hdr_event_rxhook_state == WP_API_EVENT_RXHOOK_ON) ?
"On-hook" : "Unknown");
break;
case WP_API_EVENT_RING_DETECT:
printf("%04d --> Ring Detect: %s\n",
event_cnt++,
WAN_EVENT_RING_DECODE(rx_hdr->wp_api_rx_hdr_event_ringdetect_state));
break;
default:
printf("%04d --> Unknown event\n",
event_cnt++);
break;
}
return 0;
}
static int event_ctrl(u_int8_t mode, int argc, char* argv[])
{
int i=0;
for (i = 0; i < argc; i++){
if (!strcmp(argv[i],"-tone")){
if (i+2 > argc-1){
printf("ERROR: Invalid Interface Name!\n");
return WAN_FALSE;
}
if(!isdigit(argv[i+1][0])){
printf("ERROR: Invalid tone id!\n");
return WAN_FALSE;
}
event_type = WP_API_EVENT_TONE;
tone_id = atoi(argv[i+1]);
channel = atoi(argv[i+2]);
if (tone_event_ctrl(mode, channel, tone_id)){
return -1;
}
}
if (!strcmp(argv[i],"-ring")){
if (i+1 > argc-1){
printf("ERROR: Invalid Interface Name!\n");
return WAN_FALSE;
}
if(!isdigit(argv[i+1][0])){
printf("ERROR: Invalid ring command!\n");
return WAN_FALSE;
}
event_type = WP_API_EVENT_RING;
channel = atoi(argv[i+1]);
if (ring_event_ctrl(mode, channel)) return -1;
}
if (!strcmp(argv[i],"-rxhook")){
if (i+1 > argc-1){
printf("ERROR: Invalid Interface Name!\n");
return WAN_FALSE;
}
if(!isdigit(argv[i+1][0])){
printf("ERROR: Invalid ring command!\n");
return WAN_FALSE;
}
event_type = WP_API_EVENT_RXHOOK;
channel = atoi(argv[i+1]);
if (rxhook_event_ctrl(mode, channel)) return -1;
}
if (!strcmp(argv[i],"-dtmf")){
if (i+1 > argc-1){
printf("ERROR: Invalid Interface Name!\n");
return WAN_FALSE;
}
if(!isdigit(argv[i+1][0])){
printf("ERROR: Invalid ring command!\n");
return WAN_FALSE;
}
event_type = WP_API_EVENT_DTMF;
channel = atoi(argv[i+1]);
if (dtmf_event_ctrl(mode, channel)) return -1;
}
}
return 0;
}
/***************************************************
* HANDLE SOCKET
*
* o Read a socket
* o Cast data received to api_rx_element_t data type
* o The received packet contains 16 bytes header
*
* ------------------------------------------
* | 16 bytes | X bytes ...
* ------------------------------------------
* Header Data
*
* o Data structures:
*
* typedef struct {
* unsigned char error_flag;
* unsigned short time_stamp;
* unsigned char reserved[13];
* } api_rx_hdr_t;
*
* typedef struct {
* api_rx_hdr_t api_rx_hdr;
* unsigned char data[1];
* } api_rx_element_t;
*
*/
void handle_socket(int argc, char* argv[])
{
unsigned int Rx_count,Tx_count,Tx_length;
api_rx_element_t* api_rx_el;
api_tx_element_t * api_tx_el;
fd_set ready,write,oob;
int err,i;
int rlen;
#if 0
int stream_sync=0;
#endif
Rx_count = 0;
Tx_count = 0;
Tx_length = tx_size;
printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n",
read_enable,write_enable,tx_cnt,tx_size,tx_delay);
/* Initialize the Tx Data buffer */
memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(api_tx_hdr_t));
/* If rx file is specified, open
* it and prepare it for writing */
if (files_used & RX_FILE_USED){
rx_fd=fopen(rx_file,"wb");
if (!rx_fd){
printf("Failed to open file %s\n",rx_file);
perror("File: ");
return;
}
printf("Opening %s rx file\n",rx_file);
}
/* Cast the Tx data packet with the tx element
* structure. We must insert a 16 byte
* driver header, which driver will remove
* before passing packet out the physical port */
api_tx_el = (api_tx_element_t*)&Tx_data[0];
if (files_used & TX_FILE_USED){
/* TX file is used to transmit data */
tx_fd=fopen(tx_file,"rb");
if (!tx_fd){
printf("Failed to open file %s\n",tx_file);
perror("File: ");
return;
}
printf("Opening %s tx file\n",rx_file);
rlen=fread((void*)&Tx_data[sizeof(api_tx_hdr_t)],
sizeof(char),
Tx_length,tx_fd);
if (!rlen){
printf("%s: File empty!\n",
tx_file);
return;
}
}else{
/* Create a Tx packet based on user info, or
* by deafult incrementing number starting from 0 */
for (i=0;i<Tx_length;i++){
if (tx_data == -1){
api_tx_el->data[i] = (unsigned char)i;
}else{
#if 0
api_tx_el->data[i] = (unsigned char)tx_data+(i%4);
#else
api_tx_el->data[i] = (unsigned char)tx_data;
#endif
}
}
}
write_enable = 1;
read_enable = 1;
if (event_ctrl(WP_API_EVENT_ENABLE, argc, argv)){
event_ctrl(WP_API_EVENT_DISABLE, argc, argv);
return;
}
/* Main Rx Tx OOB routine */
for(;;) {
/* Initialize all select() descriptors */
FD_ZERO(&ready);
FD_ZERO(&write);
FD_ZERO(&oob);
FD_SET(sock,&oob);
FD_SET(sock,&ready);
if (write_enable){
FD_SET(sock,&write);
}
/* Select will block, until:
* 1: OOB event, link level change
* 2: Rx data available
* 3: Interface able to Tx */
if(select(sock + 1,&ready, &write, &oob, NULL)){
fflush(stdout);
if (FD_ISSET(sock,&oob)){
api_rx_hdr_t *rx_hdr;
/* An OOB event is pending, usually indicating
* a link level change */
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 CMD Exiting\n");
rx_hdr = (api_rx_hdr_t*)Rx_data;
event_decode(rx_hdr);
break;
}
if (FD_ISSET(sock,&ready)){
/* An Rx packet is pending
* 1: Read the rx packet into the Rx_data
* buffer. Confirm len > 0
*
* 2: Cast Rx_data to the api_rx_element.
* Thus, removing a 16 byte header
* attached by the driver.
*
* 3. Check error_flag:
* CRC,Abort..etc
*/
err = recv(sock, Rx_data, MAX_RX_DATA, 0);
if (!read_enable){
goto bitstrm_skip_read;
}
/* err indicates bytes received */
if(err > 0) {
api_rx_el = (api_rx_element_t*)&Rx_data[0];
/* Check the packet length */
Rx_lgth = err - sizeof(api_rx_hdr_t);
if(Rx_lgth<=0) {
printf("\nShort frame received (%d)\n",
Rx_lgth);
return;
}
#if 0
if (api_rx_el->api_rx_hdr.error_flag){
printf("Data: ");
for(i=0;i<Rx_lgth; i ++) {
printf("0x%02X ", Rx_data[i+16]);
}
printf("\n");
}
if (api_rx_el->api_rx_hdr.error_flag & (1<<WP_FIFO_ERROR_BIT)){
printf("\nPacket with fifo overflow err=0x%X len=%i\n",
api_rx_el->api_rx_hdr.error_flag,Rx_lgth);
continue;
}
if (api_rx_el->api_rx_hdr.error_flag & (1<<WP_CRC_ERROR_BIT)){
printf("\nPacket with invalid crc! err=0x%X len=%i\n",
api_rx_el->api_rx_hdr.error_flag,Rx_lgth);
continue;
}
if (api_rx_el->api_rx_hdr.error_flag & (1<<WP_ABORT_ERROR_BIT)){
printf("\nPacket with abort! err=0x%X len=%i\n",
api_rx_el->api_rx_hdr.error_flag,Rx_lgth);
continue;
}
#endif
if (api_rx_el->api_rx_hdr.event_type){
event_decode(&api_rx_el->api_rx_hdr);
}
#if 0
if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data+1)){
if (!stream_sync){
printf("GOT SYNC %x\n",api_rx_el->data[0]);
}
stream_sync=1;
}else{
if (stream_sync){
printf("OUT OF SYNC: %x\n",api_rx_el->data[0]);
}
}
#endif
if ((files_used & RX_FILE_USED) && rx_fd){
fwrite((void*)&Rx_data[sizeof(api_rx_hdr_t)],
sizeof(char),
Rx_lgth,
rx_fd);
}
++Rx_count;
if (verbose){
printf("Received %i Olen=%i Length = %i\n",
Rx_count, err,Rx_lgth);
#if 1
printf("Data: ");
for(i=0;i<Rx_lgth; i ++) {
printf("0x%02X ", api_rx_el->data[i]);
}
printf("\n");
#endif
}else{
//putchar('R');
}
if (rx_cnt > 0 && Rx_count >= rx_cnt){
break;
}
} else {
printf("\nError receiving data\n");
break;
}
bitstrm_skip_read:
;
}
if (FD_ISSET(sock,&write)){
//err = send(sock,Tx_data, Tx_length + sizeof(api_tx_hdr_t), 0);
err=Tx_length + sizeof(api_tx_hdr_t);
if (err <= 0){
if (errno == EBUSY){
if (verbose){
printf("Sock busy try again!\n");
}
/* Socket busy try sending again !*/
}else{
/* Check socket state */
err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0);
printf("Sock state is %s\n",
(err == 0) ? "CONNECTED" :
(err == 1) ? "DISCONNECTED" :
"CONNECTING");
printf("Faild to send %i \n",errno);
perror("Send: ");
break;
}
}else{
++Tx_count;
if (verbose){
printf("Packet sent: Sent %i : %i\n",
err,Tx_count);
}else{
//putchar('T');
}
if ((files_used & TX_FILE_USED) && tx_fd){
rlen=fread((void*)&Tx_data[sizeof(api_tx_hdr_t)],
sizeof(char),
Tx_length,tx_fd);
if (!rlen){
printf("\nTx of file %s is done!\n",
tx_file);
break;
}
if (Tx_length != rlen){
Tx_length = rlen;
}
}
}
}
if (tx_delay){
usleep(tx_delay);
}
if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)){
write_enable=0;
if (rx_cnt > 0){
/* Dont break let rx finish */
}else{
break;
}
}
}
}
printf("Press any key...");
getchar();getchar();
event_ctrl(WP_API_EVENT_DISABLE, argc, argv);
if (tx_fd){
fclose(tx_fd);
}
if (rx_fd){
fclose(rx_fd);
}
close (sock);
}
/***************************************************************
* Main:
*
* o Make a socket connection to the driver.
* o Call handle_socket() to read the socket
*
**************************************************************/
int main(int argc, char* argv[])
{
int proceed;
proceed=init_args(argc,argv);
if (proceed != WAN_TRUE){
usage(argv[0]);
return -1;
}
signal(SIGINT,&sig_end);
proceed = MakeConnection();
if (proceed == WAN_TRUE){
handle_socket(argc, argv);
return 0;
}
return 0;
};
void sig_end(int sigid)
{
printf("Got Signal %i\n",sigid);
if (tx_fd){
fclose(tx_fd);
}
if (rx_fd){
fclose(rx_fd);
}
if (sock){
close (sock);
}
exit(1);
}

27
api/lib/hdlc/Makefile Normal file
View File

@ -0,0 +1,27 @@
# ============================================================================
# Makefile Make script for building Linux WAN router utilities.
# ----------------------------------------------------------------------------
# Copyright (c) 1995-1998 Sangoma Technologies Inc. All Rights Reserved.
# ============================================================================
####### MACROS ###############################################################
# Build options.
OS_TYPE = __LINUX__
DEBUG = 2
# Tools options.
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I.
TARGETS=wanpipe_hdlc.o
####### RULES ################################################################
all: $(TARGETS)
@echo "Ok."
wanpipe_hdlc.o: wanpipe_hdlc.c
$(CC) $(CFLAGS) -c -o $@ $^
clean:
rm -f $(TARGETS)

527
api/lib/hdlc/wanpipe_hdlc.c Normal file
View File

@ -0,0 +1,527 @@
/*=====================================================
* wanpipe_hdlc.c: WANPIPE HDLC Library
*
*/
#include <wanpipe_hdlc.h>
/*===================================================================
PROTOTYPES
*/
static void init_crc(void);
static void calc_rx_crc(wanpipe_hdlc_decoder_t *chan);
static int decode_byte (wanpipe_hdlc_engine_t *hdlc_eng,
wanpipe_hdlc_decoder_t *chan,
unsigned char *byte_ptr);
static void encode_byte (wanpipe_hdlc_encoder_t *chan,
unsigned char *byte_ptr, int flag);
static void calc_tx_crc(wanpipe_hdlc_encoder_t *chan, unsigned char byte);
/*===================================================================
*
* GLOBAL VARIABLES
*
*==================================================================*/
static const int MagicNums[8] = { 0x1189, 0x2312, 0x4624, 0x8C48, 0x1081, 0x2102, 0x4204, 0x8408 };
static unsigned short CRC_TABLE[256];
static unsigned long init_crc_g=0;
static const char FLAG[]={ 0x7E, 0xFC, 0xF9, 0xF3, 0xE7, 0xCF, 0x9F, 0x3F };
wanpipe_hdlc_engine_t *wanpipe_reg_hdlc_engine (void)
{
wanpipe_hdlc_engine_t *hdlc_eng;
init_crc();
hdlc_eng = malloc(sizeof(wanpipe_hdlc_engine_t));
if (!hdlc_eng){
return NULL;
}
memset(hdlc_eng,0,sizeof(wanpipe_hdlc_engine_t));
hdlc_eng->seven_bit_hdlc=0;
hdlc_eng->bits_in_byte=BITSINBYTE;
init_hdlc_decoder(&hdlc_eng->decoder);
init_hdlc_encoder(&hdlc_eng->encoder);
return hdlc_eng;
}
void wanpipe_unreg_hdlc_engine(wanpipe_hdlc_engine_t *hdlc_eng)
{
free(hdlc_eng);
}
/* HDLC Bitstream Decode Functions */
int wanpipe_hdlc_decode (wanpipe_hdlc_engine_t *hdlc_eng,
unsigned char *buf, int len)
{
int i;
int word_len;
int found=0;
int gotdata=0;
word_len=len-(len%4);
/* Before decoding the packet, make sure that the current
* bit stream contains data. Decoding is very expensive,
* thus perform word (32bit) comparision test */
for (i=0;i<word_len;i+=4){
if ((*(unsigned int*)&buf[i]) != *(unsigned int*)buf){
found=1;
break;
}
}
if ((len%4) && !found){
for (i=word_len;i<len;i++){
if (buf[i]!=buf[0]){
found=1;
break;
}
}
}
/* Data found proceed to decode
* the bitstream and pull out data packets */
if (found){
wanpipe_hdlc_decoder_t *hdlc_decoder = &hdlc_eng->decoder;
for (i=0; i<len; i++){
if (decode_byte(hdlc_eng,hdlc_decoder,&buf[i])){
gotdata=1;
}
}
if (hdlc_decoder->rx_decode_len >= MAX_SOCK_HDLC_LIMIT){
//printf("ERROR Rx decode len > max\n");
hdlc_decoder->stats.errors++;
hdlc_decoder->stats.frame_overflow++;
init_hdlc_decoder(hdlc_decoder);
}
}
return gotdata;
}
int wanpipe_hdlc_encode(wanpipe_hdlc_engine_t *hdlc_eng,
unsigned char *usr_data, int usr_len,
unsigned char *hdlc_data, int *hdlc_len,
unsigned char *next_idle)
{
wanpipe_hdlc_encoder_t *chan=&hdlc_eng->encoder;
unsigned char crc_tmp;
int i;
chan->tx_decode_len=0;
chan->tx_crc=-1;
chan->tx_crc_fin=0;
chan->tx_decode_onecnt=0;
memset(&chan->tx_decode_buf[0],0,3);
chan->tx_decode_bit_cnt=0;
#if 0
//HDLC_IDLE_ABORT
chan->tx_flag_idle=0x7E;
chan->tx_flag_offset_data=0;
chan->tx_flag_offset=0;
encode_byte(chan,&chan->tx_flag_idle,2);
#else
encode_byte(chan,&chan->tx_flag_idle,2);
encode_byte(chan,&chan->tx_flag_idle,2);
encode_byte(chan,&chan->tx_flag_idle,2);
encode_byte(chan,&chan->tx_flag_idle,2);
encode_byte(chan,&chan->tx_flag_offset_data,2);
if (!hdlc_eng->seven_bit_hdlc || chan->tx_flag_offset < 5){
chan->tx_decode_len--;
}
#endif
#if 0
DEBUG_TX("TX: Flag Idle 0x%02X, Offset Data 0x%02X, FlagBitCnt %i, DataBitCnt %i\n",
chan->tx_flag_idle,
chan->tx_flag_offset_data,
chan->tx_flag_offset,
chan->tx_decode_bit_cnt);
#endif
if (hdlc_eng->seven_bit_hdlc){
chan->bits_in_byte=7;
hdlc_eng->bits_in_byte=7;
chan->tx_decode_bit_cnt=
((chan->tx_flag_offset+2)%hdlc_eng->bits_in_byte);
}else{
chan->bits_in_byte=8;
hdlc_eng->bits_in_byte=8;
chan->tx_decode_bit_cnt=chan->tx_flag_offset;
}
chan->tx_decode_onecnt=0;
/* For all bytes in an incoming data packet, calculate
* crc bytes, and encode each byte into the outgoing
* bit stream (encoding buffer). */
for (i=0;i<usr_len;i++){
calc_tx_crc(chan,usr_data[i]);
encode_byte(chan,&usr_data[i],0);
}
/* Decode and bit shift the calculated CRC values */
FLIP_CRC(chan->tx_crc,chan->tx_crc_fin);
DECODE_CRC(chan->tx_crc_fin);
/* Encode the crc values into the bit stream
* encode buffer */
crc_tmp=(chan->tx_crc_fin>>8)&0xFF;
encode_byte(chan,&crc_tmp,0);
crc_tmp=(chan->tx_crc_fin)&0xFF;
encode_byte(chan,&crc_tmp,0);
/* End the bit stream encode buffer with the
* closing flag */
encode_byte(chan,&chan->tx_flag,1);
#if 0
//HDLC_IDLE_ABORT
chan->tx_flag_idle=0xFF;
chan->tx_flag_offset_data=0;
encode_byte(chan,&chan->tx_flag_idle,2);
#endif
memcpy(hdlc_data,chan->tx_decode_buf,chan->tx_decode_len);
*hdlc_len=chan->tx_decode_len;
#if 0
{
int i;
DEBUG_EVENT( "ENCPKT: ");
for (i=0;i<chan->tx_decode_len;i++){
printk("%02X ", chan->tx_decode_buf[i]);
}
printk("\n");
DEBUG_EVENT( "\n");
}
#endif
/* Reset the encode buffer */
chan->tx_decode_len=0;
/* Record the tx idle flag that
* should follow after this packet
* is sent out the port */
*next_idle=chan->tx_flag_idle;
#if 0
{
int i;
unsigned char *data=wan_skb_data(skb);
DEBUG_EVENT("PKT: ");
for (i=0;i<wan_skb_len(skb);i++){
printk("%02X ",data[i]);
}
printk("\n");
}
#endif
return 0;
}
int wanpipe_get_rx_hdlc_packets (wanpipe_hdlc_engine_t *hdlc_eng)
{
return hdlc_eng->decoder.stats.packets;
}
int wanpipe_get_rx_hdlc_errors (wanpipe_hdlc_engine_t *hdlc_eng)
{
return hdlc_eng->decoder.stats.errors;
}
int wanpipe_get_tx_hdlc_packets (wanpipe_hdlc_engine_t *hdlc_eng)
{
return hdlc_eng->encoder.stats.packets;
}
int wanpipe_get_tx_hdlc_errors (wanpipe_hdlc_engine_t *hdlc_eng)
{
return hdlc_eng->encoder.stats.errors;
}
/*==================================================
HDLC Encode Function
*/
static void encode_byte (wanpipe_hdlc_encoder_t *chan, unsigned char *byte_ptr, int flag)
{
int j;
unsigned long byte=*byte_ptr;
for (j=0;j<BITSINBYTE;j++){
if (test_bit(j,&byte)){
/* Got 1 */
chan->tx_decode_buf[chan->tx_decode_len] |= (1<< chan->tx_decode_bit_cnt);
if (++chan->tx_decode_bit_cnt >= chan->bits_in_byte){
++chan->tx_decode_len;
chan->tx_decode_buf[chan->tx_decode_len]=0;
chan->tx_decode_bit_cnt=0;
}
if (++chan->tx_decode_onecnt == 5){
/* Stuff a zero bit */
if (!flag){
if (++chan->tx_decode_bit_cnt >= chan->bits_in_byte){
++chan->tx_decode_len;
chan->tx_decode_buf[chan->tx_decode_len]=0;
chan->tx_decode_bit_cnt=0;
}
}
chan->tx_decode_onecnt=0;
}
}else{
/* Got 0 */
chan->tx_decode_onecnt=0;
if (++chan->tx_decode_bit_cnt >= chan->bits_in_byte){
++chan->tx_decode_len;
chan->tx_decode_buf[chan->tx_decode_len]=0;
chan->tx_decode_bit_cnt=0;
}
}
}
if (flag == 1){
/* The closing flag has been encoded into the
* buffer. We must check how much has the last flag
* bit shifted due to bit stuffing of previous data.
* The maximum bit shift is 7 bits, thus a standard
* flag 0x7E can be have 7 different values. The
* FLAG buffer will give us a correct flag, based
* on the bit shift count. */
chan->tx_flag_idle = FLAG[chan->tx_decode_bit_cnt];
chan->tx_flag_offset=chan->tx_decode_bit_cnt;
/* The bit shifted part of the flag, that crossed the byte
* boudary, must be saved, and inserted at the beginning of
* the next outgoing packet */
chan->tx_flag_offset_data=chan->tx_decode_buf[chan->tx_decode_len];
}
return;
}
/*==================================================
HDLC Decode Function
*/
static int decode_byte (wanpipe_hdlc_engine_t *hdlc_eng,
wanpipe_hdlc_decoder_t *chan,
unsigned char *byte_ptr)
{
int i;
int gotdata=0;
unsigned long byte=*byte_ptr;
/* Test each bit in an incoming bitstream byte. Search
* for an hdlc flag 0x7E, six 1s in a row. Once the
* flag is obtained, construct the data packets.
* The complete data packets are sent up the API stack */
for (i=0; i<BITSINBYTE; i++){
if (hdlc_eng->seven_bit_hdlc && i == 7){
continue;
}
if (test_bit(i,&byte)){
/* Got a 1 */
++chan->rx_decode_onecnt;
/* Make sure that we received a valid flag,
* before we start decoding incoming data */
if (!test_bit(NO_FLAG,&chan->hdlc_flag)){
chan->rx_decode_buf[chan->rx_decode_len] |= (1 << chan->rx_decode_bit_cnt);
if (++chan->rx_decode_bit_cnt >= BITSINBYTE){
/* Completed a byte of data, update the
* crc count, and start on the next
* byte. */
calc_rx_crc(chan);
#ifdef PRINT_PKT
printk(" %02X", data);
#endif
++chan->rx_decode_len;
if (chan->rx_decode_len > MAX_SOCK_HDLC_BUF){
chan->stats.errors++;
chan->stats.frame_overflow++;
init_hdlc_decoder(chan);
}else{
chan->rx_decode_buf[chan->rx_decode_len]=0;
chan->rx_decode_bit_cnt=0;
chan->hdlc_flag=0;
set_bit(CLOSING_FLAG,&chan->hdlc_flag);
}
}
}
}else{
/* Got a zero */
if (chan->rx_decode_onecnt == 5){
/* bit stuffed zero detected,
* do not increment our decode_bit_count.
* thus, ignore this bit*/
}else if (chan->rx_decode_onecnt == 6){
/* Got a Flag */
if (test_bit(CLOSING_FLAG,&chan->hdlc_flag)){
/* Got a closing flag, thus asemble
* the packet and send it up the
* stack */
chan->hdlc_flag=0;
set_bit(OPEN_FLAG,&chan->hdlc_flag);
if (chan->rx_decode_len >= 3){
GET_FIN_CRC_CNT(chan->crc_cur);
FLIP_CRC(chan->rx_crc[chan->crc_cur],chan->crc_fin);
DECODE_CRC(chan->crc_fin);
/* Check CRC error before passing data up
* the API socket */
if (chan->crc_fin==chan->rx_orig_crc){
chan->stats.packets++;
if (hdlc_eng->hdlc_data) {
hdlc_eng->hdlc_data(hdlc_eng,
chan->rx_decode_buf,
chan->rx_decode_len);
}
gotdata=1;
}else{
chan->stats.errors++;
chan->stats.crc++;
//CRC Error; initialize hdlc eng
init_hdlc_decoder(chan);
}
}else{
chan->stats.errors++;
chan->stats.abort++;
//Abort
}
}else if (test_bit(NO_FLAG,&chan->hdlc_flag)){
/* Got a very first flag */
chan->hdlc_flag=0;
set_bit(OPEN_FLAG,&chan->hdlc_flag);
}
/* After a flag, initialize the decode and
* crc buffers and get ready for the next
* data packet */
chan->rx_decode_len=0;
chan->rx_decode_buf[chan->rx_decode_len]=0;
chan->rx_decode_bit_cnt=0;
chan->rx_crc[0]=-1;
chan->rx_crc[1]=-1;
chan->rx_crc[2]=-1;
chan->crc_cur=0;
chan->crc_prv=0;
}else{
/* Got a valid zero, thus increment the
* rx_decode_bit_cnt, as a result of which
* a zero is left in the consturcted
* byte. NOTE: we must have a valid flag */
if (!test_bit(NO_FLAG,&chan->hdlc_flag)){
if (++chan->rx_decode_bit_cnt >= BITSINBYTE){
calc_rx_crc(chan);
#ifdef PRINT_PKT
printk(" %02X", data);
#endif
++chan->rx_decode_len;
if (chan->rx_decode_len > MAX_SOCK_HDLC_BUF){
chan->stats.errors++;
chan->stats.frame_overflow++;
init_hdlc_decoder(chan);
}else{
chan->rx_decode_buf[chan->rx_decode_len]=0;
chan->rx_decode_bit_cnt=0;
chan->hdlc_flag=0;
set_bit(CLOSING_FLAG,&chan->hdlc_flag);
}
}
}
}
chan->rx_decode_onecnt=0;
}
}
return gotdata;
}
/*==========================================================
CRC Routines
*/
static void init_crc(void)
{
int i,j;
if (init_crc_g){
return;
}
init_crc_g=1;
for(i=0;i<256;i++){
CRC_TABLE[i]=0;
for (j=0;j<BITSINBYTE;j++){
if (i & (1<<j)){
CRC_TABLE[i] ^= MagicNums[j];
}
}
}
}
static void calc_rx_crc(wanpipe_hdlc_decoder_t *chan)
{
INC_CRC_CNT(chan->crc_cur);
/* Save the incoming CRC value, so it can be checked
* against the calculated one */
chan->rx_orig_crc = (((chan->rx_orig_crc<<8)&0xFF00) | chan->rx_decode_buf[chan->rx_decode_len]);
chan->rx_crc_tmp = (chan->rx_decode_buf[chan->rx_decode_len] ^ chan->rx_crc[chan->crc_prv]) & 0xFF;
chan->rx_crc[chan->crc_cur] = chan->rx_crc[chan->crc_prv] >> 8;
chan->rx_crc[chan->crc_cur] &= 0x00FF;
chan->rx_crc[chan->crc_cur] ^= CRC_TABLE[chan->rx_crc_tmp];
chan->rx_crc[chan->crc_cur] &= 0xFFFF;
INC_CRC_CNT(chan->crc_prv);
}
static void calc_tx_crc(wanpipe_hdlc_encoder_t *chan, unsigned char byte)
{
chan->tx_crc_tmp = (byte ^ chan->tx_crc) & 0xFF;
chan->tx_crc = chan->tx_crc >> 8;
chan->tx_crc &= 0x00FF;
chan->tx_crc ^= CRC_TABLE[chan->tx_crc_tmp];
chan->tx_crc &= 0xFFFF;
}

181
api/lib/hdlc/wanpipe_hdlc.h Normal file
View File

@ -0,0 +1,181 @@
/*===================================================
wanpipe_hdlc.h: WANPIPE HDLC Library
*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
/*===================================================================
*
* DEFINES
*
*==================================================================*/
#define MAX_SOCK_CRC_QUEUE 3
#define MAX_SOCK_HDLC_BUF 2000
#define MAX_SOCK_HDLC_LIMIT MAX_SOCK_HDLC_BUF-500
#define HDLC_ENG_BUF_LEN 5000
#define INC_CRC_CNT(a) if (++a >= MAX_SOCK_CRC_QUEUE) a=0;
#define GET_FIN_CRC_CNT(a) { if (--a < 0) a=MAX_SOCK_CRC_QUEUE-1; \
if (--a < 0) a=MAX_SOCK_CRC_QUEUE-1; }
#define FLIP_CRC(a,b) { b=0; \
b |= (a&0x000F)<<12 ; \
b |= (a&0x00F0) << 4; \
b |= (a&0x0F00) >> 4; \
b |= (a&0xF000) >> 12; }
#define DECODE_CRC(a) { a=( (((~a)&0x000F)<<4) | \
(((~a)&0x00F0)>>4) | \
(((~a)&0x0F00)<<4) | \
(((~a)&0xF000)>>4) ); }
#define BITSINBYTE 8
#define NO_FLAG 0
#define OPEN_FLAG 1
#define CLOSING_FLAG 2
typedef struct wanpipe_hdlc_stats
{
int packets;
int errors;
int crc;
int abort;
int frame_overflow;
}wanpipe_hdlc_stats_t;
typedef struct wanpipe_hdlc_decoder{
unsigned char rx_decode_buf[MAX_SOCK_HDLC_BUF];
unsigned int rx_decode_len;
unsigned char rx_decode_bit_cnt;
unsigned char rx_decode_onecnt;
unsigned long hdlc_flag;
unsigned short rx_orig_crc;
unsigned short rx_crc[MAX_SOCK_CRC_QUEUE];
unsigned short crc_fin;
unsigned short rx_crc_tmp;
int crc_cur;
int crc_prv;
wanpipe_hdlc_stats_t stats;
}wanpipe_hdlc_decoder_t;
typedef struct wanpipe_hdlc_encoder{
unsigned char tx_decode_buf[HDLC_ENG_BUF_LEN];
unsigned int tx_decode_len;
unsigned char tx_decode_bit_cnt;
unsigned char tx_decode_onecnt;
unsigned short tx_crc;
unsigned char tx_flag;
unsigned char tx_flag_offset;
unsigned char tx_flag_offset_data;
unsigned char tx_flag_idle;
unsigned short tx_crc_fin;
unsigned short tx_crc_tmp;
unsigned char tx_idle_flag;
unsigned char bits_in_byte;
wanpipe_hdlc_stats_t stats;
}wanpipe_hdlc_encoder_t;
typedef struct wanpipe_hdlc_engine
{
wanpipe_hdlc_decoder_t decoder;
wanpipe_hdlc_encoder_t encoder;
unsigned char raw_rx[MAX_SOCK_HDLC_BUF];
unsigned char raw_tx[MAX_SOCK_HDLC_BUF];
int refcnt;
unsigned char bound;
unsigned long active_ch;
unsigned short timeslots;
struct wanpipe_hdlc_engine *next;
int skb_decode_size;
unsigned char seven_bit_hdlc;
unsigned char bits_in_byte;
int (*hdlc_data) (struct wanpipe_hdlc_engine *hdlc_eng, void *data, int len);
}wanpipe_hdlc_engine_t;
typedef struct hdlc_list
{
wanpipe_hdlc_engine_t *hdlc;
struct hdlc_list *next;
}wanpipe_hdlc_list_t;
#define set_bit(bit_no,ptr) ((*ptr)|=(1<<bit_no))
#define clear_bit(bit_no,ptr) ((*ptr)&=~(1<<bit_no))
#define test_bit(bit_no,ptr) ((*ptr)&(1<<bit_no))
#if 0
#define DEBUG_TX printf
#define DEBUG_EVENT printf
#else
#define DEBUG_EVENT
#define DEBUG_TX
#endif
static inline
void init_hdlc_decoder(wanpipe_hdlc_decoder_t *hdlc_decoder)
{
hdlc_decoder->hdlc_flag=0;
set_bit(NO_FLAG,&hdlc_decoder->hdlc_flag);
hdlc_decoder->rx_decode_len=0;
hdlc_decoder->rx_decode_buf[hdlc_decoder->rx_decode_len]=0;
hdlc_decoder->rx_decode_bit_cnt=0;
hdlc_decoder->rx_decode_onecnt=0;
hdlc_decoder->rx_crc[0]=-1;
hdlc_decoder->rx_crc[1]=-1;
hdlc_decoder->rx_crc[2]=-1;
hdlc_decoder->crc_cur=0;
hdlc_decoder->crc_prv=0;
}
static inline
void init_hdlc_encoder(wanpipe_hdlc_encoder_t *chan)
{
chan->tx_crc=-1;
chan->tx_flag= 0x7E;
chan->tx_flag_idle= 0x7E;
chan->tx_idle_flag=0x7E;
}
/* External Functions */
extern wanpipe_hdlc_engine_t *wanpipe_reg_hdlc_engine (void);
extern void wanpipe_unreg_hdlc_engine(wanpipe_hdlc_engine_t *hdlc_eng);
extern int wanpipe_hdlc_decode (wanpipe_hdlc_engine_t *hdlc_eng,
unsigned char *buf, int len);
extern int wanpipe_hdlc_encode(wanpipe_hdlc_engine_t *hdlc_eng,
unsigned char *usr_data, int usr_len,
unsigned char *hdlc_data, int *hdlc_len,
unsigned char *next_idle);
extern int wanpipe_get_rx_hdlc_errors (wanpipe_hdlc_engine_t *hdlc_eng);
extern int wanpipe_get_tx_hdlc_errors (wanpipe_hdlc_engine_t *hdlc_eng);
extern int wanpipe_get_rx_hdlc_packets (wanpipe_hdlc_engine_t *hdlc_eng);
extern int wanpipe_get_tx_hdlc_packets (wanpipe_hdlc_engine_t *hdlc_eng);

View File

@ -0,0 +1,337 @@
libsangoma_la-libsangoma.lo libsangoma_la-libsangoma.o: libsangoma.c \
libsangoma.h /usr/include/stdio.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stddef.h \
/usr/include/bits/types.h /usr/include/bits/typesizes.h \
/usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
/usr/include/bits/wchar.h /usr/include/gconv.h \
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/stdlib.h \
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
/usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \
/usr/include/sys/types.h /usr/include/time.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
/usr/include/ctype.h /usr/include/unistd.h \
/usr/include/bits/posix_opt.h /usr/include/bits/environments.h \
/usr/include/bits/confname.h /usr/include/getopt.h \
/usr/include/sys/time.h /usr/include/sys/socket.h \
/usr/include/sys/uio.h /usr/include/bits/uio.h \
/usr/include/bits/socket.h \
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/limits.h \
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h \
/lib/modules/2.6.18-8.el5/build/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \
/usr/include/bits/sockaddr.h \
/lib/modules/2.6.18-8.el5/build/include/asm/socket.h \
/lib/modules/2.6.18-8.el5/build/include/asm/sockios.h \
/usr/include/sys/ioctl.h /usr/include/bits/ioctls.h \
/lib/modules/2.6.18-8.el5/build/include/asm/ioctls.h \
/lib/modules/2.6.18-8.el5/build/include/asm/ioctl.h \
/lib/modules/2.6.18-8.el5/build/include/asm-generic/ioctl.h \
/usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h \
/usr/include/sys/signal.h /usr/include/signal.h \
/usr/include/bits/signum.h /usr/include/bits/siginfo.h \
/usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h \
/lib/modules/2.6.18-8.el5/build/include/asm/sigcontext.h \
/lib/modules/2.6.18-8.el5/build/include/linux/compiler.h \
/usr/include/bits/sigstack.h /usr/include/sys/ucontext.h \
/usr/include/bits/sigthread.h /usr/include/sys/wait.h \
/usr/include/sys/resource.h /usr/include/bits/resource.h \
/usr/include/netinet/in.h /usr/include/stdint.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h /usr/include/string.h \
/usr/include/bits/string.h /usr/include/bits/string2.h \
/usr/include/errno.h /usr/include/bits/errno.h \
/lib/modules/2.6.18-8.el5/build/include/linux/errno.h \
/lib/modules/2.6.18-8.el5/build/include/asm/errno.h \
/lib/modules/2.6.18-8.el5/build/include/asm-generic/errno.h \
/lib/modules/2.6.18-8.el5/build/include/asm-generic/errno-base.h \
/usr/include/fcntl.h /usr/include/bits/fcntl.h /usr/include/sys/stat.h \
/usr/include/bits/stat.h \
/lib/modules/2.6.18-8.el5/build/include/linux/if.h \
/lib/modules/2.6.18-8.el5/build/include/linux/types.h \
/lib/modules/2.6.18-8.el5/build/include/linux/posix_types.h \
/lib/modules/2.6.18-8.el5/build/include/linux/stddef.h \
/lib/modules/2.6.18-8.el5/build/include/asm/posix_types.h \
/lib/modules/2.6.18-8.el5/build/include/asm/types.h \
/lib/modules/2.6.18-8.el5/build/include/linux/socket.h \
/lib/modules/2.6.18-8.el5/build/include/linux/hdlc/ioctl.h \
/usr/include/poll.h /usr/include/sys/poll.h /usr/include/bits/poll.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_defines.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_version.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_kernel.h \
/lib/modules/2.6.18-8.el5/build/include/linux/version.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_cfg.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_56k.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_te1.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_te3.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_remora.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_remora_proslic.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_front_end.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_debug.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_common.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_events.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanrouter.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_tdm_api.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_includes.h \
/lib/modules/2.6.18-8.el5/build/include/linux/if_wanpipe.h \
/lib/modules/2.6.18-8.el5/build/include/linux/sockios.h \
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_codec_iface.h
libsangoma.h:
/usr/include/stdio.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/bits/wordsize.h:
/usr/include/gnu/stubs.h:
/usr/include/gnu/stubs-32.h:
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stddef.h:
/usr/include/bits/types.h:
/usr/include/bits/typesizes.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/usr/include/bits/wchar.h:
/usr/include/gconv.h:
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stdarg.h:
/usr/include/bits/stdio_lim.h:
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/stdlib.h:
/usr/include/bits/waitflags.h:
/usr/include/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/xlocale.h:
/usr/include/sys/types.h:
/usr/include/time.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/alloca.h:
/usr/include/ctype.h:
/usr/include/unistd.h:
/usr/include/bits/posix_opt.h:
/usr/include/bits/environments.h:
/usr/include/bits/confname.h:
/usr/include/getopt.h:
/usr/include/sys/time.h:
/usr/include/sys/socket.h:
/usr/include/sys/uio.h:
/usr/include/bits/uio.h:
/usr/include/bits/socket.h:
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/limits.h:
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/syslimits.h:
/usr/include/limits.h:
/usr/include/bits/posix1_lim.h:
/usr/include/bits/local_lim.h:
/lib/modules/2.6.18-8.el5/build/include/linux/limits.h:
/usr/include/bits/posix2_lim.h:
/usr/include/bits/xopen_lim.h:
/usr/include/bits/sockaddr.h:
/lib/modules/2.6.18-8.el5/build/include/asm/socket.h:
/lib/modules/2.6.18-8.el5/build/include/asm/sockios.h:
/usr/include/sys/ioctl.h:
/usr/include/bits/ioctls.h:
/lib/modules/2.6.18-8.el5/build/include/asm/ioctls.h:
/lib/modules/2.6.18-8.el5/build/include/asm/ioctl.h:
/lib/modules/2.6.18-8.el5/build/include/asm-generic/ioctl.h:
/usr/include/bits/ioctl-types.h:
/usr/include/sys/ttydefaults.h:
/usr/include/sys/signal.h:
/usr/include/signal.h:
/usr/include/bits/signum.h:
/usr/include/bits/siginfo.h:
/usr/include/bits/sigaction.h:
/usr/include/bits/sigcontext.h:
/lib/modules/2.6.18-8.el5/build/include/asm/sigcontext.h:
/lib/modules/2.6.18-8.el5/build/include/linux/compiler.h:
/usr/include/bits/sigstack.h:
/usr/include/sys/ucontext.h:
/usr/include/bits/sigthread.h:
/usr/include/sys/wait.h:
/usr/include/sys/resource.h:
/usr/include/bits/resource.h:
/usr/include/netinet/in.h:
/usr/include/stdint.h:
/usr/include/bits/in.h:
/usr/include/bits/byteswap.h:
/usr/include/string.h:
/usr/include/bits/string.h:
/usr/include/bits/string2.h:
/usr/include/errno.h:
/usr/include/bits/errno.h:
/lib/modules/2.6.18-8.el5/build/include/linux/errno.h:
/lib/modules/2.6.18-8.el5/build/include/asm/errno.h:
/lib/modules/2.6.18-8.el5/build/include/asm-generic/errno.h:
/lib/modules/2.6.18-8.el5/build/include/asm-generic/errno-base.h:
/usr/include/fcntl.h:
/usr/include/bits/fcntl.h:
/usr/include/sys/stat.h:
/usr/include/bits/stat.h:
/lib/modules/2.6.18-8.el5/build/include/linux/if.h:
/lib/modules/2.6.18-8.el5/build/include/linux/types.h:
/lib/modules/2.6.18-8.el5/build/include/linux/posix_types.h:
/lib/modules/2.6.18-8.el5/build/include/linux/stddef.h:
/lib/modules/2.6.18-8.el5/build/include/asm/posix_types.h:
/lib/modules/2.6.18-8.el5/build/include/asm/types.h:
/lib/modules/2.6.18-8.el5/build/include/linux/socket.h:
/lib/modules/2.6.18-8.el5/build/include/linux/hdlc/ioctl.h:
/usr/include/poll.h:
/usr/include/sys/poll.h:
/usr/include/bits/poll.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_defines.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_version.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_kernel.h:
/lib/modules/2.6.18-8.el5/build/include/linux/version.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_cfg.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_56k.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_te1.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_te3.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_remora.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_remora_proslic.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sdla_front_end.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_debug.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_common.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_events.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanrouter.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_tdm_api.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_includes.h:
/lib/modules/2.6.18-8.el5/build/include/linux/if_wanpipe.h:
/lib/modules/2.6.18-8.el5/build/include/linux/sockios.h:
/lib/modules/2.6.18-8.el5/build/include/linux/wanpipe_codec_iface.h:

View File

@ -0,0 +1,336 @@
libsangoma_la-sangoma_pri.lo libsangoma_la-sangoma_pri.o: sangoma_pri.c \
./libsangoma.h /usr/include/stdlib.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stddef.h \
/usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \
/usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \
/usr/include/sys/types.h /usr/include/bits/types.h \
/usr/include/bits/wordsize.h /usr/include/bits/typesizes.h \
/usr/include/time.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \
/usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
/usr/include/gconv.h \
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/bits/stdio.h /usr/include/ctype.h /usr/include/unistd.h \
/usr/include/bits/posix_opt.h /usr/include/bits/environments.h \
/usr/include/bits/confname.h /usr/include/getopt.h \
/usr/include/sys/time.h /usr/include/sys/socket.h \
/usr/include/sys/uio.h /usr/include/bits/uio.h \
/usr/include/bits/socket.h \
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/limits.h \
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/syslimits.h \
/usr/include/limits.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/src/linux/include/linux/limits.h \
/usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \
/usr/include/bits/sockaddr.h /usr/src/linux/include/asm/socket.h \
/usr/src/linux/include/asm/sockios.h /usr/include/netinet/in.h \
/usr/include/stdint.h /usr/include/bits/in.h \
/usr/include/bits/byteswap.h /usr/include/string.h \
/usr/include/bits/string.h /usr/include/bits/string2.h \
/usr/include/errno.h /usr/include/bits/errno.h \
/usr/src/linux/include/linux/errno.h /usr/src/linux/include/asm/errno.h \
/usr/src/linux/include/asm-generic/errno.h \
/usr/src/linux/include/asm-generic/errno-base.h /usr/include/fcntl.h \
/usr/include/bits/fcntl.h /usr/include/sys/stat.h \
/usr/include/bits/stat.h /usr/include/sys/ioctl.h \
/usr/include/bits/ioctls.h /usr/src/linux/include/asm/ioctls.h \
/usr/src/linux/include/asm/ioctl.h /usr/include/bits/ioctl-types.h \
/usr/include/sys/ttydefaults.h /usr/src/linux/include/linux/if.h \
/usr/src/linux/include/linux/types.h \
/usr/src/linux/include/linux/posix_types.h \
/usr/src/linux/include/linux/stddef.h \
/usr/src/linux/include/linux/compiler.h \
/usr/src/linux/include/asm/posix_types.h \
/usr/src/linux/include/asm/types.h \
/usr/src/linux/include/linux/socket.h \
/usr/src/linux/include/linux/hdlc/ioctl.h \
/usr/src/linux/include/linux/wanpipe_defines.h \
/usr/src/linux/include/linux/wanpipe_version.h \
/usr/src/linux/include/linux/wanpipe_kernel.h \
/usr/src/linux/include/linux/version.h \
/usr/src/linux/include/linux/wanpipe_cfg.h \
/usr/src/linux/include/linux/sdla_56k.h \
/usr/src/linux/include/linux/sdla_te1.h \
/usr/src/linux/include/linux/sdla_te3.h \
/usr/src/linux/include/linux/sdla_remora.h \
/usr/src/linux/include/linux/sdla_remora_proslic.h \
/usr/src/linux/include/linux/sdla_front_end.h \
/usr/src/linux/include/linux/wanpipe.h \
/usr/src/linux/include/linux/wanpipe_debug.h \
/usr/src/linux/include/linux/wanpipe_common.h \
/usr/src/linux/include/linux/wanpipe_events.h \
/usr/src/linux/include/linux/wanrouter.h /usr/include/poll.h \
/usr/include/sys/poll.h /usr/include/bits/poll.h \
/usr/src/linux/include/linux/wanpipe_tdm_api.h \
/usr/src/linux/include/linux/wanpipe_includes.h \
/usr/src/linux/include/linux/if_wanpipe.h \
/usr/src/linux/include/linux/sockios.h \
/usr/src/linux/include/linux/wanpipe_codec_iface.h \
/usr/include/signal.h /usr/include/bits/signum.h \
/usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \
/usr/include/bits/sigcontext.h /usr/src/linux/include/asm/sigcontext.h \
/usr/include/bits/sigstack.h /usr/include/sys/ucontext.h \
/usr/include/bits/sigthread.h /usr/include/sys/signal.h \
/usr/include/sys/wait.h /usr/include/sys/resource.h \
/usr/include/bits/resource.h ./sangoma_pri.h /usr/src/libpri/libpri.h \
/usr/src/libpri/pri_internal.h
./libsangoma.h:
/usr/include/stdlib.h:
/usr/include/features.h:
/usr/include/sys/cdefs.h:
/usr/include/gnu/stubs.h:
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stddef.h:
/usr/include/bits/waitflags.h:
/usr/include/bits/waitstatus.h:
/usr/include/endian.h:
/usr/include/bits/endian.h:
/usr/include/xlocale.h:
/usr/include/sys/types.h:
/usr/include/bits/types.h:
/usr/include/bits/wordsize.h:
/usr/include/bits/typesizes.h:
/usr/include/time.h:
/usr/include/sys/select.h:
/usr/include/bits/select.h:
/usr/include/bits/sigset.h:
/usr/include/bits/time.h:
/usr/include/sys/sysmacros.h:
/usr/include/bits/pthreadtypes.h:
/usr/include/bits/sched.h:
/usr/include/alloca.h:
/usr/include/stdio.h:
/usr/include/libio.h:
/usr/include/_G_config.h:
/usr/include/wchar.h:
/usr/include/bits/wchar.h:
/usr/include/gconv.h:
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stdarg.h:
/usr/include/bits/stdio_lim.h:
/usr/include/bits/sys_errlist.h:
/usr/include/bits/stdio.h:
/usr/include/ctype.h:
/usr/include/unistd.h:
/usr/include/bits/posix_opt.h:
/usr/include/bits/environments.h:
/usr/include/bits/confname.h:
/usr/include/getopt.h:
/usr/include/sys/time.h:
/usr/include/sys/socket.h:
/usr/include/sys/uio.h:
/usr/include/bits/uio.h:
/usr/include/bits/socket.h:
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/limits.h:
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/syslimits.h:
/usr/include/limits.h:
/usr/include/bits/posix1_lim.h:
/usr/include/bits/local_lim.h:
/usr/src/linux/include/linux/limits.h:
/usr/include/bits/posix2_lim.h:
/usr/include/bits/xopen_lim.h:
/usr/include/bits/sockaddr.h:
/usr/src/linux/include/asm/socket.h:
/usr/src/linux/include/asm/sockios.h:
/usr/include/netinet/in.h:
/usr/include/stdint.h:
/usr/include/bits/in.h:
/usr/include/bits/byteswap.h:
/usr/include/string.h:
/usr/include/bits/string.h:
/usr/include/bits/string2.h:
/usr/include/errno.h:
/usr/include/bits/errno.h:
/usr/src/linux/include/linux/errno.h:
/usr/src/linux/include/asm/errno.h:
/usr/src/linux/include/asm-generic/errno.h:
/usr/src/linux/include/asm-generic/errno-base.h:
/usr/include/fcntl.h:
/usr/include/bits/fcntl.h:
/usr/include/sys/stat.h:
/usr/include/bits/stat.h:
/usr/include/sys/ioctl.h:
/usr/include/bits/ioctls.h:
/usr/src/linux/include/asm/ioctls.h:
/usr/src/linux/include/asm/ioctl.h:
/usr/include/bits/ioctl-types.h:
/usr/include/sys/ttydefaults.h:
/usr/src/linux/include/linux/if.h:
/usr/src/linux/include/linux/types.h:
/usr/src/linux/include/linux/posix_types.h:
/usr/src/linux/include/linux/stddef.h:
/usr/src/linux/include/linux/compiler.h:
/usr/src/linux/include/asm/posix_types.h:
/usr/src/linux/include/asm/types.h:
/usr/src/linux/include/linux/socket.h:
/usr/src/linux/include/linux/hdlc/ioctl.h:
/usr/src/linux/include/linux/wanpipe_defines.h:
/usr/src/linux/include/linux/wanpipe_version.h:
/usr/src/linux/include/linux/wanpipe_kernel.h:
/usr/src/linux/include/linux/version.h:
/usr/src/linux/include/linux/wanpipe_cfg.h:
/usr/src/linux/include/linux/sdla_56k.h:
/usr/src/linux/include/linux/sdla_te1.h:
/usr/src/linux/include/linux/sdla_te3.h:
/usr/src/linux/include/linux/sdla_remora.h:
/usr/src/linux/include/linux/sdla_remora_proslic.h:
/usr/src/linux/include/linux/sdla_front_end.h:
/usr/src/linux/include/linux/wanpipe.h:
/usr/src/linux/include/linux/wanpipe_debug.h:
/usr/src/linux/include/linux/wanpipe_common.h:
/usr/src/linux/include/linux/wanpipe_events.h:
/usr/src/linux/include/linux/wanrouter.h:
/usr/include/poll.h:
/usr/include/sys/poll.h:
/usr/include/bits/poll.h:
/usr/src/linux/include/linux/wanpipe_tdm_api.h:
/usr/src/linux/include/linux/wanpipe_includes.h:
/usr/src/linux/include/linux/if_wanpipe.h:
/usr/src/linux/include/linux/sockios.h:
/usr/src/linux/include/linux/wanpipe_codec_iface.h:
/usr/include/signal.h:
/usr/include/bits/signum.h:
/usr/include/bits/siginfo.h:
/usr/include/bits/sigaction.h:
/usr/include/bits/sigcontext.h:
/usr/src/linux/include/asm/sigcontext.h:
/usr/include/bits/sigstack.h:
/usr/include/sys/ucontext.h:
/usr/include/bits/sigthread.h:
/usr/include/sys/signal.h:
/usr/include/sys/wait.h:
/usr/include/sys/resource.h:
/usr/include/bits/resource.h:
./sangoma_pri.h:
/usr/src/libpri/libpri.h:
/usr/src/libpri/pri_internal.h:

View File

@ -0,0 +1,2 @@
This is a Subversion working copy administrative directory.
Visit http://subversion.tigris.org/ for more information.

291
api/libsangoma/.svn/entries Normal file
View File

@ -0,0 +1,291 @@
<?xml version="1.0" encoding="utf-8"?>
<wc-entries
xmlns="svn:">
<entry
committed-rev="167"
name=""
committed-date="2007-02-08T00:43:20.661018Z"
url="svn://sangoma.freeswitch.org/libsangoma/trunk"
last-author="ncorbic"
kind="dir"
uuid="2028fedf-720c-0410-83b8-d54a3e729fb0"
revision="198"/>
<entry
committed-rev="166"
name="configure"
text-time="2007-05-17T22:12:13.000000Z"
committed-date="2007-02-07T19:00:12.109961Z"
checksum="cdcb22cae8ad2d0de88542d1adf5b13d"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:17.000000Z"/>
<entry
committed-rev="199"
name="Makefile.in"
text-time="2007-05-17T22:12:12.000000Z"
committed-date="2007-05-17T21:15:01.613603Z"
checksum="4a762c5012094547c2be4df686a23356"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:17.000000Z"
revision="199"/>
<entry
committed-rev="1"
name="AUTHORS"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="d41d8cd98f00b204e9800998ecf8427e"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:48.000000Z"/>
<entry
committed-rev="1"
name="depcomp"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="e181e2c8720c60522c4c4c981108e367"
last-author="anthm"
kind="file"
prop-time="2007-03-21T22:07:06.000000Z"/>
<entry
committed-rev="1"
name="compile"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="a7ecc032b527a0d578545f19d3418073"
last-author="anthm"
kind="file"
prop-time="2007-03-21T22:07:06.000000Z"/>
<entry
committed-rev="1"
name="config.guess"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="9ae396244b8f138c76514a6b7531e696"
last-author="anthm"
kind="file"
prop-time="2007-03-21T22:07:06.000000Z"/>
<entry
committed-rev="201"
name="libsangoma.c"
text-time="2007-05-17T22:18:42.000000Z"
committed-date="2007-05-17T21:19:07.732396Z"
checksum="ba737500208af1da3b85e09bded0817d"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:17.000000Z"
revision="201"/>
<entry
committed-rev="1"
name="ltmain.sh"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="c8215e3aa0858d700783015614f53b79"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:50.000000Z"/>
<entry
committed-rev="1"
name="config.sub"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="3d36962d51070d30b7554203b0d7c01c"
last-author="anthm"
kind="file"
prop-time="2007-03-21T22:07:06.000000Z"/>
<entry
committed-rev="156"
name="libsangoma.dsp"
text-time="2007-05-17T22:12:40.000000Z"
committed-date="2006-12-04T20:48:10.874618Z"
checksum="f934aab66c529599725686f321d182e6"
last-author="anthm"
kind="file"
prop-time="2007-05-17T22:12:39.000000Z"/>
<entry
committed-rev="166"
name="libsangoma.h"
text-time="2007-05-17T22:11:22.000000Z"
committed-date="2007-02-07T19:00:12.109961Z"
checksum="a28f5ba57fefd87ff733f9f3ba745660"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:21.000000Z"/>
<entry
committed-rev="119"
name="g711.h"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-11-06T23:11:15.401413Z"
checksum="0f725f95ced42af15dcaef21f3a1722b"
last-author="ncorbic"
kind="file"
prop-time="2006-11-07T00:15:14.000000Z"/>
<entry
committed-rev="94"
name="INSTALL"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-08-08T19:52:23.727343Z"
checksum="40539bd3eff06e4b82f380103145415b"
last-author="ncorbic"
kind="file"
prop-time="2006-02-13T15:57:58.000000Z"/>
<entry
committed-rev="156"
name="libsangoma.dsw"
text-time="2007-05-17T22:12:47.000000Z"
committed-date="2006-12-04T20:48:10.874618Z"
checksum="f13496d2105bae2add104c36a1d656f6"
last-author="anthm"
kind="file"
prop-time="2007-05-17T22:12:46.000000Z"/>
<entry
committed-rev="1"
name="COPYING"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="d41d8cd98f00b204e9800998ecf8427e"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:58.000000Z"/>
<entry
committed-rev="1"
name="NEWS"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="d41d8cd98f00b204e9800998ecf8427e"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:58.000000Z"/>
<entry
committed-rev="155"
name="sangoma_pri.c"
text-time="2007-05-17T22:11:22.000000Z"
committed-date="2006-12-04T20:47:20.283144Z"
checksum="e2a6c68fadfefb2d2b16c52534e85675"
last-author="anthm"
kind="file"
prop-time="2007-05-17T22:11:21.000000Z"/>
<entry
committed-rev="101"
name="libsangoma.so.conf"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-10-19T19:27:09.335085Z"
checksum="bcdcb23c5d5fb460cee2ce315ef7bd32"
last-author="ncorbic"
kind="file"/>
<entry
name="include"
kind="dir"/>
<entry
committed-rev="157"
name="win_api_common.h"
text-time="2007-05-17T22:13:04.000000Z"
committed-date="2006-12-04T22:21:07.339224Z"
checksum="b6be170d18fa90b79f7264cf8b0f7348"
last-author="mikej"
kind="file"
prop-time="2007-05-17T22:13:03.000000Z"/>
<entry
committed-rev="28"
name="sangoma_pri.h"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-03-24T14:19:31.976520Z"
checksum="f24c6cf396aeaa6df2747f7f6b32969d"
last-author="anthm"
kind="file"
prop-time="2006-04-28T15:08:00.000000Z"/>
<entry
committed-rev="1"
name="version"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="35f672d1fb01b542f667952c9dbb26fe"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:48.000000Z"/>
<entry
committed-rev="166"
name="configure.in"
text-time="2007-05-17T22:11:22.000000Z"
committed-date="2007-02-07T19:00:12.109961Z"
checksum="5b9888fc365c4ebffdbb55656c091a2f"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:21.000000Z"/>
<entry
committed-rev="1"
name="ChangeLog"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="d41d8cd98f00b204e9800998ecf8427e"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:48.000000Z"/>
<entry
committed-rev="6"
name="README"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-14T19:06:52.853886Z"
checksum="e8a0abce86211364eb60bbe6e07d4b05"
last-author="nenad"
kind="file"
prop-time="2006-02-13T15:57:49.000000Z"/>
<entry
committed-rev="1"
name="config.h.in"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="5c51918deee8d041af37226bd4b4271e"
last-author="anthm"
kind="file"
prop-time="2006-02-13T15:57:50.000000Z"/>
<entry
committed-rev="1"
name="missing"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="fd5dd60aa8cefab9462677280ea74a61"
last-author="anthm"
kind="file"
prop-time="2007-03-21T22:07:06.000000Z"/>
<entry
committed-rev="199"
name="Makefile.am"
text-time="2007-05-17T22:12:09.000000Z"
committed-date="2007-05-17T21:15:01.613603Z"
checksum="ae7586e69e82a8d0e19473391c14cc5d"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:21.000000Z"
revision="199"/>
<entry
committed-rev="166"
name="aclocal.m4"
text-time="2007-05-17T22:11:31.000000Z"
committed-date="2007-02-07T19:00:12.109961Z"
checksum="dd02d76e53ac83f5112d68797e8f52e3"
last-author="ncorbic"
kind="file"
prop-time="2007-05-17T22:11:21.000000Z"/>
<entry
name="examples"
kind="dir"/>
<entry
committed-rev="1"
name="install-sh"
text-time="2007-03-21T22:07:06.000000Z"
committed-date="2006-02-10T16:20:41.709688Z"
checksum="92067666ddce97609bd0ec67d36460cd"
last-author="anthm"
kind="file"
prop-time="2007-03-21T22:07:06.000000Z"/>
<entry
committed-rev="158"
name="libsangoma.vcproj"
text-time="2007-05-17T22:13:09.000000Z"
committed-date="2006-12-04T22:24:41.715361Z"
checksum="a09711e3b6aac93dd48d8e9b3014955f"
last-author="mikej"
kind="file"
prop-time="2007-05-17T22:13:09.000000Z"/>
</wc-entries>

View File

@ -0,0 +1 @@
4

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
K 14
svn:executable
V 0
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1 @@
END

View File

@ -0,0 +1,5 @@
All TDM API Instructions located on Sangoma Wiki
http://wiki.sangoma.com
Wanpipe TDM API Section

View File

@ -0,0 +1,33 @@
KINC=/lib/modules/$(shell uname -r)/build
AM_CFLAGS = -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -g -I$(KINC)/include -I. \
-D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O2 -D_DEBUG_=2 -D_GNUC_ -I../lib -I$(KINC)/include
LIB_SOURCES = libsangoma.c libsangoma.h
if LIBPRI
LIB_SOURCES += sangoma_pri.c sangoma_pri.h
endif
library_includedir = $(includedir)
library_include_HEADERS = libsangoma.h
if LIBPRI
library_include_HEADERS += sangoma_pri.h
endif
lib_LTLIBRARIES = libsangoma.la
libsangoma_la_CFLAGS = $(AM_CFLAGS)
libsangoma_la_LDFLAGS = -version-info 1:0:0
if LIBPRI
libsangoma_la_CFLAGS += -I$(libpripath)
libsangoma_la_LDFLAGS += -L$(libpripath) -lpri
endif
libsangoma_la_SOURCES = $(LIB_SOURCES)
lib_LIBRARIES = libsangoma.a
libsangoma_a_CFLAGS = $(AM_CFLAGS)
libsangoma_a_SOURCES = $(LIB_SOUCES)

View File

@ -0,0 +1,678 @@
# Makefile.in generated by automake 1.9.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@LIBPRI_TRUE@am__append_1 = sangoma_pri.c sangoma_pri.h
@LIBPRI_TRUE@am__append_2 = sangoma_pri.h
@LIBPRI_TRUE@am__append_3 = -I$(libpripath)
@LIBPRI_TRUE@am__append_4 = -L$(libpripath) -lpri
DIST_COMMON = README $(am__configure_deps) \
$(am__library_include_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
install-sh ltmain.sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno configure.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(library_includedir)"
libLIBRARIES_INSTALL = $(INSTALL_DATA)
LIBRARIES = $(lib_LIBRARIES)
ARFLAGS = cru
libsangoma_a_AR = $(AR) $(ARFLAGS)
libsangoma_a_LIBADD =
am_libsangoma_a_OBJECTS =
libsangoma_a_OBJECTS = $(am_libsangoma_a_OBJECTS)
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libsangoma_la_LIBADD =
am__libsangoma_la_SOURCES_DIST = libsangoma.c libsangoma.h \
sangoma_pri.c sangoma_pri.h
@LIBPRI_TRUE@am__objects_1 = libsangoma_la-sangoma_pri.lo
am__objects_2 = libsangoma_la-libsangoma.lo $(am__objects_1)
am_libsangoma_la_OBJECTS = $(am__objects_2)
libsangoma_la_OBJECTS = $(am_libsangoma_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES)
DIST_SOURCES = $(libsangoma_a_SOURCES) \
$(am__libsangoma_la_SOURCES_DIST)
am__library_include_HEADERS_DIST = libsangoma.h sangoma_pri.h
library_includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(library_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBPRI_FALSE = @LIBPRI_FALSE@
LIBPRI_TRUE = @LIBPRI_TRUE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libpripath = @libpripath@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
KINC = /lib/modules/$(shell uname -r)/build
AM_CFLAGS = -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -g -I$(KINC)/include -I. \
-D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O2 -D_DEBUG_=2 -D_GNUC_ -I../lib -I$(KINC)/include
LIB_SOURCES = libsangoma.c libsangoma.h $(am__append_1)
library_includedir = $(includedir)
library_include_HEADERS = libsangoma.h $(am__append_2)
lib_LTLIBRARIES = libsangoma.la
libsangoma_la_CFLAGS = $(AM_CFLAGS) $(am__append_3)
libsangoma_la_LDFLAGS = -version-info 1:0:0 $(am__append_4)
libsangoma_la_SOURCES = $(LIB_SOURCES)
lib_LIBRARIES = libsangoma.a
libsangoma_a_CFLAGS = $(AM_CFLAGS)
libsangoma_a_SOURCES = $(LIB_SOUCES)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
install-libLIBRARIES: $(lib_LIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
@$(POST_INSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
p=$(am__strip_dir) \
echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
$(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
else :; fi; \
done
uninstall-libLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLIBRARIES:
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
libsangoma.a: $(libsangoma_a_OBJECTS) $(libsangoma_a_DEPENDENCIES)
-rm -f libsangoma.a
$(libsangoma_a_AR) libsangoma.a $(libsangoma_a_OBJECTS) $(libsangoma_a_LIBADD)
$(RANLIB) libsangoma.a
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libsangoma.la: $(libsangoma_la_OBJECTS) $(libsangoma_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libsangoma_la_LDFLAGS) $(libsangoma_la_OBJECTS) $(libsangoma_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsangoma_la-libsangoma.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsangoma_la-sangoma_pri.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
libsangoma_la-libsangoma.lo: libsangoma.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-libsangoma.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" "$(DEPDIR)/libsangoma_la-libsangoma.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libsangoma.c' object='libsangoma_la-libsangoma.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c
libsangoma_la-sangoma_pri.lo: sangoma_pri.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-sangoma_pri.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" "$(DEPDIR)/libsangoma_la-sangoma_pri.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo"; exit 1; fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sangoma_pri.c' object='libsangoma_la-sangoma_pri.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-library_includeHEADERS: $(library_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)"
@list='$(library_include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \
$(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \
done
uninstall-library_includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(library_include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \
rm -f "$(DESTDIR)$(library_includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \
clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-library_includeHEADERS
install-exec-am: install-libLIBRARIES install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLIBRARIES \
uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \
clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \
dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-exec install-exec-am \
install-info install-info-am install-libLIBRARIES \
install-libLTLIBRARIES install-library_includeHEADERS \
install-man install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-info-am uninstall-libLIBRARIES \
uninstall-libLTLIBRARIES uninstall-library_includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,91 @@
* Needs wanpipe beta2-2.3.4 or higher to compile.
It can be downloaded here. Its still in beta.
ftp.sangoma.com/linux/current_wanpipe/wanpipe-beta2-2.3.4.tgz
===============================================================
The TDM API is only supported from wanpipe release:
wanpipe-beta2-2.3.4.tgz
Pleaes refer to Install/Config Instructions on
Sangoma Wiki: http://sangoma.editme.com
===============================================================
Wanpipe TDM Voice API Solution contains the following:
1. Wanpipe Driver
TDM Voice API is only supported in BETA release.
2. Wanpipe API Library: libsangoma
Already included in above release.
Wanpipe TDM Voice API is currently supported on:
1. AFT A101/A102/A104
2. AFT A104D (Working without hw echo support)
3. AFT A200 Analog (Coming soon)
Wanpipe Package Installation
1. Untar BETA release or greater
2. Run ./Setup install
3. Choose all default parameters
4. Compilation Mode:
Choose DEFAULT (No zaptel drivers needed)
or
Choose TDM (If some spans bind to zaptel)
5. Proceed with default parameters.
Wanpipe Package Configuration
There is no wancfg support yet for TDM API. Please used attached samples.
1. Please copy the following wanpipe config file into
your /etc/wanpipe directory: wanpipe1.conf
2. If you have multiple AFT cards in your machine please edit the
wanpipe1.conf and set the appropriate PCISLOT, PCIBUS
values and disable AUTOPCI option.
3. To support multiple ports copy wanpipe1.conf into wanpipe2.conf and change:
string wanpipe1 to string wanpipe2
string w1 to string w2
TDMV_SPAN to next span.
FE_LINE to AFT port number.
Please refer to all comments inside the wanpipe#.conf file.
Wanpipe LibSangoma Installation
The LibSangoma is installed in /etc/wanpipe/api/libsangoma
1. cd /etc/wanpipe/api/libsangoma
2. ./configure
3. make
4. make install
5. Add library path /usr/local/include into /etc/ld.so.conf
6. Run ldconfig to accept /etc/ld.so.conf changes.
Wanpipe TDMAPI Sample Code
Sample code for tdm api is installed in /etc/wanpipe/api/tdm_api directory.
1. cd /etc/wanpipe/api/tdm_api
2. make
3. Read the README file on how to use sample applications

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2004-10-12.08
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "compile $scriptversion"
exit 0
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,106 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <libpri.h> header file. */
#undef HAVE_LIBPRI_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <pri_internal.h> header file. */
#undef HAVE_PRI_INTERNAL_H
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to the type of arg 1 for `select'. */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for `select'. */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Version number of package */
#undef VERSION

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(libsangoma, 1.0.0, anthmct@yahoo.com)
AM_INIT_AUTOMAKE(libsangoma,1.0.0)
# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_RANLIB
# Checks for libraries.
AC_CHECK_HEADERS(fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h)
AC_ARG_WITH(libpri,
[ --with-libpri=<path> enable pri support],[libpripath="$withval"])
AM_CONDITIONAL([LIBPRI],[test -d "$libpripath" ])
AC_SUBST([libpripath])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([gettimeofday memset select socket])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,522 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2004-05-31.23
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, 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, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "depcomp $scriptversion"
exit 0
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# Dependencies are output in .lo.d with libtool 1.4.
# With libtool 1.5 they are output both in $dir.libs/$base.o.d
# and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
# latter, because the former will be cleaned when $dir.libs is
# erased.
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir$base.o.d"
tmpdepfile3="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
tmpdepfile3="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
elif test -f "$tmpdepfile2"; then
tmpdepfile="$tmpdepfile2"
else
tmpdepfile="$tmpdepfile3"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@ -0,0 +1,382 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* g711.h - In line A-law and u-law conversion routines
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 Steve Underwood
*
* Despite my general liking of the GPL, I place this code in the
* public domain for the benefit of all mankind - even the slimy
* ones who might try to proprietize my work and use it to my
* detriment.
*
* $Id: g711.h,v 1.1 2006/06/07 15:46:39 steveu Exp $
*/
/*! \file */
/*! \page g711_page A-law and mu-law handling
Lookup tables for A-law and u-law look attractive, until you consider the impact
on the CPU cache. If it causes a substantial area of your processor cache to get
hit too often, cache sloshing will severely slow things down. The main reason
these routines are slow in C, is the lack of direct access to the CPU's "find
the first 1" instruction. A little in-line assembler fixes that, and the
conversion routines can be faster than lookup tables, in most real world usage.
A "find the first 1" instruction is available on most modern CPUs, and is a
much underused feature.
If an assembly language method of bit searching is not available, these routines
revert to a method that can be a little slow, so the cache thrashing might not
seem so bad :(
Feel free to submit patches to add fast "find the first 1" support for your own
favourite processor.
Look up tables are used for transcoding between A-law and u-law, since it is
difficult to achieve the precise transcoding procedure laid down in the G.711
specification by other means.
*/
#if !defined(_G711_H_)
#define _G711_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
#ifndef __inline__
#define __inline__ __inline
#endif
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef unsigned __int16 uint16_t;
#endif
#if defined(__i386__)
/*! \brief Find the bit position of the highest set bit in a word
\param bits The word to be searched
\return The bit number of the highest set bit, or -1 if the word is zero. */
static __inline__ int top_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movl $-1,%%edx;\n"
" bsrl %%eax,%%edx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
/*! \brief Find the bit position of the lowest set bit in a word
\param bits The word to be searched
\return The bit number of the lowest set bit, or -1 if the word is zero. */
static __inline__ int bottom_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movl $-1,%%edx;\n"
" bsfl %%eax,%%edx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
#elif defined(__x86_64__)
static __inline__ int top_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movq $-1,%%rdx;\n"
" bsrq %%rax,%%rdx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
static __inline__ int bottom_bit(unsigned int bits)
{
int res;
__asm__ __volatile__(" movq $-1,%%rdx;\n"
" bsfq %%rax,%%rdx;\n"
: "=d" (res)
: "a" (bits));
return res;
}
/*- End of function --------------------------------------------------------*/
#else
static __inline__ int top_bit(unsigned int bits)
{
int i;
if (bits == 0)
return -1;
i = 0;
if (bits & 0xFFFF0000)
{
bits &= 0xFFFF0000;
i += 16;
}
if (bits & 0xFF00FF00)
{
bits &= 0xFF00FF00;
i += 8;
}
if (bits & 0xF0F0F0F0)
{
bits &= 0xF0F0F0F0;
i += 4;
}
if (bits & 0xCCCCCCCC)
{
bits &= 0xCCCCCCCC;
i += 2;
}
if (bits & 0xAAAAAAAA)
{
bits &= 0xAAAAAAAA;
i += 1;
}
return i;
}
/*- End of function --------------------------------------------------------*/
static __inline__ int bottom_bit(unsigned int bits)
{
int i;
if (bits == 0)
return -1;
i = 32;
if (bits & 0x0000FFFF)
{
bits &= 0x0000FFFF;
i -= 16;
}
if (bits & 0x00FF00FF)
{
bits &= 0x00FF00FF;
i -= 8;
}
if (bits & 0x0F0F0F0F)
{
bits &= 0x0F0F0F0F;
i -= 4;
}
if (bits & 0x33333333)
{
bits &= 0x33333333;
i -= 2;
}
if (bits & 0x55555555)
{
bits &= 0x55555555;
i -= 1;
}
return i;
}
/*- End of function --------------------------------------------------------*/
#endif
/* N.B. It is tempting to use look-up tables for A-law and u-law conversion.
* However, you should consider the cache footprint.
*
* A 64K byte table for linear to x-law and a 512 byte table for x-law to
* linear sound like peanuts these days, and shouldn't an array lookup be
* real fast? No! When the cache sloshes as badly as this one will, a tight
* calculation may be better. The messiest part is normally finding the
* segment, but a little inline assembly can fix that on an i386, x86_64 and
* many other modern processors.
*/
/*
* Mu-law is basically as follows:
*
* Biased Linear Input Code Compressed Code
* ------------------------ ---------------
* 00000001wxyza 000wxyz
* 0000001wxyzab 001wxyz
* 000001wxyzabc 010wxyz
* 00001wxyzabcd 011wxyz
* 0001wxyzabcde 100wxyz
* 001wxyzabcdef 101wxyz
* 01wxyzabcdefg 110wxyz
* 1wxyzabcdefgh 111wxyz
*
* Each biased linear code has a leading 1 which identifies the segment
* number. The value of the segment number is equal to 7 minus the number
* of leading 0's. The quantization interval is directly available as the
* four bits wxyz. * The trailing bits (a - h) are ignored.
*
* Ordinarily the complement of the resulting code word is used for
* transmission, and so the code word is complemented before it is returned.
*
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */
#define ULAW_BIAS 0x84 /* Bias for linear code. */
/*! \brief Encode a linear sample to u-law
\param linear The sample to encode.
\return The u-law value.
*/
static __inline__ uint8_t linear_to_ulaw(int linear)
{
uint8_t u_val;
int mask;
int seg;
/* Get the sign and the magnitude of the value. */
if (linear < 0)
{
linear = ULAW_BIAS - linear;
mask = 0x7F;
}
else
{
linear = ULAW_BIAS + linear;
mask = 0xFF;
}
seg = top_bit(linear | 0xFF) - 7;
/*
* Combine the sign, segment, quantization bits,
* and complement the code word.
*/
if (seg >= 8)
u_val = (uint8_t) (0x7F ^ mask);
else
u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
#ifdef ULAW_ZEROTRAP
/* Optional ITU trap */
if (u_val == 0)
u_val = 0x02;
#endif
return u_val;
}
/*- End of function --------------------------------------------------------*/
/*! \brief Decode an u-law sample to a linear value.
\param ulaw The u-law sample to decode.
\return The linear value.
*/
static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
{
int t;
/* Complement to obtain normal u-law value. */
ulaw = ~ulaw;
/*
* Extract and bias the quantization bits. Then
* shift up by the segment number and subtract out the bias.
*/
t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
}
/*- End of function --------------------------------------------------------*/
/*
* A-law is basically as follows:
*
* Linear Input Code Compressed Code
* ----------------- ---------------
* 0000000wxyza 000wxyz
* 0000001wxyza 001wxyz
* 000001wxyzab 010wxyz
* 00001wxyzabc 011wxyz
* 0001wxyzabcd 100wxyz
* 001wxyzabcde 101wxyz
* 01wxyzabcdef 110wxyz
* 1wxyzabcdefg 111wxyz
*
* For further information see John C. Bellamy's Digital Telephony, 1982,
* John Wiley & Sons, pps 98-111 and 472-476.
*/
#define ALAW_AMI_MASK 0x55
/*! \brief Encode a linear sample to A-law
\param linear The sample to encode.
\return The A-law value.
*/
static __inline__ uint8_t linear_to_alaw(int linear)
{
int mask;
int seg;
if (linear >= 0)
{
/* Sign (bit 7) bit = 1 */
mask = ALAW_AMI_MASK | 0x80;
}
else
{
/* Sign (bit 7) bit = 0 */
mask = ALAW_AMI_MASK;
linear = -linear - 8;
}
/* Convert the scaled magnitude to segment number. */
seg = top_bit(linear | 0xFF) - 7;
if (seg >= 8)
{
if (linear >= 0)
{
/* Out of range. Return maximum value. */
return (uint8_t) (0x7F ^ mask);
}
/* We must be just a tiny step below zero */
return (uint8_t) (0x00 ^ mask);
}
/* Combine the sign, segment, and quantization bits. */
return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
}
/*- End of function --------------------------------------------------------*/
/*! \brief Decode an A-law sample to a linear value.
\param alaw The A-law sample to decode.
\return The linear value.
*/
static __inline__ int16_t alaw_to_linear(uint8_t alaw)
{
int i;
int seg;
alaw ^= ALAW_AMI_MASK;
i = ((alaw & 0x0F) << 4);
seg = (((int) alaw & 0x70) >> 4);
if (seg)
i = (i + 0x108) << (seg - 1);
else
i += 8;
return (int16_t) ((alaw & 0x80) ? i : -i);
}
/*- End of function --------------------------------------------------------*/
/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
\param alaw The A-law sample to transcode.
\return The best matching u-law value.
*/
uint8_t alaw_to_ulaw(uint8_t alaw);
/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
\param alaw The u-law sample to transcode.
\return The best matching A-law value.
*/
uint8_t ulaw_to_alaw(uint8_t ulaw);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -0,0 +1,323 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2004-10-22.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit 0;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit 0;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

Some files were not shown because too many files have changed in this diff Show More