]> www.vanbest.org Git - sasc-ng.git/commitdiff
cardclient-cccam2: allow static node ID from config
authorleslie <unknown>
Mon, 14 Sep 2009 03:16:48 +0000 (11:16 +0800)
committerleslie <unknown>
Mon, 14 Sep 2009 03:16:48 +0000 (11:16 +0800)
examples/cardclient.conf.example
systems/cardclient/cccam2.c

index efb9c01d7e7f3ae26891c47b2461b6e2f79a6373..e6db6d0881dbb905025657c3a41072bc0e4f2235 100644 (file)
@@ -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]
index 72c27693c0dcb5826e8b0ed7da7831b1f964a326..6a010c2973daeb5c37f2de7ce551563ba7333e8a 100644 (file)
@@ -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; i<sizeof(nodeid); i++) nodeid[i]=rand();
+  if(n>2) {
+    const char *tmp=ni;
+    if(GetHex(tmp,nodeid,sizeof(nodeid),false)!=sizeof(nodeid)) return false;
+    }
+  else
+    for(unsigned int i=0; i<sizeof(nodeid); i++) nodeid[i]=rand();
   LDUMP(L_CC_CORE,nodeid,sizeof(nodeid),"Our nodeid:");
   return Immediate() ? Login() : true;
 }