cdrserver.cpp
来自「MySQL数据库开发源码 值得一看哦」· C++ 代码 · 共 1,492 行 · 第 1/5 页
CPP
1,492 行
puts("CauseCode"); #endif check = MyOperation->setValue("CauseCode",(char*)&tmpcdrptr->CauseCode); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 19: /* Redirection information */ switch (parmlen) { case 1: tmpcdrptr->ReroutingIndicator= (char)buf[x]; tmpcdrptr->USED_FIELDS |= B_ReroutingIndicator; break; case 2: swab(buf+x,buf+x,2); tmpcdrptr->ReroutingIndicator= buf[x]; tmpcdrptr->USED_FIELDS |= B_ReroutingIndicator; break; default : BaseString::snprintf(msg,sizeof(msg),"ERROR: Redirection information has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; #ifdef SETDBG puts("RI"); #endif check = MyOperation->setValue("RI",(char*)&tmpcdrptr->ReroutingIndicator); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); } x+=parmlen; break; case 32: /* User to user information */ if (parmlen != 1) printf("ERROR: User to User information has wrong length %d\n",parmlen); else tmpcdrptr->UserToUserInformation=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_UserToUserInformation; #ifdef SETDBG puts("UserToUserInf"); #endif check = MyOperation->setValue("UserToUserInf",(char*)&tmpcdrptr->UserToUserInformation); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 40: /* Original called number */ bcd_decode2(parmlen,&buf[x],crap); strcpy(tmpcdrptr->OriginalCalledNumber,crap); x=x+(parmlen/2); if (parmlen % 2) x++; tmpcdrptr->USED_FIELDS |= B_OriginalCalledNumber; #ifdef SETDBG puts("ONumber"); #endif check = MyOperation->setValue("ONumber",(char*)&tmpcdrptr->OriginalCalledNumber); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 42: /* User to user indicator */ if (parmlen != 1) printf("ERROR: User to User indicator has wrong length %d\n",parmlen); else tmpcdrptr->UserToUserIndicatior=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_UserToUserIndicatior; #ifdef SETDBG puts("UserToUserInd"); #endif check = MyOperation->setValue("UserToUserInd",(char*)&tmpcdrptr->UserToUserIndicatior); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 63: /* Location number */ bcd_decode2(parmlen,&buf[x],crap); strcpy(tmpcdrptr->LocationCode,crap); x=x+(parmlen/2); if (parmlen % 2) x++; tmpcdrptr->USED_FIELDS |= B_LocationCode; #ifdef SETDBG puts("LocationCode"); #endif check = MyOperation->setValue("LocationCode",(char*)&tmpcdrptr->LocationCode); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 240: /* Calling Partys cataegory */ if (parmlen != 1) printf("ERROR: Calling partys category has wrong length %d\n",parmlen); else tmpcdrptr->NetworkIndicator=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_NetworkIndicator; #ifdef SETDBG puts("NIndicator"); #endif check = MyOperation->setValue("NIndicator",(char*)&tmpcdrptr->NetworkIndicator); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 241: /* Calling Partys cataegory */ if (parmlen != 1) printf("ERROR: Calling partys category has wrong length %d\n",parmlen); else tmpcdrptr->TonASubscriberNumber=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_TonASubscriberNumber; #ifdef SETDBG puts("TonANumber"); #endif check = MyOperation->setValue("TonANumber",(char*)&tmpcdrptr->TonASubscriberNumber); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 242: /* Calling Partys cataegory */ if (parmlen != 1) printf("ERROR: Calling partys category has wrong length %d\n",parmlen); else tmpcdrptr->TonBSubscriberNumber=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_TonBSubscriberNumber; #ifdef SETDBG puts("TonBNumber"); #endif check = MyOperation->setValue("TonBNumber",(char*)&tmpcdrptr->TonBSubscriberNumber); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 243: /* Calling Partys cataegory */ if (parmlen != 1) printf("ERROR: Calling partys category has wrong length %d\n",parmlen); else tmpcdrptr->TonRedirectingNumber=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_TonRedirectingNumber; #ifdef SETDBG puts("TonRNumber"); #endif check = MyOperation->setValue("TonRNumber",(char*)&tmpcdrptr->TonRedirectingNumber); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 244: /* Calling Partys cataegory */ if (parmlen != 1) printf("ERROR: Calling partys category has wrong length %d\n",parmlen); else tmpcdrptr->TonOriginalCalledNumber=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_TonOriginalCalledNumber; #ifdef SETDBG puts("TonONumber"); #endif check = MyOperation->setValue("TonONumber",(char*)&tmpcdrptr->TonOriginalCalledNumber); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 245: /* Calling Partys cataegory */ if (parmlen != 1) printf("ERROR: Calling partys category has wrong length %d\n",parmlen); else tmpcdrptr->TonLocationCode=(char)buf[x]; x+=parmlen; tmpcdrptr->USED_FIELDS |= B_TonLocationCode; #ifdef SETDBG puts("TonLocationCode"); #endif check = MyOperation->setValue("TonLocationCode",(char*)&tmpcdrptr->TonLocationCode); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 252: /* RINParameter Parameter */ switch (parmlen) { case 1: tmpcdrptr->RINParameter=buf[x]; tmpcdrptr->USED_FIELDS |= B_RINParameter; break; case 2: swab(buf+x,buf+x,2); tmpcdrptr->RINParameter = buf[x] << 8; tmpcdrptr->USED_FIELDS |= B_RINParameter; break; default : BaseString::snprintf(msg,sizeof(msg),"ERROR: Rin parameter has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; } x+=parmlen; #ifdef SETDBG puts("RINParameter"); #endif check = MyOperation->setValue("RINParameter",(char*)&tmpcdrptr->RINParameter); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 253: /* OriginatingPointCode */ switch (parmlen) { case 2: swab(buf+x,buf+x,2); memcpy(&tmpcdrptr->OriginatingPointCode,(buf+x),2); tmpcdrptr->USED_FIELDS |= B_OriginatingPointCode; break; case 3: swab(buf+x,buf+x,2); swab(buf+(x+1),buf+(x+1),2); swab(buf+x,buf+x,2); memcpy(&tmpcdrptr->OriginatingPointCode,(buf+x),3); tmpcdrptr->USED_FIELDS |= B_OriginatingPointCode; break; default : BaseString::snprintf(msg,sizeof(msg),"ERROR: OriginatingPointCode parameter has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; } x+=parmlen; #ifdef SETDBG puts("OPC"); #endif check = MyOperation->setValue("OPC",(char*)&tmpcdrptr->OriginatingPointCode); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 254: /* DestinationPointCode */ switch (parmlen) { case 2: swab(buf+x,buf+x,2); memcpy(&tmpcdrptr->DestinationPointCode,(buf+x),2); /* tmpcdrptr->DestinationPointCode = buf[x] << 8; */ tmpcdrptr->USED_FIELDS |= B_DestinationPointCode; break; case 3: swab(buf+x,buf+x,2); swab(buf+(x+1),buf+(x+1),2); swab(buf+x,buf+x,2); memcpy(&tmpcdrptr->DestinationPointCode,(buf+x),3); tmpcdrptr->USED_FIELDS |= B_DestinationPointCode; break; default : BaseString::snprintf(msg,sizeof(msg),"ERROR: DestinationPointCode parameter has wrong length %d\n",parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); break; } x+=parmlen; #ifdef SETDBG puts("DPC"); #endif check = MyOperation->setValue("DPC",(char*)&tmpcdrptr->DestinationPointCode); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; case 255: /* CircuitIdentificationCode */ swab(buf+x,buf+x,2); memcpy(&tmpcdrptr->CircuitIdentificationCode,(buf+x),2); tmpcdrptr->USED_FIELDS |= B_CircuitIdentificationCode; x+=parmlen; #ifdef SETDBG puts("CIC"); #endif check = MyOperation->setValue("CIC",(char*)&tmpcdrptr->CircuitIdentificationCode); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); break; default: printf("ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen); BaseString::snprintf(msg,sizeof(msg),"ERROR: Undefined parmtype %d , previous %d, length %d\n",parmtype,parmtype_prev,parmlen); if ((checkchangelog(log,lognamn))==0) n2log(log,msg); if (parmlen == 0) { x++; } x+=parmlen; break; } parmtype_prev=parmtype; if ((cdrrestlen-x) == 1) { done=TRUE; } } time(&ourtime); if (ourtime != tmptime) { transfer = tmptransfer; tmptransfer = 0; if (++act_index == 30) { act_index = 0; printf("Transfer=%d\n",transfer); printf("Total operations=%d\n",reqcnt); printf("CAS1=%d\n",c1/30); printf("CAS2=%d\n",c2/30); printf("CAS3=%d\n",c3/30); c1=0; c2=0; c3=0; } tmptime = ourtime; } switch (cdrsubtype) { case 0: tmpcdrptr->ClientId = servernum; #ifdef SETDBG puts("ClientId"); #endif check = MyOperation->setValue("ClientId",(char*)&tmpcdrptr->ClientId); if (check == -1) error_handler(MyTransaction->getNdbErrorString()); tmpcdrptr->OurSTART_TIME = ourtime; #ifdef SETDBG puts("OurSTART_TIME"); #endif check = MyOperation->setValue("OurSTART_TIME",(char*)&tmpcdrptr->OurSTART_TIME); if (check == -1)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?