]> www.vanbest.org Git - sasc-ng.git/commitdiff
switch cardclient.conf to new loader code
authormirv <unknown>
Fri, 4 Jan 2008 18:22:19 +0000 (19:22 +0100)
committermirv <unknown>
Fri, 4 Jan 2008 18:22:19 +0000 (19:22 +0100)
systems/cardclient/cc.c
systems/cardclient/cc.h

index 0eb6b30441a8587b4922ed43ab6cfba84c3b9c84..797d0fcac78a49959be67bfcdc94ce895154f934 100644 (file)
@@ -17,7 +17,6 @@
  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
  */
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -160,14 +159,13 @@ cCardClientLink::cCardClientLink(const char *Name)
 
 // -- cSystemLinkCardClient -----------------------------------------------------------
 
-class cSystemLinkCardClient : public cSystemLink, private cConfRead, cSimpleList<cCardClient> {
+class cSystemLinkCardClient : public cSystemLink, public cStructListPlain<cCardClient> {
 protected:
-  virtual bool ParseLine(const char *line, bool fromCache);
+  virtual bool ParseLinePlain(char *line);
 public:
   cSystemLinkCardClient(void);
   virtual bool CanHandle(unsigned short SysId);
   virtual cSystem *Create(void);
-  virtual bool Init(const char *cfgdir);
   virtual void Clean(void);
   cCardClient *FindBySysId(unsigned short id, cCardClient *cc);
   };
@@ -236,6 +234,7 @@ void cSystemCardClient::ProcessEMM(int pid, int caid, unsigned char *buffer)
 
 cSystemLinkCardClient::cSystemLinkCardClient(void)
 :cSystemLink(SYSTEM_NAME,SYSTEM_PRI)
+,cStructListPlain<cCardClient>("cardclient config",CONF_FILE,SL_MISSINGOK|SL_VERBOSE|SL_NOPURGE)
 {
   opts=new cOpts(SYSTEM_NAME,1);
   opts->Add(new cOptBool("Immediate",trNOOP("Cardclient: connect immediately"),&immediate));
@@ -243,12 +242,11 @@ cSystemLinkCardClient::cSystemLinkCardClient(void)
 
 cCardClient *cSystemLinkCardClient::FindBySysId(unsigned short id, cCardClient *cc)
 {
-  if(cc) cc=Next(cc); else cc=First();
-  while(cc) {
-    if(cc->CanHandle(id)) return cc;
-    cc=Next(cc);
-    }
-  return 0;
+  ListLock(false);
+  for(cc=cc ? Next(cc):First(); cc; cc=Next(cc)) 
+    if(cc->CanHandle(id)) break;
+  ListUnlock();
+  return cc;
 }
 
 bool cSystemLinkCardClient::CanHandle(unsigned short SysId)
@@ -261,15 +259,7 @@ cSystem *cSystemLinkCardClient::Create(void)
   return new cSystemCardClient();
 }
 
-bool cSystemLinkCardClient::Init(const char *cfgdir)
-{
-  Clear();
-  ConfRead("cardclient config",AddDirectory(cfgdir,CONF_FILE));
-  PRINTF(L_CC_CORE,"created %d client(s)",Count());
-  return true;
-}
-
-bool cSystemLinkCardClient::ParseLine(const char *line, bool fromCache)
+bool cSystemLinkCardClient::ParseLinePlain(char *line)
 {
   char name[32];
   int num;
@@ -297,5 +287,5 @@ bool cSystemLinkCardClient::ParseLine(const char *line, bool fromCache)
 
 void cSystemLinkCardClient::Clean(void)
 {
-  Clear();
+  ListLock(true); Clear(); ListUnlock();
 }
index ee81783806124e0dd6a88d1a6a60b99737a62553..2cc117a9d197d942a17925efded8469854560a1f 100644 (file)
@@ -50,7 +50,7 @@ class cSystemCardClient;
 
 #define MAX_CC_CAID 16
 
-class cCardClient : public cSimpleItem, protected cMutex {
+class cCardClient : public cStructItem, protected cMutex {
 friend class cSystemCardClient;
 protected:
   const char *name;