From: leslie Date: Mon, 5 Sep 2011 22:58:34 +0000 (+0800) Subject: cardclient: add bunghole's disable EMM caching option patch X-Git-Tag: upstream/620~33 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=2692c888cd0d567b14c5106e750645a8ba39d8ce;p=sasc-ng.git cardclient: add bunghole's disable EMM caching option patch --- diff --git a/examples/cardclient.conf.example b/examples/cardclient.conf.example index 1bc98d4..9de35e0 100644 --- a/examples/cardclient.conf.example +++ b/examples/cardclient.conf.example @@ -5,7 +5,7 @@ # 'hostname' is the name of the server # 'port' is the port on the server # 'emm' is a flag to allow EMM transfers to the server -# (0=disabled 1=enabled) +# (0=disabled 1=enabled 2=enabled without caching) # 'caid' (optional) caid on which this client should work # 'mask' (optional) mask for caid e.g. caid=1700 mask=FF00 would allow # anything between 1700 & 17FF. diff --git a/systems/cardclient/aroureos.c b/systems/cardclient/aroureos.c index 75b16f4..d47aece 100644 --- a/systems/cardclient/aroureos.c +++ b/systems/cardclient/aroureos.c @@ -86,7 +86,7 @@ bool cCardClientAroureos::ProcessEMM(int caSys, const unsigned char *source) if(MatchEMM(source)) { const int length=SCT_LEN(source); int id=msEMM.Get(source,length,0); - if(id>0) { + if(id>0 || emmAllowed>1) { unsigned char *buff=AUTOMEM(length+8); memcpy(buff,"EMM",3); memcpy(&buff[3],source,length); diff --git a/systems/cardclient/camd.c b/systems/cardclient/camd.c index 1182aa9..49219e0 100644 --- a/systems/cardclient/camd.c +++ b/systems/cardclient/camd.c @@ -182,7 +182,7 @@ bool cCardClientCommon::ProcessEMM(int caSys, const unsigned char *source) if(MatchEMM(source)) { const int length=SCT_LEN(source); int id=msEMM.Get(source,length,0); - if(id>0) { + if(id>0 || emmAllowed>1) { unsigned char *buff=AUTOMEM(length+32); buff[0]=0x03; buff[1]=(caSys>>8); @@ -654,7 +654,7 @@ bool cCardClientCamd35::ProcessEMM(int caSys, const unsigned char *data) if(len+off<=255) { memcpy(&cb->data[off],data,len); int id=msEMM.Get(&cb->data[0],len+off,0); - if(id>0) { + if(id>0 || emmAllowed>1) { SendBlock(cb,len+off); msEMM.Cache(id,true,0); } diff --git a/systems/cardclient/cc.c b/systems/cardclient/cc.c index 2fb4f46..557737b 100644 --- a/systems/cardclient/cc.c +++ b/systems/cardclient/cc.c @@ -56,7 +56,7 @@ cCardClient::cCardClient(const char *Name) ,msEMM(32,0) { name=Name; - emmAllowed=false; emmCaid[0]=0x1700; emmMask[0]=0xFF00; numCaid=1; + emmAllowed=0; emmCaid[0]=0x1700; emmMask[0]=0xFF00; numCaid=1; } bool cCardClient::Immediate(void) @@ -74,7 +74,8 @@ bool cCardClient::ParseStdConfig(const char *config, int *num) int n, emm=0; if(!num) num=&n; if(sscanf(config,"%63[^:]:%d:%d%n",hostname,&port,&emm,num)<3) return false; - if(emm>0) emmAllowed=true; + if(emm>0) emmAllowed=1; + if(emm==2) emmAllowed=2; // EMM caching disabled if(config[*num]=='/') { numCaid=0; do { diff --git a/systems/cardclient/cc.h b/systems/cardclient/cc.h index de968e0..aa97b7d 100644 --- a/systems/cardclient/cc.h +++ b/systems/cardclient/cc.h @@ -63,7 +63,7 @@ protected: const char *name; char hostname[64]; int port; - bool emmAllowed; + int emmAllowed; int emmCaid[MAX_CC_CAID], emmMask[MAX_CC_CAID], numCaid; cMsgCache msECM, msEMM; // diff --git a/systems/cardclient/cccam2.c b/systems/cardclient/cccam2.c index c6d5401..c676f60 100644 --- a/systems/cardclient/cccam2.c +++ b/systems/cardclient/cccam2.c @@ -1236,7 +1236,7 @@ bool cCardClientCCcam2::ProcessEMM(int caSys, const unsigned char *data) while((d=ad.Assembled())) { int len=SCT_LEN(d); int id=s->Cache()->Get(d,len,0); - if(id>0) { + if(id>0 || emmAllowed>1) { if(len<256) { unsigned char bb[sizeof(struct EmmRequest)+256]; struct EmmRequest *req=(struct EmmRequest *)bb; diff --git a/systems/cardclient/newcamd.c b/systems/cardclient/newcamd.c index 5a08419..d9ea173 100644 --- a/systems/cardclient/newcamd.c +++ b/systems/cardclient/newcamd.c @@ -508,7 +508,7 @@ bool cCardClientNewCamd::ProcessEMM(int caSys, const unsigned char *data) while((data=ad.Assembled())) { int len=SCT_LEN(data); int id=msEMM.Get(data,len,0); - if(id>0) { + if(id>0 || emmAllowed>1) { if(SendMessage(data,len,true,0)) { unsigned char buffer[CWS_NETMSGSIZE]; len=ReceiveMessage(buffer,true); diff --git a/systems/cardclient/radegast.c b/systems/cardclient/radegast.c index 4b80078..9c43e58 100644 --- a/systems/cardclient/radegast.c +++ b/systems/cardclient/radegast.c @@ -284,7 +284,7 @@ bool cCardClientRadegast::ProcessEMM(int caSys, const unsigned char *data) while((data=ad.Assembled())) { int len=SCT_LEN(data); int id=msEMM.Get(data,len,0); - if(id>0) { + if(id>0 || emmAllowed>1) { unsigned char buff[512]; StartMsg(buff,0x41); // AddNano(buff,0x42,2,caSys); // EMM_CAID