This is Unofficial EPICS BASE Doxygen Site
asLib.h File Reference
#include "libComAPI.h"
#include "ellLib.h"
#include "errMdef.h"
#include "errlog.h"
+ Include dependency graph for asLib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  asBase
 
struct  UAGNAME
 
struct  uag
 
struct  HAGNAME
 
struct  hag
 
struct  ASGUAG
 
struct  ASGHAG
 
struct  ASGRULE
 
struct  ASGINP
 
struct  asg
 
struct  asgMember
 
struct  asgClient
 

Macros

#define asCheckGet(asClientPvt)   (!asActive || ((asClientPvt)->access >= asREAD))
 
#define asCheckPut(asClientPvt)   (!asActive || ((asClientPvt)->access >= asWRITE))
 
#define asTrapWriteWithData(asClientPvt, user, host, addr, type, count, data)
 
#define asTrapWriteAfter(pvt)   if (pvt) asTrapWriteAfterWrite(pvt)
 
#define asTrapWriteBefore(asClientPvt, user, host, addr)   asTrapWriteWithData(asClientPvt, user, host, addr, 0, 0, NULL)
 
#define S_asLib_clientsExist   (M_asLib| 1) /*Client Exists*/
 
#define S_asLib_noUag   (M_asLib| 2) /*User Access Group does not exist*/
 
#define S_asLib_noHag   (M_asLib| 3) /*Host Access Group does not exist*/
 
#define S_asLib_noAccess   (M_asLib| 4) /*access security: no access allowed*/
 
#define S_asLib_noModify   (M_asLib| 5) /*access security: no modification allowed*/
 
#define S_asLib_badConfig   (M_asLib| 6) /*access security: bad configuration file*/
 
#define S_asLib_badCalc   (M_asLib| 7) /*access security: bad calculation espression*/
 
#define S_asLib_dupAsg   (M_asLib| 8) /*Duplicate Access Security Group */
 
#define S_asLib_InitFailed   (M_asLib| 9) /*access security: Init failed*/
 
#define S_asLib_asNotActive   (M_asLib|10) /*access security is not active*/
 
#define S_asLib_badMember   (M_asLib|11) /*access security: bad ASMEMBERPVT*/
 
#define S_asLib_badClient   (M_asLib|12) /*access security: bad ASCLIENTPVT*/
 
#define S_asLib_badAsg   (M_asLib|13) /*access security: bad ASG*/
 
#define S_asLib_noMemory   (M_asLib|14) /*access security: no Memory */
 
#define AS_TRAP_WRITE   1
 

Typedefs

typedef struct asgMemberASMEMBERPVT
 
typedef struct asgClientASCLIENTPVT
 
typedef int(* ASINPUTFUNCPTR) (char *buf, int max_size)
 
typedef void(* ASCLIENTCALLBACK) (ASCLIENTPVT, asClientStatus)
 
typedef struct asBase ASBASE
 
typedef struct uag UAG
 
typedef struct hag HAG
 
typedef struct asg ASG
 
typedef struct asgMember ASGMEMBER
 
typedef struct asgClient ASGCLIENT
 

Enumerations

enum  asClientStatus { asClientCOAR }
 
enum  asAccessRights { asNOACCESS, asREAD, asWRITE }
 

Functions

LIBCOM_API long epicsStdCall asInitialize (ASINPUTFUNCPTR inputfunction)
 
LIBCOM_API long epicsStdCall asInitFile (const char *filename, const char *substitutions)
 
LIBCOM_API long epicsStdCall asInitFP (FILE *fp, const char *substitutions)
 
LIBCOM_API long epicsStdCall asInitMem (const char *acf, const char *substitutions)
 
LIBCOM_API long epicsStdCall asAddMember (ASMEMBERPVT *asMemberPvt, const char *asgName)
 
LIBCOM_API long epicsStdCall asRemoveMember (ASMEMBERPVT *asMemberPvt)
 
LIBCOM_API long epicsStdCall asChangeGroup (ASMEMBERPVT *asMemberPvt, const char *newAsgName)
 
LIBCOM_API void *epicsStdCall asGetMemberPvt (ASMEMBERPVT asMemberPvt)
 
LIBCOM_API void epicsStdCall asPutMemberPvt (ASMEMBERPVT asMemberPvt, void *userPvt)
 
LIBCOM_API long epicsStdCall asAddClient (ASCLIENTPVT *asClientPvt, ASMEMBERPVT asMemberPvt, int asl, const char *user, char *host)
 
LIBCOM_API long epicsStdCall asChangeClient (ASCLIENTPVT asClientPvt, int asl, const char *user, char *host)
 
LIBCOM_API long epicsStdCall asRemoveClient (ASCLIENTPVT *asClientPvt)
 
LIBCOM_API void *epicsStdCall asGetClientPvt (ASCLIENTPVT asClientPvt)
 
LIBCOM_API void epicsStdCall asPutClientPvt (ASCLIENTPVT asClientPvt, void *userPvt)
 
LIBCOM_API long epicsStdCall asRegisterClientCallback (ASCLIENTPVT asClientPvt, ASCLIENTCALLBACK pcallback)
 
LIBCOM_API long epicsStdCall asComputeAllAsg (void)
 
LIBCOM_API long epicsStdCall asCompute (ASCLIENTPVT asClientPvt)
 
LIBCOM_API int epicsStdCall asDump (void(*memcallback)(ASMEMBERPVT, FILE *), void(*clientcallback)(ASCLIENTPVT, FILE *), int verbose)
 
LIBCOM_API int epicsStdCall asDumpFP (FILE *fp, void(*memcallback)(ASMEMBERPVT, FILE *), void(*clientcallback)(ASCLIENTPVT, FILE *), int verbose)
 
LIBCOM_API int epicsStdCall asDumpUag (const char *uagname)
 
LIBCOM_API int epicsStdCall asDumpUagFP (FILE *fp, const char *uagname)
 
LIBCOM_API int epicsStdCall asDumpHag (const char *hagname)
 
LIBCOM_API int epicsStdCall asDumpHagFP (FILE *fp, const char *hagname)
 
LIBCOM_API int epicsStdCall asDumpRules (const char *asgname)
 
LIBCOM_API int epicsStdCall asDumpRulesFP (FILE *fp, const char *asgname)
 
LIBCOM_API int epicsStdCall asDumpMem (const char *asgname, void(*memcallback)(ASMEMBERPVT, FILE *), int clients)
 
LIBCOM_API int epicsStdCall asDumpMemFP (FILE *fp, const char *asgname, void(*memcallback)(ASMEMBERPVT, FILE *), int clients)
 
LIBCOM_API int epicsStdCall asDumpHash (void)
 
LIBCOM_API int epicsStdCall asDumpHashFP (FILE *fp)
 
LIBCOM_API void *epicsStdCall asTrapWriteBeforeWithData (const char *userid, const char *hostid, void *addr, int dbrType, int no_elements, void *data)
 
LIBCOM_API void epicsStdCall asTrapWriteAfterWrite (void *pvt)
 
LIBCOM_API long epicsStdCall asComputeAsg (ASG *pasg)
 
LIBCOM_API void *epicsStdCall asCalloc (size_t nobj, size_t size)
 
LIBCOM_API char *epicsStdCall asStrdup (unsigned char *str)
 
LIBCOM_API void asFreeAll (ASBASE *pasbase)
 

Variables

LIBCOM_API int asCheckClientIP
 
LIBCOM_API int asActive
 
LIBCOM_API volatile ASBASEpasbase
 

Macro Definition Documentation

#define AS_TRAP_WRITE   1

Definition at line 190 of file asLib.h.

