OpenSS7
SS7 for the
Common Man

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified:

Home Overview Status News Documentation Resources About
   
 Overview
 Status
 News
 Documentation
 Resources
 About

   
Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> ss7codec/test1.cpp


File /code/ss7codec/test1.cpp



#include "L2codec.h"
#include <iostream.h>

int len0 = 3; unsigned char fme0[] = { 0x01, 0xfe, 0x00 };
int len1 = 4; unsigned char fme1[] = { 0x01, 0xfe, 0x01, 0x02 };
int len2 = 5; unsigned char fme2[] = { 0x01, 0xfe, 0x02, 0x05, 0x00 };
int len3 = 6; unsigned char fme3[] = { 0x01, 0xfe, 0x03, 0x01, 0x02, 0x03 };

int len4 = 100; unsigned char fme4[100];
int len5 = 6; unsigned char fme5[] = { 1, 2, 3, 4, 5, 6 };

main() {
    Codec_SU anSU;    
    Codec_SU* SU = &anSU;

    char* temp;

    Codec::decode(SU,fme1,len1); Codec::report(SU); cout << '\n';
    if (SU->LSSU->SF->test("SIE")) cout << "Yes, we have an SIE!\n\n";
    if (!SU->LSS2->SF->test("SIB")) cout << "No, we don't have an SIB!\n\n";
    if (SU->LSSU->SF->get(temp)) cout << "We have an " << temp << "\n\n";
    Codec::decode(SU,fme2,len2); Codec::report(SU); cout << '\n';
    if (SU->LSS2->SF->test("SIB")) cout << "Yes, we have an SIB!\n\n";
    if (!SU->LSS2->SF->test("SIE")) cout << "No, we don't have an SIE!\n\n";
    if (SU->LSS2->SF->get(temp)) cout << "We have an " << temp << "\n\n";
    Codec::decode(SU,fme0,len0); Codec::report(SU); cout << '\n';
    Codec::decode(SU,fme3,len3); Codec::report(SU); cout << '\n';

    cout.form("BSNR = %d\n",SU->BSN->value);
    cout.form("BIBR = %d\n",SU->BIB->value);
    cout.form("FSNR = %d\n",SU->FSN->value);
    cout.form("FIBR = %d\n",SU->FIB->value);
    cout.form("LI   = %d\n",SU->LI ->value);

    int i;

    len4 = 100;

    Codec::rebuild();
    SU->BSN->set(41);
    SU->BIB->set(1);
    SU->FSN->set(32);
    SU->FIB->set(0);
    SU->MSU->build();
    SU->MSU->PDU->set(fme5,len5);
    //if (Codec::encode(SU,fme4,len4)) cout.form("Encoded %d bytes: ",len4);
    //for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n";
    //Codec::report(SU); cout << '\n';
    //if (Codec::decode(SU,fme4,len4)) cout.form("Decoded %d bytes.\n",len4);
    Codec::encode(SU,fme4,len4);
    Codec::decode(SU,fme4,len4);
    Codec::report(SU); cout << '\n';

    len4 = 100;

    Codec::rebuild();
    SU->BSN->set(42);
    SU->BIB->set(0);
    SU->FSN->set(33);
    SU->FIB->set(1);
    SU->LSSU->build();
    SU->LSSU->SF->set("SIPO");
    //if (Codec::encode(SU,fme4,len4)) cout.form("Encoded %d bytes: ",len4);
    //for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n";
    //Codec::report(SU); cout << '\n';
    //if (Codec::decode(SU,fme4,len4)) cout.form("Decoded %d bytes.\n",len4);
    Codec::encode(SU,fme4,len4);
    Codec::decode(SU,fme4,len4);
    Codec::report(SU); cout << '\n';

    len4 = 100;

    Codec::rebuild();
    SU->BSN->set(43);
    SU->BIB->set(1);
    SU->FSN->set(34);
    SU->FIB->set(0);
    SU->LSSU->build();
    SU->LSSU->SF->set("SIOS");
    //if (Codec::encode(SU,fme4,len4)) cout.form("Encoded %d bytes: ",len4);
    //for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n";
    //Codec::report(SU); cout << '\n';
    //if (Codec::decode(SU,fme4,len4)) cout.form("Decoded %d bytes.\n",len4);
    Codec::encode(SU,fme4,len4);
    Codec::decode(SU,fme4,len4);
    Codec::report(SU); cout << '\n';

    len4 = 100;

    Codec::rebuild();
    SU->BSN->set(44);
    SU->BIB->set(0);
    SU->FSN->set(35);
    SU->FIB->set(1);
    SU->LSS2->build();
    SU->LSS2->SF->set("SIB");
    //if (Codec::encode(SU,fme4,len4)) cout.form("Encoded %d bytes: ",len4);
    //for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n";
    //Codec::report(SU); cout << '\n';
    //if (Codec::decode(SU,fme4,len4)) cout.form("Decoded %d bytes.\n",len4);
    Codec::encode(SU,fme4,len4);
    Codec::decode(SU,fme4,len4);
    Codec::report(SU); cout << '\n';

    cout << "...Done.\n";
    cout.flush();
    exit(0);
};



Home Index Prev Next More Download Info FAQ Mail   Home -> Resources -> Browse Source -> ss7codec/test1.cpp

OpenSS7
SS7 for the
Common Man
Home Overview Status News Documentation Resources About

© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved.
Last modified: