Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ip ignore as ipag #30

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/gateAs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,22 @@ gateAsClient::gateAsClient(void) :
}

gateAsClient::gateAsClient(gateAsEntry *pEntry, const char *user,
const char *host) :
const char *host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
) :
asclientpvt(NULL),
asentry(pEntry),
user_arg(NULL),
user_func(NULL)
{
if(pEntry&&asAddClient(&asclientpvt,pEntry->asmemberpvt,pEntry->level,
(char*)user,(char*)host) == 0) {
if(pEntry && asAddClient(&asclientpvt,pEntry->asmemberpvt,pEntry->level,
(char*)user ,(char*)host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
) == 0) {
asPutClientPvt(asclientpvt,this);
}

Expand Down
21 changes: 18 additions & 3 deletions src/gateAs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <string.h>
#include <stdlib.h>

#include <epicsVersion.h>


extern "C" {
#include <ellLib.h>
Expand Down Expand Up @@ -152,7 +154,11 @@ class gateAsClient
{
public:
gateAsClient(void);
gateAsClient(gateAsEntry *pase, const char *user, const char *host);
gateAsClient(gateAsEntry *pase, const char *user, const char *host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);
~gateAsClient(void);

aitBool readAccess(void) const
Expand All @@ -167,8 +173,17 @@ class gateAsClient
// Used in virtual function setOwner from casChannel, not called
// from Gateway. It is a security hole to support this, and it is
// no longer implemented in base.
long changeInfo(const char* user, const char* host)
{ return asChangeClient(asclientpvt,asentry->level,(char*)user,(char*)host);}
long changeInfo(const char* user, const char* host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
)
{ return asChangeClient(asclientpvt,asentry->level, (char*)user ,
(char*)host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
);}
#endif

const char *user(void) { return (const char*)asclientpvt->user; }
Expand Down
26 changes: 22 additions & 4 deletions src/gateStat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <time.h>
#endif

#include <epicsVersion.h>

#include <gdd.h>
#include <gddApps.h>
#include "gateResources.h"
Expand Down Expand Up @@ -59,8 +61,16 @@ static struct timespec *timeSpec(void)
//////// gateStatChan (derived from gate chan derived from casChannel)

gateStatChan::gateStatChan(const casCtx &ctx, casPV *casPvIn, gateAsEntry *asentry,
const char * const user, const char * const host) :
gateChan(ctx,casPvIn,asentry,user,host)
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
) :
gateChan(ctx,casPvIn,asentry,user,host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
)
{
gateStat *pStat=(gateStat *)casPv;
if(pStat) pStat->addChan(this);
Expand Down Expand Up @@ -217,9 +227,17 @@ const char *gateStat::getName() const
}

casChannel* gateStat::createChannel(const casCtx &ctx,
const char * const user, const char * const host)
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
)
{
gateStatChan *pChan=new gateStatChan(ctx,this,asentry,user,host);
gateStatChan *pChan=new gateStatChan(ctx,this,asentry,user,host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
);
return pChan;
}

Expand Down
14 changes: 12 additions & 2 deletions src/gateStat.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef GATE_STAT_H
#define GATE_STAT_H

#include <epicsVersion.h>

#include "casdef.h"
#include "aitTypes.h"

Expand All @@ -38,7 +40,11 @@ class gateStatChan : public gateChan, public tsDLNode<gateStatChan>
{
public:
gateStatChan(const casCtx &ctx, casPV *pvIn, gateAsEntry *asentryIn,
const char * const user, const char * const host);
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);
~gateStatChan(void);

virtual caStatus write(const casCtx &ctx, const gdd &value);
Expand All @@ -61,7 +67,11 @@ class gateStat : public casPV
virtual unsigned maxSimultAsyncOps(void) const;
virtual const char *getName() const;
virtual casChannel *createChannel (const casCtx &ctx,
const char* const pUserName, const char* const pHostName);
const char* const pUserName, const char* const pHostName
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);

caStatus write(const casCtx &ctx, const gdd &dd, gateChan &chan);

Expand Down
59 changes: 50 additions & 9 deletions src/gateVc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
# include <unistd.h>
#endif

#include <epicsVersion.h>

#include <gdd.h>
#include <gddApps.h>
#include <dbMapper.h>
Expand Down Expand Up @@ -113,14 +115,25 @@ void dumpdd(int step, const char *desc, const char * /*name*/, const gdd *dd)
// gateAsClient::gateAsClient. We assume this storage is in the
// server and just keep pointers to it.
gateChan::gateChan(const casCtx &ctx, casPV *casPvIn, gateAsEntry *asentry,
const char * const userIn, const char * const hostIn) :
const char * const userIn, const char * const hostIn
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addrIn
#endif
) :
casChannel(ctx),
casPv(casPvIn),
user(userIn),
host(hostIn)
#ifdef EPICS_HAS_AS_IPAG
,ip_addr(ip_addrIn)
#endif
{

asclient=new gateAsClient(asentry,user,host);
asclient=new gateAsClient(asentry,user,host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
);
if(asclient) asclient->setUserFunction(post_rights,this);
}

Expand All @@ -133,9 +146,17 @@ gateChan::~gateChan(void)
// Virtual function from casChannel, not called from Gateway. It is a
// security hole to support this, and it is no longer implemented in
// base.
void gateChan::setOwner(const char* const u, const char* const h)
void gateChan::setOwner(const char* const u, const char* const h
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
)
{
asclient->changeInfo(u,h);
asclient->changeInfo(u,h
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
);
}
#endif

Expand Down Expand Up @@ -184,7 +205,11 @@ void gateChan::resetAsClient(gateAsEntry *asentry)
// being destroyed or if the asentry is NULL
if(!casPv || !asentry) return;

asclient=new gateAsClient(asentry,user,host);
asclient=new gateAsClient(asentry,user,host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
);
if(asclient) {
asclient->setUserFunction(post_rights,this);
}
Expand All @@ -211,8 +236,16 @@ void gateChan::deleteAsClient(void)
// ------------------------gateVcChan

gateVcChan::gateVcChan(const casCtx &ctx, casPV *casPvIn, gateAsEntry *asentry,
const char * const user, const char * const host) :
gateChan(ctx,casPvIn,asentry,user,host)
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
) :
gateChan(ctx,casPvIn,asentry,user,host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
)
{
gateVcData *vc=(gateVcData *)casPv;
if(vc) vc->addChan(this);
Expand Down Expand Up @@ -492,10 +525,18 @@ void gateVcData::destroy(void)
}

casChannel* gateVcData::createChannel(const casCtx &ctx,
const char * const user, const char * const host)
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
)
{
gateDebug0(5,"gateVcData::createChannel()\n");
gateVcChan* chan = new gateVcChan(ctx,this,asentry,user,host);
gateVcChan* chan = new gateVcChan(ctx,this,asentry,user,host
#ifdef EPICS_HAS_AS_IPAG
,ip_addr
#endif
);
return chan;
}

Expand Down
29 changes: 25 additions & 4 deletions src/gateVc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# include <sys/time.h>
#endif

#include <epicsVersion.h>

#include <caProto.h>

#include "casdef.h"
Expand Down Expand Up @@ -74,14 +76,22 @@ class gateChan : public casChannel
{
public:
gateChan(const casCtx &ctx, casPV *pvIn, gateAsEntry *asentryIn,
const char * const user, const char * const host);
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);
~gateChan(void);

#ifdef SUPPORT_OWNER_CHANGE
// Virtual function from casChannel, not called from Gateway. It
// is a security hole to support this, and it is no longer
// implemented in base.
virtual void setOwner(const char * const user, const char * const host);
virtual void setOwner(const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);
#endif

void report(FILE *fp);
Expand All @@ -103,13 +113,20 @@ class gateChan : public casChannel
gateAsClient *asclient; // Must be deleted when done using it
const char *user;
const char *host;
#ifdef EPICS_HAS_AS_IPAG
epicsUInt32 ip_addr;
#endif
};

class gateVcChan : public gateChan, public tsDLNode<gateVcChan>
{
public:
gateVcChan(const casCtx &ctx, casPV *pvIn, gateAsEntry *asentryIn,
const char * const user, const char * const host);
const char * const user, const char * const host
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);
~gateVcChan(void);

virtual caStatus write(const casCtx &ctx, const gdd &value);
Expand Down Expand Up @@ -138,7 +155,11 @@ class gateVcData : public casPV, public tsDLHashNode<gateVcData>
virtual unsigned maxDimension(void) const;
virtual aitIndex maxBound(unsigned dim) const;
virtual casChannel *createChannel (const casCtx &ctx,
const char* const pUserName, const char* const pHostName);
const char* const pUserName, const char* const pHostName
#ifdef EPICS_HAS_AS_IPAG
,epicsUInt32 ip_addr
#endif
);
virtual const char *getName() const;

caStatus write(const casCtx &ctx, const gdd &value, gateChan &chan);
Expand Down
6 changes: 6 additions & 0 deletions src/gateway.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,17 @@ static int startEverything(char *prefix)
printf("CA Protocol version %s\n", ca_version());
printEnv(stdout,"EPICS_CA_ADDR_LIST");
printEnv(stdout,"EPICS_CA_AUTO_ADDR_LIST");
#ifdef EPICS_HAS_CA_IGNORE_NET_LIST
printEnv(stdout,"EPICS_CA_IGNORE_NET_LIST");
#endif
printEnv(stdout,"EPICS_CA_SERVER_PORT");
printEnv(stdout,"EPICS_CA_MAX_ARRAY_BYTES");
printEnv(stdout,"EPICS_CAS_INTF_ADDR_LIST");
printEnv(stdout,"EPICS_CAS_SERVER_PORT");
printEnv(stdout,"EPICS_CAS_IGNORE_ADDR_LIST");
#ifdef EPICS_HAS_CAS_IGNORE_NET_LIST
printEnv(stdout,"EPICS_CAS_IGNORE_NET_LIST");
#endif
printEnv(stdout,"EPICS_CAS_AUTO_BEACON_ADDR_LIST");
printEnv(stdout,"EPICS_CAS_BEACON_ADDR_LIST");

Expand Down