#define asCheckGet (   asClientPvt)    (!asActive || ((asClientPvt)->access >= asREAD))

Definition at line 43 of file asLib.h.

#define asCheckPut (   asClientPvt)    (!asActive || ((asClientPvt)->access >= asWRITE))

Definition at line 45 of file asLib.h.

#define asTrapWriteAfter (   pvt)    if (pvt) asTrapWriteAfterWrite(pvt)

Definition at line 58 of file asLib.h.

#define asTrapWriteBefore (   asClientPvt,
  user,
  host,
  addr 
)    asTrapWriteWithData(asClientPvt, user, host, addr, 0, 0, NULL)

Definition at line 66 of file asLib.h.

#define asTrapWriteWithData (   asClientPvt,
  user,
  host,
  addr,
  type,
  count,
  data 
)
Value:
((asActive && (asClientPvt)->trapMask) \
? asTrapWriteBeforeWithData((user), (host), (addr), (type), (count), (data)) \
: 0)
LIBCOM_API void *epicsStdCall asTrapWriteBeforeWithData(const char *userid, const char *hostid, void *addr, int dbrType, int no_elements, void *data)
Definition: asTrapWrite.c:113
pvd::StructureConstPtr type
LIBCOM_API int asActive
Definition: asLibRoutines.c:40

Definition at line 54 of file asLib.h.

#define S_asLib_asNotActive   (M_asLib|10) /*access security is not active*/

Definition at line 137 of file asLib.h.

#define S_asLib_badAsg   (M_asLib|13) /*access security: bad ASG*/

Definition at line 140 of file asLib.h.

#define S_asLib_badCalc   (M_asLib| 7) /*access security: bad calculation espression*/

Definition at line 134 of file asLib.h.

#define S_asLib_badClient   (M_asLib|12) /*access security: bad ASCLIENTPVT*/

Definition at line 139 of file asLib.h.

#define S_asLib_badConfig   (M_asLib| 6) /*access security: bad configuration file*/

Definition at line 133 of file asLib.h.

#define S_asLib_badMember   (M_asLib|11) /*access security: bad ASMEMBERPVT*/

Definition at line 138 of file asLib.h.

#define S_asLib_clientsExist   (M_asLib| 1) /*Client Exists*/

Definition at line 128 of file asLib.h.

#define S_asLib_dupAsg   (M_asLib| 8) /*Duplicate Access Security Group */

Definition at line 135 of file asLib.h.

#define S_asLib_InitFailed   (M_asLib| 9) /*access security: Init failed*/

Definition at line 136 of file asLib.h.

#define S_asLib_noAccess   (M_asLib| 4) /*access security: no access allowed*/

Definition at line 131 of file asLib.h.

#define S_asLib_noHag   (M_asLib| 3) /*Host Access Group does not exist*/

Definition at line 130 of file asLib.h.

#define S_asLib_noMemory   (M_asLib|14) /*access security: no Memory */

Definition at line 141 of file asLib.h.

#define S_asLib_noModify   (M_asLib| 5) /*access security: no modification allowed*/

Definition at line 132 of file asLib.h.

#define S_asLib_noUag   (M_asLib| 2) /*User Access Group does not exist*/

Definition at line 129 of file asLib.h.

Typedef Documentation

typedef struct asBase ASBASE
typedef void(* ASCLIENTCALLBACK) (ASCLIENTPVT, asClientStatus)

Definition at line 37 of file asLib.h.

typedef struct asgClient* ASCLIENTPVT

Definition at line 30 of file asLib.h.

typedef struct asg ASG
typedef struct asgClient ASGCLIENT
typedef struct asgMember ASGMEMBER
typedef int(* ASINPUTFUNCPTR) (char *buf, int max_size)

Definition at line 31 of file asLib.h.

typedef struct asgMember* ASMEMBERPVT

Definition at line 29 of file asLib.h.

typedef struct hag HAG
typedef struct uag UAG

Enumeration Type Documentation

Enumerator
asNOACCESS 
asREAD 
asWRITE 

Definition at line 147 of file asLib.h.

Enumerator
asClientCOAR 

Definition at line 32 of file asLib.h.

