1.时间表调度实验
#include "bconstant.h"
extern "C" _declspec(dllexport) void initSchTable(int ScheduleTable[SchTabLen][SchTabWdh])
{ int i;
for (i=0;i<SchTabLen;i+=(SchTabLen/1))
ScheduleTable[i][0]=1;
for (i=0;i<SchTabLen;i+=(SchTabLen/20))
ScheduleTable[i][1]=1;
for (i=0;i<SchTabLen;i+=(SchTabLen/2))
ScheduleTable[i][2]=1;
return;
}
2.摘挂机检测实验
#include "bconstant.h"
extern "C" _declspec(dllexport) void scanfor200(int linestate200[LINEMAX], int linestate[LINEMAX],UpOnnode * head1,UpOnnode * end1)
{ int i;自然数定义
for(i=0;i<LINEMAX;i++)
{ struct UpOnnode *p=new UpOnnode;
if(linestate200[i]^linestate[i]==1)
{ if (linestate[i]==1)
p->phonestate=ehandup;
el
p->phonestate=ehandon;
end1->next=p;
end1=p;
end1->linenum=i;
end1->next=0;
}
linestate200[i]=linestate[i];
}
return;
}
//此函数不需修改
extern "C" _declspec(dllexport) void freenode(UpOnnode * node)
{
delete node;
}
3.脉冲计数实验
#include "bconstant.h"
int nor_op(int a,int b);
int or_op(int a,int b);
extern "C" _declspec(dllexport) void scanpul(int linestate[LINEMAX],int linestate10[LINEMAX],int change[LINEMAX],int fchange[LINEMAX],int pulnum[LINEMAX])
{int i;
for(i=0;i<LINEMAX;i++)
{change[i]=nor_op(linestate[i],linestate10[i]);
fchange[i]=or_op(fchange[i],change[i]);
if(change[i]&&!linestate10[i])
pulnum[i]= pulnum[i]+1;
linestate10[i]=linestate[i];
}
return;
}
//此函数不需要修改
int nor_op(int a,int b)
{
if(a==b)
return 0;
el
return 1;
}
//此函数不需要修改
int or_op(int a,int b)
{
if((a==0)&&(b==0))
return 0;
el
return 1;
}
4.位间隔识别实验
#include "stdio.h"
#include "bconstant.h"
extern "C" _declspec(dllexport) void scandigit(int linestate[LINEMAX],int linestate100[LINEMAX],int pulnum[LINEMAX],int fchange[LINEMAX],int lfchange[LINEMAX],Digitnode * head2,Digitnode * end2)
{ int i;
for (i=0;i<LINEMAX;i++)
{
if (!fchange[i]&&lfchange[i]&&linestate100[i])
{
struct Digitnode *q=new Digitnode;
q->num=pulnum[i];
q->linenum=i;
end2->next=q;
end2=q;
end2->next=0;
pulnum[i]=0;
}
lfchange[i]=fchange[i];
fchange[i]=0;
linestate100[i]=linestate[i];
}
return;
}
di舞曲//此函数不需要修改
extern "C" _declspec(dllexport) void freedigitnode(Digitnode * b)
{
de
lete b;新生化片
风流去
}
5.软件送音实验
#include "bconstant.h"
extern "C" _declspec(dllexport) int decide_ringtype(Urstate state)
{
// 1:拨号音;2:振铃音;3:回铃音;4:忙音; 5:嚎鸣音;6:空号音;
l型衣帽间switch(state)
{
ca 0:return 1; //主叫摘机
ca 1:return 4; //被叫忙
ca 2:return 4; //通话中对方先挂机
ca 3:return 4; //拨号音超时
ca 4:return 4; //收号定时器超时
ca 5:return 4; //连接定时器超时
ca 6:return 4; //空号音超时
ca 7:return 4; //回铃音定时器超时
ca 8:return 5; //忙音超时
ca 9:return 6; //被叫空号
ca 10:return 2; //(被叫)呼叫进入
ca 11:return 3; //(主叫)被叫接通
break;
}
return 0;
}
6.驱动交换网络实验
#include "bconstant.h"
extern "C" _declspec(dllexport)
void connect_network(int timeslice_tnet[TIMESLICEMAX],int timeslice1,int timeslice2,int tag)
{
if(tag==0)//tag=0表示拆除网络。
{
timeslice_tnet[timeslice1]=0;
timeslice_tnet[timeslice2]=0;
}
el
{
timeslice_tnet[timeslice1]=timeslice2;
timeslice_tnet[timeslice2]=timeslice1;
}
return;
}
3.(1)呼叫建立
#include "pconstant.h"
#include "string.h"
extern "C" _declspec(dllexport) bool tup(char * address, int port_lcn[2],DTERoutTbaleType DTERoutTbale[])
{ int i,j,k;
for (i=0;i<MaxPortNum;i++)
for (j=0;j<MaxAddressNum;j++)
{if (DTERoutTbale[i].Address[j]!=0)
{ if (!strcmp(DTERoutTbale[i].Address[j],address))
{ port_lcn[0]=i;
for (k=0;k<MaxLcnNum;k++)
if (!DTERoutTbale[i].lcn_state[k])
{DTERoutTbale[i].lcn_state[k]=true;
port_lcn[1]=k;
return true;
}
}
}
}
return true;
}
(2)呼叫拆除
#include "pconstant.h"
#include "string.h"
extern "C" _declspec(dllexport) bool clean(char * address, int port_lcn[2],DTERoutTbaleType DTERoutTbale[])
{ int i;
for (i=0;i<MaxAddressNum;i++)
{if (!strcmp(DTERoutTbale[port_lcn[0]].Address[i],address))
{ if (DTERoutTbale[port_lcn[0]].lcn_state[port_lcn[1]])
{DTERoutTbale[port_lcn[0]].lcn_state[port_lcn[1]]=fal;
return true;
}
}
}
return fal;
}
肛肠疾病
(3)分组转发
#include "pconstant.h"
extern "C" _declspec(dllexport) bool pack_switch ( int In_port_lcn[],int Out_port_lcn[], RoutTableType Table[])
{
int i;
for (i=0;i<MaxPortNum;i++)
{ if (Table[i].in_port==In_port_lcn[0])
{Out_port_lcn[0]=Table[i].out_port;
Out_port_lcn[1]=Table[i].out_lcn;
return true;
}
}
return fal;
战略投资者}
ATM
#include "aconstant.h"
extern "
C" _declspec(dllexport) int Atm_switch ( int in_port,int in_vpi, int in_vci ,RoutTableTypeItem RoutTable[])
{ int i;
for (i=0;i<Max_Rout_Line;i++)
{ if (RoutTable[i].in_port==in_port&&RoutTable[i].in_vpi==in_vpi&&RoutTable[i].in_vci==in_vci)
return i;
}
return -1;
}
MPLS
标记请求实验
#include "mplsconstant.h"
extern "C" _declspec(dllexport) struct ReqType req_process(int idnow,struct routertype routenow)
{
ReqType someReqType;
someReqType.iFirstNode=idnow;
someReqType.hop;
someReqType.ipaddress=routenow.ipaddress;
红嘴相思鸟return someReqType;
}
标记分配与分发实验
#include "mplsconstant.h"
extern "C" _declspec(dllexport) struct funcudtype label_process(struct routertype routenow,int labelout,int idnow)
{
funcudtype somefuncud;
somefuncud.libinfo.ipaddress=routenow.ipaddress;
somefuncud.libinfo.inpoint=routenow.inpoint;
somefuncud.libinfo.outpoint=routenow.outpoint;
somefuncud.libinfo.inlabel=2;
somefuncud.libinfo.outlabel=labelout;
somefuncud.labelinfo.iFirstNode=idnow;
somefuncud.labelinfo.iEndNode=routenow.lasthop;
somefuncud.labelinfo.labelvalue=labelout;
return somefuncud;
}
标记分组转发实验
#include "mplsconstant.h"
extern "C" _declspec(dllexport) struct LabelledDataPack pack_process(struct routertype routenow,struct libtype libnow,int idnow)
{
LabelledDataPack someLabelledDataPack;
someLabelledDataPack.iFirstNode=idnow;
someLabelledDataPack.hop;
someLabelledDataPack.DataInfo.ipaddress=routenow.ipaddress;
someLabelledDataPack.DataInfo.labelvalue=libnow.outlabel;
return someLabelledDataPack;
}