Commit df9a8f64 authored by Claudio Scafuri's avatar Claudio Scafuri 💬
Browse files

imported from CVS

parent a0290309
.pydevproject
.project
.cproject
.settings
obj
bin
core*
*~
*.pyc
*.so
*.so*
*.a
*.o
.pylintrc
.metadata
.idea
.cvsignore
.nse_depinfo
software
oldsrc
CVS
*_defs.h
*_server.c
*_client.c
*_support.c
# makeile for lpcresolve server
#
DEBUG = -ggdb3
OPTIM = -O2
PEDANTIC = -pedantic
CC = gcc
ANSI= -ansi
CFLAGS = -fPIC -D_REENTRANT -DTHREAD_SAFE
ELETTRA_LIB=/runtime/lib
ELETTRA_INC = /runtime/elettra/include
LIBS = -L$(ELETTRA_LIB) -lnc
INCLUDE = -I$(ELETTRA_INC) -I.
CFLAGS+= $(ANSI) $(DEBUG) $(PEDANTIC) $(CCOPTS) $(INCLUDE)
CXXFLAGS +=$(DEBUG) $(PEDANTIC) $(CXXOPTS) $(INCLUDE)
NC=/runtime/bin/nc
CLD =$(CC)
#CXXLD=$(CXX)
LDFLAGS = -shared
SHLIB_SUFFIX=so
LFLAGS_SONAME = -Wl,-soname,
LFLAGS_RPATH = -Wl,-rpath,
SERVICE=lpcresolve
STUBS= $(SERVICE)_server.c $(SERVICE)_client.c $(SERVICE)_support.c \
$(SERVICE)_defs.h
BASELIBNAME = liblpcresolve
# most important parameter - builds the dt_soname / internal name of the library
LIBVERSION = 2
LIBRELEASE = 1
LIBSUBRELEASE = 0
LIBRARY = $(BASELIBNAME).a
DT_SONAME = $(BASELIBNAME).$(SHLIB_SUFFIX).$(LIBVERSION).$(LIBRELEASE)
DT_SHLIB = $(BASELIBNAME).$(SHLIB_SUFFIX).$(LIBVERSION).$(LIBRELEASE).$(LIBSUBRELEASE)
SHLIB = $(BASELIBNAME).$(SHLIB_SUFFIX)
all: $(LIBRARY) $(DT_SHLIB) lpcresolvd libRpcResolver.a
lpcresolvd: $(STUBS) $(SERVICE)d.o lpcresolve.o serviceresolver.o $(SERVICE)_server.o config.o
$(CC) $(CLFLAGS) -o $@ $(SERVICE)d.o $(SERVICE)_server.o lpcresolve.o config.o serviceresolver.o $(TRANSITIONLIB) $(LIBS)
config.o: config.c
$(CC) $(CFLAGS) -c config.c
lpcquery: $(STUBS) lpcquery.o $(LIBRARY)
$(CC) $(CLFLAGS) -o $@ lpcquery.o $(LIBRARY) $(TRANSITIONLIB) $(LIBS)
servicequery: $(STUBS) servicequery.o $(LIBRARY)
$(CC) $(CLFLAGS) -o $@ servicequery.o $(LIBRARY) $(TRANSITIONLIB) $(LIBS)
resolvertest: resolvertest.o libRpcResolver.a
$(CXX) $(CXXLFLAGS) -o resolvertest resolvertest.o libRpcResolver.a $(LIBRARY) $(TRANSITIONLIB) $(LIBS)
query: $(STUBS) query.o
$(CXX) $(CXXLFLAGS) -o $@ query.o $(LIBRARY) $(TRANSITIONLIB) $(ELETTRA_LIB)/libnc.a
$(LIBRARY): $(STUBS) $(SERVICE)_client.o
ar -r $@ $(SERVICE)_client.o
$(DT_SHLIB): $(STUBS) $(SERVICE)_client.o
$(CLD) $(LDFLAGS) $(LFLAGS_SONAME)$(DT_SONAME) -o $(DT_SHLIB) $(SERVICE)_client.o -o $@
ln -sf $(DT_SHLIB) $(SHLIB)
ln -sf $(DT_SHLIB) $(SHLIB).$(LIBVERSION)
ln -sf $(DT_SHLIB) $(DT_SONAME)
libRpcResolver.a:RpcResolver.o
ar -r $@ RpcResolver.o
$(STUBS): $(SERVICE).nc
$(NC) -c -s $(INCLUDE) $(SERVICE).nc
clean:
rm -f *.o
rm -f core
distclean: clean
rm -f lpcresolvd
rm -f lpcquery
rm -f query
rm -f $(STUBS)
rm -f $(SHLIB) $(DT_SHLIB) $(LIBRARY)
rm -f libRpcResolver.a
rm -f query lpcquery servicequery resolvertest
install: all
$(INSTALL) $(LIBRARY) $(ELETTRA_LIB);\
chmod 644 $(ELETTRA_LIB)/$(LIBRARY); \
$(INSTALL) $(DT_SHLIB) $(ELETTRA_LIB); \
chmod 655 $(ELETTRA_LIB)/$(DT_SHLIB); \
ln -sf $(DT_SHLIB) $(ELETTRA_LIB)/$(SHLIB)
ln -sf $(DT_SHLIB) $(ELETTRA_LIB)/$(SHLIB).$(LIBVERSION)
ln -sf $(DT_SHLIB) $(ELETTRA_LIB)/$(DT_SONAME)
$(INSTALL) lpcresolve.h $(ELETTRA_INC); \
chmod 644 $(ELETTRA_INC)/lpcresolve.h; \
$(INSTALL) lpcresolvd $(ELETTRA_BIN); \
chmod 655 $(ELETTRA_BIN)/lpcresolvd; \
$(INSTALL) libRpcResolver.a $(ELETTRA_LIB);\
chmod 644 $(ELETTRA_LIB)/libRpcResolver.a
$(INSTALL) RpcResolver.h $(ELETTRA_INC); \
chmod 644 $(ELETTRA_INC)/RpcResolver.h; \
test: query lpcquery servicequery resolvertest
/* class RpcResolver
* Defines an auxiliry class for turning FAMILY_MEMBER into
* server:port.
* The defult implementation uses a static( compiled ) table
* Later it will be possible to use a dyinameci directory server
* The incapsulation provided by the class will not impair the
* existing applications
*
*------------------------------------------------------------------------
*
* $Log: RpcResolver.cpp,v $
* Revision 1.3 2011/02/21 16:03:05 claudio
* missing header file added
*
* Revision 1.2 2006/02/22 10:41:53 claudio
* added some more clear diagnostics on cerr
*
* Revision 1.1 2005/06/28 08:14:37 claudio
* C++ class wrapping client access to lpcresolver service
*
*
*/
#ifndef LINT
static char rcsiid[]="@(#)$Header: /home/cvsadm/cvsroot/utils-rpc-motif/assoclib/lpcresolve/RpcResolver.cpp,v 1.3 2011/02/21 16:03:05 claudio Exp $";
#endif
#include "lpcresolve.h"
#include "RpcResolver.h"
#include <iostream>
#include <cstdlib>
using namespace std;
//-------------------------------------------------------------------
// class constructor - does the usual initilization job
// imports the underlying rpc service
RpcResolver::RpcResolver(){
CLEARERR;
//get host and port form resolver if not specified
char *env_c_str=getenv("LPCRESOLVE_HOST");
if (env_c_str == NULL){
cerr<<"env. variable LPCRESOLVE_HOST not set"<<endl;
throw -1;
}
string env_host=string(env_c_str);
string::size_type host_sep=env_host.find(":");
if ((host_sep >= env_host.size() - 1) || (host_sep == 0)){ //test incompleto!!!
cerr<<"LPCRESOLVE_HOST env. variable syntax incorrect"<<endl;
throw -1;
}
string resolve_host=env_host.substr(0,host_sep);
string resolve_port=env_host.substr(host_sep+1);
const char *rhost=resolve_host.c_str();
CLEARERR;
sid=import_lpcresolve((char*)rhost,atoi(resolve_port.c_str()));
if(sid<0){
cerr<<"import_lpcresolve("<<rhost<<","<<atoi(resolve_port.c_str())<<") error:"<<errno<<" "<<errtype<<endl;
throw errno;
}
}
RpcResolver::~RpcResolver()
{
free_lpcresolve(sid);
}
//-------------------------------------------------------------------
// resolve: dos the actual job of the class
//
int RpcResolver::resolve(string fam,string mem,string act,string mod,char** host,short*port)
{
int res=0;
CLEARERR;
res=lpcresolve(fam.c_str(),mem.c_str(),act.c_str(),mod.c_str(),host,port);
return res;
}
// serviceresolve
int RpcResolver::resolveService(string service, char** host,short* port)
{
int res=serviceresolve(service.c_str(),host,port);
return res;
}
/* class RpcResolver
* Defines an auxiliry class for
* turning FAMILY_MEMBER into server:port.
* turning SERVICENAME into server:port
*
* The public implementation uses a dyinamic directory server
* run by the lpcresolvd daemon.
*
* The address of the lpcresolvd is usually passed tothe program by means of
* the LPCRESOLVE_HOST environment variable.
*
* this new implementation replaces the old rpc_resolver class which was
* based on a static compiled table.
*
*
* $Log: RpcResolver.h,v $
* Revision 1.1 2005/06/28 08:14:37 claudio
* C++ class wrapping client access to lpcresolver service
*
*
*/
#ifndef _RPCRESOLVER_H_INCLUDED_
#define _RPCRESOLVER_H_INCLUDED_
#include <string>
using namespace std;
class RpcResolver{
public:
RpcResolver();
~RpcResolver();
int resolve(string fam,string mem,string act,string mod, char** host,short* port);
int resolveService(string service, char** host,short* port);
private:
int sid;
};
#endif //_RPCRESOLVER_H_INCLUDED_
This diff is collapsed.
/*
* Description : Programmable Synoptic Interface PSI
* Type : PSI environment include module
* Procedure : Programmable Synoptic Interface PSI
*
* Module Name : libcfg.h
* Author(s) : Claudio Scafuri
*
*
* System(s) : UNIX System V HPUX - X11 and Motif
*
* First Version : 06/06/91
* Last Revision : 26/01/93 new syntax- member carries server information
*
* Modification :
*/
/*
* INCLUDE SESSION INCLUDE SESSION INCLUDE SESSION INCLUDE SESSION
* INCLUDE SESSION INCLUDE SESSION INCLUDE SESSION INCLUDE SESSION
*/
#ifndef CONFIGURATION_H_INCLUDED
#define CONFIGURATION_H_INCLUDED
#include <sys/types.h>
#include <psi_types.h>
/* new structure */
typedef struct mod_t{
Mode_t mode;
int npoints;
unsigned char add_action; /* flag for points with a link with other action_mode -how many to add*/
int numattribs;
Attribs *attribs;
struct mod_t *nextMode;
/* other data to trac connected widgets and offset in shm */
}modeList_t;
typedef struct act_s{
actionName_t action;
short numModes;
modeList_t *mode;
struct act_s *nextAction; /* pointer to next list element */
} actionList_t; /* type (function or struct field) */
typedef struct mem_s{
memberName_t memberName;
serverName_t serverName;
short portNumber; /* the port of the family server */
short numActions;
actionList_t *action; /* points to list of functions and */
struct mem_s *nextMember; /* pointer to next list element */
}memberList_t; /* associated info */
typedef struct fam_s{
familyName_t familyName;
memberList_t *member; /* points to list of member of the faimily */
short numMembers; /* members belonging to family */
struct fam_s *nextFamily; /* pointer to next list element */
}familyList_t;
typedef struct{
short numFamilies;
familyList_t *family; /* points to list of families */
}familyHeader_t;
/* ------------------------------------------------------------------------- */
#endif /*CONFIGURATION_H_INCLUDED*/
This diff is collapsed.
FAMILY{NAME=G011
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000]
MEMBER[NAME=S9.2
SERVER=ecrfa9
PORT=10000
ACTION(NAME=ANALOG
MODE<NAME=RR
CAPTION=Analog Value
TIMEOUT=5000
SHOWAS=XmDOUBLE
>
)
ACTION(NAME=DIGIT
MODE<NAME=RI
CAPTION=Digital Values
TIMEOUT=5000
>
)
ACTION(NAME=ALARM
MODE<NAME=WP
CAPTION=Alarm Command
>
)
ACTION(NAME=ON
MODE<NAME=WP
CAPTION=On
>
)
ACTION(NAME=OFF
MODE<NAME=WP
CAPTION=Off
>
)
ACTION(NAME=AUTO
MODE<NAME=WP
CAPTION=Auto
>
)
ACTION(NAME=MANUAL
MODE<NAME=WP
CAPTION=Manual
>
)
]
}
FAMILY{NAME=G021
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000]
MEMBER[NAME=S9.2
SERVER=ecrfa9
PORT=10000
ACTION(NAME=ANALOG
MODE<NAME=RAR
NUMPOINTS=19
CAPTION=Analog Values
TIMEOUT=5000
SHOWAS=XmDOUBLE
>
)
ACTION(NAME=DIGIT
MODE<NAME=RAI
NUMPOINTS=3
CAPTION=Digital Values
TIMEOUT=5000
>
)
ACTION(NAME=ALARM
MODE<NAME=RM
CAPTION=Alarm Messages
TIMEOUT=5000
>
)
ACTION(NAME=ON
MODE<NAME=WP
CAPTION=On
>
)
ACTION(NAME=RESET
MODE<NAME=WP
CAPTION=Reset
>
)
ACTION(NAME=START
MODE<NAME=WP
CAPTION=Start
>
)
ACTION(NAME=STOP
MODE<NAME=WP
CAPTION=Stop
>
)
ACTION(NAME=STNDBY
MODE<NAME=WP
CAPTION=Standby
>
)
]
}
FAMILY{NAME=HPA1
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000]
MEMBER[NAME=S9.2
SERVER=ecrfa9
PORT=10000
ACTION(NAME=ANALOG
MODE<NAME=RAR
NUMPOINTS=11
CAPTION=Analog Values
TIMEOUT=5000
SHOWAS=XmDOUBLE
>
)
ACTION(NAME=DIGIT
MODE<NAME=RAI
NUMPOINTS=8
CAPTION=Digital Values
TIMEOUT=5000
>
)
]
}
FAMILY{NAME=HPA2
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000]
MEMBER[NAME=S9.2
SERVER=ecrfa9
PORT=10000
ACTION(NAME=ANALOG
MODE<NAME=RAR
NUMPOINTS=11
CAPTION=Analog Values
TIMEOUT=5000
SHOWAS=XmDOUBLE
>
)
ACTION(NAME=DIGIT
MODE<NAME=RAI
NUMPOINTS=8
CAPTION=Digital Values
TIMEOUT=5000
>
)
]
}
FAMILY{NAME=TXA
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000
ACTION(NAME=ON
MODE<NAME=WP
CAPTION=On
>
)
ACTION(NAME=OFF
MODE<NAME=WP
CAPTION=Off
>
)
ACTION(NAME=OUT
MODE<NAME=WP
CAPTION=Out
>
)
ACTION(NAME=RESET
MODE<NAME=WP
CAPTION=Reset
>
)
]
}
FAMILY{NAME=TXB
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000
ACTION(NAME=ON
MODE<NAME=WP
CAPTION=On
>
)
ACTION(NAME=OFF
MODE<NAME=WP
CAPTION=Off
>
)
ACTION(NAME=OUT
MODE<NAME=WP
CAPTION=Out
>
)
ACTION(NAME=RESET
MODE<NAME=WP
CAPTION=Reset
>
)
]
}
FAMILY{NAME=TXATXB
MEMBER[NAME=S9.1
SERVER=ecrfa9
PORT=10000
ACTION(NAME=OUT
MODE<NAME=WP
CAPTION=Out
>
)
]
}
This diff is collapsed.
# configuration file for fel dignostic line power supplies %
FAMILY{NAME=PSB
MEMBER[NAME=L1
SERVER=lpsb_fel
PORT=10000
ACTION(NAME=CURR
MODE<NAME=RR
CAPTION=Current
MIN=-50.0
MAX=50.0
DECIMALS=3
TIMEOUT=1000
>
MODE<NAME=WRI
CAPTION=Current
MIN=-50.0
MAX=50.0
DECIMALS=3
>
)
ACTION(NAME=CURSET
MODE<NAME=RR
CAPTION=Dac Setting
MIN=-50.0
MAX=50.0
DECIMALS=3
TIMEOUT=3000
>
)
ACTION(NAME=CYCL
MODE<NAME=WRI
CAPTION=Cycle
MIN=0.0
MAX=50.0
DECIMALS=3
>
)
ACTION(NAME=OFF
MODE<NAME=WB
LABELFALSE=Off
LABELTRUE=Enable
>
)
ACTION(NAME=ON
MODE<NAME=WP
CAPTION=On
>
)
ACTION(NAME=RESET
MODE<NAME=WP
CAPTION=Reset
>
)
ACTION(NAME=ABORT
MODE<NAME=WP
CAPTION=Abort
>
)
ACTION(NAME=STAT
MODE<NAME=RF
FLAGS=6,GREEN_RED,On,Off:7,STATUS,Remote,Local:8,STATUS,Ready,Not Ready:9,ALARM,----,Interlock 1:10,ALARM,----,Interlock 2
TIMEOUT=1000