32  {
33  asClientCOAR /*Change of access rights*/
34  /*For now this is all*/
asClientStatus
Definition: asLib.h:32

Function Documentation

LIBCOM_API long epicsStdCall asAddClient ( ASCLIENTPVT asClientPvt,
ASMEMBERPVT  asMemberPvt,
int  asl,
const char *  user,
char *  host 
)

Definition at line 362 of file asLibRoutines.c.

364 {
365  ASGMEMBER *pasgmember = asMemberPvt;
366  ASGCLIENT *pasgclient;
367  int len, i;
368 
369  long status;
370  if(!asActive) return(S_asLib_asNotActive);
371  if(!pasgmember) return(S_asLib_badMember);
372  pasgclient = freeListCalloc(freeListPvt);
373  if(!pasgclient) return(S_asLib_noMemory);
374  len = strlen(host);
375  for (i = 0; i < len; i++) {
376  host[i] = (char)tolower((int)host[i]);
377  }
378  *pasClientPvt = pasgclient;
379  pasgclient->pasgMember = asMemberPvt;
380  pasgclient->level = asl;
381  pasgclient->user = user;
382  pasgclient->host = host;
383  LOCK;
384  ellAdd(&pasgmember->clientList,&pasgclient->node);
385  status = asComputePvt(pasgclient);
386  UNLOCK;
387  return(status);
388 }
LIBCOM_API void *epicsStdCall freeListCalloc(void *pvt)
Definition: freeListLib.c:60
ASGMEMBER * pasgMember
Definition: asLib.h:231
#define S_asLib_badMember
Definition: asLib.h:138
int asActive
Definition: asLibRoutines.c:40
pvd::Status status
int i
Definition: scan.c:967
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define S_asLib_noMemory
Definition: asLib.h:141
ELLNODE node
Definition: asLib.h:230
const char * user
Definition: asLib.h:232
void ellAdd(ELLLIST *pList, ELLNODE *pNode)
Adds a node to the end of a list.
Definition: ellLib.c:24
int level
Definition: asLib.h:236
char * host
Definition: asLib.h:233
ELLLIST clientList
Definition: asLib.h:224
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asAddMember ( ASMEMBERPVT asMemberPvt,
const char *  asgName 
)

Definition at line 286 of file asLibRoutines.c.

287 {
288  long status;
289 
290  if(!asActive) return(S_asLib_asNotActive);
291  LOCK;
292  status = asAddMemberPvt(pasMemberPvt,asgName);
293  UNLOCK;
294  return(status);
295 }
int asActive
Definition: asLibRoutines.c:40
pvd::Status status
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API void* epicsStdCall asCalloc ( size_t  nobj,
size_t  size 
)

Definition at line 874 of file asLibRoutines.c.

875 {
876  void *p;
877 
878  p=callocMustSucceed(nobj,size,"asCalloc");
879  return(p);
880 }
LIBCOM_API void * callocMustSucceed(size_t count, size_t size, const char *msg)
A calloc() that never returns NULL.
Definition: cantProceed.c:22
LIBCOM_API long epicsStdCall asChangeClient ( ASCLIENTPVT  asClientPvt,
int  asl,
const char *  user,
char *  host 
)

Definition at line 390 of file asLibRoutines.c.

392 {
393  ASGCLIENT *pasgclient = asClientPvt;
394  long status;
395  int len, i;
396 
397  if(!asActive) return(S_asLib_asNotActive);
398  if(!pasgclient) return(S_asLib_badClient);
399  len = strlen(host);
400  for (i = 0; i < len; i++) {
401  host[i] = (char)tolower((int)host[i]);
402  }
403  LOCK;
404  pasgclient->level = asl;
405  pasgclient->user = user;
406  pasgclient->host = host;
407  status = asComputePvt(pasgclient);
408  UNLOCK;
409  return(status);
410 }
int asActive
Definition: asLibRoutines.c:40
pvd::Status status
int i
Definition: scan.c:967
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
const char * user
Definition: asLib.h:232
int level
Definition: asLib.h:236
#define S_asLib_badClient
Definition: asLib.h:139
char * host
Definition: asLib.h:233
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asChangeGroup ( ASMEMBERPVT asMemberPvt,
const char *  newAsgName 
)

Definition at line 322 of file asLibRoutines.c.

323 {
324  ASGMEMBER *pasgmember;
325  long status;
326 
327  if(!asActive) return(S_asLib_asNotActive);
328  pasgmember = *asMemberPvt;
329  if(!pasgmember) return(S_asLib_badMember);
330  LOCK;
331  if(pasgmember->pasg) {
332  ellDelete(&pasgmember->pasg->memberList,&pasgmember->node);
333  } else {
334  errMessage(-1,"Logic error in asChangeGroup");
335  UNLOCK;
336  return(-1);
337  }
338  status = asAddMemberPvt(asMemberPvt,newAsgName);
339  UNLOCK;
340  return(status);
341 }
#define S_asLib_badMember
Definition: asLib.h:138
int asActive
Definition: asLibRoutines.c:40
ELLLIST memberList
Definition: asLib.h:216
pvd::Status status
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define errMessage(S, PM)
Definition: errlog.h:48
ASG * pasg
Definition: asLib.h:223
void ellDelete(ELLLIST *pList, ELLNODE *pNode)
Deletes a node from a list.
Definition: ellLib.c:75
ELLNODE node
Definition: asLib.h:222
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asCompute ( ASCLIENTPVT  asClientPvt)

Definition at line 488 of file asLibRoutines.c.

489 {
490  long status;
491 
492  if(!asActive) return(S_asLib_asNotActive);
493  LOCK;
494  status = asComputePvt(asClientPvt);
495  UNLOCK;
496  return(status);
497 }
int asActive
Definition: asLibRoutines.c:40
pvd::Status status
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asComputeAllAsg ( void  )

Definition at line 466 of file asLibRoutines.c.

467 {
468  long status;
469 
470  if(!asActive) return(S_asLib_asNotActive);
471  LOCK;
472  status = asComputeAllAsgPvt();
473  UNLOCK;
474  return(status);
475 }
int asActive
Definition: asLibRoutines.c:40
pvd::Status status
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asComputeAsg ( ASG pasg)

Definition at line 477 of file asLibRoutines.c.

478 {
479  long status;
480 
481  if(!asActive) return(S_asLib_asNotActive);
482  LOCK;
483  status = asComputeAsgPvt(pasg);
484  UNLOCK;
485  return(status);
486 }
int asActive
Definition: asLibRoutines.c:40
pvd::Status status
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API int epicsStdCall asDump ( void(*)(ASMEMBERPVT, FILE *)  memcallback,
void(*)(ASCLIENTPVT, FILE *)  clientcallback,
int  verbose 
)
LIBCOM_API int epicsStdCall asDumpFP ( FILE *  fp,
void(*)(ASMEMBERPVT, FILE *)  memcallback,
void(*)(ASCLIENTPVT, FILE *)  clientcallback,
int  verbose 
)
LIBCOM_API int epicsStdCall asDumpHag ( const char *  hagname)

Definition at line 688 of file asLibRoutines.c.

689 {
690  return asDumpHagFP(stdout,hagname);
691 }
int epicsStdCall asDumpHagFP(FILE *fp, const char *hagname)
#define stdout
Definition: epicsStdio.h:30
LIBCOM_API int epicsStdCall asDumpHagFP ( FILE *  fp,
const char *  hagname 
)

Definition at line 693 of file asLibRoutines.c.

694 {
695  HAG *phag;
696  HAGNAME *phagname;
697 
698  if(!asActive) return(0);
699  phag = (HAG *)ellFirst(&pasbase->hagList);
700  if(!phag) fprintf(fp,"No HAGs\n");
701  while(phag) {
702  if(hagname && strcmp(hagname,phag->name)!=0) {
703  phag = (HAG *)ellNext(&phag->node);
704  continue;
705  }
706  fprintf(fp,"HAG(%s)",phag->name);
707  phagname = (HAGNAME *)ellFirst(&phag->list);
708  if(phagname) fprintf(fp," {"); else fprintf(fp,"\n");
709  while(phagname) {
710  fprintf(fp,"%s",phagname->host);
711  phagname = (HAGNAME *)ellNext(&phagname->node);
712  if(phagname) fprintf(fp,","); else fprintf(fp,"}\n");
713  }
714  phag = (HAG *)ellNext(&phag->node);
715  }
716  return(0);
717 }
int asActive
Definition: asLibRoutines.c:40
char host[1]
Definition: asLib.h:174
char * name
Definition: asLib.h:178
Definition: asLib.h:176
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
ELLNODE node
Definition: asLib.h:177
ASBASE volatile * pasbase
Definition: asLibRoutines.c:38
ELLLIST list
Definition: asLib.h:179
ELLLIST hagList
Definition: asLib.h:154
ELLNODE node
Definition: asLib.h:173
Definition: asLib.h:172
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API int epicsStdCall asDumpHash ( void  )

Definition at line 860 of file asLibRoutines.c.

861 {
862  return asDumpHashFP(stdout);
863 }
#define stdout
Definition: epicsStdio.h:30
LIBCOM_API int epicsStdCall asDumpHashFP(FILE *fp)
LIBCOM_API int epicsStdCall asDumpHashFP ( FILE *  fp)

Definition at line 865 of file asLibRoutines.c.

866 {
867  if(!asActive) return(0);
868  gphDumpFP(fp,pasbase->phash);
869  return(0);
870 }
int asActive
Definition: asLibRoutines.c:40
struct gphPvt * phash
Definition: asLib.h:156
LIBCOM_API void epicsStdCall gphDumpFP(FILE *fp, struct gphPvt *pvt)
Definition: gpHashLib.c:211
ASBASE volatile * pasbase
Definition: asLibRoutines.c:38
LIBCOM_API int epicsStdCall asDumpMem ( const char *  asgname,
void(*)(ASMEMBERPVT, FILE *)  memcallback,
int  clients 
)

Definition at line 803 of file asLibRoutines.c.

805 {
806  return asDumpMemFP(stdout,asgname,memcallback,clients);
807 }
int epicsStdCall asDumpMemFP(FILE *fp, const char *asgname, void(*memcallback)(ASMEMBERPVT, FILE *), int clients)
ChannelProviderRegistry::shared_pointer clients
#define stdout
Definition: epicsStdio.h:30
LIBCOM_API int epicsStdCall asDumpMemFP ( FILE *  fp,
const char *  asgname,
void(*)(ASMEMBERPVT, FILE *)  memcallback,
int  clients 
)

Definition at line 809 of file asLibRoutines.c.

811 {
812  ASG *pasg;
813  ASGMEMBER *pasgmember;
814  ASGCLIENT *pasgclient;
815 
816  if(!asActive) return(0);
817  pasg = (ASG *)ellFirst(&pasbase->asgList);
818  if(!pasg) fprintf(fp,"No ASGs\n");
819  while(pasg) {
820 
821  if(asgname && strcmp(asgname,pasg->name)!=0) {
822  pasg = (ASG *)ellNext(&pasg->node);
823  continue;
824  }
825  fprintf(fp,"ASG(%s)\n",pasg->name);
826  pasgmember = (ASGMEMBER *)ellFirst(&pasg->memberList);
827  if(pasgmember) fprintf(fp,"\tMEMBERLIST\n");
828  while(pasgmember) {
829  if(strlen(pasgmember->asgName)==0)
830  fprintf(fp,"\t\t<null>");
831  else
832  fprintf(fp,"\t\t%s",pasgmember->asgName);
833  if(memcallback) memcallback(pasgmember,fp);
834  fprintf(fp,"\n");
835  pasgclient = (ASGCLIENT *)ellFirst(&pasgmember->clientList);
836  if(!clients) pasgclient = NULL;
837  while(pasgclient) {
838  fprintf(fp,"\t\t\t %s %s",
839  pasgclient->user,pasgclient->host);
840  if(pasgclient->level>=0 && pasgclient->level<=1)
841  fprintf(fp," %s",asLevelName[pasgclient->level]);
842  else
843  fprintf(fp," Illegal Level %d",pasgclient->level);
844  if(pasgclient->access<=2)
845  fprintf(fp," %s %s",
846  asAccessName[pasgclient->access],
847  asTrapOption[pasgclient->trapMask]);
848  else
849  fprintf(fp," Illegal Access %d",pasgclient->access);
850  fprintf(fp,"\n");
851  pasgclient = (ASGCLIENT *)ellNext(&pasgclient->node);
852  }
853  pasgmember = (ASGMEMBER *)ellNext(&pasgmember->node);
854  }
855  pasg = (ASG *)ellNext(&pasg->node);
856  }
857  return(0);
858 }
int asActive
Definition: asLibRoutines.c:40
ELLLIST memberList
Definition: asLib.h:216
ELLNODE node
Definition: asLib.h:212
int trapMask
Definition: asLib.h:238
ELLNODE node
Definition: asLib.h:230
#define NULL
Definition: catime.c:38
const char * user
Definition: asLib.h:232
const char * asgName
Definition: asLib.h:225
ELLLIST asgList
Definition: asLib.h:155
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
char * name
Definition: asLib.h:213
ChannelProviderRegistry::shared_pointer clients
asAccessRights access
Definition: asLib.h:237
ASBASE volatile * pasbase
Definition: asLibRoutines.c:38
int level
Definition: asLib.h:236
Definition: asLib.h:211
char * host
Definition: asLib.h:233
ELLNODE node
Definition: asLib.h:222
ELLLIST clientList
Definition: asLib.h:224
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API int epicsStdCall asDumpRules ( const char *  asgname)

Definition at line 719 of file asLibRoutines.c.

720 {
721  return asDumpRulesFP(stdout,asgname);
722 }
#define stdout
Definition: epicsStdio.h:30
int epicsStdCall asDumpRulesFP(FILE *fp, const char *asgname)
LIBCOM_API int epicsStdCall asDumpRulesFP ( FILE *  fp,
const char *  asgname 
)

Definition at line 724 of file asLibRoutines.c.

725 {
726  ASG *pasg;
727  ASGINP *pasginp;
728  ASGRULE *pasgrule;
729  ASGHAG *pasghag;
730  ASGUAG *pasguag;
731 
732  if(!asActive) return(0);
733  pasg = (ASG *)ellFirst(&pasbase->asgList);
734  if(!pasg) fprintf(fp,"No ASGs\n");
735  while(pasg) {
736  int print_end_brace;
737 
738  if(asgname && strcmp(asgname,pasg->name)!=0) {
739  pasg = (ASG *)ellNext(&pasg->node);
740  continue;
741  }
742  fprintf(fp,"ASG(%s)",pasg->name);
743  pasginp = (ASGINP *)ellFirst(&pasg->inpList);
744  pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList);
745  if(pasginp || pasgrule) {
746  fprintf(fp," {\n");
747  print_end_brace = TRUE;
748  } else {
749  fprintf(fp,"\n");
750  print_end_brace = FALSE;
751  }
752  while(pasginp) {
753 
754  fprintf(fp,"\tINP%c(%s)",(pasginp->inpIndex + 'A'),pasginp->inp);
755  if ((pasg->inpBad & (1ul << pasginp->inpIndex)))
756  fprintf(fp," INVALID");
757  fprintf(fp," value=%f",pasg->pavalue[pasginp->inpIndex]);
758  fprintf(fp,"\n");
759  pasginp = (ASGINP *)ellNext(&pasginp->node);
760  }
761  while(pasgrule) {
762  int print_end_brace;
763 
764  fprintf(fp,"\tRULE(%d,%s,%s)",
765  pasgrule->level,asAccessName[pasgrule->access],
766  asTrapOption[pasgrule->trapMask]);
767  pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList);
768  pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList);
769  if(pasguag || pasghag || pasgrule->calc) {
770  fprintf(fp," {\n");
771  print_end_brace = TRUE;
772  } else {
773  fprintf(fp,"\n");
774  print_end_brace = FALSE;
775  }
776  if(pasguag) fprintf(fp,"\t\tUAG(");
777  while(pasguag) {
778  fprintf(fp,"%s",pasguag->puag->name);
779  pasguag = (ASGUAG *)ellNext(&pasguag->node);
780  if(pasguag) fprintf(fp,","); else fprintf(fp,")\n");
781  }
782  pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList);
783  if(pasghag) fprintf(fp,"\t\tHAG(");
784  while(pasghag) {
785  fprintf(fp,"%s",pasghag->phag->name);
786  pasghag = (ASGHAG *)ellNext(&pasghag->node);
787  if(pasghag) fprintf(fp,","); else fprintf(fp,")\n");
788  }
789  if(pasgrule->calc) {
790  fprintf(fp,"\t\tCALC(\"%s\")",pasgrule->calc);
791  fprintf(fp," result=%s",(pasgrule->result==1 ? "TRUE" : "FALSE"));
792  fprintf(fp,"\n");
793  }
794  if(print_end_brace) fprintf(fp,"\t}\n");
795  pasgrule = (ASGRULE *)ellNext(&pasgrule->node);
796  }
797  if(print_end_brace) fprintf(fp,"}\n");
798  pasg = (ASG *)ellNext(&pasg->node);
799  }
800  return(0);
801 }
char * inp
Definition: asLib.h:205
#define FALSE
Definition: dbDefs.h:32
int asActive
Definition: asLibRoutines.c:40
ELLNODE node
Definition: asLib.h:212
ELLLIST ruleList
Definition: asLib.h:215
int trapMask
Definition: asLib.h:201
char * calc
Definition: asLib.h:197
double * pavalue
Definition: asLib.h:217
char * name
Definition: asLib.h:178
unsigned long inpBad
Definition: asLib.h:218
ELLNODE node
Definition: asLib.h:192
ELLLIST asgList
Definition: asLib.h:155
UAG * puag
Definition: asLib.h:184
ELLNODE node
Definition: asLib.h:204
int result
Definition: asLib.h:196
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
char * name
Definition: asLib.h:213
ASBASE volatile * pasbase
Definition: asLibRoutines.c:38
ELLLIST uagList
Definition: asLib.h:199
int inpIndex
Definition: asLib.h:208
ELLLIST hagList
Definition: asLib.h:200
ELLNODE node
Definition: asLib.h:187
int level
Definition: asLib.h:194
Definition: asLib.h:211
HAG * phag
Definition: asLib.h:188
#define TRUE
Definition: dbDefs.h:27
Definition: asLib.h:186
ELLLIST inpList
Definition: asLib.h:214
ELLNODE node
Definition: asLib.h:183
asAccessRights access
Definition: asLib.h:193
Definition: asLib.h:191
Definition: asLib.h:182
char * name
Definition: asLib.h:168
Definition: asLib.h:203
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API int epicsStdCall asDumpUag ( const char *  uagname)

Definition at line 657 of file asLibRoutines.c.

658 {
659  return asDumpUagFP(stdout,uagname);
660 }
#define stdout
Definition: epicsStdio.h:30
int epicsStdCall asDumpUagFP(FILE *fp, const char *uagname)
LIBCOM_API int epicsStdCall asDumpUagFP ( FILE *  fp,
const char *  uagname 
)

Definition at line 662 of file asLibRoutines.c.

663 {
664  UAG *puag;
665  UAGNAME *puagname;
666 
667  if(!asActive) return(0);
668  puag = (UAG *)ellFirst(&pasbase->uagList);
669  if(!puag) fprintf(fp,"No UAGs\n");
670  while(puag) {
671  if(uagname && strcmp(uagname,puag->name)!=0) {
672  puag = (UAG *)ellNext(&puag->node);
673  continue;
674  }
675  fprintf(fp,"UAG(%s)",puag->name);
676  puagname = (UAGNAME *)ellFirst(&puag->list);
677  if(puagname) fprintf(fp," {"); else fprintf(fp,"\n");
678  while(puagname) {
679  fprintf(fp,"%s",puagname->user);
680  puagname = (UAGNAME *)ellNext(&puagname->node);
681  if(puagname) fprintf(fp,","); else fprintf(fp,"}\n");
682  }
683  puag = (UAG *)ellNext(&puag->node);
684  }
685  return(0);
686 }
Definition: asLib.h:162
ELLNODE node
Definition: asLib.h:163
int asActive
Definition: asLibRoutines.c:40
Definition: asLib.h:166
char * user
Definition: asLib.h:164
ELLLIST list
Definition: asLib.h:169
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
ASBASE volatile * pasbase
Definition: asLibRoutines.c:38
ELLNODE node
Definition: asLib.h:167
ELLLIST uagList
Definition: asLib.h:153
char * name
Definition: asLib.h:168
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API void asFreeAll ( ASBASE pasbase)

