wanpipe-3.5.1.tgz
This commit is contained in:
parent
9ce52904ea
commit
d401f20f8c
679
ChangeLog.3.4
679
ChangeLog.3.4
|
@ -1,679 +0,0 @@
|
|||
------------------------------------------------------------------------------
|
||||
WANPIPE TDM VOICE - IP/WAN Package
|
||||
------------------------------------------------------------------------------
|
||||
Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
Copyright (c) 1995-2009 Sangoma Technologies Inc.
|
||||
|
||||
For more info visit: http://wiki.sangoma.com
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
* Wed Feb 17 2010 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.9
|
||||
================================================================================
|
||||
|
||||
- New Firmware
|
||||
A108 - V41
|
||||
A104/2/1 - V37
|
||||
A200 - V13
|
||||
Updates for latest PCIe latency specifications.
|
||||
|
||||
- Support for Linux 2.6.31 and higher
|
||||
|
||||
- BRI EC Bug fix introduced in 3.4.8 release.
|
||||
The EC was not properly turned off on call stop
|
||||
causing noise on the line of the multipoint setup.
|
||||
Where there are multiple devices on a single bri line.
|
||||
|
||||
- Support for B600 rev3 hwec detection.
|
||||
|
||||
|
||||
|
||||
* Wed Dec 30 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.8
|
||||
================================================================================
|
||||
|
||||
- Fixed RBS signalling for E1 channel 31
|
||||
- Added Front end Reset Detection
|
||||
-> Support for new A108 Firmware V40
|
||||
- Fixed RTP TAP bug: Caused high system load on RTP TAP usage.
|
||||
- Added excessive fifo error sanity check. Fixes random pci dma errors.
|
||||
- Increased EC VQE Delay: Fixes random fax failure due to hwec.
|
||||
- HWEC: Check state before bypass enable.
|
||||
- HWEC: Disable bypass on release
|
||||
|
||||
|
||||
* Tue Nov 25 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.7
|
||||
================================================================================
|
||||
|
||||
- New A200 Firmware V12
|
||||
Fixes the fifo reporting in firmware.
|
||||
|
||||
- Updated driver fifo handling so that if customer is running
|
||||
older version of A200 firmware (less than V12) the fifo interrupt handling
|
||||
would still work correctly.
|
||||
|
||||
- Dahdi 2.2 broke Sangoma RBS support
|
||||
- Fixed the free run interrupt supported on V38 firmware
|
||||
- Fixed chan_woomera inbound calls on second profile
|
||||
- Fixed sangoma_mgd for multiple profiles
|
||||
- Updated smg
|
||||
- Fixed wanpipemon LIU alarm statistics
|
||||
- Updates SMG for 32T1/E1 Support
|
||||
- Backporte front end OOF alarm update.
|
||||
A OOF alarm counter was added so that link does not
|
||||
drop on a single OOF alarm as per T1/E1 spec.
|
||||
|
||||
|
||||
* Tue Sep 18 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.6
|
||||
===============================================================================
|
||||
|
||||
- Fund a bug in Sangoma_mgd causing channel 31 in each span to
|
||||
fail. This bug was introduced in 3.4.5 release.
|
||||
|
||||
|
||||
* Tue Sep 16 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.5
|
||||
===============================================================================
|
||||
|
||||
- New firmawre feature for A101/2/5/8: Free Run Timer Interrupt
|
||||
The AFT T1/E1 cards will now provide perfect timing to zatpel/dahdi
|
||||
even when the ports are not connected. The free run interrupt
|
||||
will be enabled when all zaptel/dahdi ports are down, or on
|
||||
inital card start. To test this feature just start a wanpipe
|
||||
port with zaptel/dahdi and run zttest.
|
||||
A108 firmare V38
|
||||
A104/2/1/ firmware V36
|
||||
|
||||
- Added module inc cound when zaptel/dahdi starts.
|
||||
So wanpipe drivers do not crash if one tries to unload
|
||||
zaptel/dahdi before stopping wanpipe drivers.
|
||||
|
||||
- Dahdi 2.2 Support
|
||||
- Updated for 2.6.30 kernel
|
||||
|
||||
|
||||
* Fri Jun 17 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.4
|
||||
=====================================================================
|
||||
|
||||
- Latest smg update in 3.4.3 broke BRI support
|
||||
- This is now fixed.
|
||||
|
||||
|
||||
* Fri Jun 17 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.3
|
||||
=====================================================================
|
||||
|
||||
- New firmware
|
||||
2007-07-10: A108D Latest Firmware Release........ v37 . More info
|
||||
2007-07-10: A104D Latest Firmware Release ....... v35 . More info
|
||||
2007-07-10: A102D Latest Firmware Release ....... v35 . More info
|
||||
2007-07-10: A101D Latest Firmware Release. ...... v34 . More info
|
||||
2007-07-10: A200 Latest Firmware Release ........ v11 . More info
|
||||
2007-07-10: A400 Latest Firmware Release ........ v11 . More info
|
||||
2007-07-10: A104D Latest Firmware Release........ v26 . More info
|
||||
2007-07-10: A301-SH Latest Firmware Release...... v09 . More info
|
||||
2008-10-28: A14X Latest Firmware Release......... v07 . More Info
|
||||
2009-04-30: A500 Latest Firmware Release......... v35 . More info
|
||||
2009-05-08: B600 Latest Firmware Release......... v02 . More Info
|
||||
2009-07-03: B700 Latest Firmware Release......... v35 . More Info
|
||||
|
||||
- Updated Makefile Build
|
||||
make zaptel ZAPDIR=<absolute path to zaptel> # Build for Zaptel
|
||||
make dahdi DAHDI_DIR=<absolute path to dahdi> # Build for DAHDI
|
||||
make install
|
||||
|
||||
or use original script method
|
||||
|
||||
./Setup install # General Build
|
||||
./Setup zaptel # Zaptel specific build
|
||||
./Setup dahdi # Dahdi specific build
|
||||
|
||||
- For 64bit systems there is no need to use --64bit_4G flag any more.
|
||||
The check is done in the driver.
|
||||
|
||||
- Updated TDM ring buffer logic to battle noise and data
|
||||
corrupting in channelized voice mode. Backport from 3.5.
|
||||
|
||||
- Updated for 2.6.29 kernel.
|
||||
|
||||
- Added DAHDI 2.2 support
|
||||
|
||||
- AFT TE3 Update
|
||||
Added a define AFT_TE3_IFT_FEATURE_DISABLE to disable
|
||||
the hardware feature that implements IFT timeout interrupt
|
||||
on DMA chains. On some very slow machines this feature
|
||||
can yeild slower performance because the machine does
|
||||
not have to power to fill the T3/E3 line with traffic.
|
||||
|
||||
- Turned off Framer Timer Interrupt
|
||||
It was only used for stats and was not necessary
|
||||
|
||||
- Update for DMA chains to combat PCI IRQ latency
|
||||
|
||||
- Updated 64bit data protocols
|
||||
|
||||
- Updated smg_ctrl scripts for bri and ss7
|
||||
made them common
|
||||
|
||||
- Bug fix for Mixed Voice & Data mode
|
||||
On fifo overrun recovery do not disable dma if running in mixed
|
||||
voice & data mode.
|
||||
|
||||
- Updated to wancfg_zaptel script.
|
||||
Bug fix smg was prompting user even if bri was not installed.
|
||||
|
||||
- Updated SMG/Woomera
|
||||
Added Asterisk Load balancing using extension information.
|
||||
|
||||
|
||||
* Fri Apr 30 2009 Nenad Corbic <ncorbic@sangoma.com> - Feature Frozen - 3.4.1
|
||||
=======================================================================
|
||||
|
||||
- Updated wancfg_zaptel configuration utility
|
||||
Use wancfg_fs to configure analog/BRI card for FreeSwitch
|
||||
Update for remove old start/stop script
|
||||
Added configuration option for TDMV_HW_FAX_DETECT
|
||||
Bug fixes in silent option
|
||||
|
||||
- A500 BRI - Firmware Update V35
|
||||
On some machines the A500 card caused PCI parity errors,
|
||||
causing a system reboot or a crash. The firmware V35
|
||||
fixes this problem.
|
||||
|
||||
- BRI DCHAN Bug Fix
|
||||
The DCHAN on some machines could become stuck due to a
|
||||
driver interrupt race condition, causing BRI to stop
|
||||
reciving/tranmsitting calls. This bug has now been fixed.
|
||||
|
||||
- Updated BRI stack and sangoma_mdg
|
||||
|
||||
- Added TDMV_HW_FAX_DETECT option
|
||||
To enable hardware fax detection. Used in conjunction with
|
||||
TDMV_HW_DTMF.
|
||||
TDMV_HW_FAX_DETECT=<option>
|
||||
<option> = 0 or NO - disabled
|
||||
= 1-8 or YES - enabled
|
||||
The number represents fax tone timeout
|
||||
value in seconds on call start. The fax
|
||||
event will be valid for X about of seconds
|
||||
at the start of the call. Default=8 seconds.
|
||||
Option YES is equal to Default 8 seconds.
|
||||
- Adsl Bug Fix
|
||||
Updated SNR reporting, fixes connecting issues on some lines.
|
||||
Updated stability on multiple restarts on some machines.
|
||||
|
||||
- Bug fix in chan_woomera on transfer
|
||||
- Major regression testing of BRI/SS7 chan_woomera and sangoma_mgd
|
||||
- Stable 500 Long Term Call load of Astersk+SMG/SS7
|
||||
- Build update for latest 2.6.28 kernel.
|
||||
- Build update for latest 2.6.29 kernel.
|
||||
- Build update for latest Suse
|
||||
|
||||
|
||||
* Mon Mar 11 2009 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.16
|
||||
=====================================================================
|
||||
|
||||
- Fixed S514 2 Byte receive
|
||||
|
||||
- A14X Serial Driver Update
|
||||
Added clock recovery option
|
||||
Added control of DTR/RTS on startup using
|
||||
DTR_CTRL and RTS_CTRL config variables.
|
||||
|
||||
- AFT T1/E1 BERT Feature
|
||||
Ability to run Bert tests on T1/E1 cards using wanpipemon
|
||||
|
||||
- AFT HWEC
|
||||
Hardware DTMF detection now detects FAX tones as well,
|
||||
and passes then up to Zaptel/Asterisk
|
||||
|
||||
- PPP Protocol
|
||||
Added option to disable MAGIC number in negotiation
|
||||
Set MAGIC_DISABLE=YES in ppp profile section.
|
||||
|
||||
- Updates for new 2.6.X kernels
|
||||
Added queue check on shutdown
|
||||
Support for latest 2.6 kernels
|
||||
|
||||
- Updated T3/E3 Code
|
||||
The T3/E3 dma logic had a bug that was demonstrated under
|
||||
high load. Was introduced in 3.3.15 release.
|
||||
|
||||
- Added hardware probe DUMP
|
||||
wanrouter hwprobe dump
|
||||
To be used by developers to easily parse the hwprobe output
|
||||
|
||||
- ADSL Update
|
||||
Bug fix in adsl. Could cause period disconnects on
|
||||
some equipment. The SNR value was not being properly reported
|
||||
the the upstream.
|
||||
|
||||
|
||||
* Tue Dec 08 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.15
|
||||
=====================================================================
|
||||
|
||||
- Added support for new B600 Analog Card
|
||||
|
||||
- Added task stop function on shutdown.
|
||||
This feature prevents an unlikely event that task gets
|
||||
scheduled after card has shutdown.
|
||||
|
||||
- Fixed tty driver for new Linux Kernel 2.6.26 and greater
|
||||
|
||||
- Fixed tristate mode using wanpipemon
|
||||
Used to enable/disable T1/E1 transmitter.
|
||||
wanpipemon -p aft for help.
|
||||
|
||||
- Fixed yellow alarm handler on T1/E1
|
||||
|
||||
- Added an option to run Zaptel & TDM API on same span.
|
||||
|
||||
- Fixed E3 Support for A301 cards.
|
||||
A301 cards need new Firmware v11 and CPLD v0.
|
||||
wanrouter hwprobe verbose shows current firmware and cpld version.
|
||||
|
||||
- Fixed Serial AFT card events
|
||||
Added X21 Support
|
||||
|
||||
- Added XMTP2 API for old PMC T1/E1 cards.
|
||||
|
||||
- Fixed Channel Bank ring problem on AFT T1/E1 cards.
|
||||
Some channel banks would ring all phones on card stop.
|
||||
This is now fixed.
|
||||
|
||||
- Updated AFT Core to fix XMTP2 startup with 16E1 links.
|
||||
|
||||
- Updated API for A14X Serial Cards
|
||||
Ability to receive Modem Events.
|
||||
|
||||
- Updated for Serial A14X API
|
||||
API for setting and receiving line events
|
||||
Sample code wanpipe-<version>/api/aft/aft_api_serial.c
|
||||
|
||||
- Updated Serial A14X for NRZI
|
||||
New firmware update v05
|
||||
|
||||
- Added wanrouter hwprobe dump
|
||||
Should be used for programs to parse hwprobe easily
|
||||
|
||||
|
||||
* Tue Oct 8 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.14
|
||||
=====================================================================
|
||||
|
||||
- Updated TDM API
|
||||
This update helps FreeSwitch analog support.
|
||||
|
||||
- Analog TDM API TAPPING Feature
|
||||
Sangoma Analog cards and TDM API used in TAPPING mode can be used to build
|
||||
custom call recording applications
|
||||
|
||||
- Enabled Zaptel/DAHDI operation mode
|
||||
This driver supports DAHDI/Asterisk
|
||||
Dahdi is supported on Asterisk 1.6 and 1.4
|
||||
Added dahdi to installation modes.
|
||||
-> ./Setup install #General installation
|
||||
-> ./Setup zaptel #Zaptel based installation
|
||||
-> ./Setup dahdi #Dahdi based installation
|
||||
-> ./Setup bri #SMG BRI installation
|
||||
|
||||
- LibSS7 MTP2 Option
|
||||
The MTP2 option improves the performance of LibSS7
|
||||
eg: instead of using: dchan=24 use mtp2=24
|
||||
Please consult libss7 documentation.
|
||||
|
||||
- Updated TDM API for A200
|
||||
Fixes FreeSwitch OpenZAP with TDM API for Analog
|
||||
|
||||
- Bug fix in XMTP2 API
|
||||
The fifo error could cause xmtp2 buffering to fail
|
||||
|
||||
- wanpipemon utility
|
||||
Updated T1/E1 Loopback commands
|
||||
Bug fix on 2.6.25 kernels
|
||||
|
||||
- Driver compile update for Latest
|
||||
2.6.26 kernels
|
||||
|
||||
- Update AFT driver to implement new loopback commands
|
||||
|
||||
- Updated for 56K driver
|
||||
|
||||
- Added Asterisk DAHDI Support
|
||||
|
||||
- A200/A400 Analog driver update
|
||||
Bug fix possible race condition due to front end interrupt.
|
||||
|
||||
- AFT Core Update
|
||||
Disabled fifo overrun handling in transparent mode.
|
||||
It does not provide any improvement.
|
||||
XMTP2 API mode could run out of buffers due to overrun errors.
|
||||
This has now been fixed.
|
||||
|
||||
- Fixed A301 E3 Support
|
||||
New firmware V11 is needed.
|
||||
Please upgrade firmware before starting up the card.
|
||||
To check firmware run: wanrouter hwprobe
|
||||
|
||||
|
||||
* Fri Sep 1 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.13
|
||||
=====================================================================
|
||||
|
||||
- This release was never released.
|
||||
|
||||
|
||||
|
||||
* Fri Aug 1 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.12
|
||||
=====================================================================
|
||||
|
||||
- Compilation fix for 2.6.25 kernel
|
||||
Introduced in 3.3.11 release
|
||||
|
||||
- Setup update
|
||||
Added bri and zaptel installation modes.
|
||||
-> ./Setup install #General installation
|
||||
-> ./Setup zaptel #Zaptel based installation
|
||||
-> ./Setup bri #SMG BRI installation
|
||||
|
||||
Streamlined Setup installation script
|
||||
Added check for Asterisk directory when installing BRI
|
||||
Added check for x86 in architecture
|
||||
|
||||
- Fixed Makefile build
|
||||
|
||||
- Updated README File
|
||||
|
||||
|
||||
* Wed Jul 30 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.11
|
||||
=====================================================================
|
||||
|
||||
- BRI to Analog Faxing Update
|
||||
Improved faxing over SMG Gateway and Zaptel Analog.
|
||||
This feature drastically improves faxing performance between
|
||||
BRI and Analog cards over Asterisk.
|
||||
|
||||
- BRI Update
|
||||
Added overlap dialing support
|
||||
Added support for BRI with 16 channel Echo Canceler.
|
||||
Support for test start option, that only verifies configuration
|
||||
files without applying changes.
|
||||
Support for non-syslog logging.
|
||||
|
||||
- BRI Bug Fix
|
||||
BRI was configured for answer on accept. This caused a call to
|
||||
be answered before the remote leg of the call became connected.
|
||||
|
||||
- T1/E1 Loopback Update
|
||||
wanpipemon was update to check loopback status as well as set
|
||||
T1/E1 loopback commands.
|
||||
|
||||
- Removed S508 ISA Support from drivers
|
||||
|
||||
- Fixed the BRI chip security handler. Tested that all BRI
|
||||
ports get properly shut down.
|
||||
|
||||
- Updated for New PLX & Tundra PCIe Bridges chips
|
||||
- Update hwprobe verbose for PMC Shark
|
||||
|
||||
- Updated for 2.6.25 kernel
|
||||
|
||||
- Fixed 64bit compilation for Octasic EC Image
|
||||
|
||||
- TDM API Bug Fix:
|
||||
Added a check for buffer overflow in write function.
|
||||
|
||||
- New Octasic EC Image
|
||||
Improves faxing over Hardware Echo Canceler.
|
||||
|
||||
- BRI Bug fix on startup
|
||||
The clock measuring function has limited and could fail on some machines.
|
||||
|
||||
- AFT T1/E1 - Added missing LBO configuration option WAN_T1_0_110
|
||||
|
||||
- Updated for 2.6.25 kernel
|
||||
|
||||
- Updated wancfg for interface MTU/MRU
|
||||
By default do not configure interface MTU/MRU if values have
|
||||
not changed by default. This way the global mtu can be used
|
||||
to easily configure the MTU/MRU of all interfaces.
|
||||
|
||||
- Updated wancfg_smg to configure XMTP2 API
|
||||
|
||||
- Wireshark Tracing for MTP2
|
||||
http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing
|
||||
|
||||
- T3/E3 Update
|
||||
Driver level update to improve code.
|
||||
|
||||
- MTP2 API Support
|
||||
http://wiki.sangoma.com/wanpipe-aft-ss7-mtp2-api
|
||||
|
||||
|
||||
* Fri May 15 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.10
|
||||
======================================================================
|
||||
|
||||
- BRI Update
|
||||
Binary segfaulted on some systems due to gcc incompabilitly.
|
||||
This is now fixed.
|
||||
|
||||
* Fri Apr 30 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.9
|
||||
======================================================================
|
||||
|
||||
- AFT BRI Clock Reference Update
|
||||
Disabled reference clocking feature on original A500 BRI Cards.
|
||||
It has been determined that reference clocking feature is not always stable
|
||||
on original A500 BRI cards. It can cause noise and call drops in some
|
||||
circumstances where BRI lines go up and down due to power saving mode.
|
||||
|
||||
If you have problems with FAX synchronization on an original A500 BRI Card
|
||||
contact Sangoma Support and we will swap out the card for one with
|
||||
an updated CPLD that will work with the reference clock and provide
|
||||
reliable FAXing.
|
||||
|
||||
Run wanrouter hwprobe verbose to determine your A500 BRI CPLD Version
|
||||
-> wanrouter hwprobe verbose
|
||||
-C00 -> old bri cpld (non reference clock)
|
||||
-C01 -> new bri cpld (reference clock enabled)
|
||||
|
||||
|
||||
- Manually Disabling BRI Clock Reference
|
||||
This option is valid from 3.3.6 release and greater.
|
||||
This option can be used in case of noise and voice quality issues
|
||||
and call drop issues on BRI card.
|
||||
|
||||
In order to disable BRI clock reference manually one can add
|
||||
RM_BRI_CLOCK=OSC in each BRI wanpipe config file in /etc/wanpipe directory.
|
||||
1. vi /etc/wanpipe/wanpipe1.conf
|
||||
2. Under the TDMV_SPAN option add
|
||||
RM_BRI_CLOCK=OSC
|
||||
3. Save file
|
||||
4. Repeat for all BRI wanpipe configuration files
|
||||
5. Restart all wanpipe devices
|
||||
|
||||
Note from 3.3.9 release on, all old CPLD A500 BRI cards
|
||||
have clock referencing disabled automatically.
|
||||
|
||||
- Updated BRI Stack
|
||||
Fix for RDNIS not cleared
|
||||
Support for show_spans and show_calls.
|
||||
Added support for multiple MSNs.
|
||||
Added support for timer_t3 and timer_t302
|
||||
http://wiki.sangoma.com/sangoma-wanpipe-smg-asterisk-bri-installation
|
||||
|
||||
|
||||
* Fri Apr 25 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.8
|
||||
======================================================================
|
||||
|
||||
- AFT Update
|
||||
A bug was introduced in 3.3.7 release that failed to load
|
||||
AFT cards without HWEC.
|
||||
|
||||
- AFT TE1 Code
|
||||
Defaulted Maxim T1 Rx Level to 36DB
|
||||
Defaulted Maxim E1 Rx Level to 42DB
|
||||
This will improve T1/E1 connectivity on noisy or low power lines.
|
||||
|
||||
- AFT BRI Update
|
||||
Minor update on BRI to conform better to TBR3 Certification
|
||||
|
||||
|
||||
* Wed Apr 23 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.7
|
||||
======================================================================
|
||||
|
||||
- BRI HWEC MAJOR Bug Fix
|
||||
BRI hwec was not configured properly on startup.
|
||||
Every second channel on each span was not being configured for hwec.
|
||||
This would result in random echo problems.
|
||||
|
||||
- Support for 2.6.24 kernels and up
|
||||
This release will now compile properly on 2.6.24 kernels and up.
|
||||
|
||||
- AFT Analog Update
|
||||
Added TBR21 operation mode
|
||||
Used for most european countries.
|
||||
-> this option must be added manually in wanpipe#.conf
|
||||
-> TDMV_OPERMODE=TBR21
|
||||
|
||||
- AFT A144 Update
|
||||
Added MPAPI X25 support to AFT A144/A142 cards
|
||||
Use: wancfg_legacy to configure MPAPI over AFT cards.
|
||||
http://wiki.sangoma.com/wanpipe-linux-mpapi-x25
|
||||
|
||||
- BRI Updated
|
||||
BRI driver updated for new 512hz clock used to improve
|
||||
hardware echo canceler with clock recovery mechanism.
|
||||
This featue will solve any random hwec warning messages
|
||||
one might see in /var/log/messages. Note these random
|
||||
warning messages did not cause any abnormal behaviour
|
||||
in extensive lab testings.
|
||||
To check your BRI hardware version run:
|
||||
-> wanrouter hwprobe verbose
|
||||
-C00 -> old bri cpld
|
||||
-C01 -> new bri cpld
|
||||
|
||||
- Wanpipemon PRI/BRI PCAP Tracing for Wireshark
|
||||
Using wanpipemon dchan trace one can now capture
|
||||
pcap files that can be opened by Wireshark.
|
||||
http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing
|
||||
|
||||
- S514 Secondary port bug fix
|
||||
The secondary port was not working.
|
||||
|
||||
- Updated wanrouter hwprobe
|
||||
New wanrouter hwprobe device summary line will only contain
|
||||
found devices. For backward compatibility we created "wanrouter hwprobe legacy"
|
||||
that can be used to revert hwprobe output to the original format.
|
||||
|
||||
- Add pci parity check to wanrouter
|
||||
wanrouter parity -> displays current system pci parity
|
||||
wanrouter parity off -> disables system pci parity
|
||||
wanrouter parity on -> enables system pci parity
|
||||
|
||||
/etc/wanpipe/wanrouter.rc
|
||||
WAN_PCI_PARITY=OFF -> on wanrouter start disable pci parity
|
||||
-> event logged in /var/log/wanrouter
|
||||
|
||||
On some servers pci parity can cause NMI interrupts that
|
||||
can lead to reboots. Parity can be caused by unsuported
|
||||
or buggy pci/bridge chipsets. The above commands can be used
|
||||
to combat pci parity reboots.
|
||||
|
||||
Another option is to disable PCI parity in BIOS :)
|
||||
|
||||
|
||||
* Wed Apr 4 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.6
|
||||
======================================================================
|
||||
|
||||
- BRI Driver bug fixes
|
||||
Secured the bri restart logic to prevent possible
|
||||
race conditions.
|
||||
|
||||
- BRI Stack update
|
||||
Bug Fix: bri stack update fixes reconnect on etsi lines
|
||||
Feature: group outbound calls skip disconnected lines
|
||||
|
||||
- T3 update
|
||||
Fixed dma issues on some machines when tx/rx mixed
|
||||
voip and data traffic.
|
||||
|
||||
- Hardware Probe Verbose Update
|
||||
Analog and BRI cards now display PCI/PCIe info on
|
||||
wanrouter hwrobe verbose.
|
||||
|
||||
|
||||
* Wed Mar 27 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.5
|
||||
======================================================================
|
||||
|
||||
|
||||
- Removed debugging out of firmware update utility
|
||||
- Updated firmware bin files
|
||||
- Updated firmware update script.
|
||||
|
||||
- No Functional Changes from 3.3.4
|
||||
|
||||
* Wed Mar 26 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.4
|
||||
======================================================================
|
||||
|
||||
- BRI TE auto clocking feature - Bug fix
|
||||
This feature failed on on some machines with multiple TE BRI modules.
|
||||
This bug would cause modules to loose sync. Bug introduced in 3.3.3
|
||||
release.
|
||||
|
||||
* Tue Mar 25 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.3
|
||||
======================================================================
|
||||
|
||||
- BRI TE auto clocking feature.
|
||||
Where a connected TE port is elected
|
||||
as the telco clock recovery port for the whole card. If that TE
|
||||
port goes down, another connected TE port is found to provide
|
||||
telco recovery clock to the card. If no connected TE ports are found
|
||||
then internal oscillator is used.
|
||||
-> This option is fully automatic no configuration options needed.
|
||||
|
||||
- BRI Zaptel Clock Source
|
||||
Since BRI does not interface to zaptel, it acts as ZT DUMMY to
|
||||
provide zaptel reliable timing. One has to configure
|
||||
TDMV_DUMMY_REF=YES in [wanpipe1] section of wanpipe1.conf
|
||||
|
||||
- A200/A400 Remora Relax CFG
|
||||
If one module fails during operation the wanpipe driver by default
|
||||
fails to load. With this option wanpipe driver
|
||||
will allow the card to come up with a broken module so that
|
||||
customer will be able to continue working until the module is replaced.
|
||||
RM_RELAX_CFG=YES in [wanpipe1] section of wanpipe1.conf
|
||||
|
||||
|
||||
|
||||
* Fri Feb 14 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.2.1
|
||||
======================================================================
|
||||
|
||||
- Added DTR API for Serial S514X Card
|
||||
Ability to read and set the DTR/RTS on serial cards throught the API.
|
||||
Sample code in wanpipe-3.3.2.1/api/chdlc/chdlc_modem_cmd.c
|
||||
|
||||
|
||||
* Wed Feb 12 2008 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.3.2
|
||||
======================================================================
|
||||
|
||||
- Support for A500 hardware support with NetBricks BRI Stack
|
||||
- Major A500 driver updates and fixes
|
||||
- Serial A142/A144 hardware support
|
||||
- AFT A056 56K hardware support
|
||||
|
||||
- Support for HW DTMF
|
||||
|
||||
- Updates for AFT PMC and MAXIM framers
|
||||
PMC - lowered LOS sensitivity
|
||||
Fixes fake up/down state changes on
|
||||
started inactive lines.
|
||||
|
||||
MAXIM - lowered sensistivy
|
||||
Fixes cable cross talk on 8 port cards.
|
||||
- Enabled Unframed E1
|
||||
- Enabled Tri-State Mode
|
||||
- Fixed loopback commands
|
||||
|
||||
- Updated loopback commands for AFT Maxim cards
|
||||
|
||||
- Updated for AstLinux
|
||||
The make file can now build all WAN and Voice Protocols
|
||||
|
||||
- Updated legacy protocols for new front end architecture
|
||||
|
||||
-
|
|
@ -0,0 +1,40 @@
|
|||
------------------------------------------------------------------------------
|
||||
WANPIPE TDM VOICE - IP/WAN Package
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
Copyright (c) 1995-2009 Sangoma Technologies Inc.
|
||||
|
||||
For more info visit: http://wiki.sangoma.com
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
* Thu May 07 2009 Nenad Corbic <ncorbic@sangoma.com> - Beta - 3.5.1
|
||||
===================================================================
|
||||
|
||||
- New Hardware Support
|
||||
B700 - Mixed BRI & Analog
|
||||
B600 - Analog 4FXO/FXS
|
||||
USB-FXO - USB Fxo device
|
||||
|
||||
- New Unified API for Linux & Windows
|
||||
API Library - libsangoma
|
||||
Unified Voice API for Linux & Windows
|
||||
|
||||
-More Info
|
||||
http://wiki.sangoma.com/wanpipe-api
|
||||
|
||||
- SPAN mode API
|
||||
- CHAN mode API
|
||||
|
||||
- Unified driver for Linux & Windows
|
||||
- Updated BRI Stack and Support
|
||||
- New BRI A500 & B700 firmware that fixes PCI parity errors.
|
||||
On some systems A500 & B700 cards can generate parity errors.
|
||||
|
||||
- FreeSwitch Tested
|
||||
- Update for 2.6.26 kernel
|
||||
|
||||
Note this is a major release. It has been fully regression
|
||||
tested and stress tested in the lab and in the field.
|
||||
|
||||
|
133
Makefile
133
Makefile
|
@ -14,10 +14,6 @@
|
|||
PWD=$(shell pwd)
|
||||
KBUILD_VERBOSE=0
|
||||
|
||||
EXTRA_CFLAGS=
|
||||
EXTRA_FLAGS=
|
||||
|
||||
#Default zaptel directory to be overwritten by user
|
||||
|
||||
ifdef DAHDI_DIR
|
||||
ZAPDIR=$(DAHDI_DIR)
|
||||
|
@ -30,7 +26,7 @@ ifneq (,$(wildcard ./.pbxdir))
|
|||
endif
|
||||
endif
|
||||
|
||||
$(shell echo $(ZAPDIR) > .pbxdir)
|
||||
$(shell echo $(ZAPDIR) > .pbxdir)
|
||||
|
||||
#Kernel version and location
|
||||
ifndef KVER
|
||||
|
@ -53,24 +49,8 @@ ifndef ASTDIR
|
|||
ASTDIR=/usr/src/asterisk
|
||||
endif
|
||||
|
||||
ifdef DESTDIR
|
||||
INSTALLPREFIX=$(DESTDIR)
|
||||
endif
|
||||
|
||||
ifndef INSTALLPREFIX
|
||||
INSTALLPREFIX=
|
||||
endif
|
||||
|
||||
ifndef LIBPREFIX
|
||||
LIBPREFIX=/usr
|
||||
endif
|
||||
|
||||
ifndef 64BIT_4G
|
||||
64BIT_4G="Disabled"
|
||||
else
|
||||
EXTRA_CFLAGS+= -DWANPIPE_64BIT_4G_DMA
|
||||
endif
|
||||
|
||||
INSTALLPREFIX=
|
||||
|
||||
#Local wanpipe includes
|
||||
WINCLUDE=patches/kdrivers/include
|
||||
|
@ -83,7 +63,7 @@ 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$(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
|
||||
|
||||
#Setup utility extra flags and include path
|
||||
|
@ -93,11 +73,6 @@ EXTRA_UTIL_FLAGS += -I$(PWD)/patches/kdrivers/wanec -I$(PWD)/patches/kdrivers/wa
|
|||
ENABLE_WANPIPEMON_ZAP=NO
|
||||
ZAPHDLC_PRIV=/etc/wanpipe/.zaphdlc
|
||||
|
||||
EXTRA_CFLAGS += $(EXTRA_FLAGS)
|
||||
|
||||
#Enable for debugging only
|
||||
#EXTRA_CFLAGS += -DWANPIPE_PERFORMANCE_DEBUG
|
||||
|
||||
|
||||
#Check if zaptel exists
|
||||
ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
|
||||
|
@ -120,9 +95,7 @@ else
|
|||
ZAPDIR_PRIV=$(ZAPDIR)
|
||||
ENABLE_WANPIPEMON_ZAP=YES
|
||||
EXTRA_CFLAGS+= -DSTANDALONE_ZAPATA -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL -DDAHDI_ISSUES -DBUILDING_TONEZONE -I$(ZAPDIR)/include -I$(ZAPDIR)/include/dahdi -I$(ZAPDIR)/drivers/dahdi
|
||||
ifneq (,$(wildcard $(ZAPDIR)/drivers/dahdi/Makefile))
|
||||
ZAP_OPTS= --zaptel-path=$(ZAPDIR)/drivers/dahdi/
|
||||
endif
|
||||
ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
ZAP_PROT=TDM
|
||||
PROTS=DEF-TDM
|
||||
else
|
||||
|
@ -135,7 +108,6 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
|
||||
EXTRA_CFLAGS += -I$(KDIR)/include/linux -I$(ZAPDIR)
|
||||
|
||||
RM = @rm -rf
|
||||
|
@ -151,42 +123,14 @@ else
|
|||
|
||||
#This will check for zaptel, kenrel source and build utilites and kernel modules
|
||||
#within local directory structure
|
||||
all: cleanup_local _checkzap _checksrc all_bin_kmod all_util
|
||||
|
||||
all_src: cleanup_local _checkzap _checksrc all_kmod all_util
|
||||
|
||||
all_src_ss7: cleanup_local _checkzap _checksrc all_kmod_ss7 all_util
|
||||
|
||||
dahdi: all_src
|
||||
|
||||
zaptel: all_src
|
||||
|
||||
openzap: all_src all_lib
|
||||
@touch .all_lib
|
||||
|
||||
openzap_ss7: all_src_ss7 all_lib
|
||||
@touch .all_lib
|
||||
|
||||
tdmapi: all_src all_lib
|
||||
@touch .all_lib
|
||||
|
||||
cleanup_local:
|
||||
@rm -f .all* 2> /dev/null;
|
||||
|
||||
all: _checkzap _checksrc all_bin_kmod all_util
|
||||
|
||||
all_src: _checkzap _checksrc all_kmod all_util all_lib
|
||||
|
||||
#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) ZAPHDLC=$(ZAPHDLC_PRIV) HOMEDIR=$(PWD) modules
|
||||
|
||||
all_kmod_ss7: _checkzap _checksrc _cleanoldwanpipe _check_kver
|
||||
@if [ -e $(PWD)/ss7_build_dir ]; then \
|
||||
rm -rf $(PWD)/ss7_build_dir; \
|
||||
fi
|
||||
@mkdir -p $(PWD)/ss7_build_dir
|
||||
./Setup drivers --builddir=$(PWD)/ss7_build_dir --with-linux=$(KDIR) $(ZAP_OPTS) --usr-cc=$(CC) --protocol=AFT_TE1-XMTP2 --no-zaptel-compile --noautostart --arch=$(ARCH) --silent
|
||||
@eval "./patches/copy_modules.sh $(PWD)/ss7_build_dir $(WAN_DIR)"
|
||||
|
||||
all_bin_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver
|
||||
@if [ -e $(PWD)/ast_build_dir ]; then \
|
||||
rm -rf $(PWD)/ast_build_dir; \
|
||||
|
@ -197,7 +141,7 @@ all_bin_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver
|
|||
|
||||
|
||||
#Clean utilites and kernel modules
|
||||
clean: cleanup_local clean_util _cleanoldwanpipe
|
||||
clean: clean_util _cleanoldwanpipe
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(WAN_DIR) clean
|
||||
@find patches/kdrivers -name '.*.cmd' | xargs rm -f
|
||||
@find . -name 'Module.symver*' | xargs rm -f
|
||||
|
@ -240,40 +184,35 @@ _checkzap:
|
|||
@echo " +--------- Wanpipe Build Info --------------+"
|
||||
@echo
|
||||
@if [ ! -e $(ZAPDIR)/zaptel.h ] && [ ! -e $(ZAPDIR)/kernel/zaptel.h ] && [ ! -e $(ZAPDIR)/include/dahdi/kernel.h ] ; then \
|
||||
echo " ZAPTEL/DAHDI Support: Disabled"; \
|
||||
echo " Compiling Wanpipe without ZAPTEL/DAHDI Support!"; \
|
||||
echo " Zaptel/Dahdi Dir: $(ZAPDIR)"; \
|
||||
ZAPDIR_PRIV=; \
|
||||
ENABLE_WANPIPEMON_ZAP=NO; \
|
||||
else \
|
||||
if [ -e $(ZAPDIR)/include/dahdi/kernel.h ]; then \
|
||||
echo " ZAPTEL/DAHDI Support: DAHDI Enabled"; \
|
||||
echo " DAHDI Dir : $(ZAPDIR)"; \
|
||||
echo " Compiling Wanpipe with DAHDI Support!"; \
|
||||
echo " Dahdi Dir: $(ZAPDIR)"; \
|
||||
echo; \
|
||||
ZAPDIR_PRIV=$(ZAPDIR); \
|
||||
ENABLE_WANPIPEMON_ZAP=YES; \
|
||||
if [ -f $(ZAPDIR)/drivers/dahdi/Module.symvers ]; then \
|
||||
cp -f $(ZAPDIR)/drivers/dahdi/Module.symvers $(WAN_DIR)/; \
|
||||
elif [ -f $(ZAPDIR)/src/dahdi-headers/drivers/dahdi/Module.symvers ]; then \
|
||||
cp -f $(ZAPDIR)/src/dahdi-headers/drivers/dahdi/Module.symvers $(WAN_DIR)/; \
|
||||
else \
|
||||
echo "Error: Dahdi source not compiled, missing Module.symvers file"; \
|
||||
echo " Please recompile Dahdi directory first"; \
|
||||
fi; \
|
||||
cp -f $(ZAPDIR)/drivers/dahdi/Module.symvers $(WAN_DIR)/; \
|
||||
else \
|
||||
echo " ZAPTEL/DAHDI Support: ZAPTEL Enabled"; \
|
||||
echo " ZAPTEL Dir : $(ZAPDIR)"; \
|
||||
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; \
|
||||
if [ -f $(ZAPDIR)/kernel/Module.symvers ]; then \
|
||||
cp -f $(ZAPDIR)/kernel/Module.symvers $(WAN_DIR)/; \
|
||||
elif [ -f $(ZAPDIR)/Module.symvers ]; then \
|
||||
elif [ -f -f $(ZAPDIR)/Module.symvers ]; then \
|
||||
cp -f $(ZAPDIR)/Module.symvers $(WAN_DIR)/; \
|
||||
else \
|
||||
echo "Error: Zaptel source not compiled, missing Module.symvers file"; \
|
||||
echo " Please recompile zaptel directory first"; \
|
||||
fi; \
|
||||
echo ; \
|
||||
echo "Please recompile and reinstall ZAPTEL after installation"; \
|
||||
fi \
|
||||
fi
|
||||
@echo
|
||||
|
@ -282,11 +221,7 @@ _checkzap:
|
|||
@sleep 2;
|
||||
|
||||
#Install all utilities etc and modules
|
||||
install: install_util install_etc install_kmod install_inc
|
||||
@if [ -e .all_lib ] ; then \
|
||||
$(MAKE) -C api/libsangoma install; \
|
||||
fi
|
||||
|
||||
install: install_util install_etc install_kmod install_inc install_lib
|
||||
|
||||
#Install kernel modules only
|
||||
install_kmod:
|
||||
|
@ -306,11 +241,6 @@ install_kmod:
|
|||
echo "install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}"; \
|
||||
install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}; \
|
||||
fi
|
||||
@rm -f $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/xmtp2km.${MODTYPE}
|
||||
@if [ -f $(WAN_DIR)/xmtp2km.${MODTYPE} ]; then \
|
||||
echo "install -D -m 644 $(WAN_DIR)/xmtp2km.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/xmtp2km.${MODTYPE}"; \
|
||||
install -D -m 644 $(WAN_DIR)/xmtp2km.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/xmtp2km.${MODTYPE};\
|
||||
fi
|
||||
@eval "./patches/rundepmod.sh"
|
||||
|
||||
endif
|
||||
|
@ -322,14 +252,6 @@ all_util: install_inc
|
|||
$(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)
|
||||
|
||||
all_lib:
|
||||
$(shell cd api/libsangoma; ./init-automake.sh >> $(PWD)/.cfg_log; ./configure --prefix=$(LIBPREFIX) >> $(PWD)/.cfg_log;)
|
||||
$(MAKE) -C api/libsangoma clean
|
||||
$(MAKE) -C api/libsangoma all
|
||||
|
||||
install_lib:
|
||||
$(MAKE) -C api/libsangoma install DESTDIR=$(INSTALLPREFIX)
|
||||
|
||||
#Clean utilities only
|
||||
clean_util:
|
||||
$(MAKE) -C util clean SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX)
|
||||
|
@ -338,10 +260,22 @@ clean_util:
|
|||
install_util:
|
||||
$(MAKE) -C util install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX)
|
||||
|
||||
all_lib:
|
||||
$(shell cd api/libsangoma; ./init-automake.sh > /dev/null; ./configure --prefix=/usr > /dev/null;)
|
||||
$(MAKE) -C api/libsangoma clean
|
||||
$(MAKE) -C api/libsangoma all
|
||||
$(shell cd api/libstelephony; ./init-automake.sh > /dev/null; ./configure --prefix=/usr > /dev/null;)
|
||||
$(MAKE) -C api/libstelephony clean
|
||||
$(MAKE) -C api/libstelephony all
|
||||
|
||||
install_lib:
|
||||
$(MAKE) -C api/libsangoma install
|
||||
$(MAKE) -C api/libstelephony install
|
||||
|
||||
install_smgbri:
|
||||
$(MAKE) -C ssmg/sangoma_mgd.trunk/ install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX)
|
||||
install -D -m 755 ssmg/sangoma_bri/smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl
|
||||
install -D -m 755 ssmg/sangoma_bri/sangoma_brid.$(ARCH) $(INSTALLPREFIX)/usr/sbin/sangoma_brid
|
||||
install -D -m 755 ssmg/sangoma_bri/sangoma_brid $(INSTALLPREFIX)/usr/sbin/sangoma_brid
|
||||
$(MAKE) -C ssmg/libsangoma.trunk/ install DESTDIR=$(INSTALLPREFIX)
|
||||
$(MAKE) -C ssmg/sangoma_mgd.trunk/lib/libteletone install DESTDIR=$(INSTALLPREFIX)
|
||||
|
||||
|
@ -383,9 +317,9 @@ install_inc:
|
|||
@\cp -rf $(PWD)/patches/kdrivers/wanec/*.h $(INSTALLPREFIX)/usr/include/wanpipe/
|
||||
|
||||
smgbri:
|
||||
@cd ssmg/libsangoma.trunk; ./configure --prefix=$(LIBPREFIX) ; cd ../..;
|
||||
@cd ssmg/libsangoma.trunk; ./configure --prefix=/usr ; cd ../..;
|
||||
$(MAKE) -C ssmg/libsangoma.trunk/ CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR)
|
||||
@cd ssmg/sangoma_mgd.trunk/lib/libteletone; ./configure --prefix=$(LIBPREFIX) ; cd ../../..;
|
||||
@cd ssmg/sangoma_mgd.trunk/lib/libteletone; ./configure --prefix=/usr ; cd ../../..;
|
||||
$(MAKE) -C ssmg/sangoma_mgd.trunk/lib/libteletone CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR)
|
||||
$(MAKE) -C ssmg/sangoma_mgd.trunk/ CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) ASTDIR=$(ASTDIR)
|
||||
|
||||
|
@ -396,5 +330,4 @@ clean_smgbri:
|
|||
$(MAKE) -C ssmg/sangoma_mgd.trunk/ clean CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR)
|
||||
|
||||
distclean: clean
|
||||
rm -f .pbxdir
|
||||
|
||||
rm -f .pbxdir
|
||||
|
|
585
Setup
585
Setup
|
@ -2,18 +2,13 @@
|
|||
#
|
||||
# Setup WANPIPE WAN Router Installation/Removal Script.
|
||||
#
|
||||
# Copyright (c) 1996-2009, Sangoma Technologies Inc.
|
||||
# Copyright (c) 1996-2008, 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.
|
||||
# ----------------------------------------------------------------------------
|
||||
# Jul 29, 2009 Konrad Hammel Added --with-asterisk option
|
||||
# Jul 27, 2009 Konrad Hammel Update to not compile unneeded utilities in
|
||||
# TDM_VOICE mode.
|
||||
# Jul 24, 2008 Konrad Hammel Removed the addition of UDEV rules for Dahdi
|
||||
# installs, only needed for Zaptel
|
||||
# Jul 30, 2008 Jignesh Patel Added check for sctp utlity
|
||||
# May 30, 2008 Jignesh Patel Fixed bootscript installation failure
|
||||
# Mar 12, 2008 Konrad Hammel Updated for Zaptel-1.4.9 (kernel sub-dir)
|
||||
|
@ -844,9 +839,56 @@ update_wanpipe_drivers ()
|
|||
return 1
|
||||
fi
|
||||
|
||||
wan_update_headers;
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
|
||||
|
||||
if [ -e $WANPIPE_INCLUDE_DIR ]; then
|
||||
eval "\rm -rf $WANPIPE_INCLUDE_DIR"
|
||||
fi
|
||||
|
||||
eval "\mkdir -p $WANPIPE_INCLUDE_DIR"
|
||||
|
||||
if [ ! -e $WANPIPE_INCLUDE_DIR/linux ]; then
|
||||
cd $WANPIPE_INCLUDE_DIR
|
||||
ln -s . linux
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
fi
|
||||
|
||||
eval "\cp -f *.h $WANPIPE_INCLUDE_DIR/ 2> /dev/null"
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/wanec
|
||||
eval "\cp -rf oct6100_api/include/ $WANPIPE_INCLUDE_DIR/oct6100_api 2> /dev/null"
|
||||
eval "\cp -rf *.h $WANPIPE_INCLUDE_DIR/ 2> /dev/null"
|
||||
eval "\cp -rf *.h $SOURCEDIR/include/linux 2> /dev/null"
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
|
||||
if [ $superuser = "YES" ] && [ -e /usr/include/linux ]; then
|
||||
eval "\cp -f *.h /usr/include/linux/ 2> /dev/null"
|
||||
fi
|
||||
|
||||
eval "\cp -f *.h $SOURCEDIR/include/linux/ 2> /dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo -e "Failed!\n"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -e $DRIVER_UPDATE_DIR/include/annexg ]; then
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/include/annexg
|
||||
|
||||
if [ -e /usr/include/linux ]; then
|
||||
eval "\cp -f *.h /usr/include/linux/ 2> /dev/null"
|
||||
fi
|
||||
|
||||
eval "\cp -f *.h $SOURCEDIR/include/linux/ 2> /dev/null"
|
||||
fi
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
|
||||
|
||||
|
||||
echo -n "Upgrading ${DISTR_NAME} kernel drivers ..."
|
||||
|
@ -1016,9 +1058,10 @@ get_kernel_ver ()
|
|||
local err=0
|
||||
|
||||
IFS="="
|
||||
|
||||
|
||||
while read name value;
|
||||
do
|
||||
|
||||
if [ $AWK_SUPPORT = YES ]; then
|
||||
name=`echo $name | awk '{ gsub(" ", "") ; print }'`
|
||||
elif [ $BASH_SUPPORT -gt 1 ]; then
|
||||
|
@ -1052,14 +1095,14 @@ get_kernel_ver ()
|
|||
|
||||
KERNEL_VERSION=$KVER"."$KPATCH"."$KLVL$KEVER
|
||||
|
||||
if [ "$KVER" -eq "2" ] && [ "$KPATCH" -eq "6" ]; then
|
||||
if [ $KVER -eq 2 ] && [ $KPATCH -eq 6 ]; then
|
||||
KERN_VER=26;
|
||||
LINUXDRIVERS_NET="drivers/net/wan"
|
||||
KLVL=${KLVL:-6}
|
||||
elif [ "$KVER" -eq "2" ] && [ "$KPATCH" -eq "4" ]; then
|
||||
elif [ $KVER -eq 2 ] && [ $KPATCH -eq 4 ]; then
|
||||
KERN_VER=24;
|
||||
LINUXDRIVERS_NET="drivers/net/wan"
|
||||
elif [ "$KVER" -eq "2" ] && [ "$KPATCH" -eq "2" ]; then
|
||||
elif [ $KVER -eq 2 ] && [ $KPATCH -eq 2 ]; then
|
||||
KERN_VER=22;
|
||||
LINUXDRIVERS_NET="drivers/net"
|
||||
if [ $ADSL_PROT = YES ];then
|
||||
|
@ -2061,8 +2104,6 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
|
||||
delete_old_tools;
|
||||
|
||||
wan_update_headers;
|
||||
|
||||
cd $PROD_HOME/util
|
||||
|
||||
echo
|
||||
|
@ -2097,7 +2138,7 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
|
||||
|
||||
echo
|
||||
echo -n "Compiling ${DISTR_NAME} WanCfg Utility ..."
|
||||
echo "Compiling ${DISTR_NAME} WanCfg Utility ..."
|
||||
|
||||
WANCFG_DEFS=
|
||||
if [ "$TDM_PROT" = "YES" ]; then
|
||||
|
@ -2106,11 +2147,11 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
WANCFG_DEFS=$WANCFG_DEFS" DAHDI_ISSUES=YES"
|
||||
fi
|
||||
fi
|
||||
eval "make -C wancfg all CC=$CC SYSINC=$WANPIPE_INCLUDE_DIR $WANCFG_DEFS >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make -C wancfg all CC=$CC SYSINC=$SOURCEDIR/include $WANCFG_DEFS >> $CMP_LOG 2>> $CMP_LOG"
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo -e "Done.\n\n"
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo
|
||||
echo -e "Failed!\n"
|
||||
|
@ -2130,124 +2171,100 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
|
||||
cd $PROD_HOME/util/misc
|
||||
|
||||
echo
|
||||
echo -n "Compiling WANPIPE Misc Utilities ..."
|
||||
eval "make CC=$CC SYSINC=$SOURCEDIR/include > /dev/null"
|
||||
echo -e "Done.\n\n"
|
||||
echo -e "Done.\n"
|
||||
|
||||
if [ $TDM_VOICE_ONLY = 'YES' ]; then
|
||||
echo -e "Compiling WANPIPE LibSangoma API Library ... skipped, not required.\n\n"
|
||||
else
|
||||
echo -n "Compiling WANPIPE LibSangoma API library ..."
|
||||
echo
|
||||
echo -n "Compiling WANPIPE LibSangoma API library ..."
|
||||
|
||||
cd $PROD_HOME/api
|
||||
|
||||
if [ $superuser = "YES" ] && [ -z $ROOT ]; then
|
||||
eval "find /usr/local/lib -name 'libsangoma*' > /dev/null 2>/dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "find /usr/local/lib -name 'libsangoma*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
eval "find /usr/local/include -name 'libsangoma*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
fi
|
||||
eval "find /usr/local/lib -name 'libstelephony*' > /dev/null 2>/dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "find /usr/local/lib -name 'libstelephony*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
eval "find /usr/local/include -name 'libstelephony*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
fi
|
||||
eval "find /usr/lib -name 'libsangoma*' > /dev/null 2>/dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "find /usr/lib -name 'libsangoma*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
eval "find /usr/include -name 'libsangoma*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
fi
|
||||
eval "find /usr/lib/lib -name 'libstelephony*' > /dev/null 2>/dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "find /usr/lib -name 'libstelephony*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
eval "find /usr/include -name 'libstelephony*' | xargs rm -f > /dev/null 2>/dev/null"
|
||||
fi
|
||||
cd $PROD_HOME/api
|
||||
|
||||
if [ $superuser = "YES" ] && [ -z $ROOT ]; then
|
||||
eval "find /usr/local/lib -name 'libsangoma*' > /dev/null 2>/dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "find /usr/local/lib -name 'libsangoma*' | xargs rm > /dev/null 2>/dev/null"
|
||||
eval "find /usr/local/include -name 'libsangoma*' | xargs rm > /dev/null 2>/dev/null"
|
||||
fi
|
||||
|
||||
cd libsangoma
|
||||
eval "./init-automake.sh >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "./configure --prefix=/usr >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make clean >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make CC=$CC SYSINC=$WANPIPE_INCLUDE_DIR >> $CMP_LOG 2>> $CMP_LOG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n\n"
|
||||
else
|
||||
echo -e "Failed. \n\n"
|
||||
pause
|
||||
eval "find /usr/local/lib -name 'libstelephony*' > /dev/null 2>/dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "find /usr/local/lib -name 'libstelephony*' | xargs rm > /dev/null 2>/dev/null"
|
||||
eval "find /usr/local/include -name 'libstelephony*' | xargs rm > /dev/null 2>/dev/null"
|
||||
fi
|
||||
eval "make install DESTDIR=$ROOT >> $CMP_LOG 2>> $CMP_LOG"
|
||||
cd ..
|
||||
fi
|
||||
|
||||
if [ $TDM_VOICE_ONLY = 'YES' ]; then
|
||||
echo -e "Compiling WANPIPE LibStelephony API Library ... skipped, not required.\n\n"
|
||||
cd libsangoma
|
||||
eval "./init-automake.sh > /dev/null"
|
||||
eval "./configure --prefix=$ROOT/usr >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make clean >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make CC=$CC SYSINC=$SOURCEDIR/include >> $CMP_LOG 2>> $CMP_LOG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
if [ -e libstelephony ]; then
|
||||
echo -n "Compiling WANPIPE LibStelephony API library ..."
|
||||
cd libstelephony
|
||||
eval "./init-automake.sh >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "./configure --prefix=/usr >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make clean >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make CC=$CC SYSINC=$WANPIPE_INCLUDE_DIR >> $CMP_LOG 2>> $CMP_LOG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n\n"
|
||||
else
|
||||
echo -e "Failed. -- Note this library is not mandatory its safe to continue install \n\n"
|
||||
pause
|
||||
fi
|
||||
fi
|
||||
|
||||
eval "make install DESTDIR=$ROOT >> $CMP_LOG 2>> $CMP_LOG"
|
||||
|
||||
|
||||
if [ $superuser = "YES" ] && [ -z $ROOT ]; then
|
||||
eval "ldconfig > /dev/null 2> /dev/null"
|
||||
fi
|
||||
fi
|
||||
echo -e "Failed. \n"
|
||||
pause
|
||||
fi
|
||||
eval "make install >> $CMP_LOG 2>> $CMP_LOG"
|
||||
|
||||
if [ $TDM_VOICE_ONLY = 'YES' ]; then
|
||||
echo -e "Compiling WANPIPE API Development Utilities ... skipped, not required.\n\n"
|
||||
cd ..
|
||||
echo -n "Compiling WANPIPE LibStelephony API library ..."
|
||||
|
||||
cd libstelephony
|
||||
eval "./init-automake.sh > /dev/null"
|
||||
eval "./configure --prefix=$ROOT/usr >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make clean >> $CMP_LOG 2>> $CMP_LOG"
|
||||
eval "make CC=$CC SYSINC=$SOURCEDIR/include >> $CMP_LOG 2>> $CMP_LOG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo -n "Compiling WANPIPE API Development Utilities ..."
|
||||
|
||||
cd $PROD_HOME/api
|
||||
|
||||
if [ -f Makefile ]; then
|
||||
eval "make CC=$CC SYSINC=$WANPIPE_INCLUDE_DIR >> $CMP_LOG 2>> $CMP_LOG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo -e "Failed!\n"
|
||||
echo -e "\tERROR: Failed to compile WANPIPE API Tools !!!"
|
||||
echo -e "\tPlease contact support at Sangoma Technologies"
|
||||
echo -e "\temail: techdesk@sangoma.com"
|
||||
echo -e "\tPlease include the file setup_drv_compile.log\n"
|
||||
pause
|
||||
fi
|
||||
echo -e "Failed. \n"
|
||||
pause
|
||||
fi
|
||||
eval "make install >> $CMP_LOG 2>> $CMP_LOG"
|
||||
|
||||
|
||||
if [ $superuser = "YES" ] && [ -z $ROOT ]; then
|
||||
eval "ldconfig > /dev/null 2> /dev/null"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -n "Compiling WANPIPE API Development Utilities ..."
|
||||
|
||||
cd $PROD_HOME/api
|
||||
|
||||
if [ -f Makefile ]; then
|
||||
eval "make CC=$CC SYSINC=$SOURCEDIR/include >> $CMP_LOG 2>> $CMP_LOG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo -e "Skipped, no makefile\n"
|
||||
echo -e "Failed!\n"
|
||||
echo -e "\tERROR: Failed to compile WANPIPE API Tools !!!"
|
||||
echo -e "\t\nPlease contact Sangoma Technologies"
|
||||
pause
|
||||
fi
|
||||
else
|
||||
echo "Skiped"
|
||||
fi
|
||||
|
||||
if [ -d $PROD_HOME/util/wanec_client ] && [ -d $DRIVER_UPDATE_DIR/wanec ] ; then
|
||||
echo
|
||||
echo -n "Compiling WANPIPE HWEC Utilities ..."
|
||||
cd $PROD_HOME/util/wanec_client
|
||||
eval "make CC=$CC SYSINC=$WANPIPE_INCLUDE_DIR WANEC_DIR=$DRIVER_UPDATE_DIR/wanec >> $CMP_LOG 2>> $CMP_LOG "
|
||||
eval "make CC=$CC SYSINC=$SOURCEDIR/include WANEC_DIR=$DRIVER_UPDATE_DIR/wanec >> $CMP_LOG 2>> $CMP_LOG "
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n\n"
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo -e "Failed!\n"
|
||||
echo -e "\tERROR: Failed to compile WANPIPE HWEC Tools !!!"
|
||||
echo -e "\tPlease contact support at Sangoma Technologies"
|
||||
echo -e "\temail: techdesk@sangoma.com"
|
||||
echo -e "\tPlease include the file setup_drv_compile.log\n"
|
||||
echo -e "\t\nPlease contact Sangoma Technologies"
|
||||
pause
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo -n "WANPIPE HWEC Utilities not installed"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
echo -e "\tWANPIPE Environment Setup Complete !!!\n"
|
||||
pause
|
||||
return 0
|
||||
|
@ -2537,15 +2554,9 @@ function build_kernel_module()
|
|||
#echo "----------------------------"
|
||||
#echo
|
||||
|
||||
rm -f $modname.ko
|
||||
rm -f $modname.mod.o
|
||||
|
||||
make MODULE_NAME=$modname OBJS="$ofiles" CC=$CC SUBDIRS=$PWD KBUILD_VERBOSE=$KBUILD_VERBOSE KDIR=$SOURCEDIR \
|
||||
EXTRA_CFLAGS="-D__LINUX__ $PROTOCOL_DEFINES $extra_flags " >> $CMP_LOG 2>> $CMP_LOG
|
||||
# echo "ld $LD_ELF -r -o $modname.ko $modname.o $modname.mod.o" >> $CMP_BUILD
|
||||
# $EVALCMD "ld $LD_ELF -r -o $modname.ko $modname.o $modname.mod.o"
|
||||
echo "ld $LD_ELF -r -o $modname.ko $modname.o $modname.mod.o" >> $CMP_BUILD
|
||||
$EVALCMD "ld $LD_ELF -r -o $modname.ko $modname.o $modname.mod.o"
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
for file in $modfiles
|
||||
|
@ -3082,20 +3093,20 @@ function select_compilation_mode()
|
|||
Protocols: Frame Relay, CHDLC, PPP, ATM, X25, ADSL, TDM API
|
||||
Default for: Wan Routing, Data & Voice API devel.
|
||||
|
||||
2. TDM Voice (Dahdi/Zaptel) Support
|
||||
Protocols: TDMV (Dahid/Zaptel), TDM API on AFT adatpers.
|
||||
2. TDM Voice (Zaptel) Support
|
||||
Protocols: TDMV (Zaptel), TDM API on AFT adatpers.
|
||||
Default for: Asterisk & CallWeaver
|
||||
|
||||
3. TDM Voice (Dahid/Zaptel) + WAN Protocol Support
|
||||
3. TDM Voice (Zaptel) + WAN Protocol Support
|
||||
|
||||
4. SMG (SS7) (Default for Asterisk SMG/SS7 install)
|
||||
|
||||
5. SMG (SS7) + TDM Voice (Dahdi/Zaptel)
|
||||
5. SMG (SS7) + TDM Voice (Zaptel)
|
||||
Default for: Asterisk SS7 + PRI
|
||||
|
||||
6. SMG (BRI) (Default for Asterisk SMG/BRI install)
|
||||
|
||||
7. SMG (BRI) + TDM Voice (Dahdi/Zaptel)
|
||||
7. SMG (BRI) + TDM Voice (Zaptel)
|
||||
Default for: Asterisk BRI + PRI + Analog
|
||||
|
||||
8. TDM API
|
||||
|
@ -3124,7 +3135,6 @@ if [ -z $NONINTERACTIVE ]; then
|
|||
enable_protocols $DEFAULT_PROTOCOLS
|
||||
|
||||
elif [ "$response" -eq 2 ]; then
|
||||
TDM_VOICE_ONLY=YES
|
||||
enable_protocols "TDM"
|
||||
enable_protocols "AFT_TE1"
|
||||
LIP_PROT=NO
|
||||
|
@ -3199,67 +3209,6 @@ function makefile_function ()
|
|||
|
||||
|
||||
|
||||
function wan_update_headers ()
|
||||
{
|
||||
if [ "$WAN_HEADERS_UPDATED" = "YES" ]; then
|
||||
#Headers already updated
|
||||
return 0;
|
||||
fi
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
|
||||
if [ -e $WANPIPE_INCLUDE_DIR ]; then
|
||||
eval "\rm -rf $WANPIPE_INCLUDE_DIR"
|
||||
fi
|
||||
|
||||
eval "\mkdir -p $WANPIPE_INCLUDE_DIR"
|
||||
|
||||
if [ ! -e $WANPIPE_INCLUDE_DIR/linux ]; then
|
||||
cd $WANPIPE_INCLUDE_DIR
|
||||
ln -s . linux
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
fi
|
||||
|
||||
eval "\cp -f *.h $WANPIPE_INCLUDE_DIR/ 2> /dev/null"
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/wanec
|
||||
eval "\cp -rf oct6100_api/include/ $WANPIPE_INCLUDE_DIR/oct6100_api 2> /dev/null"
|
||||
eval "\cp -rf *.h $WANPIPE_INCLUDE_DIR/ 2> /dev/null"
|
||||
eval "\cp -rf wanec_iface.h $SOURCEDIR/include/linux 2> /dev/null"
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/include/
|
||||
|
||||
if [ $superuser = "YES" ] && [ -e /usr/include/linux ]; then
|
||||
eval "\cp -f *.h /usr/include/linux/ 2> /dev/null"
|
||||
fi
|
||||
|
||||
eval "\cp -f *.h $SOURCEDIR/include/linux/ 2> /dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "Done.\n"
|
||||
else
|
||||
echo -e "Failed!\n"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
if [ -e $DRIVER_UPDATE_DIR/include/annexg ]; then
|
||||
|
||||
cd $DRIVER_UPDATE_DIR/include/annexg
|
||||
|
||||
if [ -e /usr/include/linux ]; then
|
||||
eval "\cp -f *.h /usr/include/linux/ 2> /dev/null"
|
||||
fi
|
||||
|
||||
eval "\cp -f *.h $WANPIPE_INCLUDE_DIR/ 2> /dev/null"
|
||||
eval "\cp -f *.h $SOURCEDIR/include/linux/ 2> /dev/null"
|
||||
fi
|
||||
|
||||
WAN_HEADERS_UPDATED=YES
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
function compile_drivers ()
|
||||
{
|
||||
|
@ -3297,8 +3246,8 @@ For greater customization you will be prompted to
|
|||
select which Protocol/Drivers you would like to
|
||||
build into the WANPIPE kernel modules.
|
||||
|
||||
Wanpipe for Asterisk/Dahdi/Zaptel
|
||||
Default for Asterisk/Dahdi/Zaptel
|
||||
Wanpipe for Asterisk/Zaptel
|
||||
Default for Asterisk/Zaptel
|
||||
Wanpipe for Wan Routing/API
|
||||
Default for Wan/IP Routing and Data API
|
||||
Wanpipe for Asterisk SMG/SS7
|
||||
|
@ -3320,8 +3269,6 @@ ENDOFTEXT
|
|||
rm -rf $DRIVER_TMP_DIR
|
||||
fi
|
||||
|
||||
eval "find $PROD_HOME -name \"Module.symvers*\" | xargs \rm -f"
|
||||
|
||||
\mkdir "$DRIVER_TMP_DIR"
|
||||
\mkdir "$DRIVER_TMP_DIR/mod"
|
||||
\mkdir "$DRIVER_TMP_DIR/tmp"
|
||||
|
@ -3751,23 +3698,14 @@ CFLAGS="$CC -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dli
|
|||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=sdla_xilinx -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/sdla_xilinx.o sdla_xilinx.c"
|
||||
|
||||
if [ $REL = "3.4" ]; then
|
||||
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=sdla_aft_te1 -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/sdla_aft_te1.o sdla_aft_te1.c"
|
||||
|
||||
else
|
||||
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core.o aft_core.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core_api_events -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core_api_events.o aft_core_api_events.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core_prot -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core_prot.o aft_core_prot.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core_utils -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core_utils.o aft_core_utils.c"
|
||||
fi
|
||||
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core.o aft_core.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core_api_events -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core_api_events.o aft_core_api_events.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core_prot -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core_prot.o aft_core_prot.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_core_utils -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_core_utils.o aft_core_utils.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_a104 -DKBUILD_MODNAME=wanpipe_lite \
|
||||
-c -o tmp/aft_a104.o aft_a104.c"
|
||||
eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=aft_analog -DKBUILD_MODNAME=wanpipe_lite \
|
||||
|
@ -3784,21 +3722,12 @@ CFLAGS="$CC -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dli
|
|||
MEXT=ko
|
||||
fi
|
||||
|
||||
|
||||
if [ $REL = "3.4" ]; then
|
||||
eval "ld $LD_ELF -r -o mod/wanpipe_lite.$MEXT tmp/wanpipe_main.o tmp/wanpipe_hdlc.o \
|
||||
eval "ld $LD_ELF -r -o mod/wanpipe_lite.$MEXT tmp/wanpipe_main.o tmp/wanpipe_hdlc.o \
|
||||
tmp/wanpipe_linux_iface.o tmp/sdla_te1.o tmp/sdla_8te1.o tmp/sdla_te3.o tmp/sdla_56k.o \
|
||||
tmp/wanpipe_utils.o tmp/wanpipe_abstr.o tmp/sdla_xilinx.o tmp/sdla_aft_te1.o \
|
||||
tmp/wanpipe_utils.o tmp/wanpipe_abstr.o tmp/sdla_xilinx.o \
|
||||
tmp/aft_core.o tmp/aft_core_api_events.o tmp/aft_core_prot.o tmp/aft_core_utils.o \
|
||||
tmp/sdladrv.o tmp/aft_a104.o tmp/aft_analog.o "
|
||||
|
||||
else
|
||||
eval "ld $LD_ELF -r -o mod/wanpipe_lite.$MEXT tmp/wanpipe_main.o tmp/wanpipe_hdlc.o \
|
||||
tmp/wanpipe_linux_iface.o tmp/sdla_te1.o tmp/sdla_8te1.o tmp/sdla_te3.o tmp/sdla_56k.o \
|
||||
tmp/wanpipe_utils.o tmp/wanpipe_abstr.o tmp/sdla_xilinx.o \
|
||||
tmp/aft_core.o tmp/aft_core_api_events.o tmp/aft_core_prot.o tmp/aft_core_utils.o \
|
||||
tmp/sdladrv.o tmp/aft_a104.o tmp/aft_analog.o "
|
||||
fi
|
||||
|
||||
install -D -m 644 mod/wanpipe_lite.$MEXT $ROOT/lib/modules/$KERNEL_VERSION/kernel/drivers/net/wan/wanpipe_lite.$MEXT
|
||||
|
||||
# End of LITE
|
||||
|
@ -3887,12 +3816,7 @@ WANPIPE_OBJS=
|
|||
cp $MODSYM $PROD_HOME/$MODSYM.sdladrv
|
||||
fi
|
||||
|
||||
WANROUTER_OBJS="wanmain wanproc waniface "
|
||||
if [ $REL != "3.4" ]; then
|
||||
WANROUTER_OBJS=$WANROUTER_OBJS" wandev wanpipe_cdev_linux"
|
||||
fi
|
||||
|
||||
build_kernel_module wanrouter "$WANROUTER_OBJS"
|
||||
build_kernel_module wanrouter "wanmain wanproc waniface wandev wanpipe_cdev_linux"
|
||||
if [ -e $MODSYM ]; then
|
||||
cp $MODSYM $PROD_HOME/$MODSYM.wanrouter
|
||||
fi
|
||||
|
@ -4089,9 +4013,7 @@ WANPIPE_OBJS=
|
|||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_remora_tdmv.c .
|
||||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_bri_tdmv.c .
|
||||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_tdmv_dummy.c .
|
||||
if [ -e $DRIVER_UPDATE_DIR/src/net/sdla_usb_remora_tdmv.c ]; then
|
||||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_usb_remora_tdmv.c .
|
||||
fi
|
||||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_usb_remora_tdmv.c .
|
||||
WANPIPE_OBJS=$WANPIPE_OBJS"sdla_tdmv sdla_remora_tdmv sdla_bri_tdmv sdla_tdmv_dummy "
|
||||
WANPIPE_EXTRA_CFLAGS=$WANPIPE_EXTRA_CFLAGS"-I$ZAPTEL_SOURCE_DIR "
|
||||
if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
|
||||
|
@ -4101,12 +4023,7 @@ WANPIPE_OBJS=
|
|||
fi
|
||||
|
||||
if [ "$AFT_TE1_PROT" = "YES" ]; then
|
||||
if [ $REL = "3.4" ]; then
|
||||
WANPIPE_OBJS=$WANPIPE_OBJS"sdla_xilinx sdla_aft_te1 aft_a104 sdla_remora aft_analog "
|
||||
else
|
||||
WANPIPE_OBJS=$WANPIPE_OBJS"sdla_xilinx aft_core aft_core_api_events aft_core_prot aft_core_utils aft_a104 sdla_remora sdla_remora_analog aft_analog wanpipe_timer_dev "
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$AFT_BRI_PROT" = "YES" ]; then
|
||||
|
@ -4341,9 +4258,6 @@ WANPIPE_OBJS=
|
|||
XMTP2KM_OBJ="main2_6 fwmsg"
|
||||
|
||||
build_kernel_module xmtp2km "$XMTP2KM_OBJ" "-D__XMTP2__" "bin/$xmtp2km_file"
|
||||
if [ -e $MODSYM ]; then
|
||||
cp $MODSYM $PROD_HOME/$MODSYM.xmtp2
|
||||
fi
|
||||
|
||||
if [ -e xmtp2km.ko ]; then
|
||||
\cp -f xmtp2km.ko ../mod
|
||||
|
@ -4363,14 +4277,8 @@ WANPIPE_OBJS=
|
|||
lip_src_mods=$lip_src_mods" wanpipe_hdlc_iface wanpipe_hdlc_eng"
|
||||
fi
|
||||
|
||||
if [ -e $PROD_HOME/$MODSYM.xmtp2 ]; then
|
||||
cat $PROD_HOME/$MODSYM.xmtp2 >> $MODSYM
|
||||
fi
|
||||
|
||||
build_kernel_module wanpipe_lip "$lip_src_mods" "$LIP_DEFINES" "$LIP_BIN_OBJS"
|
||||
if [ -e $MODSYM ]; then
|
||||
cp $MODSYM $PROD_HOME/$MODSYM.lip
|
||||
fi
|
||||
|
||||
|
||||
if [ $FR_PROT = "YES" ]; then
|
||||
echo "FR compiled for GCC Ver=$GCC_VER Arch=$ARCH File:$fr_file"
|
||||
|
@ -4418,10 +4326,6 @@ WANPIPE_OBJS=
|
|||
echo -n "Linking Wanpipe Driver and protocols ..."
|
||||
|
||||
#Link in appropriate protocols as needed.
|
||||
if [ -e $MODSYM ]; then
|
||||
eval "\rm -f $MODSYM"
|
||||
fi
|
||||
|
||||
if [ "$TDM_PROT" = "YES" ]; then
|
||||
if [ -f $ZAPTEL_SYM_DIR/$MODSYM ]; then
|
||||
cat $ZAPTEL_SYM_DIR/$MODSYM >> $MODSYM
|
||||
|
@ -4434,12 +4338,6 @@ WANPIPE_OBJS=
|
|||
if [ -f $PROD_HOME/$MODSYM.syncppp ]; then
|
||||
cat $PROD_HOME/$MODSYM.syncppp >> $MODSYM
|
||||
fi
|
||||
if [ -e $PROD_HOME/$MODSYM.xmtp2 ]; then
|
||||
cat $PROD_HOME/$MODSYM.xmtp2 >> $MODSYM
|
||||
fi
|
||||
if [ -e $PROD_HOME/$MODSYM.lip ]; then
|
||||
cat $PROD_HOME/$MODSYM.lip >> $MODSYM
|
||||
fi
|
||||
|
||||
WANPIPE_OBJS=$WANPIPE_OBJS"sdlamain wanpipe_tdm_api wanpipe_codec wanpipe_codec_law "
|
||||
build_kernel_module wanpipe "$WANPIPE_OBJS" "$WANPIPE_EXTRA_CFLAGS" "$WANPIPE_BIN_OBJS"
|
||||
|
@ -4735,11 +4633,9 @@ ENDOFTEXT
|
|||
function install_chan_woomera()
|
||||
{
|
||||
AST_MODULES=chan_woomera.c
|
||||
if [ "$AST_DFLT_INSTALL_DIR" = "" ]; then
|
||||
ast_src_dir=/usr/src/asterisk
|
||||
else
|
||||
ast_src_dir=$AST_DFLT_INSTALL_DIR
|
||||
fi
|
||||
if test $NONINTERACTIVE; then
|
||||
ast_src_dir=/usr/src/asterisk
|
||||
fi
|
||||
|
||||
cd $PROD_HOME/$SSMG_DIR
|
||||
cd sangoma_mgd.trunk
|
||||
|
@ -5019,7 +4915,7 @@ function install_smg_samples_ss7()
|
|||
if [ -f $ROOT/etc/asterisk/extensions.conf ]; then
|
||||
eval "grep -i outb-ss7 $ROOT/etc/asterisk/extensions.conf 2> /dev/null > /dev/null"
|
||||
if [ $? -ne 0 ]; then
|
||||
cat $ROOT/etc/asterisk/extensions.conf ./conf/woomera_ext.conf > conf.$$
|
||||
cat $ROOT/etc/asterisk/extensions.conf ./conf_ss7/woomera_ext.conf > conf.$$
|
||||
mv conf.$$ $ROOT/etc/asterisk/extensions.conf
|
||||
echo "Asterisk extensions.conf file updated with woomera config"
|
||||
else
|
||||
|
@ -5031,7 +4927,7 @@ function install_smg_samples_ss7()
|
|||
if [ -f $ROOT/etc/asterisk/iax.conf ]; then
|
||||
eval "grep -i outb-ss7 $ROOT/etc/asterisk/iax.conf 2> /dev/null > /dev/null"
|
||||
if [ $? -ne 0 ]; then
|
||||
cat $ROOT/etc/asterisk/iax.conf ./conf/woomera_iax.conf > conf.$$
|
||||
cat $ROOT/etc/asterisk/iax.conf ./conf_ss7/woomera_iax.conf > conf.$$
|
||||
mv conf.$$ $ROOT/etc/asterisk/iax.conf
|
||||
echo "Asterisk iax.conf file updated with ss7 guest config"
|
||||
else
|
||||
|
@ -5581,18 +5477,18 @@ function tdmv_apply_zaptel_dchan_patch_old ()
|
|||
}
|
||||
|
||||
function tdmv_apply_zaptel_chunk_patch () {
|
||||
lhome=`pwd`
|
||||
TEMP=tmp
|
||||
cd $ZAPTEL_SOURCE_DIR
|
||||
echo "Applying Zaptel/Dahdi Chunk patch..."
|
||||
echo " "
|
||||
lhome=`pwd`
|
||||
TEMP=tmp
|
||||
cd $ZAPTEL_SOURCE_DIR
|
||||
echo "Applying Zaptel/Dahdi Chunk patch..."
|
||||
echo " "
|
||||
|
||||
filetopatch="zaptel.h"
|
||||
chunkname="ZT_CHUNKSIZE"
|
||||
dhname="Zaptel"
|
||||
isdahdi="no"
|
||||
if [ -f $ZAPTEL_SOURCE_DIR/dahdi/kernel.h ]; then
|
||||
filetopatch="$ZAPTEL_SOURCE_DIR/dahdi/$kernel.h"
|
||||
filetopatch="kernel.h"
|
||||
chunkname="DAHDI_CHUNKSIZE"
|
||||
dhname="Dahdi"
|
||||
isdahdi="yes"
|
||||
|
@ -5669,31 +5565,20 @@ function tdmv_apply_zaptel_chunk_patch () {
|
|||
fi
|
||||
# for zaptel-1.2.26 or later (including Dahdi)
|
||||
if [ -f Kbuild ]; then
|
||||
eval "cat Kbuild | sed 's/^obj-.*+=.*wct4xx.*//g'>$TEMP 2>/dev/null "
|
||||
eval "cat Kbuild | sed 's/^obj-m.*+=.*wct4xx.*//g'>$TEMP 2>/dev/null "
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " Failed to remove wct4xxp from Kbuild"
|
||||
exit 1
|
||||
|
||||
else
|
||||
eval "\mv -f $TEMP Kbuild"
|
||||
echo " wct4xxp module removed from Kbuild successfully"
|
||||
zaptel_modified=1
|
||||
fi
|
||||
|
||||
eval "cat Kbuild | sed 's/^obj-.*+=.*wcb4xx.*//g'>$TEMP 2>/dev/null "
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " Failed to remove wcb4xxp from Kbuild"
|
||||
exit 1
|
||||
|
||||
else
|
||||
eval "\mv -f $TEMP Kbuild"
|
||||
echo " wcb4xxp module removed from Kbuild successfully"
|
||||
zaptel_modified=1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
cd $lhome
|
||||
return 0;
|
||||
cd $lhome
|
||||
return 0;
|
||||
}
|
||||
|
||||
function tdmv_apply_zaptel_echo_debug_patch ()
|
||||
|
@ -5978,13 +5863,6 @@ function tdmv_check_zaptel_udev()
|
|||
echo " UDEV rules not used "
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $DAHDI_SUPPORT = "YES" ]; then
|
||||
echo " Dahdi installed, no need to add UDEV rules"
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
#UDEV rules
|
||||
if [ ! -f /etc/udev/rules.d/50-udev.rules ]; then
|
||||
echo " UDEV rules not found/or not used "
|
||||
|
@ -6262,7 +6140,7 @@ function find_ast_dirs ()
|
|||
fi
|
||||
|
||||
echo
|
||||
echo "Looking for Asterisk/CallWeaver directory in /usr/src ..."
|
||||
echo "Looking for Asteris/CallWeaver directory in /usr/src ..."
|
||||
echo "-------------------------------------------"
|
||||
if [ "$astdirs" = "" ]; then
|
||||
astdirs=`find /usr/src -maxdepth 2 -name 'asterisk*' | xargs `
|
||||
|
@ -6590,11 +6468,10 @@ ENDOFTEXT
|
|||
if [ $? -eq 0 ]; then
|
||||
if [ $XMTP2_PROT != YES ]; then
|
||||
echo "Enabling the SS7 XMTP2 Protocol"
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_XMTP2 -DAFT_XMTP2_API_SUPPORT -I$DRIVER_UPDATE_DIR/src/xmtp2km "
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_XMTP2 -DAFT_XMTP2_API_SUPPORT "
|
||||
fi
|
||||
PROT_MATCH=YES
|
||||
XMTP2_PROT=YES
|
||||
LIP_PROT=YES
|
||||
SSMG=YES
|
||||
fi
|
||||
|
||||
|
@ -6703,17 +6580,13 @@ ENDOFTEXT
|
|||
if [ $? -eq 0 ]; then
|
||||
if [ $AFT_TE1_PROT != YES ]; then
|
||||
echo "Enabling the AFT TE1 Support"
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_56K -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL -DCONFIG_PRODUCT_WANPIPE_AFT_A600 "
|
||||
if [ $REL != "3.4" ]; then
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_USB -DCONFIG_PRODUCT_WANPIPE_AFT_A700 "
|
||||
fi
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_56K -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL -DCONFIG_PRODUCT_WANPIPE_AFT_A600 -DCONFIG_PRODUCT_WANPIPE_USB -DCONFIG_PRODUCT_WANPIPE_AFT_A700"
|
||||
|
||||
fi
|
||||
AFT_TE1_PROT=YES
|
||||
AFT_BRI_PROT=YES
|
||||
AFT_SERIAL_PROT=YES
|
||||
if [ $REL != "3.4" ]; then
|
||||
AFT_USB_PROT=YES
|
||||
fi
|
||||
PROT_MATCH=YES
|
||||
fi
|
||||
|
||||
|
@ -7129,7 +7002,7 @@ function detect_rpm_build_utility()
|
|||
function compile_aft_firmware_util()
|
||||
{
|
||||
lhome=`pwd`
|
||||
\cp -rf $PROD_HOME/util/wan_aftup $PROD_HOME/rpmbuild/etc/wanpipe/firmware/
|
||||
\cp -f $PROD_HOME/util/wan_aftup $PROD_HOME/rpmbuild/etc/wanpipe/firmware/ -r
|
||||
|
||||
cd $PROD_HOME/rpmbuild/etc/wanpipe/firmware/wan_aftup
|
||||
echo "Compiling firmware update utilities..."
|
||||
|
@ -7201,72 +7074,51 @@ or
|
|||
optional command extensions:
|
||||
----------------------------
|
||||
|
||||
--silent : Non interactive. Run all above commands
|
||||
without user interaction. Thus default
|
||||
environment values are assumed such
|
||||
as:
|
||||
--silent : Non interactive. Run all above commands
|
||||
without user interaction. Thus default
|
||||
environment values are assumed such
|
||||
as:
|
||||
|
||||
Linux source dir: $SOURCEDIR
|
||||
Architecture : uname -m
|
||||
Kernel Image : uname -r
|
||||
Linux source dir: $SOURCEDIR
|
||||
Architecture : uname -m
|
||||
Kernel Image : uname -r
|
||||
|
||||
--builddir : Install WANPIPE package into a virtual
|
||||
directory. The path must be
|
||||
absolute and must exist. Default is set
|
||||
to system root( / ).
|
||||
eg: --builddir=/root/wanpipe_build
|
||||
--builddir : Install WANPIPE package into a virtual
|
||||
directory. The path must be
|
||||
absolute and must exist. Default is set
|
||||
to system root( / ).
|
||||
eg: --builddir=/root/wanpipe_build
|
||||
|
||||
--with-linux : Build modules using a custom linux
|
||||
source directory. Default value is
|
||||
set to $SOURCEDIR
|
||||
eg: --with-linux=/usr/src/linux-2.4.4
|
||||
--with-linux: Build modules using a custom linux
|
||||
source directory. Default value is
|
||||
set to $SOURCEDIR
|
||||
eg: --with-linux=/usr/src/linux-2.4.4
|
||||
|
||||
--with-zaptel : Build modules using a certain verion of
|
||||
zaptel or dahdi
|
||||
eg: --with-zaptel=/usr/src/zaptel-1.4.12
|
||||
--with-zaptel=/usr/src/dahdi-linux-2.2.0.2
|
||||
|
||||
--with-asterisk : Build modules using a certain verions of
|
||||
Asterisk
|
||||
eg: --with-asterisk=/usr/src/asterisk-1.6.0.9
|
||||
--arch : Build modules using a custom defined
|
||||
architecture. (i686 or i586)
|
||||
By default: (uname -m)
|
||||
eg: --arch=i686
|
||||
|
||||
--arch : Build modules using a custom defined
|
||||
architecture. (i686 or i586)
|
||||
By default: (uname -m)
|
||||
eg: --arch=i686
|
||||
--split_rpms: Option to split the rpm build into
|
||||
util and modules package. Thus,
|
||||
splitting user space utilities and
|
||||
kernel modules into two packages.
|
||||
Default: one rpm package containing
|
||||
both utilites and modules.
|
||||
eg: ./Setup buildrpm --split_rpms
|
||||
|
||||
--split_rpms : Option to split the rpm build into
|
||||
util and modules package. Thus,
|
||||
splitting user space utilities and
|
||||
kernel modules into two packages.
|
||||
Default: one rpm package containing
|
||||
both utilites and modules.
|
||||
eg: ./Setup buildrpm --split_rpms
|
||||
--linux-vanilla: Compile wanpipe drivers as if the
|
||||
current linux source is a vanilla source.
|
||||
Used to remove the default assumption that
|
||||
stock distribution kernels pull changes
|
||||
from higher linux kernel versions.
|
||||
|
||||
--linux-vanilla : Compile wanpipe drivers as if the
|
||||
current linux source is a vanilla source.
|
||||
Used to remove the default assumption that
|
||||
stock distribution kernels pull changes
|
||||
from higher linux kernel versions.
|
||||
|
||||
--no-gcc-debug : Remove -g option out of gcc compile argumetns.
|
||||
|
||||
--noautostart : Do not install start scripts, used to overwrite
|
||||
the install of these scripts when using --silent
|
||||
|
||||
--64bit_4GB : Use this option when installing on systems using
|
||||
a 64bit kernel and 4GB of RAM or more. Wanpipe
|
||||
needs to be aware that 64bit memory mapping is
|
||||
used.
|
||||
|
||||
--dahdi-chunk : Use to increase the chunk size of Dahdi.
|
||||
Drastically improves performance in TDM Voice
|
||||
See the wiki for more information
|
||||
--no-gcc-debug: Remove -g option out of gcc compile argumetns.
|
||||
|
||||
|
||||
--protocol : Option to compile in extra protocols
|
||||
that are not installed by default.
|
||||
eg: ./Setup install --protocol=<PROT>
|
||||
--protocol: Option to compile in extra protocols
|
||||
that are not installed by default.
|
||||
eg: ./Setup install --protocol=<PROT>
|
||||
|
||||
Extra Protocols Supported:
|
||||
|
||||
|
@ -7320,14 +7172,13 @@ ENDOFTEXT
|
|||
#set -x
|
||||
|
||||
|
||||
REL="3.4"
|
||||
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
|
||||
KERNEL_VERSION=`uname -r`
|
||||
KERNEL_UNAME=`uname -r`
|
||||
PKG_NAME=wanpipe
|
||||
DISTR_NAME="WANPIPE"
|
||||
PROD=wanrouter
|
||||
PROD_VER=3.4.9
|
||||
PROD_VER=3.5.1
|
||||
PROD_HOME=`pwd`
|
||||
META_CONF=$PROD_HOME/$PROD.rc
|
||||
WAN_INTR_DIR=$PROD_HOME/interfaces
|
||||
|
@ -7377,7 +7228,7 @@ bri_auto_install="NO"
|
|||
setup_install_quick="NO"
|
||||
MODSYM=Module.symvers
|
||||
DEFAULT_KERNEL_VERSION="NO"
|
||||
TDM_VOICE_ONLY=NO #used to detect whether this is a zaptel/dahdi only install...no API compile then
|
||||
|
||||
|
||||
echo > $CMP_LOG
|
||||
echo "WANPIPE DRIVER COMPILE LOG" >> $CMP_LOG
|
||||
|
@ -7764,25 +7615,6 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then
|
|||
set_zaptel_source_dir
|
||||
|
||||
;;
|
||||
|
||||
--with-asterisk*)
|
||||
AST_DFLT_INSTALL_DIR=`echo $arg | cut -d'=' -f2`;
|
||||
if [ "$AST_DFLT_INSTALL_DIR" = "" ]; then
|
||||
echo "Error invalid --with-asterisk option";
|
||||
exit 1;
|
||||
fi
|
||||
if [ ! -d "$AST_DFLT_INSTALL_DIR" ]; then
|
||||
echo "Error: Asterisk source directory not found: $AST_DFLT_INSTALL_DIR";
|
||||
exit 1;
|
||||
fi
|
||||
if [ ! -f "$AST_DFLT_INSTALL_DIR/Makefile" ]; then
|
||||
echo "Error: Invalid Asterisk source found in $AST_DFLT_INSTALL_DIR";
|
||||
exit 1;
|
||||
fi
|
||||
AST_PATH_OP="YES";
|
||||
echo "Asterisk path defined as: $AST_DFLT_INSTALL_DIR"
|
||||
|
||||
;;
|
||||
|
||||
--no-zaptel-compile*)
|
||||
ZAPTEL_COMPILE_DISABLE="YES";
|
||||
|
@ -7861,17 +7693,16 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then
|
|||
--gz-modules)
|
||||
GZ_MODULES="YES";
|
||||
;;
|
||||
|
||||
--zap-chunk* | --dahdi-chunk*)
|
||||
--zap-chunk*)
|
||||
ZAP_CHUNK=`echo $arg | cut -d'=' -f2`;
|
||||
|
||||
if [ $ZAP_CHUNK != "8" ] && [ $ZAP_CHUNK != "16" ] && [ $ZAP_CHUNK != "40" ] && [ $ZAP_CHUNK != "80" ]; then
|
||||
echo "Error: Invalid Dahdi/Zaptel Chunk size"
|
||||
echo "Error: Invalid Zaptel Chunk size"
|
||||
exit 1;
|
||||
else
|
||||
echo "WARNING:"
|
||||
echo "WARNING: Zaptel custom chunk option is EXPERIMENTAL"
|
||||
echo "The wct4xxp module will be removed from your system"
|
||||
getyn "Do you want to use custom Dahdi/Zaptel chunk size of $ZAP_CHUNK"
|
||||
getyn "Do you want to use custom Zaptel chunk size of $ZAP_CHUNK"
|
||||
if [ $? -eq 0 ]; then
|
||||
ZAP_CHUNK_OP="YES"
|
||||
else
|
||||
|
|
22
api/Makefile
22
api/Makefile
|
@ -5,23 +5,19 @@
|
|||
# ============================================================================
|
||||
|
||||
APIINC=/usr/include/wanpipe
|
||||
LIB_INSTALL_DIR=/usr
|
||||
|
||||
####### RULES ################################################################
|
||||
|
||||
all:
|
||||
make -C x25 all APIINC=$(APIINC)
|
||||
make -C chdlc all APIINC=$(APIINC)
|
||||
make -C fr all APIINC=$(APIINC)
|
||||
make -C bitstrm all APIINC=$(APIINC)
|
||||
make -C bisync all APIINC=$(APIINC)
|
||||
# make -C ss7 all APIINC=$(APIINC)
|
||||
make -C sample_c
|
||||
make -C sample_cpp
|
||||
make -C tdm_api
|
||||
make -C legacy
|
||||
|
||||
clean:
|
||||
make -C x25 clean
|
||||
make -C chdlc clean
|
||||
make -C fr clean
|
||||
make -C bitstrm clean
|
||||
make -C bisync clean
|
||||
make -C tdmapi clean
|
||||
make -C sample_c clean
|
||||
make -C sample_cpp clean
|
||||
make -C tdm_api clean
|
||||
make -C legacy clean
|
||||
make -C lib/hdlc clean
|
||||
# make -C ss7 clean
|
||||
|
|
37
api/README
37
api/README
|
@ -4,30 +4,45 @@ WANPIPE API SAMPLE PROGRAMS
|
|||
Author: Nenad Corbic
|
||||
|
||||
|
||||
Note: These applications are NOT supported for
|
||||
kernels lower than 2.2.X.
|
||||
API drivers and applicatons are ONLY
|
||||
suppoted in 2.2.X kernels and greater.
|
||||
|
||||
This directory contains:
|
||||
|
||||
X25: WANPIPE X25 API sample programs. These programs
|
||||
should be used for rapid x25 api development,
|
||||
libsangoma: Unified Linux/Windows API library
|
||||
|
||||
libstelephony: Telephony API used for dtmf/callerid etc.
|
||||
|
||||
sample_c: C sample code that uses libsangoma
|
||||
|
||||
sample_cpp: C++ sample code that uses libsangoma + libstelephony
|
||||
|
||||
tdm_api: Old test applications based on libsangoma
|
||||
|
||||
legacy/ Old Legacy API
|
||||
|
||||
legacy/aft:
|
||||
Sample API aplications used on to of all AFT hardware.
|
||||
|
||||
legacy/mpapi/x25:
|
||||
WANPIPE MAPI X25 API sample programs. These programs
|
||||
should be used for rapid mpapi x25 api development,
|
||||
and initial testing.
|
||||
|
||||
FR: WANPIPE Frame Relay API sample programs. These programs
|
||||
legacy/fr:
|
||||
WANPIPE Frame Relay API sample programs. These programs
|
||||
should be used for rapid frame relay api development,
|
||||
and initial testing.
|
||||
|
||||
CHDLC: WANPIPE CHDLC API sample programs. These programs
|
||||
legacy/chdlc:
|
||||
WANPIPE CHDLC API sample programs. These programs
|
||||
should be used for rapid chlc api development,
|
||||
and initial testing.
|
||||
|
||||
BITSTRM: WANPIPE BitStreaming API sample programs. These programs
|
||||
legacy/bitstrm:
|
||||
WANPIPE BitStreaming API sample programs. These programs
|
||||
should be used for rapid bitstreaming api development,
|
||||
and initial testing.
|
||||
|
||||
BiSync: WANPIPE BiSync API sample programs. These programs
|
||||
legacy/bisync:
|
||||
WANPIPE BiSync API sample programs. These programs
|
||||
should be used for rapid BiSync api development,
|
||||
and initial testing.
|
||||
|
||||
|
|
|
@ -1,538 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* 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"
|
||||
|
||||
#define MAX_TX_DATA 1024*10 /* Size of tx data */
|
||||
#define MAX_FRAMES 5000 /* Number of frames to transmit */
|
||||
|
||||
#define MAX_RX_DATA 1024*10
|
||||
|
||||
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( void);
|
||||
void sig_end(int sigid);
|
||||
|
||||
int sock;
|
||||
FILE *tx_fd=NULL,*rx_fd=NULL;
|
||||
|
||||
/***************************************************
|
||||
* MakeConnection
|
||||
*
|
||||
* o Create a Socket
|
||||
* o Bind a socket to a wanpipe network interface
|
||||
* (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;
|
||||
|
||||
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( (char*)sa.sll_device, if_name);
|
||||
strcpy( (char*)sa.sll_card, card_name);
|
||||
sa.sll_protocol = htons(PVC_PROT);
|
||||
sa.sll_family=AF_WANPIPE;
|
||||
|
||||
if(bind(sock, (struct sockaddr *)&sa, sizeof(struct wan_sockaddr_ll)) < 0){
|
||||
perror("bind");
|
||||
printf("Failed to bind a socket to %s interface\n",if_name);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printf("Socket bound to %s\n\n",if_name);
|
||||
|
||||
return( WAN_TRUE );
|
||||
|
||||
}
|
||||
|
||||
|
||||
int sangoma_read_socket(int sock, void *data, int len, int flag)
|
||||
{
|
||||
return recv(sock,data,len,flag);
|
||||
|
||||
}
|
||||
|
||||
int sangoma_readmsg_socket(int sock, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
|
||||
{
|
||||
struct msghdr msg;
|
||||
struct iovec iov[2];
|
||||
|
||||
memset(&msg,0,sizeof(struct msghdr));
|
||||
|
||||
iov[0].iov_len=hdrlen;
|
||||
iov[0].iov_base=hdrbuf;
|
||||
|
||||
iov[1].iov_len=datalen;
|
||||
iov[1].iov_base=databuf;
|
||||
|
||||
msg.msg_iovlen=2;
|
||||
msg.msg_iov=iov;
|
||||
|
||||
return recvmsg(sock,&msg,flag);
|
||||
}
|
||||
|
||||
int sangoma_send_socket(int sock, void *data, int len, int flag)
|
||||
{
|
||||
return send(sock,data,len,flag);
|
||||
|
||||
}
|
||||
|
||||
int sangoma_sendmsg_socket(int sock, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
|
||||
{
|
||||
struct msghdr msg;
|
||||
struct iovec iov[2];
|
||||
|
||||
memset(&msg,0,sizeof(struct msghdr));
|
||||
|
||||
iov[0].iov_len=hdrlen;
|
||||
iov[0].iov_base=hdrbuf;
|
||||
|
||||
iov[1].iov_len=datalen;
|
||||
iov[1].iov_base=databuf;
|
||||
|
||||
msg.msg_iovlen=2;
|
||||
msg.msg_iov=iov;
|
||||
|
||||
return sendmsg(sock,&msg,flag);
|
||||
}
|
||||
|
||||
|
||||
static void handle_oob_event(unsigned char *data)
|
||||
{
|
||||
api_rx_hdr_t* api_rx_hdr = (api_rx_hdr_t*)data;
|
||||
|
||||
if (api_rx_hdr->wp_api_rx_hdr_event_type == WP_API_EVENT_MODEM_STATUS) {
|
||||
printf("Received Serial Status Change! 0x%X\n",
|
||||
api_rx_hdr->wp_api_rx_hdr_event_serial_status);
|
||||
|
||||
printf("RTS = %s DTR = %s CTS = %s DCD = %s \n",
|
||||
api_rx_hdr->wp_api_rx_hdr_event_serial_status & AFT_SERIAL_MODEM_RTS ? "On":"Off",
|
||||
api_rx_hdr->wp_api_rx_hdr_event_serial_status & AFT_SERIAL_MODEM_DTR ? "On":"Off",
|
||||
api_rx_hdr->wp_api_rx_hdr_event_serial_status & AFT_SERIAL_MODEM_CTS ? "On":"Off",
|
||||
api_rx_hdr->wp_api_rx_hdr_event_serial_status & AFT_SERIAL_MODEM_DCD ? "On":"Off");
|
||||
}
|
||||
}
|
||||
|
||||
static int aft_set_modem_status(int sock, unsigned char status)
|
||||
{
|
||||
api_tx_hdr_t api_tx_hdr;
|
||||
int err=-1;
|
||||
|
||||
/* Enable Rx-hook events */
|
||||
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
|
||||
|
||||
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_MODEM_STATUS;
|
||||
api_tx_hdr.wp_api_tx_hdr_event_serial_status = status;
|
||||
api_tx_hdr.wp_api_tx_hdr_event_mode = WP_API_EVENT_SET;
|
||||
|
||||
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
|
||||
if (err < 0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Serial SET Status is 0x%X\n",api_tx_hdr.wp_api_tx_hdr_event_serial_status);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int aft_get_modem_status(int sock)
|
||||
{
|
||||
api_tx_hdr_t api_tx_hdr;
|
||||
int err=-1;
|
||||
|
||||
/* Enable Rx-hook events */
|
||||
memset(&api_tx_hdr, 0, sizeof(api_tx_hdr_t));
|
||||
|
||||
api_tx_hdr.wp_api_tx_hdr_event_type = WP_API_EVENT_MODEM_STATUS;
|
||||
api_tx_hdr.wp_api_tx_hdr_event_mode = WP_API_EVENT_GET;
|
||||
|
||||
err = ioctl(sock,SIOC_WANPIPE_API,&api_tx_hdr);
|
||||
if (err < 0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
printf("Serial GET Status is 0x%X\n",api_tx_hdr.wp_api_tx_hdr_event_serial_status);
|
||||
|
||||
return api_tx_hdr.wp_api_tx_hdr_event_serial_status;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************
|
||||
* 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(void)
|
||||
{
|
||||
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;
|
||||
|
||||
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));
|
||||
|
||||
/* 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];
|
||||
|
||||
|
||||
/* 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{
|
||||
api_tx_el->data[i] = (unsigned char)tx_data;
|
||||
}
|
||||
}
|
||||
|
||||
aft_get_modem_status(sock);
|
||||
|
||||
getchar();
|
||||
aft_set_modem_status(sock,0);
|
||||
|
||||
getchar();
|
||||
aft_get_modem_status(sock);
|
||||
|
||||
getchar();
|
||||
aft_set_modem_status(sock,(AFT_SERIAL_MODEM_RTS|AFT_SERIAL_MODEM_DTR));
|
||||
|
||||
getchar();
|
||||
|
||||
|
||||
/* 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)){
|
||||
|
||||
/* 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;
|
||||
} else {
|
||||
handle_oob_event(Rx_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
memset(Rx_data, 0, sizeof(Rx_data));
|
||||
|
||||
err = sangoma_readmsg_socket(sock,
|
||||
Rx_data,16,
|
||||
&Rx_data[16], MAX_RX_DATA-16,
|
||||
0);
|
||||
|
||||
if (!read_enable){
|
||||
goto bitstrm_skip_read;
|
||||
}
|
||||
|
||||
|
||||
/* err indicates bytes received */
|
||||
if(err <= 0) {
|
||||
printf("\nError receiving data\n");
|
||||
break;
|
||||
}
|
||||
|
||||
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 (api_rx_el->api_rx_hdr.wp_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.wp_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.wp_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;
|
||||
}
|
||||
|
||||
++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);
|
||||
#if 1
|
||||
printf("Data: ");
|
||||
for(i=0;i<Rx_lgth; i ++) {
|
||||
printf("0x%02X ", api_rx_el->data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (rx_cnt > 0 && Rx_count >= rx_cnt){
|
||||
break;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
err = sangoma_sendmsg_socket(sock,
|
||||
Tx_data,16,
|
||||
&Tx_data[16], Tx_length,
|
||||
0);
|
||||
|
||||
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("Failed to send errno=%i len=%i \n",errno,Tx_length);
|
||||
perror("Send: ");
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
|
||||
++Tx_count;
|
||||
|
||||
if (verbose){
|
||||
printf("Packet sent: Sent %i : %i\n",
|
||||
err,Tx_count);
|
||||
}else{
|
||||
//putchar('T');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
void sig_end(int sigid)
|
||||
{
|
||||
|
||||
printf("Got Signal %i\n",sigid);
|
||||
|
||||
if (sock >= 0){
|
||||
close (sock);
|
||||
sock=-1;
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
# ============================================================================
|
||||
# Makefile Make script for building Linux WAN router utilities.
|
||||
# ----------------------------------------------------------------------------
|
||||
# Copyright (c) 1995-2000 Sangoma Technologies Inc. All Rights Reserved.
|
||||
# ============================================================================
|
||||
|
||||
APIINC=/usr/include/wanpipe
|
||||
|
||||
####### RULES ################################################################
|
||||
|
||||
all:
|
||||
make -C x25 all APIINC=$(APIINC)
|
||||
make -C chdlc all APIINC=$(APIINC)
|
||||
make -C fr all APIINC=$(APIINC)
|
||||
make -C bitstrm all APIINC=$(APIINC)
|
||||
make -C bisync all APIINC=$(APIINC)
|
||||
|
||||
clean:
|
||||
make -C x25 clean
|
||||
make -C chdlc clean
|
||||
make -C fr clean
|
||||
make -C bitstrm clean
|
||||
make -C bisync clean
|
|
@ -16,12 +16,11 @@ INC_EC_APILIB=-I/usr/include/wanpipe/oct6100_api -I$(DIR_EC_APILIB)
|
|||
|
||||
# Tools options.
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -DCONFIG_PRODUCT_WANPIPE_TDMV_EC -D_GNUC_ -I../lib
|
||||
CFLAGS += -I$(PWD)/../../patches/kdrivers/include -I/usr/include/wanpipe
|
||||
CFLAGS += -I/usr/include/wanpipe
|
||||
|
||||
TARGETS=aft_api
|
||||
#TARGETS+= aft_api_events
|
||||
TARGETS+= aft_api_repeater
|
||||
TARGETS+= aft_api_serial
|
||||
#TARGETS+= aft_api_repeater
|
||||
#TARGETS+= aft_api_ss7
|
||||
#TARGETS+= aft_api_check
|
||||
#TARGETS+= aft_tdm_api
|
||||
|
@ -40,9 +39,6 @@ aft_api_events: aft_api_events.c $(SRC_EC_APILIB) ../lib/lib_api.c
|
|||
aft_api_repeater: aft_api_repeater.c ../lib/lib_api.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
aft_api_serial: aft_api_serial.c ../lib/lib_api.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
aft_api_check: aft_api_check.c ../lib/lib_api.c
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
Binary file not shown.
|
@ -31,7 +31,7 @@
|
|||
#include <linux/wanpipe_defines.h>
|
||||
#include <linux/wanpipe_cfg.h>
|
||||
#include <linux/wanpipe.h>
|
||||
#include <linux/sdla_xilinx.h>
|
||||
#include <linux/wanpipe_api.h>
|
||||
#include "lib_api.h"
|
||||
|
||||
#define MAX_TX_DATA 1024*10 /* Size of tx data */
|
||||
|
@ -186,7 +186,7 @@ int sangoma_sendmsg_socket(int sock, void *hdrbuf, int hdrlen, void *databuf, in
|
|||
* o Data structures:
|
||||
*
|
||||
* typedef struct {
|
||||
* unsigned char error_flag;
|
||||
* unsigned char wp_api_rx_hdr_error_flag;
|
||||
* unsigned short time_stamp;
|
||||
* unsigned char reserved[13];
|
||||
* } api_rx_hdr_t;
|
||||
|
@ -331,7 +331,7 @@ void handle_socket(void)
|
|||
* Thus, removing a 16 byte header
|
||||
* attached by the driver.
|
||||
*
|
||||
* 3. Check error_flag:
|
||||
* 3. Check wp_api_rx_hdr_error_flag:
|
||||
* CRC,Abort..etc
|
||||
*/
|
||||
|
||||
|
@ -366,7 +366,7 @@ void handle_socket(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (api_rx_el->api_rx_hdr.error_flag){
|
||||
if (api_rx_el->api_rx_hdr.wp_api_rx_hdr_error_flag){
|
||||
printf("Data: ");
|
||||
for(i=0;i<Rx_lgth; i ++) {
|
||||
printf("0x%02X ", Rx_data[i+16]);
|
||||
|
@ -374,21 +374,21 @@ void handle_socket(void)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
if (api_rx_el->api_rx_hdr.error_flag & (1<<WP_FIFO_ERROR_BIT)){
|
||||
if (api_rx_el->api_rx_hdr.wp_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);
|
||||
api_rx_el->api_rx_hdr.wp_api_rx_hdr_error_flag,Rx_lgth);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (api_rx_el->api_rx_hdr.error_flag & (1<<WP_CRC_ERROR_BIT)){
|
||||
if (api_rx_el->api_rx_hdr.wp_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);
|
||||
api_rx_el->api_rx_hdr.wp_api_rx_hdr_error_flag,Rx_lgth);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (api_rx_el->api_rx_hdr.error_flag & (1<<WP_ABORT_ERROR_BIT)){
|
||||
if (api_rx_el->api_rx_hdr.wp_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);
|
||||
api_rx_el->api_rx_hdr.wp_api_rx_hdr_error_flag,Rx_lgth);
|
||||
continue;
|
||||
}
|
||||
|
Binary file not shown.
|
@ -11,7 +11,7 @@ OS_TYPE = __LINUX__
|
|||
DEBUG = 2
|
||||
|
||||
# Project file paths.
|
||||
APIINC = /usr/src/linux/include
|
||||
APIINC = /usr/include/wanpipe
|
||||
|
||||
# Tools options.
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I$(APIINC)
|
|
@ -304,8 +304,8 @@ void process_con(void)
|
|||
data = (unsigned char *)&api_tx_el->data;
|
||||
|
||||
/* Send on a particular BiSync station */
|
||||
api_tx_el->api_tx_hdr.station = 0;
|
||||
api_tx_el->api_tx_hdr.misc_tx_rx_bits=0;
|
||||
api_tx_el->wan_api_tx_hdr.station = 0;
|
||||
api_tx_el->wan_api_tx_hdr.misc_tx_rx_bits=0;
|
||||
|
||||
|
||||
/* Create a data packet */
|
||||
|
@ -357,7 +357,7 @@ void process_con(void)
|
|||
|
||||
printf("Received packet %i, Station=%i Length = %i\n",
|
||||
++Rx_count,
|
||||
api_rx_el->api_rx_hdr.station,
|
||||
api_rx_el->hdr.wp_api_rx_hdr_station,
|
||||
Rx_lgth);
|
||||
|
||||
/* In this example I an sending data after
|
|
@ -11,7 +11,7 @@ OS_TYPE = __LINUX__
|
|||
DEBUG = 2
|
||||
|
||||
# Project file paths.
|
||||
APIINC = /usr/src/linux/include
|
||||
APIINC = /usr/include/wanpipe
|
||||
|
||||
# Tools options.
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I ../lib -I$(APIINC)
|
|
@ -228,7 +228,7 @@ void handle_socket(void)
|
|||
api_rx_el = (api_rx_element_t*)&Rx_data[0];
|
||||
|
||||
printf("GOT OOB RBS: Channel=%i Data=0x%X\n",
|
||||
api_rx_el->api_rx_hdr.channel,
|
||||
api_rx_el->api_rx_hdr.wan_hdr_bitstrm_channel,
|
||||
api_rx_el->data[0]);
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@ void handle_socket(void)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (api_rx_el->api_rx_hdr.error_flag){
|
||||
switch (api_rx_el->api_rx_hdr.wan_hdr_hdlc_error_flag){
|
||||
|
||||
case 0:
|
||||
/* Rx packet is good */
|
Binary file not shown.
|
@ -237,7 +237,7 @@ void handle_socket(void)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (api_rx_el->api_rx_hdr.error_flag){
|
||||
switch (api_rx_el->api_rx_hdr.wan_hdr_hdlc_error_flag){
|
||||
|
||||
case 0:
|
||||
/* Rx packet is good */
|
|
@ -276,7 +276,7 @@ void handle_socket(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
switch (api_rx_el->api_rx_hdr.error_flag){
|
||||
switch (api_rx_el->hdr.wan_hdr_hdlc_error_flag){
|
||||
|
||||
case 0:
|
||||
/* Rx packet is good */
|
Binary file not shown.
|
@ -209,7 +209,7 @@ void process_con(void)
|
|||
* Switched CTS/RTS or Idle Mark, the misc_Tx_bits
|
||||
* must be used as described above */
|
||||
|
||||
api_tx_el->api_tx_hdr.misc_Tx_bits = 0;
|
||||
api_tx_el->wan_api_tx_hdr.wp_api_tx_hdr_chdlc_misc_tx_bits = 0;
|
||||
|
||||
/* Fill in the packet data */
|
||||
|
||||
|
@ -266,7 +266,7 @@ void process_con(void)
|
|||
|
||||
api_rx_el = (api_rx_element_t*)Rx_data;
|
||||
|
||||
switch (api_rx_el->api_rx_hdr.error_flag){
|
||||
switch (api_rx_el->api_rx_hdr.wan_hdr_hdlc_error_flag){
|
||||
|
||||
case 0:
|
||||
/* Rx packet is good */
|
|
@ -0,0 +1 @@
|
|||
../lib
|
|
@ -11,10 +11,16 @@ OS_TYPE = __LINUX__
|
|||
DEBUG = 2
|
||||
|
||||
# Project file paths.
|
||||
APIINC = ../../include
|
||||
APIINC = /usr/include/wanpipe
|
||||
|
||||
ifneq (,$(wildcard /wanpipe/code/Makefile.in))
|
||||
include /wanpipe/code/Makefile.in
|
||||
EXTRA_FLAGS+=$(GLOBAL_CFLAGS)
|
||||
endif
|
||||
|
||||
|
||||
# Tools options.
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../ -I../../lib -I$(APIINC)
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../ -I../../lib -I$(APIINC) $(EXTRA_FLAGS)
|
||||
|
||||
####### RULES ################################################################
|
||||
|
|
@ -208,7 +208,13 @@ int MakeConnection (char *i_name )
|
|||
printf("%s: Server waiting form incoming calls ...\n",
|
||||
prognamed);
|
||||
|
||||
for (;;){
|
||||
err=ioctl(sock,SIOCG_LAPB_STATUS,0);
|
||||
if (err<0){
|
||||
perror("HDLC LINK STATUS");
|
||||
}
|
||||
printf("LAPB STATE = %s (err=%i)\n", err==1?"On":"Off",err);
|
||||
|
||||
for (;;) {
|
||||
|
||||
/* Accept call will block and wait for incoming calls.
|
||||
* When a call comes in, a new socket will be created
|
||||
|
@ -234,7 +240,8 @@ int MakeConnection (char *i_name )
|
|||
perror("Listen");
|
||||
close(sock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
err=ioctl(sock,SIOCG_LAPB_STATUS,0);
|
||||
if (err<0){
|
||||
perror("HDLC LINK STATUS");
|
|
@ -252,7 +252,12 @@ int MakeConnection (char *i_name )
|
|||
* -f field cannot be set to zero (i.e. -f0)
|
||||
* Refer to x25.pdf hardware manual.
|
||||
*/
|
||||
sprintf(api_cmd.data,"-d%s -s%s -u%s",
|
||||
|
||||
sprintf(daddr,"1");
|
||||
sprintf(saddr,"3");
|
||||
sprintf(udata,"01");
|
||||
|
||||
sprintf(api_cmd.data,"-d%s -s%s -u%s -f0180",
|
||||
daddr,
|
||||
saddr,
|
||||
udata);
|
||||
|
@ -269,7 +274,7 @@ int MakeConnection (char *i_name )
|
|||
close(sock_fd[i].sock);
|
||||
sock_fd[i].sock=0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the pid information used by the wanpipe
|
||||
* proc file system: /proc/net/wanrouter/map
|
|
@ -1,135 +1,135 @@
|
|||
// bitmap.c
|
||||
// Routines to manage a bitmap -- an array of bits each of which
|
||||
// can be either on or off. Represented as an array of integers.
|
||||
|
||||
#include "bitmap.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::BitMap
|
||||
// Initialize a bitmap with "nitems" bits, so that every bit is clear.
|
||||
// it can be added somewhere on a list.
|
||||
// "nitems" is the number of bits in the bitmap.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
BitMap::BitMap(int nitems)
|
||||
{
|
||||
numBits = nitems;
|
||||
numWords = divRoundUp(numBits, BitsInWord);
|
||||
map = new unsigned int[numWords];
|
||||
if (pthread_mutex_init(&mut,NULL) != 0)
|
||||
perror("BitMap:BitMap");
|
||||
for (int i = 1; i <= numBits; i++)
|
||||
Clear(i);
|
||||
Mark(numBits);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::~BitMap
|
||||
// De-allocate a bitmap.
|
||||
//----------------------------------------------------------------------
|
||||
BitMap::~BitMap()
|
||||
{
|
||||
delete map;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Set
|
||||
// Set the "nth" bit in a bitmap.
|
||||
// Makes this entry Unavailable
|
||||
// "which" is the number of the bit to be set.
|
||||
//----------------------------------------------------------------------
|
||||
void BitMap::Mark(int which)
|
||||
{
|
||||
assert(which >= 0 && which <= numBits);
|
||||
map[which / BitsInWord] |= 1 << (which % BitsInWord);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Clear
|
||||
// Clear the "nth" bit in a bitmap. (in other words, it's made available)
|
||||
// "which" is the number of the bit to be cleared.
|
||||
//----------------------------------------------------------------------
|
||||
void BitMap::Clear(int which)
|
||||
{
|
||||
assert(which > 0 && which <= numBits);
|
||||
map[which / BitsInWord] &= ~(1 << (which % BitsInWord));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Test
|
||||
// Return TRUE if the "nth" bit is set.
|
||||
// "which" is the number of the bit to be tested.
|
||||
//----------------------------------------------------------------------
|
||||
bool BitMap::Test(int which)
|
||||
{
|
||||
assert(which >= 0 && which <= numBits);
|
||||
|
||||
if (map[which / BitsInWord] & (1 << (which % BitsInWord)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Find
|
||||
// Return the number of the first bit which is clear.
|
||||
// As a side effect, set the bit (mark it as in use).
|
||||
// (In other words, find and allocate a bit.)
|
||||
// If no bits are clear, return -1.
|
||||
//----------------------------------------------------------------------
|
||||
int BitMap::Find()
|
||||
{
|
||||
|
||||
pthread_mutex_lock(&mut); // provides mutual exclusion
|
||||
|
||||
for (int i = 1; i <= numBits; i++)
|
||||
{
|
||||
if (!Test(i))
|
||||
{
|
||||
Mark(i); // found it,so mark it as busy
|
||||
pthread_mutex_unlock(&mut);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&mut);
|
||||
return -1; // did not find an spot available, return -1
|
||||
|
||||
} // end of the Find method
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::NumClear
|
||||
// Return the number of clear bits in the bitmap.
|
||||
// (In other words, how many bits are unallocated?)
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int BitMap::NumClear()
|
||||
{
|
||||
int count=0;
|
||||
|
||||
for (int i=1; i <= numBits; i++)
|
||||
if (!Test(i))
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Print
|
||||
// Print the contents of the bitmap, for debugging.
|
||||
//
|
||||
// Could be done in a number of ways, but we just print the #'s of
|
||||
// all the bits that are set in the bitmap.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void BitMap::Print()
|
||||
{
|
||||
printf("Bitmap set:\n");
|
||||
for (int i = 1; i <= numBits; i++)
|
||||
if (Test(i))
|
||||
{
|
||||
printf("%d, ", i);
|
||||
if (i%25 == 0)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// bitmap.c
|
||||
// Routines to manage a bitmap -- an array of bits each of which
|
||||
// can be either on or off. Represented as an array of integers.
|
||||
|
||||
#include "bitmap.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::BitMap
|
||||
// Initialize a bitmap with "nitems" bits, so that every bit is clear.
|
||||
// it can be added somewhere on a list.
|
||||
// "nitems" is the number of bits in the bitmap.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
BitMap::BitMap(int nitems)
|
||||
{
|
||||
numBits = nitems;
|
||||
numWords = divRoundUp(numBits, BitsInWord);
|
||||
map = new unsigned int[numWords];
|
||||
if (pthread_mutex_init(&mut,NULL) != 0)
|
||||
perror("BitMap:BitMap");
|
||||
for (int i = 1; i <= numBits; i++)
|
||||
Clear(i);
|
||||
Mark(numBits);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::~BitMap
|
||||
// De-allocate a bitmap.
|
||||
//----------------------------------------------------------------------
|
||||
BitMap::~BitMap()
|
||||
{
|
||||
delete map;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Set
|
||||
// Set the "nth" bit in a bitmap.
|
||||
// Makes this entry Unavailable
|
||||
// "which" is the number of the bit to be set.
|
||||
//----------------------------------------------------------------------
|
||||
void BitMap::Mark(int which)
|
||||
{
|
||||
assert(which >= 0 && which <= numBits);
|
||||
map[which / BitsInWord] |= 1 << (which % BitsInWord);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Clear
|
||||
// Clear the "nth" bit in a bitmap. (in other words, it's made available)
|
||||
// "which" is the number of the bit to be cleared.
|
||||
//----------------------------------------------------------------------
|
||||
void BitMap::Clear(int which)
|
||||
{
|
||||
assert(which > 0 && which <= numBits);
|
||||
map[which / BitsInWord] &= ~(1 << (which % BitsInWord));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Test
|
||||
// Return TRUE if the "nth" bit is set.
|
||||
// "which" is the number of the bit to be tested.
|
||||
//----------------------------------------------------------------------
|
||||
bool BitMap::Test(int which)
|
||||
{
|
||||
assert(which >= 0 && which <= numBits);
|
||||
|
||||
if (map[which / BitsInWord] & (1 << (which % BitsInWord)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Find
|
||||
// Return the number of the first bit which is clear.
|
||||
// As a side effect, set the bit (mark it as in use).
|
||||
// (In other words, find and allocate a bit.)
|
||||
// If no bits are clear, return -1.
|
||||
//----------------------------------------------------------------------
|
||||
int BitMap::Find()
|
||||
{
|
||||
|
||||
pthread_mutex_lock(&mut); // provides mutual exclusion
|
||||
|
||||
for (int i = 1; i <= numBits; i++)
|
||||
{
|
||||
if (!Test(i))
|
||||
{
|
||||
Mark(i); // found it,so mark it as busy
|
||||
pthread_mutex_unlock(&mut);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&mut);
|
||||
return -1; // did not find an spot available, return -1
|
||||
|
||||
} // end of the Find method
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::NumClear
|
||||
// Return the number of clear bits in the bitmap.
|
||||
// (In other words, how many bits are unallocated?)
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
int BitMap::NumClear()
|
||||
{
|
||||
int count=0;
|
||||
|
||||
for (int i=1; i <= numBits; i++)
|
||||
if (!Test(i))
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// BitMap::Print
|
||||
// Print the contents of the bitmap, for debugging.
|
||||
//
|
||||
// Could be done in a number of ways, but we just print the #'s of
|
||||
// all the bits that are set in the bitmap.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void BitMap::Print()
|
||||
{
|
||||
printf("Bitmap set:\n");
|
||||
for (int i = 1; i <= numBits; i++)
|
||||
if (Test(i))
|
||||
{
|
||||
printf("%d, ", i);
|
||||
if (i%25 == 0)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
|
@ -61,9 +61,35 @@ 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++){
|
||||
|
@ -73,11 +99,12 @@ int wanpipe_hdlc_decode (wanpipe_hdlc_engine_t *hdlc_eng,
|
|||
}
|
||||
|
||||
if (hdlc_decoder->rx_decode_len >= MAX_SOCK_HDLC_LIMIT){
|
||||
//printf("ERROR Rx decode len > max\n");
|
||||
printf("ERROR Rx decode len > max\n");
|
||||
hdlc_decoder->stats.errors++;
|
||||
hdlc_decoder->stats.frame_overflow++;
|
||||
init_hdlc_decoder(hdlc_decoder);
|
||||
}
|
||||
}
|
||||
|
||||
return gotdata;
|
||||
}
|
||||
|
@ -99,15 +126,6 @@ int wanpipe_hdlc_encode(wanpipe_hdlc_engine_t *hdlc_eng,
|
|||
memset(&chan->tx_decode_buf[0],0,3);
|
||||
chan->tx_decode_bit_cnt=0;
|
||||
|
||||
if (hdlc_eng->seven_bit_hdlc){
|
||||
chan->bits_in_byte=7;
|
||||
hdlc_eng->bits_in_byte=7;
|
||||
|
||||
}else{
|
||||
chan->bits_in_byte=8;
|
||||
hdlc_eng->bits_in_byte=8;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//HDLC_IDLE_ABORT
|
||||
chan->tx_flag_idle=0x7E;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
*==================================================================*/
|
||||
|
||||
#define MAX_SOCK_CRC_QUEUE 3
|
||||
#define MAX_SOCK_HDLC_BUF 2000
|
||||
#define MAX_SOCK_HDLC_BUF 15000
|
||||
#define MAX_SOCK_HDLC_LIMIT MAX_SOCK_HDLC_BUF-500
|
||||
#define HDLC_ENG_BUF_LEN 5000
|
||||
#define HDLC_ENG_BUF_LEN 8000
|
||||
|
||||
|
||||
#define INC_CRC_CNT(a) if (++a >= MAX_SOCK_CRC_QUEUE) a=0;
|
||||
|
|
|
@ -56,8 +56,8 @@ char if_name[WAN_IFNAME_SZ];
|
|||
char sw_if_name[WAN_IFNAME_SZ];
|
||||
char sw_card_name[WAN_IFNAME_SZ];
|
||||
|
||||
char tx_file[WAN_FILE_NAME_SZ];
|
||||
char rx_file[WAN_FILE_NAME_SZ];
|
||||
char tx_file[WAN_IFNAME_SZ];
|
||||
char rx_file[WAN_IFNAME_SZ];
|
||||
|
||||
char daddr[TX_ADDR_STR_SZ];
|
||||
char saddr[TX_ADDR_STR_SZ];
|
||||
|
@ -237,7 +237,7 @@ int init_args(int argc, char *argv[])
|
|||
return WAN_FALSE;
|
||||
}
|
||||
|
||||
strncpy(tx_file, argv[i+1],WAN_FILE_NAME_SZ);
|
||||
strncpy(tx_file, argv[i+1],WAN_IFNAME_SZ);
|
||||
files_used |= TX_FILE_USED;
|
||||
|
||||
}else if (!strcmp(argv[i],"-rxfile")){
|
||||
|
@ -247,7 +247,7 @@ int init_args(int argc, char *argv[])
|
|||
return WAN_FALSE;
|
||||
}
|
||||
|
||||
strncpy(rx_file, argv[i+1],WAN_FILE_NAME_SZ);
|
||||
strncpy(rx_file, argv[i+1],WAN_IFNAME_SZ);
|
||||
files_used |= RX_FILE_USED;
|
||||
|
||||
}else if (!strcmp(argv[i],"-daddr")){
|
||||
|
|
|
@ -38,10 +38,8 @@ extern int cause;
|
|||
extern int card_cnt;
|
||||
extern int i_cnt;
|
||||
|
||||
#define WAN_FILE_NAME_SZ 1024
|
||||
|
||||
extern char tx_file[WAN_FILE_NAME_SZ];
|
||||
extern char rx_file[WAN_FILE_NAME_SZ];
|
||||
extern char tx_file[WAN_IFNAME_SZ];
|
||||
extern char rx_file[WAN_IFNAME_SZ];
|
||||
|
||||
#define TX_ADDR_STR_SZ 100
|
||||
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
Automake Init Done
|
||||
|
||||
Please run
|
||||
-> ./configure --prefix=/usr
|
||||
-> make
|
||||
-> make install
|
||||
checking for a BSD-compatible install... /usr/bin/install -c
|
||||
checking whether build environment is sane... yes
|
||||
checking for gawk... gawk
|
||||
checking whether make sets $(MAKE)... yes
|
||||
checking for gcc... gcc
|
||||
checking for C compiler default output file name... a.out
|
||||
checking whether the C compiler works... yes
|
||||
checking whether we are cross compiling... no
|
||||
checking for suffix of executables...
|
||||
checking for suffix of object files... o
|
||||
checking whether we are using the GNU C compiler... yes
|
||||
checking whether gcc accepts -g... yes
|
||||
checking for gcc option to accept ANSI C... none needed
|
||||
checking for style of include used by make... GNU
|
||||
checking dependency style of gcc... gcc3
|
||||
checking build system type... i686-redhat-linux-gnu
|
||||
checking host system type... i686-redhat-linux-gnu
|
||||
checking for a sed that does not truncate output... /bin/sed
|
||||
checking for egrep... grep -E
|
||||
checking for ld used by gcc... /usr/bin/ld
|
||||
checking if the linker (/usr/bin/ld) is GNU ld... yes
|
||||
checking for /usr/bin/ld option to reload object files... -r
|
||||
checking for BSD-compatible nm... /usr/bin/nm -B
|
||||
checking whether ln -s works... yes
|
||||
checking how to recognise dependent libraries... pass_all
|
||||
checking how to run the C preprocessor... gcc -E
|
||||
checking for ANSI C header files... yes
|
||||
checking for sys/types.h... yes
|
||||
checking for sys/stat.h... yes
|
||||
checking for stdlib.h... yes
|
||||
checking for string.h... yes
|
||||
checking for memory.h... yes
|
||||
checking for strings.h... yes
|
||||
checking for inttypes.h... yes
|
||||
checking for stdint.h... yes
|
||||
checking for unistd.h... yes
|
||||
checking dlfcn.h usability... yes
|
||||
checking dlfcn.h presence... yes
|
||||
checking for dlfcn.h... yes
|
||||
checking for g++... g++
|
||||
checking whether we are using the GNU C++ compiler... yes
|
||||
checking whether g++ accepts -g... yes
|
||||
checking dependency style of g++... gcc3
|
||||
checking how to run the C++ preprocessor... g++ -E
|
||||
checking for g77... no
|
||||
checking for f77... no
|
||||
checking for xlf... no
|
||||
checking for frt... no
|
||||
checking for pgf77... no
|
||||
checking for fort77... no
|
||||
checking for fl32... no
|
||||
checking for af77... no
|
||||
checking for f90... no
|
||||
checking for xlf90... no
|
||||
checking for pgf90... no
|
||||
checking for epcf90... no
|
||||
checking for f95... f95
|
||||
checking whether we are using the GNU Fortran 77 compiler... yes
|
||||
checking whether f95 accepts -g... yes
|
||||
checking the maximum length of command line arguments... 32768
|
||||
checking command to parse /usr/bin/nm -B output from gcc object... ok
|
||||
checking for objdir... .libs
|
||||
checking for ar... ar
|
||||
checking for ranlib... ranlib
|
||||
checking for strip... strip
|
||||
checking if gcc supports -fno-rtti -fno-exceptions... no
|
||||
checking for gcc option to produce PIC... -fPIC
|
||||
checking if gcc PIC flag -fPIC works... yes
|
||||
checking if gcc static flag -static works... yes
|
||||
checking if gcc supports -c -o file.o... yes
|
||||
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
|
||||
checking whether -lc should be explicitly linked in... no
|
||||
checking dynamic linker characteristics... GNU/Linux ld.so
|
||||
checking how to hardcode library paths into programs... immediate
|
||||
checking whether stripping libraries is possible... yes
|
||||
checking if libtool supports shared libraries... yes
|
||||
checking whether to build shared libraries... yes
|
||||
checking whether to build static libraries... yes
|
||||
configure: creating libtool
|
||||
appending configuration tag "CXX" to libtool
|
||||
checking for ld used by g++... /usr/bin/ld
|
||||
checking if the linker (/usr/bin/ld) is GNU ld... yes
|
||||
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
|
||||
checking for g++ option to produce PIC... -fPIC
|
||||
checking if g++ PIC flag -fPIC works... yes
|
||||
checking if g++ static flag -static works... yes
|
||||
checking if g++ supports -c -o file.o... yes
|
||||
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
|
||||
checking dynamic linker characteristics... GNU/Linux ld.so
|
||||
checking how to hardcode library paths into programs... immediate
|
||||
appending configuration tag "F77" to libtool
|
||||
checking if libtool supports shared libraries... yes
|
||||
checking whether to build shared libraries... yes
|
||||
checking whether to build static libraries... yes
|
||||
checking for f95 option to produce PIC... -fPIC
|
||||
checking if f95 PIC flag -fPIC works... yes
|
||||
checking if f95 static flag -static works... yes
|
||||
checking if f95 supports -c -o file.o... yes
|
||||
checking whether the f95 linker (/usr/bin/ld) supports shared libraries... yes
|
||||
checking dynamic linker characteristics... GNU/Linux ld.so
|
||||
checking how to hardcode library paths into programs... immediate
|
||||
checking for ar... ar
|
||||
checking fcntl.h usability... yes
|
||||
checking fcntl.h presence... yes
|
||||
checking for fcntl.h... yes
|
||||
checking netinet/in.h usability... yes
|
||||
checking netinet/in.h presence... yes
|
||||
checking for netinet/in.h... yes
|
||||
checking for stdlib.h... (cached) yes
|
||||
checking for string.h... (cached) yes
|
||||
checking sys/ioctl.h usability... yes
|
||||
checking sys/ioctl.h presence... yes
|
||||
checking for sys/ioctl.h... yes
|
||||
checking sys/socket.h usability... yes
|
||||
checking sys/socket.h presence... yes
|
||||
checking for sys/socket.h... yes
|
||||
checking sys/time.h usability... yes
|
||||
checking sys/time.h presence... yes
|
||||
checking for sys/time.h... yes
|
||||
checking for unistd.h... (cached) yes
|
||||
checking math.h usability... yes
|
||||
checking math.h presence... yes
|
||||
checking for math.h... yes
|
||||
checking whether time.h and sys/time.h may both be included... yes
|
||||
checking sys/select.h usability... yes
|
||||
checking sys/select.h presence... yes
|
||||
checking for sys/select.h... yes
|
||||
checking for sys/socket.h... (cached) yes
|
||||
checking types of arguments for select... int,fd_set *,struct timeval *
|
||||
checking for gettimeofday... yes
|
||||
checking for memset... yes
|
||||
checking for select... yes
|
||||
checking for socket... yes
|
||||
configure: creating ./config.status
|
||||
config.status: creating Makefile
|
||||
config.status: creating config.h
|
||||
config.status: executing depfiles commands
|
|
@ -1,209 +0,0 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 33
|
||||
/svn/libsangoma/!svn/ver/22/trunk
|
||||
END
|
||||
configure
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/11/trunk/configure
|
||||
END
|
||||
doxygen.config
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/libsangoma/!svn/ver/18/trunk/doxygen.config
|
||||
END
|
||||
Makefile.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/21/trunk/Makefile.in
|
||||
END
|
||||
AUTHORS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/AUTHORS
|
||||
END
|
||||
libhpsangoma_priv.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/18/trunk/libhpsangoma_priv.c
|
||||
END
|
||||
depcomp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/depcomp
|
||||
END
|
||||
compile
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/compile
|
||||
END
|
||||
config.guess
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/1/trunk/config.guess
|
||||
END
|
||||
libhpsangoma_priv.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 53
|
||||
/svn/libsangoma/!svn/ver/18/trunk/libhpsangoma_priv.h
|
||||
END
|
||||
ltmain.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 42
|
||||
/svn/libsangoma/!svn/ver/1/trunk/ltmain.sh
|
||||
END
|
||||
config.sub
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/1/trunk/config.sub
|
||||
END
|
||||
libsangoma.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/12/trunk/libsangoma.c
|
||||
END
|
||||
libsangoma.dsp
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 47
|
||||
/svn/libsangoma/!svn/ver/1/trunk/libsangoma.dsp
|
||||
END
|
||||
libsangoma.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/11/trunk/libsangoma.h
|
||||
END
|
||||
g711.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 39
|
||||
/svn/libsangoma/!svn/ver/1/trunk/g711.h
|
||||
END
|
||||
INSTALL
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/INSTALL
|
||||
END
|
||||
libsangoma.dsw
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 47
|
||||
/svn/libsangoma/!svn/ver/1/trunk/libsangoma.dsw
|
||||
END
|
||||
COPYING
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/COPYING
|
||||
END
|
||||
NEWS
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 37
|
||||
/svn/libsangoma/!svn/ver/1/trunk/NEWS
|
||||
END
|
||||
sangoma_pri.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/1/trunk/sangoma_pri.c
|
||||
END
|
||||
libsangoma.so.conf
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 51
|
||||
/svn/libsangoma/!svn/ver/1/trunk/libsangoma.so.conf
|
||||
END
|
||||
win_api_common.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/libsangoma/!svn/ver/1/trunk/win_api_common.h
|
||||
END
|
||||
sangoma_pri.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 46
|
||||
/svn/libsangoma/!svn/ver/1/trunk/sangoma_pri.h
|
||||
END
|
||||
version
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/version
|
||||
END
|
||||
libhpsangoma.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/libsangoma/!svn/ver/18/trunk/libhpsangoma.c
|
||||
END
|
||||
configure.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/1/trunk/configure.in
|
||||
END
|
||||
ChangeLog
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 42
|
||||
/svn/libsangoma/!svn/ver/1/trunk/ChangeLog
|
||||
END
|
||||
libhpsangoma.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/libsangoma/!svn/ver/18/trunk/libhpsangoma.h
|
||||
END
|
||||
README
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 39
|
||||
/svn/libsangoma/!svn/ver/1/trunk/README
|
||||
END
|
||||
config.h.in
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 44
|
||||
/svn/libsangoma/!svn/ver/1/trunk/config.h.in
|
||||
END
|
||||
Makefile.am
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/libsangoma/!svn/ver/21/trunk/Makefile.am
|
||||
END
|
||||
missing
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/libsangoma/!svn/ver/1/trunk/missing
|
||||
END
|
||||
install-sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/libsangoma/!svn/ver/1/trunk/install-sh
|
||||
END
|
||||
libsangoma.vcproj
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 50
|
||||
/svn/libsangoma/!svn/ver/1/trunk/libsangoma.vcproj
|
||||
END
|
|
@ -1,521 +0,0 @@
|
|||
8
|
||||
|
||||
dir
|
||||
22
|
||||
https://www.sangomapbx.com/svn/libsangoma/trunk
|
||||
https://www.sangomapbx.com/svn/libsangoma
|
||||
|
||||
|
||||
|
||||
2008-09-17T21:25:40.156211Z
|
||||
22
|
||||
ncorbic
|
||||
|
||||
|
||||
svn:special svn:externals svn:needs-lock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
8fe45b59-3c47-0410-bdf9-e5d932a076a6
|
||||
|
||||
configure
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-09-17T15:43:38.000000Z
|
||||
f84c30e2597ef02a8b7ae6e7abc79cba
|
||||
2008-07-23T22:34:10.394780Z
|
||||
11
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
doxygen.config
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-08-18T04:42:48.000000Z
|
||||
9f9274a01491fc18fc590cc72aee50b5
|
||||
2008-08-18T04:37:20.241598Z
|
||||
18
|
||||
ncorbic
|
||||
|
||||
Makefile.in
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-09-17T15:43:37.000000Z
|
||||
b64570263ebee3d9e6ba2d2337fd986f
|
||||
2008-09-17T16:28:59.949208Z
|
||||
21
|
||||
ncorbic
|
||||
|
||||
AUTHORS
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libhpsangoma_priv.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-08-18T04:42:48.000000Z
|
||||
bd544f6a63804d97771b5d6f14f9c7cd
|
||||
2008-08-18T04:37:20.241598Z
|
||||
18
|
||||
ncorbic
|
||||
|
||||
depcomp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
e181e2c8720c60522c4c4c981108e367
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
compile
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
a7ecc032b527a0d578545f19d3418073
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
docs
|
||||
dir
|
||||
|
||||
config.guess
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
9ae396244b8f138c76514a6b7531e696
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
libhpsangoma_priv.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-08-18T04:42:48.000000Z
|
||||
d1808b1e536319bd48486efa8bea18bc
|
||||
2008-08-18T04:37:20.241598Z
|
||||
18
|
||||
ncorbic
|
||||
|
||||
svn-commit.2.tmp
|
||||
file
|
||||
24
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
deleted
|
||||
|
||||
ltmain.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
c8215e3aa0858d700783015614f53b79
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
config.sub
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
3d36962d51070d30b7554203b0d7c01c
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
libsangoma.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-08-18T04:42:48.000000Z
|
||||
997c16d3e1205046feceb00ab3fee8dd
|
||||
2008-08-18T00:57:37.953171Z
|
||||
12
|
||||
ncorbic
|
||||
|
||||
libsangoma.dsp
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
f934aab66c529599725686f321d182e6
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libsangoma.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-24T14:57:18.000000Z
|
||||
8a81a030df0847f94467dfa91957739f
|
||||
2008-07-23T22:34:10.394780Z
|
||||
11
|
||||
ncorbic
|
||||
|
||||
g711.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
0f725f95ced42af15dcaef21f3a1722b
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
INSTALL
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
40539bd3eff06e4b82f380103145415b
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
COPYING
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libsangoma.dsw
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
f13496d2105bae2add104c36a1d656f6
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
NEWS
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
Makefile
|
||||
file
|
||||
23
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
deleted
|
||||
|
||||
libsangoma.so.conf
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
bcdcb23c5d5fb460cee2ce315ef7bd32
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
sangoma_pri.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
e2a6c68fadfefb2d2b16c52534e85675
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
win_api_common.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
b6be170d18fa90b79f7264cf8b0f7348
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
version
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
35f672d1fb01b542f667952c9dbb26fe
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
sangoma_pri.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
f24c6cf396aeaa6df2747f7f6b32969d
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libhpsangoma.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-08-18T04:42:48.000000Z
|
||||
b1d5eaa1c7cde587df266b1833f5e735
|
||||
2008-08-18T04:37:20.241598Z
|
||||
18
|
||||
ncorbic
|
||||
|
||||
configure.in
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
5b9888fc365c4ebffdbb55656c091a2f
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
ChangeLog
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
d41d8cd98f00b204e9800998ecf8427e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
libhpsangoma.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-08-18T04:42:48.000000Z
|
||||
706cd7f3886d4f5f7515cf84bdae55ad
|
||||
2008-08-18T04:37:20.241598Z
|
||||
18
|
||||
ncorbic
|
||||
|
||||
svn-commit.tmp
|
||||
file
|
||||
24
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
deleted
|
||||
|
||||
README
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
e8a0abce86211364eb60bbe6e07d4b05
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
config.h.in
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
5c51918deee8d041af37226bd4b4271e
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
||||
Makefile.am
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-09-17T15:43:08.000000Z
|
||||
5796040dd24c0fe0d5873523ba46ae01
|
||||
2008-09-17T16:28:59.949208Z
|
||||
21
|
||||
ncorbic
|
||||
|
||||
missing
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
fd5dd60aa8cefab9462677280ea74a61
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
examples
|
||||
dir
|
||||
|
||||
install-sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
92067666ddce97609bd0ec67d36460cd
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
libsangoma.vcproj
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-07-17T12:20:35.000000Z
|
||||
a09711e3b6aac93dd48d8e9b3014955f
|
||||
2008-02-28T18:51:53.196120Z
|
||||
1
|
||||
root
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
All TDM API Instructions located on Sangoma Wiki
|
||||
|
||||
http://wiki.sangoma.com
|
||||
|
||||
Wanpipe TDM API Section
|
|
@ -1,34 +0,0 @@
|
|||
|
||||
WLINC=../../patches/kdrivers/include
|
||||
WINC=/usr/include/wanpipe
|
||||
|
||||
AM_CFLAGS = -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -g -I$(WLINC) -I$(WINC) -I. \
|
||||
-D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O2 -D_DEBUG_=2 -D_GNUC_ -I../lib
|
||||
|
||||
LIB_SOURCES = libsangoma.c libsangoma.h libhpsangoma.c libhpsangoma.h libhpsangoma_priv.c libhpsangoma_priv.h
|
||||
|
||||
if LIBPRI
|
||||
LIB_SOURCES += sangoma_pri.c sangoma_pri.h
|
||||
endif
|
||||
|
||||
library_includedir = $(includedir)
|
||||
library_include_HEADERS = libsangoma.h libhpsangoma.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)
|
|
@ -1,91 +0,0 @@
|
|||
* 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,442 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* libhpsangoma.c: Sangoma High Performance TDM API - Span Based Library
|
||||
*
|
||||
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2008 Nenad Corbic <ncorbic@sangoma.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 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libhpsangoma.h"
|
||||
#include "libhpsangoma_priv.h"
|
||||
|
||||
/*---------------------------------------------------------
|
||||
PRIVATE STRUCTURES
|
||||
----------------------------------------------------------*/
|
||||
|
||||
void (*lib_log)(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...)=NULL;
|
||||
|
||||
|
||||
/*!
|
||||
\brief Channel Method: User tx a chunk into a channel
|
||||
\param chan channel object
|
||||
\param data pointer to user voice chunk
|
||||
\param len size of user voice chunk
|
||||
\return -1 = packet too large, -2 = channel closed, 1 = busy, 0 = tx ok
|
||||
*/
|
||||
|
||||
static int sangoma_hp_tdm_chan_push(struct sangoma_hptdm_chan *chan, char *data, int len)
|
||||
{
|
||||
hp_tmd_chunk_t *tx_chunk;
|
||||
int free_slots;
|
||||
|
||||
if (!chan->init) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (len >= SMG_HP_MAX_CHAN_DATA) {
|
||||
/* Data Too Big */
|
||||
lib_printf(0,NULL,"chan_push c%i tx chunk len %i too big\n",
|
||||
chan->span_no+1,chan->chan_no+1,chan->tx_idx_in,len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Lock */
|
||||
if (chan->tx_idx_in >= chan->tx_idx_out) {
|
||||
free_slots=SMG_HP_TDM_CHUNK_IDX_SZ-(chan->tx_idx_in-chan->tx_idx_out);
|
||||
} else {
|
||||
free_slots=chan->tx_idx_out-chan->tx_idx_in;
|
||||
}
|
||||
/* Un Lock */
|
||||
|
||||
if (!free_slots) {
|
||||
/* We have just overruned the tx buffer */
|
||||
lib_printf(0,NULL,"chan_push c%i failed no free slots in %i out %i\n",
|
||||
chan->span_no+1,chan->chan_no+1, chan->tx_idx_in,chan->tx_idx_out);
|
||||
return 1;
|
||||
}
|
||||
|
||||
tx_chunk = &chan->tx_idx[chan->tx_idx_in];
|
||||
if (tx_chunk->init) {
|
||||
/* This should NEVER happen the chunk should be free */
|
||||
lib_printf(15,NULL,"chan_push s%ic%i tx chunk overrun in %i \n",
|
||||
chan->span_no+1,chan->chan_no+1,chan->tx_idx_in);
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(tx_chunk,0,sizeof(hp_tmd_chunk_t));
|
||||
memcpy(&tx_chunk->data,data,len);
|
||||
tx_chunk->len=len;
|
||||
tx_chunk->init=1;
|
||||
|
||||
lib_printf(15,NULL,"chan_push s%ic%i tx chunk in %i \n",
|
||||
chan->span_no+1,chan->chan_no+1,chan->tx_idx_in);
|
||||
|
||||
chan->tx_idx_in++;
|
||||
if (chan->tx_idx_in >= SMG_HP_TDM_CHUNK_IDX_SZ) {
|
||||
chan->tx_idx_in=0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
Internal Span Methods
|
||||
-------------------------------------------------*/
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span Method: Open a channel inside of span
|
||||
\param span span object
|
||||
\param cfg channel registration structure
|
||||
\param chan_no channel number
|
||||
\param chan_ptr pass user the channel pointer reference
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
static int sangoma_hp_tdm_open_chan(sangoma_hptdm_span_t *span,
|
||||
sangoma_hptdm_chan_reg_t *cfg,
|
||||
unsigned int chan_no,
|
||||
sangoma_hptdm_chan_t **chan_ptr)
|
||||
{
|
||||
sangoma_hptdm_chan_t *chan;
|
||||
|
||||
if (!span->init) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (chan_no >= SMG_HP_TDM_MAX_CHANS) {
|
||||
lib_printf(0,NULL,"open_chan failed chan_no %i >= max chans %i\n",
|
||||
chan_no, SMG_HP_TDM_MAX_CHANS);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!cfg->rx_data || !cfg->p) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (span->chan_idx[chan_no].chan_no_hw < 0) {
|
||||
lib_printf(0,NULL,"open_chan failed chan_no s%ic%i is not mapped to hardware\n",
|
||||
span->span_no+1,chan_no+1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
chan = &span->chan_idx[chan_no].chan;
|
||||
if (chan->init) {
|
||||
/* Chan Busy */
|
||||
lib_printf(0,NULL,"open_chan failed chan_no s%ic%i is busy\n",
|
||||
span->span_no+1,chan_no+1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(chan,0,sizeof(sangoma_hptdm_chan_t));
|
||||
|
||||
chan->chan_no = chan_no;
|
||||
chan->span = span;
|
||||
memcpy(&chan->chan_reg, cfg, sizeof(sangoma_hptdm_chan_reg_t));
|
||||
|
||||
chan->push = sangoma_hp_tdm_chan_push;
|
||||
|
||||
chan->init=1;
|
||||
lib_printf(15,NULL,"open_chan chan_no s%ic%i ok\n",
|
||||
span->span_no+1,chan_no+1);
|
||||
|
||||
*chan_ptr = chan;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span Method: Close channel
|
||||
\param chan channel object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
static int sangoma_hp_tdm_close_chan(sangoma_hptdm_chan_t *chan)
|
||||
{
|
||||
chan->init=0;
|
||||
chan->chan_reg.p=NULL;
|
||||
lib_printf(15,NULL,"close_chan chan_no s%ic%i ok\n",
|
||||
chan->span_no+1,chan->chan_no+1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span Method: Test if channel is closed
|
||||
\param chan channel object
|
||||
\return 0 = channel is NOT closed, non zero channel IS closed
|
||||
*/
|
||||
static int sangoma_hp_tdm_is_chan_closed (sangoma_hptdm_chan_t *chan)
|
||||
{
|
||||
return (chan->init == 0) ? 1:0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Span Method: Close span
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
static int sangoma_hp_tdm_close_span(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
int i;
|
||||
sangoma_hptdm_chan_t *chan=NULL;
|
||||
|
||||
for (i=0;i<SMG_HP_TDM_MAX_CHANS;i++) {
|
||||
chan = &span->chan_idx[i].chan;
|
||||
if (chan->init) {
|
||||
chan->init=0;
|
||||
}
|
||||
}
|
||||
|
||||
close(span->sock);
|
||||
span->sock=-1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Span Method: User passes cmd to the span
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
static int sangoma_hp_tdm_event_ctrl_span(sangoma_hptdm_span_t *span, hp_tdmapi_tx_event_t *event)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (!span->init || span->sock < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = ioctl(span->sock,SIOC_WANPIPE_API,event);
|
||||
if (err < 0){
|
||||
lib_printf(0,NULL,"Error: SPAN %i Failed to execute event!\n",
|
||||
span->span_no+1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Span Method: User requests full span configuration
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
static int sangoma_hp_tdm_event_get_cfg(sangoma_hptdm_span_t *span, wan_if_cfg_t *if_cfg)
|
||||
{
|
||||
memcpy(if_cfg,&span->span_cfg,sizeof(if_cfg));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Span Method: handle the span
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
static int sangoma_hp_tdm_run_span(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
int err=0;
|
||||
fd_set sock_read,sock_write,sock_oob;
|
||||
|
||||
if (!span->init) {
|
||||
lib_printf(0, NULL, "Span %i not initialized %i\n",span->span_no+1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
lib_printf(15, NULL, "Starting RUN SPAN %i Sock=%i\n",span->span_no+1, span->sock);
|
||||
|
||||
if (span->sock < 0) {
|
||||
err=sangoma_hptdm_span_open(span);
|
||||
if (err) {
|
||||
usleep(500000);
|
||||
err=-2;
|
||||
goto sangoma_hp_tdm_run_span_exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize all select() descriptors */
|
||||
FD_ZERO(&sock_read);
|
||||
FD_ZERO(&sock_write);
|
||||
FD_ZERO(&sock_oob);
|
||||
|
||||
FD_SET(span->sock,&sock_oob);
|
||||
FD_SET(span->sock,&sock_read);
|
||||
FD_SET(span->sock,&sock_write);
|
||||
|
||||
err=select(span->sock + 1,&sock_read, NULL, &sock_oob, NULL);
|
||||
|
||||
if (err > 0) {
|
||||
|
||||
if (FD_ISSET(span->sock,&sock_oob)){
|
||||
err=sangoma_hp_tdm_handle_oob_event(span);
|
||||
if (err) {
|
||||
lib_printf(0, NULL, "RUN SPAN: %i oob err %i\n",
|
||||
span->span_no+1, err);
|
||||
err=-3;
|
||||
goto sangoma_hp_tdm_run_span_exit;
|
||||
}
|
||||
}
|
||||
if (FD_ISSET(span->sock,&sock_read)){
|
||||
err=sangoma_hp_tdm_handle_read_event(span);
|
||||
if (err) {
|
||||
lib_printf(0, NULL, "RUN SPAN: %i read err %i\n",
|
||||
span->span_no+1, err);
|
||||
err=-4;
|
||||
goto sangoma_hp_tdm_run_span_exit;
|
||||
}
|
||||
|
||||
err=sangoma_hp_tdm_handle_write_event(span);
|
||||
if (err) {
|
||||
lib_printf(0, NULL, "RUN SPAN: %i write err %i\n",
|
||||
span->span_no+1, err);
|
||||
err=-5;
|
||||
goto sangoma_hp_tdm_run_span_exit;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (err==0) {
|
||||
/* Timeout continue */
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
/* Error */
|
||||
if (errno == EAGAIN) {
|
||||
goto sangoma_hp_tdm_run_span_exit;
|
||||
}
|
||||
|
||||
err=-6;
|
||||
}
|
||||
|
||||
sangoma_hp_tdm_run_span_exit:
|
||||
|
||||
if (err < 0) {
|
||||
if (span->sock) {
|
||||
close(span->sock);
|
||||
span->sock=-1;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
PUBLIC STRUCTURES
|
||||
----------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
\brief Initialize and Configure Span - private functions not to be used directly!
|
||||
\param span_no span number - integer
|
||||
\param cfg span registration struct
|
||||
\param version library version number added by the macro
|
||||
\return NULL: fail, Span Object: pass
|
||||
*
|
||||
* The __sangoma_hptdm_api_span_init() function must NOT be called directly!
|
||||
* One MUST use defined sangoma_hptdm_api_span_init() macro instead
|
||||
*/
|
||||
|
||||
sangoma_hptdm_span_t * __sangoma_hptdm_api_span_init(int span_no, sangoma_hptdm_span_reg_t *cfg, int version)
|
||||
{
|
||||
int err,i,ch=0;
|
||||
sangoma_hptdm_span_t *span;
|
||||
|
||||
span = malloc(sizeof(sangoma_hptdm_span_t));
|
||||
if (!span) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(span,0,sizeof(sangoma_hptdm_span_t));
|
||||
|
||||
span->span_no=span_no;
|
||||
sprintf(span->if_name,"w%ig1",span_no+1);
|
||||
|
||||
if (cfg) {
|
||||
memcpy(&span->span_reg,cfg,sizeof(sangoma_hptdm_span_reg_t));
|
||||
if (!lib_log) {
|
||||
lib_log=cfg->log;
|
||||
}
|
||||
}
|
||||
|
||||
err=sangoma_hptdm_span_open(span);
|
||||
if (err) {
|
||||
free(span);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (span->span_cfg.media == WAN_MEDIA_E1) {
|
||||
span->span_cfg.active_ch = span->span_cfg.active_ch >> 1;
|
||||
}
|
||||
|
||||
lib_printf(0,NULL,"Span %i Configuration\n",span->span_no+1);
|
||||
lib_printf(0,NULL,"Used By\t:%i\n",span->span_cfg.usedby);
|
||||
lib_printf(0,NULL,"Media\t:%i\n",span->span_cfg.media);
|
||||
lib_printf(0,NULL,"Active Ch\t:0x%08X\n",span->span_cfg.active_ch);
|
||||
lib_printf(0,NULL,"Chunk Sz\t:%i\n",span->span_cfg.chunk_sz);
|
||||
lib_printf(0,NULL,"HW Coding\t:%i\n",span->span_cfg.hw_coding);
|
||||
lib_printf(0,NULL,"If Number\t:%i\n",span->span_cfg.interface_number);
|
||||
|
||||
|
||||
/* Map all channels to the actually configued on hardware */
|
||||
for (i=0;i<SMG_HP_TDM_MAX_CHANS;i++) {
|
||||
span->chan_idx[i].chan_no_hw=-1;
|
||||
if (span->span_cfg.active_ch & (1<<i)) {
|
||||
span->chan_idx[i].chan_no_hw=ch;
|
||||
lib_printf(0,NULL,"Chan %i Mapped to %i",i,ch);
|
||||
ch++;
|
||||
span->max_chans++;
|
||||
} else {
|
||||
lib_printf(0,NULL,"Chan %i Not Mapped",i);
|
||||
}
|
||||
}
|
||||
|
||||
lib_printf(0,NULL,"Total Chans\t:%i\n",span->max_chans);
|
||||
|
||||
/* Must be configurable */
|
||||
span->chunk_sz=span->span_cfg.chunk_sz;
|
||||
span->tx_size=span->max_chans*span->chunk_sz;
|
||||
|
||||
span->init=1;
|
||||
span->idle=0xFF;
|
||||
|
||||
span->open_chan = sangoma_hp_tdm_open_chan;
|
||||
span->close_chan = sangoma_hp_tdm_close_chan;
|
||||
span->is_chan_closed = sangoma_hp_tdm_is_chan_closed;
|
||||
span->run_span =sangoma_hp_tdm_run_span;
|
||||
span->close_span = sangoma_hp_tdm_close_span;
|
||||
span->event_ctrl = sangoma_hp_tdm_event_ctrl_span;
|
||||
span->get_cfg = sangoma_hp_tdm_event_get_cfg;
|
||||
|
||||
lib_printf(5, NULL, "Span %i Initialized\n",span->span_no+1);
|
||||
|
||||
return span;
|
||||
}
|
||||
|
||||
/*
|
||||
\brief Free, Un-Initialize Span
|
||||
\param span_no span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
int sangoma_hptdm_api_span_free(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
if (span->sock >= 0) {
|
||||
span->close_span(span);
|
||||
}
|
||||
|
||||
free(span);
|
||||
span=NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,324 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* libhpsangoma.h : Sangoma High Performance TDM API - Span Based Library
|
||||
*
|
||||
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2008 Nenad Corbic <ncorbic@sangoma.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 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#ifndef _LIB_HP_SNAGOMA_H
|
||||
#define _LIB_HP_SNAGOMA_H
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#error "WINDOWS NOT DEFINED"
|
||||
|
||||
#else
|
||||
/* L I N U X */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/resource.h>
|
||||
#include <netinet/in.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/if.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
#include <linux/wanpipe_defines.h>
|
||||
#include <linux/wanpipe_common.h>
|
||||
#include <linux/wanpipe_cfg.h>
|
||||
#include <linux/wanpipe.h>
|
||||
#include <linux/if_wanpipe.h>
|
||||
#include <linux/sdla_aft_te1.h>
|
||||
#endif
|
||||
|
||||
#define SMG_HP_MAX_CHAN_DATA 1024
|
||||
#define SMG_HP_TDM_CHUNK_IDX_SZ 16
|
||||
#define SMG_HP_TDM_MAX_CHANS 31
|
||||
#define SMG_HP_MAX_SPAN_DATA (31*160)+32
|
||||
|
||||
#define hp_tdmapi_rx_event_t api_rx_hdr_t
|
||||
#define hp_tdmapi_tx_event_t api_tx_hdr_t
|
||||
|
||||
#define SANGOMA_HPTDM_VERSION 1
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* PUBLIC DEFINITIONS
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span registration structure
|
||||
*/
|
||||
typedef struct sangoma_hptdm_span_reg
|
||||
{
|
||||
/*! pointer to user object used with callback functions */
|
||||
void *p;
|
||||
/*! callback function to implement library logging */
|
||||
void (*log)(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...);
|
||||
/*! callback function to span global events for all channels in a span */
|
||||
int (*rx_event)(void *p, hp_tdmapi_rx_event_t *data);
|
||||
}sangoma_hptdm_span_reg_t;
|
||||
|
||||
|
||||
/*!
|
||||
\brief A chunk structure used to implement a chunk buffer
|
||||
*/
|
||||
typedef struct hp_tdm_chunk
|
||||
{
|
||||
/*! chunk init flag used to determine if chunk is being used*/
|
||||
int init;
|
||||
/*! length of the current data chunk */
|
||||
int len;
|
||||
/*! current offset to write/read to/from the chunk data structure. */
|
||||
int offset;
|
||||
/*! chunk data location */
|
||||
char data[SMG_HP_MAX_CHAN_DATA];
|
||||
}hp_tmd_chunk_t;
|
||||
|
||||
/*!
|
||||
\brief Chan registration structure
|
||||
*/
|
||||
typedef struct sangoma_hptdm_chan_reg
|
||||
{
|
||||
/*! pointer to user object used with callback functions */
|
||||
void *p;
|
||||
/*! callback function used to pass rx chunk to user application */
|
||||
int (*rx_data)(void *p, char *data, int len);
|
||||
/*! callback function used to pass channel specific event to user application */
|
||||
int (*rx_event)(void *p, hp_tdmapi_rx_event_t *data);
|
||||
|
||||
}sangoma_hptdm_chan_reg_t;
|
||||
|
||||
/*!
|
||||
\brief Channel structure, describes a single timeslot/channel in a span.
|
||||
*/
|
||||
typedef struct sangoma_hptdm_chan
|
||||
{
|
||||
/*! channel init flag used to determine if chan is being used */
|
||||
int init;
|
||||
|
||||
/*! channel number: starting from 0 */
|
||||
int chan_no;
|
||||
|
||||
/*! span number the current channel belongs to: starting from 0 */
|
||||
int span_no;
|
||||
|
||||
/*! span object pointer the current channel belongs */
|
||||
void *span;
|
||||
|
||||
/*! Rx chunk buffer used to rx data from the span */
|
||||
hp_tmd_chunk_t rx_chunk;
|
||||
|
||||
/*! Circular buffer of tx data chunks used to tx data to span */
|
||||
hp_tmd_chunk_t tx_idx[SMG_HP_TDM_CHUNK_IDX_SZ];
|
||||
|
||||
/*! Circular buffer index for user to chan tx */
|
||||
int tx_idx_in;
|
||||
|
||||
/*! Circular buffer index for chan to span tx */
|
||||
int tx_idx_out;
|
||||
|
||||
/*! Callback func called by user to push chunk of data into the channel */
|
||||
int (*push)(struct sangoma_hptdm_chan *, char *data, int len);
|
||||
|
||||
/*! Channel registration struct used to store user data, cfg and callbacks */
|
||||
sangoma_hptdm_chan_reg_t chan_reg;
|
||||
|
||||
}sangoma_hptdm_chan_t;
|
||||
|
||||
/*!
|
||||
\brief Structure describing a array index of a channel inside the span structure.
|
||||
*
|
||||
* Structure describing a array index of a channel inside the span structure.
|
||||
* Furthermore the index * also servers as a map from hardware channels to library channels.
|
||||
* Hardware might be configured for channels 1-15.17-31, however library always
|
||||
* provides all 31 channels
|
||||
*/
|
||||
typedef struct sangoma_hptdm_chan_map
|
||||
{
|
||||
/*! A hardware channel number that is mapped to the current channel structure.
|
||||
* Hardware might be configured for channels 1-15.17-31, however library always
|
||||
* provides all 31 channels */
|
||||
int chan_no_hw;
|
||||
|
||||
/*! A channel structure */
|
||||
sangoma_hptdm_chan_t chan;
|
||||
|
||||
}sangoma_hptdm_chan_map_t;
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span structure. Structure describing a single span.
|
||||
*/
|
||||
typedef struct sangoma_hptdm_span
|
||||
{
|
||||
/*! span init flag used to determine if span is being used */
|
||||
int init;
|
||||
|
||||
/*! span number - integer starting from 0 */
|
||||
int span_no;
|
||||
|
||||
/*! span hw interface name to which span is bounded to */
|
||||
char if_name[100];
|
||||
|
||||
/*! span socket file descriptor used to rx/tx data to and from hw interface */
|
||||
int sock;
|
||||
|
||||
/*! chunk size for each channel inside the span */
|
||||
int chunk_sz;
|
||||
|
||||
/*! total number of channels configured in the span */
|
||||
int max_chans;
|
||||
|
||||
/*! total tx data size to hw interface. tx_size = max_chans * chunk_sz */
|
||||
int tx_size;
|
||||
|
||||
/*! idle flag used to fill an unused channel */
|
||||
unsigned char idle;
|
||||
|
||||
/*! bit map of configured timeslots obtained from hw interface */
|
||||
unsigned int timeslot_cfg;
|
||||
|
||||
/*! hw data encoding: ULAW/ALAW obtained from hw interface */
|
||||
unsigned int hwcoding;
|
||||
|
||||
/*! array of maximum number of channels in a span */
|
||||
sangoma_hptdm_chan_map_t chan_idx[SMG_HP_TDM_MAX_CHANS];
|
||||
|
||||
/*! span rx data block: used to receive a block of data from hw interface: recv() */
|
||||
char rx_data[SMG_HP_MAX_SPAN_DATA];
|
||||
|
||||
/*! span rx data len, obtained after a recv() call to hw interface */
|
||||
int rx_len;
|
||||
|
||||
/*! span tx data block: used to transmit a block of data to hw interface: send() */
|
||||
char tx_data[SMG_HP_MAX_SPAN_DATA];
|
||||
|
||||
/*! span tx data block len: passed to send() function */
|
||||
int tx_len;
|
||||
|
||||
/*! span registration functions: contains user callback functions */
|
||||
sangoma_hptdm_span_reg_t span_reg;
|
||||
|
||||
/*! span config structure obtained from hw interface via managment ioctl call. */
|
||||
wan_if_cfg_t span_cfg;
|
||||
|
||||
/*! span managment structure used to execute mgmnt ioctl commands to hw interface */
|
||||
wan_udp_hdr_t wan_udp;
|
||||
|
||||
/*! \brief Method: open a channel inside a span
|
||||
* \param span span object
|
||||
* \param chan_reg channel registration structure: callbacks and cfg
|
||||
* \param chan_no channel number - integer starting from 0
|
||||
* \param chan_ptr user container for channel object passed up to the user.
|
||||
*/
|
||||
int (*open_chan)(struct sangoma_hptdm_span *span,
|
||||
sangoma_hptdm_chan_reg_t *chan_reg,
|
||||
unsigned int chan_no,
|
||||
sangoma_hptdm_chan_t **chan_ptr);
|
||||
|
||||
/*! \brief Method: close a channel inside the span
|
||||
* \param chan chan object
|
||||
*/
|
||||
int (*close_chan)(sangoma_hptdm_chan_t *chan);
|
||||
|
||||
/*! \brief Method: check if channel is closed
|
||||
* \param chan chan object */
|
||||
int (*is_chan_closed)(sangoma_hptdm_chan_t *chan);
|
||||
|
||||
/*! \brief Method: run main span execution logic: rx/tx/oob
|
||||
* \param span span object
|
||||
*
|
||||
* Run main span execution logic. This function peforms all socket operations
|
||||
* on a hw interface. Rx/Tx/Oob.
|
||||
* Receives data and demultiplexes it to channels.
|
||||
* Receives oob data and passes user events global to all channels.
|
||||
* Multiplexes all channel tx data into a single tx data block and
|
||||
* passes it to hw iface.
|
||||
*/
|
||||
int (*run_span)(struct sangoma_hptdm_span *span);
|
||||
|
||||
/*! \brief Method: close span
|
||||
* \param span span object */
|
||||
int (*close_span)(struct sangoma_hptdm_span *span);
|
||||
|
||||
/*! \brief Method: used by user app to execute events on current span
|
||||
* \param span span object
|
||||
* \param event event object
|
||||
*/
|
||||
int (*event_ctrl)(struct sangoma_hptdm_span *span, hp_tdmapi_tx_event_t *event);
|
||||
|
||||
/*! \brief Method: request full span configuration from a current span
|
||||
* \param span span object
|
||||
* \param cfg configuratoin object to be filled by span
|
||||
*/
|
||||
int (*get_cfg)(struct sangoma_hptdm_span *span, wan_if_cfg_t *cfg);
|
||||
|
||||
|
||||
}sangoma_hptdm_span_t;
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* PUBLIC FUNCTIONS
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Initialize and Configure a Span
|
||||
\param span_no span number - integer
|
||||
\param cfg span registration struct
|
||||
\return NULL: fail, Span Object: pass
|
||||
*/
|
||||
|
||||
/* Initialize and Configure a Span */
|
||||
#define sangoma_hptdm_api_span_init(span,cfg) __sangoma_hptdm_api_span_init(span, cfg, SANGOMA_HPTDM_VERSION);
|
||||
|
||||
/*!
|
||||
\brief Initialize and Configure Span - private functions not to be used directly!
|
||||
\param span_no span number - integer
|
||||
\param cfg span registration struct
|
||||
\param version library version number added by the macro
|
||||
\return NULL: fail, Span Object: pass
|
||||
*
|
||||
* The __sangoma_hptdm_api_span_init() function must NOT be called directly!
|
||||
* One MUST use defined sangoma_hptdm_api_span_init() macro instead
|
||||
*/
|
||||
|
||||
/*
|
||||
* The __sangoma_hptdm_api_span_init() function must NOT be called directly!
|
||||
* One MUST use defined sangoma_hptdm_api_span_init() macro instead
|
||||
*/
|
||||
extern sangoma_hptdm_span_t * __sangoma_hptdm_api_span_init(int span_no, sangoma_hptdm_span_reg_t *cfg, int version);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Free, Un-Initialize Span
|
||||
\param span_no span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
extern int sangoma_hptdm_api_span_free(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,403 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* libhpsangoma_priv.c: Sangoma High Performance TDM API - Span Based Library
|
||||
*
|
||||
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2008 Nenad Corbic <ncorbic@sangoma.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 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
*
|
||||
*/
|
||||
|
||||
#include "libhpsangoma.h"
|
||||
#include "libhpsangoma_priv.h"
|
||||
#define DFT_CARD "wanpipe1"
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span read data from a hw interface
|
||||
\param fd socket file descriptor to span hw interface
|
||||
\param hdrbuf pointer to header buffer used for misc oob data - not used
|
||||
\param hdrlen size of hdr buffer - always standard 16 bytes
|
||||
\param databuf pointer to span data that includes all timeslots * chunk size
|
||||
\param datalen size of span data: timeslots * chunk size
|
||||
\param flag selects normal (0) or oob (MSG_OOB) read queue
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_readmsg_hp_tdm(int fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag)
|
||||
{
|
||||
int rx_len=0;
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
#error "WINDOWS HP TDMAPI NOT DEFINED"
|
||||
|
||||
#else
|
||||
struct msghdr msg;
|
||||
struct iovec iov[2];
|
||||
|
||||
memset(&msg,0,sizeof(struct msghdr));
|
||||
|
||||
iov[0].iov_len=hdrlen;
|
||||
iov[0].iov_base=hdrbuf;
|
||||
|
||||
iov[1].iov_len=datalen;
|
||||
iov[1].iov_base=databuf;
|
||||
|
||||
msg.msg_iovlen=2;
|
||||
msg.msg_iov=iov;
|
||||
|
||||
rx_len = recvmsg(fd,&msg,0);
|
||||
|
||||
if (rx_len <= sizeof(api_rx_hdr_t)){
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rx_len-=sizeof(api_rx_hdr_t);
|
||||
#endif
|
||||
|
||||
return rx_len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span write data into a hw interface
|
||||
\param fd socket file descriptor to span hw interface
|
||||
\param hdrbuf pointer to header buffer used for misc oob data - not used
|
||||
\param hdrlen size of hdr buffer - always standard 16 bytes
|
||||
\param databuf pointer to span data that includes all timeslots * chunk size
|
||||
\param datalen size of span data: timeslots * chunk size
|
||||
\param flag selects normal (0) or oob (MSG_OOB) read queue
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_writemsg_hp_tdm(int fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag)
|
||||
{
|
||||
int bsent;
|
||||
|
||||
#if defined(WIN32)
|
||||
|
||||
#error "Windows TX not implemented"
|
||||
|
||||
#else
|
||||
struct msghdr msg;
|
||||
struct iovec iov[2];
|
||||
|
||||
memset(&msg,0,sizeof(struct msghdr));
|
||||
|
||||
iov[0].iov_len=hdrlen;
|
||||
iov[0].iov_base=hdrbuf;
|
||||
|
||||
iov[1].iov_len=datalen;
|
||||
iov[1].iov_base=databuf;
|
||||
|
||||
msg.msg_iovlen=2;
|
||||
msg.msg_iov=iov;
|
||||
|
||||
bsent = sendmsg(fd,&msg,0);
|
||||
if (bsent > 0){
|
||||
bsent-=sizeof(api_tx_hdr_t);
|
||||
}
|
||||
#endif
|
||||
return bsent;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Execute a management ioctl command
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int do_wanpipemon_cmd(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
memset(&ifr,0,sizeof(ifr));
|
||||
ifr.ifr_data = (void*)&span->wan_udp;
|
||||
sprintf (ifr.ifr_name, "%s", span->if_name);
|
||||
return ioctl(span->sock,SIOC_WANPIPE_PIPEMON,&ifr);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Get full span hw configuration
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
unsigned char sangoma_get_cfg(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
span->wan_udp.wan_udphdr_command = READ_CONFIGURATION;
|
||||
span->wan_udp.wan_udphdr_data_len = 0;
|
||||
span->wan_udp.wan_udphdr_return_code = 0xaa;
|
||||
do_wanpipemon_cmd(span);
|
||||
if (span->wan_udp.wan_udphdr_return_code != 0){
|
||||
lib_printf(0,NULL,"Error: SPAN %i management command failed 0x02Xs (%s)",
|
||||
span->span_no+1, span->wan_udp.wan_udphdr_return_code,strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(&span->span_cfg,&span->wan_udp.wan_udphdr_data[0],sizeof(span->span_cfg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Open socket to span hw interface
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
int sangoma_hptdm_span_open(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
struct wan_sockaddr_ll sa;
|
||||
char if_name[100];
|
||||
int sock=-1;
|
||||
int err;
|
||||
|
||||
memset(&sa,0,sizeof(struct wan_sockaddr_ll));
|
||||
sock = socket(AF_WANPIPE, SOCK_RAW, 0);
|
||||
if( sock < 0 ) {
|
||||
perror("Socket");
|
||||
return -1;
|
||||
} /* if */
|
||||
|
||||
sprintf(if_name, "w%ig1", span->span_no+1);
|
||||
|
||||
strcpy( (char*)sa.sll_device, if_name);
|
||||
strcpy( (char*)sa.sll_card, DFT_CARD);
|
||||
sa.sll_protocol = htons(PVC_PROT);
|
||||
sa.sll_family=AF_WANPIPE;
|
||||
|
||||
if(bind(sock, (struct sockaddr *)&sa, sizeof(struct wan_sockaddr_ll)) < 0){
|
||||
lib_printf(0,NULL,"bind failed on span span %i %s\n",
|
||||
span->span_no+1,strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
span->sock=sock;
|
||||
|
||||
err= sangoma_get_cfg(span);
|
||||
if (err) {
|
||||
goto sangoma_hptdm_span_open_error;
|
||||
}
|
||||
|
||||
lib_printf(0,NULL,"libhp: span %i opened\n",
|
||||
span->span_no+1);
|
||||
|
||||
return 0;
|
||||
|
||||
sangoma_hptdm_span_open_error:
|
||||
|
||||
if (span->sock) {
|
||||
close(span->sock);
|
||||
span->sock=-1;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Read oob event from hw and push oob event up to the user. Called after select()
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
int sangoma_hp_tdm_handle_oob_event(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
int err;
|
||||
hp_tdmapi_rx_event_t *rx_event;
|
||||
|
||||
err = recv(span->sock, span->rx_data, sizeof(span->rx_data), MSG_OOB);
|
||||
if (err > 0) {
|
||||
rx_event=(hp_tdmapi_rx_event_t*)&span->rx_data;
|
||||
if (span->span_reg.rx_event && span->span_reg.p) {
|
||||
span->span_reg.rx_event(span->span_reg.p, rx_event);
|
||||
}
|
||||
}
|
||||
/* For now treat all err as socket reload */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Multiplex span rx data and push it up to each channel
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
int sangoma_hp_tdm_push_rx_data(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
int i=0,x=0,err=0;
|
||||
sangoma_hptdm_chan_t *chan=NULL;
|
||||
hp_tmd_chunk_t *chunk=NULL;
|
||||
int chan_no_hw;
|
||||
char *rx_data = &span->rx_data[sizeof(api_rx_hdr_t)];
|
||||
|
||||
|
||||
for (i=0;i<SMG_HP_TDM_MAX_CHANS;i++) {
|
||||
chan = &span->chan_idx[i].chan;
|
||||
if (!chan->init) {
|
||||
continue;
|
||||
}
|
||||
chan_no_hw = span->chan_idx[i].chan_no_hw;
|
||||
|
||||
lib_printf(15,NULL, "SPAN %i Chan %i Chunk %i Channelizing\n",
|
||||
span->span_no+1, chan->chan_no+1, span->chunk_sz);
|
||||
|
||||
chunk = &chan->rx_chunk;
|
||||
|
||||
for (x=0;x<span->chunk_sz;x++) {
|
||||
chunk->data[x] = rx_data[(span->max_chans*x)+chan_no_hw];
|
||||
}
|
||||
|
||||
chunk->len = span->chunk_sz;
|
||||
if (chan->chan_reg.p && chan->chan_reg.rx_data) {
|
||||
err=chan->chan_reg.rx_data(chan->chan_reg.p,chunk->data,chunk->len);
|
||||
} else {
|
||||
err=1;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
chan->init=0;
|
||||
chan->chan_reg.p=NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Read data from hw interface and pass it up to the rxdata handler: called by run_span()
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
|
||||
int sangoma_hp_tdm_handle_read_event(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
int err;
|
||||
hp_tdmapi_rx_event_t *rx_event = (hp_tdmapi_rx_event_t*)&span->rx_data[0];
|
||||
|
||||
err = sangoma_readmsg_hp_tdm(span->sock,
|
||||
&span->rx_data[0],sizeof(api_rx_hdr_t),
|
||||
&span->rx_data[sizeof(api_rx_hdr_t)],
|
||||
sizeof(span->rx_data) - sizeof(api_rx_hdr_t),
|
||||
0);
|
||||
|
||||
if (err > sizeof(api_rx_hdr_t)) {
|
||||
|
||||
lib_printf(15,NULL, "SPAN %i Read Len = %i\n",span->span_no+1,err);
|
||||
|
||||
if (rx_event->event_type) {
|
||||
|
||||
if (span->span_reg.rx_event && span->span_reg.p) {
|
||||
span->span_reg.rx_event(span->span_reg.p, rx_event);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (err % span->chunk_sz) {
|
||||
lib_printf(0,NULL, "Error: SPAN %i Read Len = %i Block not chunk %i aligned! \n",span->span_no+1,err,span->chunk_sz);
|
||||
/* Received chunk size is not aligned drop it for now */
|
||||
return 0;
|
||||
}
|
||||
|
||||
sangoma_hp_tdm_push_rx_data(span);
|
||||
}
|
||||
|
||||
err=0;
|
||||
|
||||
} else {
|
||||
if (errno == EAGAIN) {
|
||||
err = 0;
|
||||
} else {
|
||||
err=-1;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Pull data from all chans and write data to hw interface: called by run_span()
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_hp_tdm_handle_write_event(sangoma_hptdm_span_t *span)
|
||||
{
|
||||
int i=0,x=0,err=0;
|
||||
sangoma_hptdm_chan_t *chan;
|
||||
hp_tmd_chunk_t *chunk;
|
||||
int chan_no_hw=0;
|
||||
char *tx_data = &span->tx_data[sizeof(api_tx_hdr_t)];
|
||||
|
||||
memset(&span->tx_data,span->idle,sizeof(span->tx_data));
|
||||
|
||||
|
||||
for (i=0;i<SMG_HP_TDM_MAX_CHANS;i++) {
|
||||
chan = &span->chan_idx[i].chan;
|
||||
if (!chan->init) {
|
||||
/* This channel is not open */
|
||||
continue;
|
||||
}
|
||||
chan_no_hw=span->chan_idx[i].chan_no_hw;
|
||||
|
||||
chunk = &chan->tx_idx[chan->tx_idx_out];
|
||||
if (!chunk->init) {
|
||||
lib_printf(15,NULL,"span write s%ic%i tx chunk underrun out %i \n",
|
||||
chan->span_no+1,chan->chan_no+1,chan->tx_idx_out);
|
||||
/* There is no tx data for this channel */
|
||||
continue;
|
||||
}
|
||||
|
||||
for (x=0;x<span->chunk_sz;x++) {
|
||||
|
||||
tx_data[(span->max_chans*x)+chan_no_hw] = chunk->data[chunk->offset];
|
||||
chunk->offset++;
|
||||
|
||||
if (chunk->offset >= chunk->len) {
|
||||
chunk->init=0;
|
||||
|
||||
lib_printf(15,NULL,"span write s%ic%i tx chunk out %i \n",
|
||||
chan->span_no+1,chan->chan_no+1,chan->tx_idx_out);
|
||||
|
||||
chan->tx_idx_out++;
|
||||
if (chan->tx_idx_out >= SMG_HP_TDM_CHUNK_IDX_SZ) {
|
||||
chan->tx_idx_out=0;
|
||||
}
|
||||
chunk=&chan->tx_idx[chan->tx_idx_out];
|
||||
if (!chunk->init) {
|
||||
/* We are out of tx data on this channel */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
err = sangoma_writemsg_hp_tdm(span->sock,
|
||||
span->tx_data,sizeof(api_tx_hdr_t),
|
||||
tx_data, span->tx_size,
|
||||
0);
|
||||
|
||||
lib_printf(15, NULL, "SPAN %i TX Len %i Expecting %i\n",
|
||||
span->span_no+1, err, span->tx_size+sizeof(api_tx_hdr_t));
|
||||
|
||||
if (err < span->tx_size) {
|
||||
if (errno == EAGAIN) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
err=0;
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* libhpsangoma.h : Sangoma High Performance TDM API - Span Based Library
|
||||
*
|
||||
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2008 Nenad Corbic <ncorbic@sangoma.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 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
#ifndef _LIB_HP_SANGOMA_PRIV_H
|
||||
#define _LIB_HP_SANGOMA_PRIV_H
|
||||
|
||||
#include "libhpsangoma.h"
|
||||
|
||||
|
||||
/*!
|
||||
\brief library print function based on registered span callback function
|
||||
\return void
|
||||
*/
|
||||
#define lib_printf(level, fp, fmt, ...) if (lib_log) lib_log(level, fp, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
|
||||
|
||||
extern void (*lib_log)(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...);
|
||||
|
||||
|
||||
/*---------------------------------------------------------
|
||||
* PRIVATE - FUNCTIONS
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Span read data from a hw interface
|
||||
\param fd socket file descriptor to span hw interface
|
||||
\param hdrbuf pointer to header buffer used for misc oob data - not used
|
||||
\param hdrlen size of hdr buffer - always standard 16 bytes
|
||||
\param databuf pointer to span data that includes all timeslots * chunk size
|
||||
\param datalen size of span data: timeslots * chunk size
|
||||
\param flag selects normal (0) or oob (MSG_OOB) read queue
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_readmsg_hp_tdm(int fd, void *hdrbuf, int hdrlen, void *databuf, int datalen, int flag);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Span write data into a hw interface
|
||||
\param fd socket file descriptor to span hw interface
|
||||
\param hdrbuf pointer to header buffer used for misc oob data - not used
|
||||
\param hdrlen size of hdr buffer - always standard 16 bytes
|
||||
\param databuf pointer to span data that includes all timeslots * chunk size
|
||||
\param datalen size of span data: timeslots * chunk size
|
||||
\param flag selects normal (0) or oob (MSG_OOB) read queue
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_writemsg_hp_tdm(int fd, void *hdrbuf, int hdrlen, void *databuf, unsigned short datalen, int flag);
|
||||
|
||||
/*!
|
||||
\brief Execute a management ioctl command
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int do_wanpipemon_cmd(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Get full span hw configuration
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
unsigned char sangoma_get_cfg(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Open socket to span hw interface
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_hptdm_span_open(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Read oob event from hw and push oob event up to the user. Called after select()
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_hp_tdm_handle_oob_event(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Multiplex span rx data and push it up to each channel
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_hp_tdm_push_rx_data(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Read data from hw interface and pass it up to the rxdata handler: called by run_span()
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_hp_tdm_handle_read_event(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
/*!
|
||||
\brief Pull data from all chans and write data to hw interface: called by run_span()
|
||||
\param span span object
|
||||
\return 0 = pass, non zero fail
|
||||
*/
|
||||
int sangoma_hp_tdm_handle_write_event(sangoma_hptdm_span_t *span);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue