From 25e4f7a967298b0c0b99a9875ce4edadd3cfbd40 Mon Sep 17 00:00:00 2001 From: leslie Date: Mon, 14 Sep 2009 11:16:48 +0800 Subject: [PATCH] cardclient-cccam2: allow static node ID from config --- examples/cardclient.conf.example | 3 ++- systems/cardclient/cccam2.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/cardclient.conf.example b/examples/cardclient.conf.example index efb9c01..e6db6d0 100644 --- a/examples/cardclient.conf.example +++ b/examples/cardclient.conf.example @@ -56,7 +56,8 @@ gbox:hostname:port:emm/caid/mask cccam:hostname:port:emm/caid/mask:socket # # (the real) cccam client +# 'nodeid' is your node ID (16characters). Optional, defaults to use random ID # # NOTE: this is a real client. You don't need to have CCcam running on local # machine. -cccam2:hostname:port:emm/caid/mask:username:password +cccam2:hostname:port:emm/caid/mask:username:password[:nodeid] diff --git a/systems/cardclient/cccam2.c b/systems/cardclient/cccam2.c index 72c2769..6a010c2 100644 --- a/systems/cardclient/cccam2.c +++ b/systems/cardclient/cccam2.c @@ -699,12 +699,18 @@ bool cCardClientCCcam2::CanHandle(unsigned short SysId) bool cCardClientCCcam2::Init(const char *config) { cMutexLock lock(this); - int num=0; + int n=0, num=0; Logout(); + char ni[17]; if(!ParseStdConfig(config,&num) - || sscanf(&config[num],":%20[^:]:%63[^:]",username,password)!=2 ) return false; + || (n=sscanf(&config[num],":%20[^:]:%63[^:]:%16[^:]",username,password,ni))<2 ) return false; PRINTF(L_CC_CORE,"%s: username=%s password=%s",name,username,password); - for(unsigned int i=0; i2) { + const char *tmp=ni; + if(GetHex(tmp,nodeid,sizeof(nodeid),false)!=sizeof(nodeid)) return false; + } + else + for(unsigned int i=0; i