Definition at line 1047 of file asLibRoutines.c.

1048 {
1049  UAG *puag;
1050  UAGNAME *puagname;
1051  HAG *phag;
1052  HAGNAME *phagname;
1053  ASG *pasg;
1054  ASGINP *pasginp;
1055  ASGRULE *pasgrule;
1056  ASGHAG *pasghag;
1057  ASGUAG *pasguag;
1058  void *pnext;
1059 
1060  puag = (UAG *)ellFirst(&pasbase->uagList);
1061  while(puag) {
1062  puagname = (UAGNAME *)ellFirst(&puag->list);
1063  while(puagname) {
1064  pnext = ellNext(&puagname->node);
1065  ellDelete(&puag->list,&puagname->node);
1066  free(puagname);
1067  puagname = pnext;
1068  }
1069  pnext = ellNext(&puag->node);
1070  ellDelete(&pasbase->uagList,&puag->node);
1071  free(puag);
1072  puag = pnext;
1073  }
1074  phag = (HAG *)ellFirst(&pasbase->hagList);
1075  while(phag) {
1076  phagname = (HAGNAME *)ellFirst(&phag->list);
1077  while(phagname) {
1078  pnext = ellNext(&phagname->node);
1079  ellDelete(&phag->list,&phagname->node);
1080  free(phagname);
1081  phagname = pnext;
1082  }
1083  pnext = ellNext(&phag->node);
1084  ellDelete(&pasbase->hagList,&phag->node);
1085  free(phag);
1086  phag = pnext;
1087  }
1088  pasg = (ASG *)ellFirst(&pasbase->asgList);
1089  while(pasg) {
1090  free(pasg->pavalue);
1091  pasginp = (ASGINP *)ellFirst(&pasg->inpList);
1092  while(pasginp) {
1093  pnext = ellNext(&pasginp->node);
1094  ellDelete(&pasg->inpList,&pasginp->node);
1095  free(pasginp);
1096  pasginp = pnext;
1097  }
1098  pasgrule = (ASGRULE *)ellFirst(&pasg->ruleList);
1099  while(pasgrule) {
1100  free(pasgrule->calc);
1101  free(pasgrule->rpcl);
1102  pasguag = (ASGUAG *)ellFirst(&pasgrule->uagList);
1103  while(pasguag) {
1104  pnext = ellNext(&pasguag->node);
1105  ellDelete(&pasgrule->uagList,&pasguag->node);
1106  free(pasguag);
1107  pasguag = pnext;
1108  }
1109  pasghag = (ASGHAG *)ellFirst(&pasgrule->hagList);
1110  while(pasghag) {
1111  pnext = ellNext(&pasghag->node);
1112  ellDelete(&pasgrule->hagList,&pasghag->node);
1113  free(pasghag);
1114  pasghag = pnext;
1115  }
1116  pnext = ellNext(&pasgrule->node);
1117  ellDelete(&pasg->ruleList,&pasgrule->node);
1118  free(pasgrule);
1119  pasgrule = pnext;
1120  }
1121  pnext = ellNext(&pasg->node);
1122  ellDelete(&pasbase->asgList,&pasg->node);
1123  free(pasg);
1124  pasg = pnext;
1125  }
1126  gphFreeMem(pasbase->phash);
1127  free(pasbase);
1128 }
Definition: asLib.h:162
ELLNODE node
Definition: asLib.h:163
ELLNODE node
Definition: asLib.h:212
ELLLIST ruleList
Definition: asLib.h:215
char * calc
Definition: asLib.h:197
Definition: asLib.h:166
double * pavalue
Definition: asLib.h:217
Definition: asLib.h:176
ELLNODE node
Definition: asLib.h:192
ELLLIST asgList
Definition: asLib.h:155
struct gphPvt * phash
Definition: asLib.h:156
ELLNODE node
Definition: asLib.h:204
ELLLIST list
Definition: asLib.h:169
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
void * rpcl
Definition: asLib.h:198
ELLNODE node
Definition: asLib.h:177
ELLLIST list
Definition: asLib.h:179
ELLNODE node
Definition: asLib.h:167
LIBCOM_API void epicsStdCall gphFreeMem(struct gphPvt *pvt)
Definition: gpHashLib.c:176
ELLLIST uagList
Definition: asLib.h:199
ELLLIST hagList
Definition: asLib.h:154
ELLLIST uagList
Definition: asLib.h:153
ELLLIST hagList
Definition: asLib.h:200
ELLNODE node
Definition: asLib.h:187
Definition: asLib.h:211
Definition: asLib.h:186
ELLNODE node
Definition: asLib.h:173
ELLLIST inpList
Definition: asLib.h:214
Definition: asLib.h:172
ELLNODE node
Definition: asLib.h:183
void ellDelete(ELLLIST *pList, ELLNODE *pNode)
Deletes a node from a list.
Definition: ellLib.c:75
Definition: asLib.h:191
Definition: asLib.h:182
Definition: asLib.h:203
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API void* epicsStdCall asGetClientPvt ( ASCLIENTPVT  asClientPvt)

Definition at line 447 of file asLibRoutines.c.

448 {
449  ASGCLIENT *pasgclient = asClientPvt;
450 
451  if(!asActive) return(NULL);
452  if(!pasgclient) return(NULL);
453  return(pasgclient->userPvt);
454 }
int asActive
Definition: asLibRoutines.c:40
#define NULL
Definition: catime.c:38
void * userPvt
Definition: asLib.h:234
LIBCOM_API void* epicsStdCall asGetMemberPvt ( ASMEMBERPVT  asMemberPvt)

Definition at line 343 of file asLibRoutines.c.

