OpenSS7 SS7 for the Common Man |
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |
||||||||||||||||||||||||||
Home | Overview | Status | News | Documentation | Resources | About | |||||||||||||||||||||
File /code/ss7codec/test3.cpp#include "SCCPcodec.h" #include <iostream.h> int len4 = 1000; unsigned char fme4[1000]; int len5 = 6; unsigned char fme5[] = { 1, 2, 3, 4, 5, 6 }; int len6 = 5; unsigned char fme6[] = { 0x04, 0x43, 0x36, 0x65, 0x78 }; main() { Codec_SCCP anSCCP; Codec_SCCP* SCCP = &anSCCP; int i; len4 = 1000; Codec::rebuild(); SCCP->UDT->build(); SCCP->PCL->build(); SCCP->PCL->PCL->set("PC0"); SCCP->PCL->OPT->set("NSO"); SCCP->CDPA->build(); SCCP->CDPA->CDPA->build(); SCCP->CDPA->CDPA->SPC->set(4,6,4); SCCP->CDPA->CDPA->SSN->build(); SCCP->CDPA->CDPA->GT4->build(); SCCP->CDPA->CDPA->TT->set(252); SCCP->CDPA->CDPA->ES->set("BCDE"); SCCP->CDPA->CDPA->NPLAN->set("ISDN"); SCCP->CDPA->CDPA->NAI->set("NSN"); SCCP->CDPA->CDPA->ADDI->set(fme6,len6); SCCP->CGPA->build(); SCCP->CGPA->CGPA->build(); SCCP->CGPA->CGPA->SPC->set(8,12,8); SCCP->CGPA->CGPA->SSN->build(); SCCP->CGPA->CGPA->GT4->build(); SCCP->CGPA->CGPA->TT->set(252); SCCP->CGPA->CGPA->ES->set("BCDE"); SCCP->CGPA->CGPA->NPLAN->set("ISDN"); SCCP->CGPA->CGPA->NAI->set("NSN"); SCCP->CGPA->CGPA->ADDI->set(fme6,len6); SCCP->UPART->build(); SCCP->UPART->SCMG->build(); SCCP->UPART->SCMG->MTC->set("SOR"); SCCP->UPART->SCMG->ASSN->set("MAP"); SCCP->UPART->SCMG->APC->set(8,12,8); SCCP->UPART->SCMG->SMI->set("ASD"); cout << "Encoding...\n"; if (Codec::encode(SCCP,fme4,len4)) cout.form("Encoded %d bytes: ",len4); for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n"; cout << "Reporting...\n"; Codec::report(SCCP); cout << '\n'; cout << "Decoding...\n"; if (Codec::decode(SCCP,fme4,len4)) cout.form("Decoded %d bytes.\n",len4); //Codec::encode(SCCP,fme4,len4); //Codec::decode(SCCP,fme4,len4); Codec::report(SCCP); cout << '\n'; len4 = 1000; Codec::rebuild(); SCCP->XUDT->build(); SCCP->PCL->build(); SCCP->PCL->PCL->set("PC0"); SCCP->PCL->OPT->set("NSO"); SCCP->CDPA->build(); SCCP->CDPA->CDPA->build(); SCCP->CDPA->CDPA->SPC->set(4,6,4); SCCP->CDPA->CDPA->SSN->build(); SCCP->CDPA->CDPA->GT4->build(); SCCP->CDPA->CDPA->TT->set(252); SCCP->CDPA->CDPA->ES->set("BCDE"); SCCP->CDPA->CDPA->NPLAN->set("ISDN"); SCCP->CDPA->CDPA->NAI->set("NSN"); SCCP->CDPA->CDPA->ADDI->set(fme6,len6); SCCP->CGPA->build(); SCCP->CGPA->CGPA->build(); SCCP->CGPA->CGPA->SPC->set(8,12,8); SCCP->CGPA->CGPA->SSN->build(); SCCP->CGPA->CGPA->GT4->build(); SCCP->CGPA->CGPA->TT->set(252); SCCP->CGPA->CGPA->ES->set("BCDE"); SCCP->CGPA->CGPA->NPLAN->set("ISDN"); SCCP->CGPA->CGPA->NAI->set("NSN"); SCCP->CGPA->CGPA->ADDI->set(fme6,len6); SCCP->UPART->build(); SCCP->UPART->SCMG->build(); SCCP->UPART->SCMG->MTC->set("SOR"); SCCP->UPART->SCMG->ASSN->set("MAP"); SCCP->UPART->SCMG->APC->set(8,12,8); SCCP->UPART->SCMG->SMI->set("ASD"); SCCP->OPARMS->SLR->build(); SCCP->OPARMS->DLR->build(); cout << "Encoding...\n"; if (Codec::encode(SCCP,fme4,len4)) cout.form("Encoded %d bytes: ",len4); for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n"; cout << "Reporting...\n"; Codec::report(SCCP); cout << '\n'; cout << "Decoding...\n"; if (Codec::decode(SCCP,fme4,len4)) cout.form("Decoded %d bytes.\n",len4); //Codec::encode(SCCP,fme4,len4); //Codec::decode(SCCP,fme4,len4); Codec::report(SCCP); cout << '\n'; len4 = 1000; Codec::rebuild(); SCCP->XUDT->build(); Codec** parm = (Codec**)&(SCCP->OPARMS->SLR); for (i=0;i<16;i++) parm[15-i]->build(); if (Codec::encode(SCCP,fme4,len4)) cout.form("Encoded %d bytes: ",len4); for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n"; cout << "Reporting...\n"; Codec::report(SCCP); cout << '\n'; cout << "Decoding...\n"; if (Codec::decode(SCCP,fme4,len4)) cout.form("Decoded %d bytes.\n",len4); cout << "Reporting...\n"; Codec::report(SCCP); cout << '\n'; int j; Codec** msg = (Codec**)&(SCCP->CR); for (j=0;j<18;j++) { len4 = 1000; Codec::rebuild(); msg[j]->build(); if (Codec::encode(SCCP,fme4,len4)) cout.form("Encoded %d bytes: ",len4); for (i=0;i<len4;i++) cout.form("%2x ",fme4[i]&0xff); cout << "\n"; cout << "Reporting...\n"; Codec::report(SCCP); cout << '\n'; cout << "Decoding...\n"; if (Codec::decode(SCCP,fme4,len4)) cout.form("Decoded %d bytes.\n",len4); cout << "Reporting...\n"; Codec::report(SCCP); cout << '\n'; } cout << "...Done.\n"; cout.flush(); exit(0); };
|
|||||||||||||||||||||||||||
OpenSS7 SS7 for the Common Man |
Home | Overview | Status | News | Documentation | Resources | About | ||||||||||||||||||||
© Copyright 1997-2004,OpenSS7 Corporation, All Rights Reserved. |