📄 svcriter.cpp
字号:
{stat=comparespcode(msg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 9://CIC
stat=NOPASS;
msg=bmsg+6; //msg-->slc
if (numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
if ((BUFSETMEM[varno]!=*msg)
||(BUFSETMEM[varno+1]!= (*(msg+1)&0x0f)) )
stat=NOPASS;
crit +=5; //crit-->OR/AND/0xaa
}
else //compare with criteria
{stat=compare12bitscode(msg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 10: //H1H0
selecth1h0=0xff;
msg=bmsg+8; //msg-->H1H0
head=*msg; //get h1h0
stat=compare8bitscode(msg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
case 11:
stat=NOPASS;
if (selecth1h0==0xff)//have select H1H0
{msg=bmsg+9;
if(head==0x41)//SAO
{ code=*msg&0x0f; //ADDR:D3-D0,IN SAO
stat=compare(&code,crit+2,0);
}//SAO
else if (head==0x14)//ACM
{ code=*msg; //MIN:8BITS,IN ACM
stat=compare(&code,crit+2,0);
}//ACM
}//have select H1H0
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
case 12:
stat=NOPASS;
if (selecth1h0==0xff)//have select H1H0
{if((head==0x31)&&((*bmsg+9)&0xf0))//SAM and BNOA!=0
stat=compareaddr(bmsg+10,crit); //BADDR in SAM
else if (head==0xf5)
stat=comparespcode(bmsg+10,crit);//SPCODE in EUM
}//have select H1H0
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
//BADDR in IAM\IAI
case 14:
stat=NOPASS;
if ((selecth1h0==0xff) && //have select H1H0
((head==0x11)||(head==0x21)) ) //IAM or IAI
{msg=bmsg+11; //msg-->BNOA
if((*msg&0xf0)!=0) stat=compareaddr(msg+1,crit);//BNOA!=0
}//have select H1H0,and IAM\IAI
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
//AADDR in GSM
case 15:
stat=NOPASS;
if ((selecth1h0==0xff)&&(head==0x12))//have select H1H0,GSM
{msg=bmsg+9; //msg-->ATIN
if (*msg&0x02) //exist AADDR
{msg++; //msg-->ANOR or CLGPC
if(*msg&0x01) msg++; //exist CLGPC
if (*msg&0xf0) stat=compareaddr(msg+1,crit);//ANOA!=0
}//exist AADDR
}//have select H1H0,GSM
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
//TXID in GSM
case 18:
stat=NOPASS;
if ((selecth1h0==0xff)&&(head==0x12))//have select H1H0,GSM
{msg=bmsg+9; //msg-->ATIN
c=*msg; //get ATIN
if ((c&0x04)==0x04) //exist TXID
{msg++; //msg-->ANOR or CLGPC
if(c&0x01) msg++; //exist CLGPC,msg-->ANOA
if(c&0x02) {c=*msg++; msg +=(c&0xf0+0x10)/0x20;}
c=*msg; //get EXLIN
if ((c&0xf0)==0) stat=comparespcode(msg+1,crit);
else stat=compareaddr(msg+1,crit);
}//exist TXID
}//have select H1H0,GSM
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
//AADDR in IAI
case 22:
stat=NOPASS;
if ((selecth1h0==0xff)&&(head==0x21))//have select H1H0,IAI
{msg=bmsg+11; //msg-->BNOA
c=*msg++; msg +=(c&0xf0+0x10)/0x20; //si-->IN1
c=*msg++; //get IN1
if (c&0x10) //exist AADDR
{if(c&0x01) msg++;
if(c&0x02) msg +=5; //exist CUGIN
if(c&0x04) msg +=BYTEOFACUIN;//exist ACUIN
if(c&0x08) msg +=BYTEOFAPIN;
c=*msg; //get ANOA
if(c*0xf0) stat=compareaddr(msg+1,crit);//ANOA!=0
}//exist AADDR
}//have select H1H0,IAI
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
//OADDR in GSM
case 23:
stat=NOPASS;
if ((selecth1h0==0xff)&&(head==0x12))//have select H1H0,GSM
{msg=bmsg+9; //msg-->ATIN
c=*msg; //get ATIN
if ((c&0x08)==0x08) //exist OADDR
{msg++; //msg-->ANOR or CLGPC
if(c&0x01) msg++; //exist CLGPC,msg-->ANOA
if(c&0x02) {c=*msg++; msg +=(c&0xf0+0x10)/0x20;}
if(c&0x04) //exist TXID
{c=*msg++; //get EXLIN
if ((c&0x0f)==0) msg+=3;
else {c=*msg++; msg +=(c&0xf0+0x10)/0x20;}
}//exist TXID
c=*msg++; //get FLIN
msg += c/0x10; //msg-->ONOA
c=*msg++; //get ONOA
if ((c&0xf0)==0) stat=comparespcode(msg,crit);
}//exist OADDR
}//have select H1H0,GSM
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
//OADDR in IAI
case 25:
stat=NOPASS;
if ((selecth1h0==0xff)&&(head==0x21))//have select H1H0,IAI
{msg=bmsg+11; //msg-->BNOA
c=*msg++; msg +=(c&0xf0+0x10)/0x20; //si-->IN1
c=*msg++; //get IN1
if (c&0x20) //exist OADDR
{if(c&0x01) msg++;
if(c&0x02) msg +=5; //exist CUGIN
if(c&0x04) msg +=BYTEOFACUIN;//exist ACUIN
if(c&0x08) msg +=BYTEOFAPIN;
if(c&0x10) //exist AADDR
{c=*msg++; msg += (c&0xf0+0x10)/0x20; }//get ANOA
c=*msg; //get ONOA
if(c*0xf0) stat=compareaddr(msg+1,crit);//ANOA!=0
}//exist OADDR
}//have select H1H0,IAI
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
default:stat=NOPASS; break;
}//switch
crit++; //crit-->F7/F8/AA
if((stat!=PASS && *crit==0xf8)//the condition isn't pass & and
||(stat==PASS && *crit==0xf7))//the condition is pass & or
break;
else if ((stat==PASS && *crit==0xf8)//condition is pass & OR
||(stat!=PASS && *crit==0xf7))//condition isn't pass & AND
crit++;
} while(*crit!=0xaa);
return stat;
}
u8 SNTmesscri14(u8 *bmsg,u8 *crit)
{
u8 fldno,numofbyte,varno;
u8 stat,code,*msg;
do{
fldno = *crit++;
numofbyte=*(crit+3);
switch (fldno)
{
case 7://DPC
if (numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
if ((BUFSETMEM[varno]!=*bmsg)
||(BUFSETMEM[varno+1]!=(*(bmsg+1)&0x3f) ) )
stat=NOPASS;
crit +=5; //crit-->OR(F7)/AND(F8)/CC
}
else //compare with criteria
{stat=compareDPC14(bmsg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 8://OPC
msg=bmsg+1; //msg-->OPC
if (numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
if ((BUFSETMEM[varno]!=(*msg&0xc0))
||(BUFSETMEM[varno+1]!=*(msg+1))
||(BUFSETMEM[varno+2]!=*(msg+2))) stat=NOPASS;
crit +=5; //crit-->OR/AND/0xaa
}
else //compare with criteria
{stat=compareOPC14(msg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 9://SLC
msg=bmsg+3; //msg-->slc
if (numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
if (BUFSETMEM[varno]!=(*msg&0xf0)) stat=NOPASS;
crit +=5; //crit-->OR/AND/0xaa
}
else //compare with criteria
{code=*msg&0xf0; code=code>>4;
stat=compare(&code,crit+2,0);;
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 10: //H1H0
code=*(bmsg+4); //get H1H0
stat=compare(&code,crit+2,0);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
default:stat=NOPASS; break;
}//switch
crit++; //crit-->F7/F8/AA
if((stat!=PASS && *crit==0xf8)//the condition isn't pass & and
||(stat==PASS && *crit==0xf7))//the condition is pass & or
break;
else if ((stat==PASS && *crit==0xf8)//condition is pass & OR
||(stat!=PASS && *crit==0xf7))//condition isn't pass & AND
crit++; //crit-->field No.
} while(*crit!=0xaa);
return stat;
}
u8 SNTmesscri(u8 *bmsg,u8 *crit)
{
u8 fldno,numofbyte,varno;
u8 c,stat,code,*msg;
do{
fldno = *crit++;
numofbyte=*(crit+3);
switch (fldno)
{
case 7://DPC
msg=bmsg;
if (numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
crit +=5; //crit-->OR(F7)/AND(F8)/CC
for (c=0;c<3;c++)
if (BUFSETMEM[varno+c]!=*(msg+c)) {stat=NOPASS;break;}
}
else //compare with criteria
{stat=comparespcode(msg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 8://OPC
msg=bmsg+3;
if(numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
crit +=5; //crit-->OR/AND/0xaa
for (c=0;c<3;c++)
if (BUFSETMEM[varno+c]!=*(msg+c)) {stat=NOPASS;break;}
}
else //compare with criteria
{stat=comparespcode(msg,crit);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 9://SLC
msg=bmsg+6; //msg-->slc
if (numofbyte==0)//compare with var
{varno = (*(crit+4))*BYTEOFPVAR;stat=PASS;
if (BUFSETMEM[varno]!=*msg) stat=NOPASS;
crit +=5; //crit-->OR/AND/0xaa
}
else //compare with criteria
{code=*msg&0x0f;
stat=compare(&code,crit+2,0);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
}
break;
case 10: //H1H0
code=*(bmsg+7);
stat=compare(&code,crit+2,0);
if (*(crit+2)==0xf5) numofbyte *=2;//logical sign
crit += 4+numofbyte;//crit-->OR(F7)/AND(F8)/CC
break;
default:stat=NOPASS; break;
}//switch
crit++; //crit-->F7/F8/AA
if((stat!=PASS && *crit==0xf8)//the condition isn't pass & and
||(stat==PASS && *crit==0xf7))//the condition is pass & or
break;
else if ((stat==PASS && *crit==0xf8)//condition is pass & OR
||(stat!=PASS && *crit==0xf7))//condition isn't pass & AND
crit++;
} while(*crit!=0xaa);
return stat;
}
extern u8 MESSCRI2(u8 *msg,u8 *crit);
u8 MESSCRI2(u8 *msg,u8 *crit)
{ u8 stat;
u8 temp8,c;
if(*(u16 *)crit!=0xffff) return(PASS); //not select
msg += 2; //LI
crit +=2; //Signal-Unit-Select
temp8 = *crit++; //crit-->user part
if ((temp8==0||temp8>4)) stat=NOPASS;
else if (temp8==4) stat=PASS; //pass all
else if (temp8==1) //no FISU
{if(*msg>2) return PASS;
else return NOPASS;
}//else:noFISU
else if (temp8==2) //LSSU
{stat=NOPASS;
if((*msg==1)||(*msg==2))
{if ((*crit==0xaa) || ((*crit-1)==*(msg+1))) return(PASS);}
}//LSSU
else if (temp8==3) //MSU
{ stat=NOPASS;
temp8= *msg++; //get LI
if (temp8>3)//LI>3
{temp8=*crit++; //get user part and crit-->EE
if(temp8==0xaa) //the criteria is end
return PASS;
if (temp8==1)//select SNM
{c=*msg++; //get SIO to c and msg-->DPC
if((c&0x0f)!=0x00) return NOPASS;
temp8=*crit++; //get EE and crit-->AA\F8
if(temp8==0xee && *crit==0xaa) return PASS; //crit is end
crit++; //crit-->field No
if ((c&0x0f)==0) //the message is SNM
{if ((c&0xf0)!=0xc0) stat=SNTmesscri(msg,crit);
else stat=SNTmesscri14(msg,crit);
}//the message is SNM
}//select SNM
else if (temp8==2)//select SNT
{c=*msg++; //get SIO to c and msg-->DPC
if((c&0x0f)!=0x01) return NOPASS;
temp8=*crit++; //get EE and crit-->AA\F8
if(temp8==0xee && *crit==0xaa) return PASS; //crit is end
crit++; //crit-->field No
if ((c&0x0f)==1) //the message is SNT
{if ((c&0xf0)!=0xc0) stat=SNTmesscri(msg,crit);
else stat=SNTmesscri14(msg,crit);
}//the message is SNT
}//select SNT
else if (temp8==3)//select SCCP
{c=*msg++; //get SIO to c and msg-->DPC
if((c&0x0f)!=0x03) return NOPASS;
temp8=*crit++; //get EE and crit-->AA\F8
if(temp8==0xee && *crit==0xaa) return PASS; //crit is end
crit++; //crit-->field No
if ((c&0x0f)==3) //the message is SCCP
{if ((c&0xf0)!=0xc0) stat=SCCPmesscri(msg,crit);
else stat=SCCPmesscri14(msg,crit);
}//the message is SCCP
}//select SCCP
else if (temp8==4)//select TUP
{c=*msg++; //get SIO to c and msg-->DPC
if((c&0x0f)!=0x04) return NOPASS;
temp8=*crit++; //get EE and crit-->AA\F8
if(temp8==0xee && *crit==0xaa) return PASS; //crit is end
crit++; //crit-->field No
if ((c&0x0f)==4) //the message is SNM
{if ((c&0xf0)!=0xc0) stat=TUPmesscri(msg,crit);
else stat=TUPmesscri14(msg,crit);
}//the message is TUP
}//select TUP
else if (temp8==5)//select ISUP
{c=*msg++; //get SIO to c and msg-->DPC
if((c&0x0f)!=0x05) return NOPASS;
temp8=*crit++; //get EE and crit-->AA\F8
if(temp8==0xee && *crit==0xaa) return PASS; //crit is end
crit++; //crit-->field No
if ((c&0x0f)==5) //the message is ISUP
{if ((c&0xc0)!=0xc0) stat=ISUPmesscri(msg,crit);
else stat=ISUPmesscri14(msg,crit);
}//the message is TSUP
}//select ISUP
else if (temp8==6)//select DUP
{c=*msg++; //get SIO to c and msg-->DPC
if((c&0x0f)!=0x06 && (c&0x0f)!=0x07) return NOPASS;
temp8=*crit++; //get EE and crit-->AA\F8
if(temp8==0xee && *crit==0xaa) return PASS; //crit is end
crit++; //crit-->field No
if ((c&0x0f)==6) //the message is DUP
{if ((c&0xf0)!=0xc0) stat=DUPmesscri(msg,crit);
else stat=DUPmesscri14(msg,crit);
}//the message is DUP
}//select DUP
}//else LI>3
}
return stat;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -