Wanpipe Linux MPAPI X25

    1. MPAPI X25 Pre Requisites
    2. MPAPI X25 Installation
    3. MPAPI X25 Installation Verification
    4. MPAPI X25 Configuration
    5. MPAPI X25 Operation
    6. MPAPI X25 Debugging
    7. MPAPI X25 Sample Codes
    8. MPAPI X25 Decoded Sample Config File
    9. MPAPI X25 FAQ
    10. MPAPI X25 Programming Manual PDF
    11. MPAPI X25 configuration for A101/A102/A104/A108

     

    *Note: Only supported on CentOS 5.x


    Pre requisites

    1. CentOS 5.x
    2. 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 MPAPI X25 support



    The MPAPI X25 API is NOT distributed with standard wanpipe release.
    One has to request the MPAPI binary or source from Sangoma Technologies.

    1. Download and Untar latest 3.4 wanpipe release for S514 Cards only.
      --> tar xfz wanpipe-<version>.tgz
      --> cd wanpipe-<version>
        
    2. Download and Untar latest 3.5 or greater wanpipe release for AFT A142/4 & S514 Cards
      -> tar xfz wanpipe-<version>.tgz
      -> cd wanpipe-<version>  
      ---
    3. Obtain MPAPI source tar ball from Sangoma Technologies.
      --> ftp.sangoma.com/linux/custom/mpapi

      The latest tar ball should be copied into the wanpipe-<ver>/ source directory that was created by untarring latest STABLE release. Untar the mpapi zip release into wanpipe-<ver>/ source directory.
      --> cp wanpipe-mpapi-<ver>.zip  wanpipe-<ver>/
      --> cd wanpipe-<ver>
      --> unzip -e wanpipe-mpapi-<ver>.zip
            (Supply password received from Sangoma Support)
      --> tar xf wanpipe-mpapi-<ver>.tar
       
    4. Run ./Setup install
      Choose all default options until you come to COMPILATION.

      The MPAPI X25 API support IS NOT installed by default during WANPIPE installation process.

      Select CUSTOM driver compilation option and choose:
          DEF <enter>
          MPAPI <enter>
          q <enter>


      For the rest of the installation choose default parameters.


    After successful installation proceed to configure you MPAPI X25 API card using:
    /usr/sbin/wancfg_legacy  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 MPAPI X25 API



    Note: wancfg_legacy can only CREATE MPAPI X25 config file.  You cannot use EDIT option.

    Run: /usr/sbin/wancfg_legacy

    1. Create new device

    2. Select wanpipe1

    3. Protocol Section
        Select Protocol: MP Protocol

    4. Hardware Section
        Select Probe Hardware
            Select your S514 or A14X 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)
            
        Rest of the options leave default.

      
    5. Interface Section
        
       Configure Operation Mode to: ANNEXG
                
       X25 Link Setup -->

        Lapb Profile -->

            Create New Lapb Profile -->

                Configure lapb station based on your ISP spec.
                    lapb_station: DTE (default)
                                                  DCE
          
                Configure other parameter based on your
                            ISP specs.

            
        Lapb Interface Cfg -->
        
            Configure Operation mode to: API

        X25 Profile -->

            Create New Lapb Profile -->

                Configure x25 station based on your ISP spec.
                    x25_station: DTE (default)
                                                 DCE
            
                Configure PVC or SVC parameters based on
                            your ISP specs.
                ***Make sure that either PVC or SVC values are set.

                Configure other parameter based on your
                            ISP specs.

        X25 Interface Cfg --->

            Configure Operation modes to: API


    7. Save and Exit


    Start MPAPI X25 API protocol


    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 dispalyed.

        Confirm the Link state

        Confirm that Restart Messages have been
            received and transmitted.

        Check for any error events.

     


    Debugging MPAPI X25 Line


    Before starting with application programming, you must make sure that the x25 protocol has come up and that it has successfuly sent Restart Req/Reply to and from remote switch.

    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.
    "X25 Restart Request Rec" --> "X25 Restart Request": This indicates that X25 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/x25/config

    You should notice the x25 link state for each x25 link. 
    You should see "Link Ready/Connected"


    If you don't see above messages, and x25 is not connected you must check the following:

    1. X25 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 cards back to back, you needa NULL MODEM Cable.
    Or a sangoma back to back S514 cable.

    Custom MPAPI X25 API Application



    A sample API application exists in
    /etc/wanpipe/api/mpapi/x25 directory.

    Read the /etc/wanpipe/api/mpapi/x25/README
    for more info.

    To compile it run:  make

    Run:    ./svc_client  #For placing SVC calls
                ./server_v1   #For accepting SCV calls
               ./pvc_clinet  #For working with PVCs


    API ./svc_client USAGE:

    ./svc_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_legacy creates the following file in:

    /etc/wanpipe/wanpipe1.conf


    ----- CUT HERE------

    #================================================
    # WANPIPE1 Configuration File
    #================================================
    #
    # Date: Fri Dec  9 17:53:35 EST 2005
    #
    # 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, , ANNEXG, Comment
    w1clapb = wanpipe1, ,API, lapb, lapb.wp1mp, ,  
    w1cs1 = wanpipe1, , API, x25, x25.wp1mp


    [wanpipe1]
    CARD_TYPE     = S51X
    S514CPU     = A
    AUTO_PCISLOT    = NO
    PCISLOT     = 19
    PCIBUS        = 0
    Firmware    = /etc/wanpipe/firmware/cdual514.sfm
    CommPort    = PRI
    Interface     = V35
    Clocking     = External
    BaudRate     = 64000
    MTU         = 1500
    UDPPORT     = 9000
    TTL         = 255
    IGNORE_FRONT_END  = NO

    [lapb.wp1mp]
    STATION    = DTE
    T1    = 10
    T2    = 0
    T3    = 100
    T4    = 20
    N2    = 5
    LAPB_MODE = 8
    LAPB_WINDOW  = 7
    MAX_PKT_SIZE = 1024


    [x25.wp1mp]
    STATION    = DTE
    LOWESTPVC        = 0
    HIGHESTPVC    = 0
    LOWESTSVC     = 1
    HIGHESTSVC    = 1
    PACKETWINDOW    = 7
    DFLT_PKT_SIZE     = 1024
    MAX_PKT_SIZE     = 1024

    #-------------------------------------
    #X25 API OPTIONS
    #-------------------------------------
    #DONT_CHK_TX_WIN_ON_DATA_TX            0x0001    
    #-------------------------------------

    X25_API_OPTIONS    = 0x00


    #-------------------------------------
    #X25_PROTOCOL_OPTIONS
    #-------------------------------------
    #
    #registration pragmatics supported
    #REGISTRATION_PRAGMATICS_SUPP            0x0001    
    #
    #A station configured as a DCE will issue
    #Diagnostic packets
    #NO_DIAG_PKTS_ISSUED_BY_DCE            0x0002
    #
    #Restart Request packet is not issued when
    #entering the ABM
    #define NO_RESTART_REQ_ON_ENTER_ABM        0x0004    
    #
    #Asynchronous packet does not include a
    #diagnostic field
    #define NO_DIAG_FIELD_IN_ASYNC_PKTS        0x0008
    #
    #D-bit pragmatics are not supported
    #define D_BIT_PRAGMATICS_NOT_SUPPORTED        0x0010
    #
    #Flow control facilities are automatically
    #inserted in call setup packets
    #define AUTO_FLOW_CTRL_PARM_FACIL_INS         0x0020    
    #
    #A transmitted or received Call Accept packet
    #does not include Address and facilities
    #length field
    #define CALLAC_DOES_NOT_INCL_ADDR_LGTH         0x0040    
    #                                                        
    #All incoming facilities are supported
    #define HANDLE_ALL_INCOMING_FACILS        0x0080    
    #
    #All Incoming facilities are NOT checked
    #and processed
    #define NO_CHK_PROC_INCOMING_FACILS        0x0100    
    #-------------------------------------

    X25_PROTOCOL_OPTIONS    = 0x0090


    #-------------------------------------
    #X25_RESPONSE_OPTIONS
    #-------------------------------------
    #
    #All received Data packets are acknowledged
    #with an RR
    #define ALL_DATA_PKTS_ACKED_WITH_RR        0x0001    
    #
    #Disable the automatic issing of Clear
    #Confirmation packets
    #define DISABLE_AUTO_CLEAR_CONF            0x0002    
    #
    #Disable the automatic issing of Reset
    #Confirmation packets
    #define DISABLE_AUTO_RESET_CONF            0x0004    
    #
    #Disable the automatic issing of Restart
    #Confirmation packets
    #define DISABLE_AUTO_RESTART_CONF        0x0008
    #
    #Disable the automatic issing of Interrupt
    #Confirmation packets
    #define DISABLE_AUTO_INT_CONF            0x0010    
    #-------------------------------------

    X25_RESPONSE_OPTIONS    = 0x01     #Respond RR after every packet improves flow


    #-------------------------------------
    #GEN_FACILITY_1
    #-------------------------------------
    #
    #define FLOW_CTRL_PARM_NEG_SUPP            0x0001
    #define THROUGHPUT_CLASS_NEG_SUPP        0x0002
    #define REV_CHARGING_SUPP            0x0004
    #define FAST_SELECT_SUPP            0x0008
    #define NUI_SELECTION_SUPP            0x0010
    #define CUG_SELECT_BASIC_SUPP            0x0020
    #define CUG_SELECT_EXT_SUPP            0x0040
    #define CUG_OUT_ACC_SEL_BASIC_SUPP        0x0080
    #define CUG_OUT_ACC_SEL_EXT_SUPP        0x0100
    #define BI_CUG_SEL_SUPP                0x0200
    #define RPOA_SEL_BASIC_FORMAT_SUPP        0x0400
    #define RPOA_SEL_EXT_FORMAT_SUPP        0x0800
    #define CALL_DEFLEC_SEL_SUPP            0x1000
    #define CALL_REDIR_DEFLEC_NOTIF_SUPP        0x2000
    #define CALLED_LNE_ADDR_MOD_NOTIF_SUPP        0x4000
    #define TRANSIT_DELAY_SELECT_IND_SUPP        0x8000
    #-------------------------------------

    GEN_FACILITY_1     = 0x01                #Allow only Window Packet facilities


    GEN_FACILITY_2     = 0xFFFF             #This variable is not used

    CCITT_FACILITY     = 0x00                  #This variable is not used
    NON_X25_FACILITY  = 0x00                #This variable is not used
    X25_STATISTICS_OPTIONS    = 0x00   #This variable is not used

    CCITTCOMPAT    = 1988                    #Default do not change

    T10_T20        = 30
    T11_T21        = 30
    T12_T22         = 30
    T13_T23        = 10
    T16_T26        = 30
    T28        = 30
    R10_R20        = 5
    R12_R22        = 5
    R13_R23        = 5

    X25_MODE = 8                        #X25 Modulus Mode [ 8 or 128 ]
    CALL_BACKOFF = 10               #On call collision backoff for 10 seconds
    CALL_LOGGING = YES             #Logs all calls in/out.  Disable for less verbosity


    [wp1mp]
    HDLC_STREAMING    = YES    #Default do not change
    MPPP_PROT    = HDLC           #Default do not change
    IGNORE_DCD    = YES            #Default do not change
    IGNORE_CTS    = YES             #Default do not change


    --------------- CUT HERE------------------

     


    MPAPI X25 configuration for A101/A102/A104/A108


    =================================================================================================================

    In /etc/wanpipe/wanpipe2.conf

    --------------- CUT HERE------------------

    [devices]
    wanpipe2 = WAN_AFT_TE1, Comment

    [interfaces]
    wp2mp = wanpipe2, , ANNEXG, Comment
    w2clapb = wanpipe2, ,API, lapb, lapb.wp2mp, ,
    w2cs1 = wanpipe2, , API, x25, x25.wp2mp
    w2cs2 = wanpipe2, , API, x25, x25.wp2mp
    w2cs3 = wanpipe2, , API, x25, x25.wp2mp
    w2cs4 = wanpipe2, , API, x25, x25.wp2mp
    w2cs5 = wanpipe2, , API, x25, x25.wp2mp
    w2cs6 = wanpipe2, , API, x25, x25.wp2mp
    w2cs7 = wanpipe2, , API, x25, x25.wp2mp
    w2cs8 = wanpipe2, , API, x25, x25.wp2mp
    w2cs9 = wanpipe2, , API, x25, x25.wp2mp
    w2cs10 = wanpipe2, , API, x25, x25.wp2mp

    [wanpipe2]
    CARD_TYPE       = AFT
    S514CPU         = A
    CommPort        = PRI
    AUTO_PCISLOT    = NO
    PCISLOT         = 4
    PCIBUS          = 5
    FE_MEDIA        = E1
    FE_LCODE        = HDB3
    FE_FRAME        = CRC4
    FE_LINE         = 1
    TE_CLOCK        = NORMAL
    TE_REF_CLOCK    = 0
    TE_HIGHIMPEDANCE        = NO
    TE_RX_SLEVEL    = 120
    LBO             = 120OH
    FE_TXTRISTATE   = NO
    MTU             = 1500
    UDPPORT         = 9000
    TTL             = 255
    IGNORE_FRONT_END = NO

    [lapb.wp2mp]
    STATION = DTE
    T1      = 10
    T2      = 0
    T3      = 100
    T4      = 20
    N2      = 5
    LAPB_MODE = 8
    LAPB_WINDOW  = 7
    MAX_PKT_SIZE = 1024

    [x25.wp2mp]
    STATION = DTE
    LOWESTPVC               = 0
    HIGHESTPVC      = 0
    LOWESTSVC       = 1
    HIGHESTSVC      = 10
    PACKETWINDOW    = 7
    DFLT_PKT_SIZE   = 128
    MAX_PKT_SIZE    = 1024
    X25_API_OPTIONS = 0x00
    X25_PROTOCOL_OPTIONS    = 0x00D0
    X25_RESPONSE_OPTIONS    = 0x01
    X25_STATISTICS_OPTIONS  = 0x00
    CCITTCOMPAT     = 1988
    T10_T20         = 30
    T11_T21         = 30
    T12_T22         = 30
    R10_R20         = 5
    R12_R22         = 5
    R13_R23         = 5
    GEN_FACILITY_1  = 0x00
    GEN_FACILITY_2  = 0x00
    CCITT_FACILITY  = 0x00
    NON_X25_FACILITY  = 0x00
    X25_MODE = 8
    CALL_BACKOFF = 10
    CALL_LOGGING = NO

    [wp2mp]
    HDLC_STREAMING  = YES
    ACTIVE_CH       = 1

    --------------- CUT HERE------------------

    ==================================================================================================================

    ==================================================================================================================

    In /etc/wanpipe/annexg/wp2mp.lapb

    --------------- CUT HERE------------------

    w2clapb = wanpipe2, ,API, lapb, lapb.wp2mp, ,

    --------------- CUT HERE------------------

    ==================================================================================================================

    ==================================================================================================================

    In /etc/wanpipe/annexg/interface/w2clapd

    --------------- CUT HERE------------------

    DEVICE=w2clapb
    IPADDR=
    NETMASK=255.255.255.0
    POINTOPOINT=
    ONBOOT=yes

    --------------- CUT HERE------------------

    ==================================================================================================================

    ==================================================================================================================

    In /etc/wanpipe/annexg/lapb_profiles/lapb.wp2mp

    --------------- CUT HERE------------------

    [lapb.wp2mp]
    STATION = DTE
    T1      = 10
    T2      = 0
    T3      = 100
    T4      = 20
    N2      = 5
    LAPB_MODE = 8
    LAPB_WINDOW  = 7
    MAX_PKT_SIZE = 1024

    --------------- CUT HERE------------------

    ==================================================================================================================

    ==================================================================================================================

    In /etc/wanpipe/annexg/x25_profiles/x25.wp2mp

    --------------- CUT HERE------------------

    [x25.wp2mp]
    STATION = DTE
    LOWESTPVC               = 0
    HIGHESTPVC      = 0
    LOWESTSVC       = 1
    HIGHESTSVC      = 10
    PACKETWINDOW    = 7
    DFLT_PKT_SIZE   = 128
    MAX_PKT_SIZE    = 1024
    X25_API_OPTIONS = 0x00
    X25_PROTOCOL_OPTIONS    = 0x00D0
    X25_RESPONSE_OPTIONS    = 0x01
    X25_STATISTICS_OPTIONS  = 0x00
    CCITTCOMPAT     = 1988
    T10_T20         = 30
    T11_T21         = 30
    T12_T22         = 30
    T13_T23         = 10
    T16_T26         = 30
    T28             = 30
    R10_R20         = 5
    R12_R22         = 5
    R13_R23         = 5
    GEN_FACILITY_1  = 0x00
    GEN_FACILITY_2  = 0x00
    CCITT_FACILITY  = 0x00
    NON_X25_FACILITY  = 0x00
    X25_MODE = 8
    CALL_BACKOFF = 10
    CALL_LOGGING = NO

    --------------- CUT HERE------------------

    ==================================================================================================================

     


    FAQ

     

    1. Does using MPAPI X25 change the way to perform X25 communication on a programming point of view ( Compared to X25 API with socket programming )?

      The MPAPI X25 API is 99% identical to the original legacy X25 API.  The MPAPI applications use a different header file wanpipe_x25.h instead of sdla_x25.h. 
      The difference is located in socket binding not tx/rx operation. MAPI sample code should be used to develop MPAPI applications. 

      If one is migrating from Legacy X25 API to MPAPI X25, one should change the include file sdla_x25.h -> wanpipe_x25.h  and review sample MPAPI code for call setup changes.

       
    2. Do you have some sample code of a program performing X25 communication using MPAPI X25?

      The MPAPI sample code is located in /etc/wanpipe/api/mpapi/x25 directory.  This directory is created after sucessfull wanpipe MAPI installation. 
       
    3. Do you have some sample config file to have the Wanpipe run X25 communication
      as MPAPI over HDLC firmware?


      The MPAPI X25 configuration files are created using /usr/sbin/wancfg_legacy configuration file. Please read the MPAPI X25 Configuration Section.