]> www.vanbest.org Git - sasc-ng.git/commitdiff
cardclient-cccam2: change cardclient config line format
authorleslie <unknown>
Sat, 23 Jan 2010 09:30:38 +0000 (10:30 +0100)
committerleslie <unknown>
Sat, 23 Jan 2010 09:30:38 +0000 (10:30 +0100)
examples/cardclient.conf.example
systems/cardclient/cccam2.c

index 6f7f6c754be499fb000c90e17666eee702a898b4..2af65c7ce6d2cdd9fa7b2fa11f82a481e96e3c0f 100644 (file)
@@ -56,12 +56,15 @@ gbox:hostname:port:emm/caid/mask
 cccam:hostname:port:emm/caid/mask:socket
 #
 # (the real) cccam client
-# 'nodeid' is your node ID (16 characters). Optional, defaults to use random ID
-# 'version/build' is the version and build string send to the server (each max.
-#  31 characters). Optional, defaults to 2.0.11/2892
-# If you want to specify version/build but you don't want to specify a node ID,
-# put a * to the node ID field.
+#
+# The parameter field is a list of parameters seperated by ','. The individual
+# parameters must be given in the form PARAMETER=VALUE.
+# NODEID=<16 characters>    - your static node ID. Defaults to random ID
+# VERSION=<str>             - version string. Defaults to '2.0.11'
+# BUILD=<str>               - build string. Defaults to '2892'
+#
+# parameter example: BUILD=3212,NODEID=123A567F901C34E6
 #
 # 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[:nodeid][:version/build]
+cccam2:hostname:port:emm/caid/mask:username:password[:param=value[,param=value]]
index fbb725974f39660da7565dfda5921378000b598d..3ec3484a6fa96e8b0ef56afb573799c02e3a557d 100644 (file)
@@ -727,20 +727,47 @@ bool cCardClientCCcam2::CanHandle(unsigned short SysId)
 bool cCardClientCCcam2::Init(const char *config)
 {
   cMutexLock lock(this);
+  // defaults
   strn0cpy(versstr,"2.0.11",sizeof(versstr));
   strn0cpy(buildstr,"2892",sizeof(buildstr));
+  for(unsigned int i=0; i<sizeof(nodeid); i++) nodeid[i]=rand();
+
   int n=0, num=0;
   Logout();
-  char ni[17];
+  char params[256];
   if(!ParseStdConfig(config,&num)
-     || (n=sscanf(&config[num],":%20[^:]:%63[^:]:%16[^:]:%31[^/]:%31[^:]",username,password,ni,versstr,buildstr))<2 ) return false;
+     || (n=sscanf(&config[num],":%20[^:]:%63[^:]:%255[^:]",username,password,params))<2 ) return false;
   PRINTF(L_CC_CORE,"%s: username=%s password=%s",name,username,password);
-  if(n>2 && strcmp(ni,"*")) {
-    const char *tmp=ni;
-    if(GetHex(tmp,nodeid,sizeof(nodeid),false)!=sizeof(nodeid)) return false;
+  if(n>2) {
+    char *save;
+    char *p=strtok_r(params,",",&save);
+    while(p) {
+      char *v=index(p,'=');
+      if(v) {
+        *v++=0;
+        if(!strcasecmp(p,"NODEID")) {
+          const char *v2=v;
+          if(GetHex(v2,nodeid,sizeof(nodeid),false)!=sizeof(nodeid)) {
+            PRINTF(L_CC_CORE,"NODEID parameter format error");
+            return false;
+            }
+          }
+        else if(!strcasecmp(p,"VERSION"))
+          strn0cpy(versstr,v,sizeof(versstr));
+        else if(!strcasecmp(p,"BUILD"))
+          strn0cpy(buildstr,v,sizeof(buildstr));
+        else {
+          PRINTF(L_CC_CORE,"unknown parameter '%s'",p);
+          return false;
+          }
+        }
+      else {
+        PRINTF(L_CC_CORE,"bad parameter format '%s'",p);
+        return false;
+        }
+      p=strtok_r(0,",",&save);
+      }
     }
-  else
-    for(unsigned int i=0; i<sizeof(nodeid); i++) nodeid[i]=rand();
   LDUMP(L_CC_CORE,nodeid,sizeof(nodeid),"our nodeid:");
   PRINTF(L_CC_CORE,"pretended CCcam version '%s' build '%s'",versstr,buildstr);
   return true;