344 {
345  ASGMEMBER *pasgmember = asMemberPvt;
346 
347  if(!asActive) return(NULL);
348  if(!pasgmember) return(NULL);
349  return(pasgmember->userPvt);
350 }
int asActive
Definition: asLibRoutines.c:40
#define NULL
Definition: catime.c:38
void * userPvt
Definition: asLib.h:226
LIBCOM_API long epicsStdCall asInitFile ( const char *  filename,
const char *  substitutions 
)

Definition at line 169 of file asLibRoutines.c.

170 {
171  FILE *fp;
172  long status;
173 
174  fp = fopen(filename,"r");
175  if(!fp) {
176  errlogPrintf("asInitFile: Can't open file '%s'\n", filename);
177  return(S_asLib_badConfig);
178  }
179  status = asInitFP(fp,substitutions);
180  if(fclose(fp)==EOF) {
181  errMessage(0,"asInitFile: fclose failed!");
182  if(!status) status = S_asLib_badConfig;
183  }
184  return(status);
185 }
pvd::Status status
#define errMessage(S, PM)
Definition: errlog.h:48
long epicsStdCall asInitFP(FILE *fp, const char *substitutions)
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
#define S_asLib_badConfig
Definition: asLib.h:133
LIBCOM_API long epicsStdCall asInitFP ( FILE *  fp,
const char *  substitutions 
)

Definition at line 224 of file asLibRoutines.c.

225 {
226  char buffer[BUF_SIZE];
227  char mac_buffer[BUF_SIZE];
228  long status;
229  char **macPairs;
230 
231  buffer[0] = 0;
232  my_buffer = buffer;
233  my_buffer_ptr = my_buffer;
234  stream = fp;
235  if(substitutions) {
236  if((status = macCreateHandle(&macHandle,NULL))) {
237  errMessage(status,"asInitFP: macCreateHandle error");
238  return(status);
239  }
240  macParseDefns(macHandle,substitutions,&macPairs);
241  if(macPairs ==NULL) {
242  macDeleteHandle(macHandle);
243  macHandle = NULL;
244  } else {
245  macInstallMacros(macHandle,macPairs);
246  free(macPairs);
247  mac_input_buffer = mac_buffer;
248  }
249  }
250  status = asInitialize(myInputFunction);
251  if(macHandle) {
252  macDeleteHandle(macHandle);
253  macHandle = NULL;
254  }
255  return(status);
256 }
LIBCOM_API long epicsStdCall macParseDefns(MAC_HANDLE *handle, const char *defns, char **pairs[])
Parse macro definitions into an array of {name, value} pairs.
Definition: macUtil.c:32
pvd::Status status
long epicsStdCall asInitialize(ASINPUTFUNCPTR inputfunction)
Definition: asLibRoutines.c:84
#define NULL
Definition: catime.c:38
#define errMessage(S, PM)
Definition: errlog.h:48
#define BUF_SIZE
long epicsStdCall macDeleteHandle(MAC_HANDLE *handle)
Marks a handle invalid, and frees all storage associated with it.
Definition: macCore.c:360
long epicsStdCall macCreateHandle(MAC_HANDLE **pHandle, const char *pairs[])
Creates a new macro substitution context.
Definition: macCore.c:100
LIBCOM_API long epicsStdCall macInstallMacros(MAC_HANDLE *handle, char *pairs[])
Install set of {name, value} pairs as definitions.
Definition: macUtil.c:253
LIBCOM_API long epicsStdCall asInitialize ( ASINPUTFUNCPTR  inputfunction)

Definition at line 84 of file asLibRoutines.c.

85 {
86  ASG *pasg;
87  long status;
88  ASBASE *pasbaseold;
89  GPHENTRY *pgphentry;
90  UAG *puag;
91  UAGNAME *puagname;
92  HAG *phag;
93  HAGNAME *phagname;
94  static epicsThreadOnceId asInitializeOnceFlag = EPICS_THREAD_ONCE_INIT;
95 
96  epicsThreadOnce(&asInitializeOnceFlag,asInitializeOnce,(void *)0);
97  LOCK;
98  pasbasenew = asCalloc(1,sizeof(ASBASE));
99  if(!freeListPvt) freeListInitPvt(&freeListPvt,sizeof(ASGCLIENT),20);
100  ellInit(&pasbasenew->uagList);
101  ellInit(&pasbasenew->hagList);
102  ellInit(&pasbasenew->asgList);
103  asAsgAdd(DEFAULT);
104  status = myParse(inputfunction);
105  if(status) {
106  status = S_asLib_badConfig;
107  /*Not safe to call asFreeAll */
108  UNLOCK;
109  return(status);
110  }
111  pasg = (ASG *)ellFirst(&pasbasenew->asgList);
112  while(pasg) {
113  pasg->pavalue = asCalloc(CALCPERFORM_NARGS, sizeof(double));
114  pasg = (ASG *)ellNext(&pasg->node);
115  }
116  gphInitPvt(&pasbasenew->phash, 256);
117  /*Hash each uagname and each hagname*/
118  puag = (UAG *)ellFirst(&pasbasenew->uagList);
119  while(puag) {
120  puagname = (UAGNAME *)ellFirst(&puag->list);
121  while(puagname) {
122  pgphentry = gphAdd(pasbasenew->phash,puagname->user,puag);
123  if(!pgphentry) {
124  errlogPrintf("Duplicated user '%s' in UAG '%s'\n",
125  puagname->user, puag->name);
126  }
127  puagname = (UAGNAME *)ellNext(&puagname->node);
128  }
129  puag = (UAG *)ellNext(&puag->node);
130  }
131  phag = (HAG *)ellFirst(&pasbasenew->hagList);
132  while(phag) {
133  phagname = (HAGNAME *)ellFirst(&phag->list);
134  while(phagname) {
135  pgphentry = gphAdd(pasbasenew->phash,phagname->host,phag);
136  if(!pgphentry) {
137  errlogPrintf("Duplicated host '%s' in HAG '%s'\n",
138  phagname->host, phag->name);
139  }
140  phagname = (HAGNAME *)ellNext(&phagname->node);
141  }
142  phag = (HAG *)ellNext(&phag->node);
143  }
144  pasbaseold = (ASBASE *)pasbase;
145  pasbase = (ASBASE volatile *)pasbasenew;
146  if(pasbaseold) {
147  ASG *poldasg;
148  ASGMEMBER *poldmem;
149  ASGMEMBER *pnextoldmem;
150 
151  poldasg = (ASG *)ellFirst(&pasbaseold->asgList);
152  while(poldasg) {
153  poldmem = (ASGMEMBER *)ellFirst(&poldasg->memberList);
154  while(poldmem) {
155  pnextoldmem = (ASGMEMBER *)ellNext(&poldmem->node);
156  ellDelete(&poldasg->memberList,&poldmem->node);
157  status = asAddMemberPvt(&poldmem,poldmem->asgName);
158  poldmem = pnextoldmem;
159  }
160  poldasg = (ASG *)ellNext(&poldasg->node);
161  }
162  asFreeAll(pasbaseold);
163  }
164  asActive = TRUE;
165  UNLOCK;
166  return(0);
167 }
Definition: asLib.h:162
ELLNODE node
Definition: asLib.h:163
int asActive
Definition: asLibRoutines.c:40
ELLLIST memberList
Definition: asLib.h:216
ELLNODE node
Definition: asLib.h:212
pvd::Status status
char host[1]
Definition: asLib.h:174
#define LOCK
Definition: asLibRoutines.c:34
Definition: asLib.h:166
#define UNLOCK
Definition: asLibRoutines.c:35
double * pavalue
Definition: asLib.h:217
char * name
Definition: asLib.h:178
#define DEFAULT
Definition: asLibRoutines.c:45
Definition: asLib.h:176
char * user
Definition: asLib.h:164
Definition: asLib.h:152
LIBCOM_API void epicsStdCall freeListInitPvt(void **ppvt, int size, int nmalloc)
Definition: freeListLib.c:44
const char * asgName
Definition: asLib.h:225
ELLLIST asgList
Definition: asLib.h:155
#define CALCPERFORM_NARGS
Number of input arguments to a calc expression (A-L)
Definition: postfix.h:25
struct gphPvt * phash
Definition: asLib.h:156
LIBCOM_API void epicsStdCall gphInitPvt(struct gphPvt **ppvt, int tableSize)
Definition: gpHashLib.c:37
ELLLIST list
Definition: asLib.h:169
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
#define EPICS_THREAD_ONCE_INIT
Definition: epicsThread.h:109
LIBCOM_API void epicsStdCall epicsThreadOnce(epicsThreadOnceId *id, EPICSTHREADFUNC, void *arg)
LIBCOM_API void *epicsStdCall asCalloc(size_t nobj, size_t size)
ELLNODE node
Definition: asLib.h:177
ASBASE volatile * pasbase
Definition: asLibRoutines.c:38
ELLLIST list
Definition: asLib.h:179
ELLNODE node
Definition: asLib.h:167
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
ELLLIST hagList
Definition: asLib.h:154
ELLLIST uagList
Definition: asLib.h:153
void asFreeAll(ASBASE *pasbase)
Definition: asLib.h:211
#define TRUE
Definition: dbDefs.h:27
#define ellInit(PLIST)
Initialize a list type.
Definition: ellLib.h:76
ELLNODE node
Definition: asLib.h:173
Definition: asLib.h:172
void ellDelete(ELLLIST *pList, ELLNODE *pNode)
Deletes a node from a list.
Definition: ellLib.c:75
ELLNODE node
Definition: asLib.h:222
LIBCOM_API GPHENTRY *epicsStdCall gphAdd(struct gphPvt *pvt, const char *name, void *pvtid)
Definition: gpHashLib.c:97
char * name
Definition: asLib.h:168
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
#define S_asLib_badConfig
Definition: asLib.h:133
LIBCOM_API long epicsStdCall asInitMem ( const char *  acf,
const char *  substitutions 
)

