LAPB API (Linux)
- LAPB API Pre Requisites
- LAPB API Installation
- LAPB API Configuration
- LAPB API Operation
- LAPB API Debugging
- LAPB API Sample Codes
- LAPB API Decoded Sample Config File
- A Linux kernel source or header must be available.
Usually in /lib/modules/$(uname -r)/build directory.
Furthermore, the linux source or headers version must
match the currently running image.
i.e. Output of 'uname -r'
must match the source version
number in /lib/modules/$(uname -r)/build/Makefile.
Note: That on 99% of standard kernel distributions this is DEFAULT.
Note: The Setup installation script checks for this condition and will take appropriate steps to resolve the name mismatch.
Installing WANPIPE with LIP LAPB support
- Download and Untar latest BETA wanpipe release for AFT A142/4 & S514 Cards
-> tar xfz wanpipe-<version>.tgz
-> cd wanpipe-<version> - Run ./Setup install
Choose all default options until you come to COMPILATION.
The LIP LAPB API support IS NOT installed by default during WANPIPE installation process.
Select CUSTOM driver compilation option and choose:
DEF <enter>
LIPAPI <enter> (Enables LIP LAPB and XDLC)
q <enter>
For the rest of the installation choose default parameters.
After successful installation proceed to configure you LAPB API card using:
/usr/sbin/wancfg GUI configurator.
Installation Verification
Run wanpipe hardware probe to make sure that the kernel modules
are working fine:
Run: wanrouter hwprobe
In case of error:
-----------------
Please contact Sangoma Tech Support
Tel. 905 474 1990 ex118
Email: techdesk@sangoma.com
Configuring LIP LAPB API
Run: /usr/sbin/wancfg
1. Create new device
2. Select wanpipe1
3. Hardware Section
Select Probe Hardware
Select your A142 or S514 adapter.
Configure hardware front end interface
based on your ISP config:
Interface: V35 or
RS232
Configure clocking mode:
Clocking: External (Default)
Internal
Configure baud rage (if clocking = Internal)
Baudrate: 64000 (Usually x25 lines go up to 128K)
4. Protocol Section
Select Protocol: HDLC LAPB
Configure Selected Protocol
--> Configure LAPB Protocol -> Specify DTE/DCE, Timers etc..
5. Interface Section
Configure Operation Mode to: API
7. Save and Exit
Run: wanrouter start
In case of errors:
------------------
Run: wanrouter messages
It will display kernel error
messages.
Please contact Sangoma Tech Support
Tel. 905 474 1990 ex118
Email: techdesk@sangoma.com
Startup Confirmation
--------------------
Run: wanrouter messages
Make sure no error messages are displayed.
Confirm the Link state
Confirm that Restart Messages have been
received and transmitted.
Check for any error events.
Before starting with application programming, you must make sure that the LAPB protocol has come up and that it has successfully
Run: tail -n 100 -f /var/log/messages
You should notice in /var/log/messages after wanrouter startup sequence messages such as:
"LABP Link Connectin..." --> "LAPB Link Connected": This indicates Labp has come up.
Only once you see these messages in you /var/log/messages, can you proceed with sample applications.
Run: cat /proc/net/wanrouter/lapb/config
You should notice the lapb link state for each lapb link.
You should see "Link Ready/Connected"
If you don't see above messages, and lapb is not connected you must check the following:
1. lapb Configuraton
Configure for DTE if remote end is DCE and vice versa.
Configure for External clocking if remote is configured for Internal and vice versa.
2. Tracing the line
run: wanpipemon -i wp1mp -c tr
Start trace and check for incoming and outgoing frames. If you dont see any INCOMING frames you might have cable problems.
3. Cable Issues
To configure two S514/A14X cards back to back, you need a NULL MODEM Cable.
Or a sangoma back to back S514/A14X cable.
Or a sangoma back to back S514 cable.
Custom LAPB API Application
A sample API application exists in
/etc/wanpipe/api/aft directory.
Since LAPB is just a single link protocol, one can use the general AFT api sample code to bind to
LAPB interface and read/write data.
To compile it run: make
Run: ./aft_api -i w1clapb -c wanpipe1 -r -w -txsize 100 -txcnt 10 -verbose # transmitter
./aft_api -i w1clapb -c wanpipe1 -r -verbose # receiver
API ./aft_api USAGE:
./aft_api <options> <extra options>
<options>:
-i <ifname> #interface name
-c <card name> #card name
-r #read enable
-w #write eable
<extra options>
-txcnt <digit> #number of tx packets (Dflt: 1)
-txsize <digit> #tx packet size (Dflt: 10)
-txdelay <digit> #delay in sec after each tx packet (Dflt: 0)
-txdata <digit> #data to tx <1-255>
-txfile <file> #Use file to tx instead
-rxfile <file> #Save all rx data to a file
-rxcnt <digit> #number of rx packets before exit
#this number overwrites the txcnt
#Thus, app will only exit after it
#receives the rxcnt number of packets.
-verbose #Enable verbose mode
Decoded Wanpipe Configuration File
The /usr/sbin/wancfg creates the following file in:
/etc/wanpipe/wanpipe1.conf
#================================================
# WANPIPE1 Configuration File
#================================================
#
# Date: Fri Jun 25 16:47:33 EDT 2004
#
# Note: This file was generated automatically
# by /usr/sbin/wancfg program.
#
# If you want to edit this file, it is
# recommended that you use wancfg program
# to do so.
#================================================
# Sangoma Technologies Inc.
#================================================
[devices]
wanpipe1 = WAN_MULTPROT, Comment
[interfaces]
wp1mp = wanpipe1, , STACK, Comment
wp1lapb = wanpipe1, 1 ,API, lip_lapb, lapb.wp1mp, ,
[wanpipe1]
CARD_TYPE = S51X
S514CPU = A
AUTO_PCISLOT = YES
PCISLOT = 5
PCIBUS = 0
Firmware = /etc/wanpipe/firmware/cdual514.sfm
CommPort = PRI
Interface = V35
Clocking = Internal
BaudRate = 64000
MTU = 1500
UDPPORT = 9000
TTL = 255
IGNORE_FRONT_END = NO
[lapb.wp1mp]
STATION = DTE
T1 = 2
T2 = 0
T3 = 6
T4 = 3
N2 = 5
MODE = 8
WINDOW = 7
MAX_PKT_SIZE = 1024
[wp1mp]
HDLC_STREAMING = YES
MPPP_PROT = HDLC
IGNORE_DCD = YES
IGNORE_CTS = YES







