//  ==========================================================================
//  
//  @(#) $Id: test2.C,v 1.3 2000/10/13 15:45:51 brian Exp $
//  
//  --------------------------------------------------------------------------
//  
//  Copyright (C) 1997-2000  Brian Bidulock <bidulock@dallas.net>
//  
//  All Rights Reserved.
//  
//  This library is free software; you can redistribute it and/or modify it
//  under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation; either version 2.1 of the License, or (at
//  your option) any later version.
//  
//  This library is distributed in the hope that it will be useful, but
//  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
//  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser Public License
//  for more details.
//  
//  You should have received a copy of the GNU Lesser General Public License
//  along with this library; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// 
//  Last Modified $Date: 2000/10/13 15:45:51 $ by $Author: brian $
// 
//  --------------------------------------------------------------------------
// 
//  $Log: test2.C,v $
//  Revision 1.3  2000/10/13 15:45:51  brian
//  First public release.
//
//  ==========================================================================

static char const ident[] = "$Id: test2.C,v 1.3 2000/10/13 15:45:51 brian Exp $";

#pragma implementation
#include "head.h"

#include "L3_Codec.H"
#include <iostream.h>

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

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

main() {
    Codec_L3 anMSU;
    Codec_L3* MSU = &anMSU;

    int i;

    len4 = 100;

    Codec::rebuild();
    MSU->MP->set(1);
    MSU->NI->set("NAT");
    MSU->RL->OPC->NET->set(4);
    MSU->RL->OPC->CLS->set(6);
    MSU->RL->OPC->MEM->set(4);
    MSU->RL->DPC->NET->set(8);
    MSU->RL->DPC->CLS->set(12);
    MSU->RL->DPC->MEM->set(8);
    MSU->RL->SLS->set(5);
    MSU->SNMM->build();
    MSU->SNMM->CHM->build();
    MSU->SNMM->CHM->COO->build();
    MSU->SNMM->CHM->COO->FSNL->set(57);
    //if (Codec::encode(MSU,fme4,len4)) cout.form("Encoded %d bytes: ",len4);
    //for (i=0;i<len4;i++) cout.form("%x ",fme4[i]); cout << "\n";
    //Codec::report(MSU); cout << '\n';
    //if (Codec::decode(MSU,fme4,len4)) cout.form("Decoded %d bytes.\n",len4);
    Codec::encode(MSU,fme4,len4);
    Codec::decode(MSU,fme4,len4);
    Codec::report(MSU); cout << '\n';

    len4 = 100;

    Codec::rebuild();
    MSU->MP->set(1);
    MSU->NI->set("NAT");
    MSU->RL->OPC->NET->set(4);
    MSU->RL->OPC->CLS->set(6);
    MSU->RL->OPC->MEM->set(4);
    MSU->RL->DPC->NET->set(8);
    MSU->RL->DPC->CLS->set(12);
    MSU->RL->DPC->MEM->set(8);
    MSU->RL->SLS->set(5);
    MSU->SCCP->build();
    MSU->SCCP->PDU->set(fme5,len5);
    Codec::encode(MSU,fme4,len4);
    Codec::decode(MSU,fme4,len4);
    //if (Codec::encode(MSU,fme4,len4)) cout.form("Encoded %d bytes: ",len4);
    //for (i=0;i<len4;i++) cout.form("%x ",fme4[i]); cout << "\n";
    //Codec::report(MSU); cout << '\n';
    //if (Codec::decode(MSU,fme4,len4)) cout.form("Decoded %d bytes.\n",len4);
    Codec::report(MSU); cout << '\n';

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