Definition at line 274 of file asLibRoutines.c.

275 {
276  long ret = S_asLib_InitFailed;
277  if(!acf) return ret;
278 
279  membuf = acf;
280  ret = asInitialize(&memInputFunction);
281  membuf = NULL;
282 
283  return ret;
284 }
long epicsStdCall asInitialize(ASINPUTFUNCPTR inputfunction)
Definition: asLibRoutines.c:84
#define NULL
Definition: catime.c:38
#define S_asLib_InitFailed
Definition: asLib.h:136
LIBCOM_API void epicsStdCall asPutClientPvt ( ASCLIENTPVT  asClientPvt,
void *  userPvt 
)

Definition at line 456 of file asLibRoutines.c.

457 {
458  ASGCLIENT *pasgclient = asClientPvt;
459  if(!asActive) return;
460  if(!pasgclient) return;
461  LOCK;
462  pasgclient->userPvt = userPvt;
463  UNLOCK;
464 }
int asActive
Definition: asLibRoutines.c:40
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
void * userPvt
Definition: asLib.h:234
LIBCOM_API void epicsStdCall asPutMemberPvt ( ASMEMBERPVT  asMemberPvt,
void *  userPvt 
)

Definition at line 352 of file asLibRoutines.c.

353 {
354  ASGMEMBER *pasgmember = asMemberPvt;
355 
356  if(!asActive) return;
357  if(!pasgmember) return;
358  pasgmember->userPvt = userPvt;
359  return;
360 }
int asActive
Definition: asLibRoutines.c:40
void * userPvt
Definition: asLib.h:226
LIBCOM_API long epicsStdCall asRegisterClientCallback ( ASCLIENTPVT  asClientPvt,
ASCLIENTCALLBACK  pcallback 
)

Definition at line 433 of file asLibRoutines.c.

435 {
436  ASGCLIENT *pasgclient = asClientPvt;
437 
438  if(!asActive) return(S_asLib_asNotActive);
439  if(!pasgclient) return(S_asLib_badClient);
440  LOCK;
441  pasgclient->pcallback = pcallback;
442  (*pasgclient->pcallback)(pasgclient,asClientCOAR);
443  UNLOCK;
444  return(0);
445 }
int asActive
Definition: asLibRoutines.c:40
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
ASCLIENTCALLBACK pcallback
Definition: asLib.h:235
#define S_asLib_badClient
Definition: asLib.h:139
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asRemoveClient ( ASCLIENTPVT asClientPvt)

Definition at line 412 of file asLibRoutines.c.

413 {
414  ASGCLIENT *pasgclient = *asClientPvt;
415  ASGMEMBER *pasgMember;
416 
417  if(!asActive) return(S_asLib_asNotActive);
418  if(!pasgclient) return(S_asLib_badClient);
419  LOCK;
420  pasgMember = pasgclient->pasgMember;
421  if(!pasgMember) {
422  errMessage(-1,"asRemoveClient: No ASGMEMBER");
423  UNLOCK;
424  return(-1);
425  }
426  ellDelete(&pasgMember->clientList,&pasgclient->node);
427  UNLOCK;
428  freeListFree(freeListPvt,pasgclient);
429  *asClientPvt = NULL;
430  return(0);
431 }
ASGMEMBER * pasgMember
Definition: asLib.h:231
int asActive
Definition: asLibRoutines.c:40
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
ELLNODE node
Definition: asLib.h:230
#define NULL
Definition: catime.c:38
#define errMessage(S, PM)
Definition: errlog.h:48
LIBCOM_API void epicsStdCall freeListFree(void *pvt, void *pmem)
Definition: freeListLib.c:131
#define S_asLib_badClient
Definition: asLib.h:139
void ellDelete(ELLLIST *pList, ELLNODE *pNode)
Deletes a node from a list.
Definition: ellLib.c:75
ELLLIST clientList
Definition: asLib.h:224
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API long epicsStdCall asRemoveMember ( ASMEMBERPVT asMemberPvt)

Definition at line 297 of file asLibRoutines.c.

298 {
299  ASGMEMBER *pasgmember;
300 
301  if(!asActive) return(S_asLib_asNotActive);
302  pasgmember = *asMemberPvt;
303  if(!pasgmember) return(S_asLib_badMember);
304  LOCK;
305  if (ellCount(&pasgmember->clientList) > 0) {
306  UNLOCK;
307  return(S_asLib_clientsExist);
308  }
309  if(pasgmember->pasg) {
310  ellDelete(&pasgmember->pasg->memberList,&pasgmember->node);
311  } else {
312  errMessage(-1,"Logic error in asRemoveMember");
313  UNLOCK;
314  return(-1);
315  }
316  free(pasgmember);
317  *asMemberPvt = NULL;
318  UNLOCK;
319  return(0);
320 }
#define S_asLib_badMember
Definition: asLib.h:138
int asActive
Definition: asLibRoutines.c:40
#define ellCount(PLIST)
Report the number of nodes in a list.
Definition: ellLib.h:84
ELLLIST memberList
Definition: asLib.h:216
#define LOCK
Definition: asLibRoutines.c:34
#define UNLOCK
Definition: asLibRoutines.c:35
#define NULL
Definition: catime.c:38
#define errMessage(S, PM)
Definition: errlog.h:48
#define S_asLib_clientsExist
Definition: asLib.h:128
ASG * pasg
Definition: asLib.h:223
void ellDelete(ELLLIST *pList, ELLNODE *pNode)
Deletes a node from a list.
Definition: ellLib.c:75
ELLNODE node
Definition: asLib.h:222
ELLLIST clientList
Definition: asLib.h:224
#define S_asLib_asNotActive
Definition: asLib.h:137
LIBCOM_API char* epicsStdCall asStrdup ( unsigned char *  str)

Definition at line 881 of file asLibRoutines.c.

882 {
883  size_t len = strlen((char *) str);
884  char *buf = asCalloc(1, len + 1);
885  strcpy(buf, (char *) str);
886  return buf;
887 }
#define str(v)
LIBCOM_API void *epicsStdCall asCalloc(size_t nobj, size_t size)
LIBCOM_API void epicsStdCall asTrapWriteAfterWrite ( void *  pvt)

Definition at line 151 of file asTrapWrite.c.

152 {
153  writeMessage *pwriteMessage = (writeMessage *)pvt;
154  listenerPvt *plistenerPvt;
155 
156  if (pwriteMessage == 0 ||
157  pasTrapWritePvt == 0) return;
158 
159  epicsMutexMustLock(pasTrapWritePvt->lock);
160  plistenerPvt = (listenerPvt *)ellFirst(&pwriteMessage->listenerPvtList);
161  while (plistenerPvt) {
162  listenerPvt *pnext = (listenerPvt *)ellNext(&plistenerPvt->node);
163  listener *plistener = plistenerPvt->plistener;
164 
165  pwriteMessage->message.userPvt = plistenerPvt->userPvt;
166  plistener->func(&pwriteMessage->message, 1);
167  ellDelete(&pwriteMessage->listenerPvtList, &plistenerPvt->node);
168  freeListFree(pasTrapWritePvt->freeListListenerPvt, plistenerPvt);
169  plistenerPvt = pnext;
170  }
171  ellDelete(&pasTrapWritePvt->writeMessageList, &pwriteMessage->node);
172  freeListFree(pasTrapWritePvt->freeListWriteMessage, pwriteMessage);
173  epicsMutexUnlock(pasTrapWritePvt->lock);
174 }
void * freeListWriteMessage
Definition: asTrapWrite.c:54
void * userPvt
Definition: asTrapWrite.c:35
ELLNODE node
Definition: asTrapWrite.c:44
epicsMutexId lock
Definition: asTrapWrite.c:56
asTrapWriteListener func
Definition: asTrapWrite.c:40
ELLNODE node
Definition: asTrapWrite.c:33
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
Definition: epicsMutex.cpp:140
ELLLIST writeMessageList
Definition: asTrapWrite.c:53
void * userPvt
A field for use by the asTrapWriteListener.
Definition: asTrapWrite.h:49
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
LIBCOM_API void epicsStdCall freeListFree(void *pvt, void *pmem)
Definition: freeListLib.c:131
struct listener * plistener
Definition: asTrapWrite.c:34
asTrapWriteMessage message
Definition: asTrapWrite.c:45
ELLLIST listenerPvtList
Definition: asTrapWrite.c:46
void * freeListListenerPvt
Definition: asTrapWrite.c:55
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
Definition: epicsMutex.h:214
void ellDelete(ELLLIST *pList, ELLNODE *pNode)
Deletes a node from a list.
Definition: ellLib.c:75
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
LIBCOM_API void* epicsStdCall asTrapWriteBeforeWithData ( const char *  userid,
const char *  hostid,
void *  addr,
int  dbrType,
int  no_elements,
void *  data 
)

Definition at line 113 of file asTrapWrite.c.

116 {
117  writeMessage *pwriteMessage;
118  listener *plistener;
119 
120  if (pasTrapWritePvt == 0 ||
121  ellCount(&pasTrapWritePvt->listenerList) <= 0) return 0;
122 
123  pwriteMessage = (writeMessage *)freeListCalloc(
124  pasTrapWritePvt->freeListWriteMessage);
125  pwriteMessage->message.userid = userid;
126  pwriteMessage->message.hostid = hostid;
127  pwriteMessage->message.serverSpecific = addr;
128  pwriteMessage->message.dbrType = dbrType;
129  pwriteMessage->message.no_elements = no_elements;
130  pwriteMessage->message.data = data;
131  ellInit(&pwriteMessage->listenerPvtList);
132 
133  epicsMutexMustLock(pasTrapWritePvt->lock);
134  ellAdd(&pasTrapWritePvt->writeMessageList, &pwriteMessage->node);
135  plistener = (listener *)ellFirst(&pasTrapWritePvt->listenerList);
136  while (plistener) {
137  listenerPvt *plistenerPvt = (listenerPvt *)freeListCalloc(
138  pasTrapWritePvt->freeListListenerPvt);
139 
140  plistenerPvt->plistener = plistener;
141  pwriteMessage->message.userPvt = 0;
142  plistener->func(&pwriteMessage->message, 0);
143  plistenerPvt->userPvt = pwriteMessage->message.userPvt;
144  ellAdd(&pwriteMessage->listenerPvtList, &plistenerPvt->node);
145  plistener = (listener *)ellNext(&plistener->node);
146  }
147  epicsMutexUnlock(pasTrapWritePvt->lock);
148  return pwriteMessage;
149 }
LIBCOM_API void *epicsStdCall freeListCalloc(void *pvt)
Definition: freeListLib.c:60
void * freeListWriteMessage
Definition: asTrapWrite.c:54
void * userPvt
Definition: asTrapWrite.c:35
ELLNODE node
Definition: asTrapWrite.c:44
epicsMutexId lock
Definition: asTrapWrite.c:56
int dbrType
Data type from ca/db_access.h, NOT dbFldTypes.h.
Definition: asTrapWrite.h:50
#define ellCount(PLIST)
Report the number of nodes in a list.
Definition: ellLib.h:84
asTrapWriteListener func
Definition: asTrapWrite.c:40
void * serverSpecific
A field for use by the server.
Definition: asTrapWrite.h:41
ELLNODE node
Definition: asTrapWrite.c:33
void * data
Might be NULL if no data is available.
Definition: asTrapWrite.h:52
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
Definition: epicsMutex.cpp:140
ELLLIST writeMessageList
Definition: asTrapWrite.c:53
void * userPvt
A field for use by the asTrapWriteListener.
Definition: asTrapWrite.h:49
const char * hostid
Hostid of whoever orginated the request.
Definition: asTrapWrite.h:33
void ellAdd(ELLLIST *pList, ELLNODE *pNode)
Adds a node to the end of a list.
Definition: ellLib.c:24
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
ELLLIST listenerList
Definition: asTrapWrite.c:52
struct listener * plistener
Definition: asTrapWrite.c:34
asTrapWriteMessage message
Definition: asTrapWrite.c:45
ELLNODE node
Definition: asTrapWrite.c:39
const char * userid
Userid of whoever orginated the request.
Definition: asTrapWrite.h:32
#define ellInit(PLIST)
Initialize a list type.
Definition: ellLib.h:76
ELLLIST listenerPvtList
Definition: asTrapWrite.c:46
void * freeListListenerPvt
Definition: asTrapWrite.c:55
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
Definition: epicsMutex.h:214
int no_elements
Array length.
Definition: asTrapWrite.h:51
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89

Variable Documentation

LIBCOM_API int asActive

Definition at line 40 of file asLibRoutines.c.

LIBCOM_API int asCheckClientIP

Definition at line 31 of file asLibRoutines.c.

LIBCOM_API volatile ASBASE* pasbase

Definition at line 38 of file asLibRoutines.c.