Add AS write hooks
This commit is contained in:

committed by
Michael Davidsaver

parent
c95d9a68fe
commit
69a7bb3795
@ -7,6 +7,8 @@ Release 1.3.2 (UNRELEASED)
|
|||||||
|
|
||||||
- Additions
|
- Additions
|
||||||
- Add new "structure" to @ref qsrv_group_map_types
|
- Add new "structure" to @ref qsrv_group_map_types
|
||||||
|
- Changes
|
||||||
|
- Add Access Security hooks for single and group writes.
|
||||||
|
|
||||||
Release 1.3.1 (June 2021)
|
Release 1.3.1 (June 2021)
|
||||||
=========================
|
=========================
|
||||||
|
10
pdbApp/pdb.h
10
pdbApp/pdb.h
@ -2,6 +2,7 @@
|
|||||||
#define PDB_H
|
#define PDB_H
|
||||||
|
|
||||||
#include <dbEvent.h>
|
#include <dbEvent.h>
|
||||||
|
#include <asLib.h>
|
||||||
|
|
||||||
#include <pv/configuration.h>
|
#include <pv/configuration.h>
|
||||||
#include <pv/pvAccess.h>
|
#include <pv/pvAccess.h>
|
||||||
@ -73,4 +74,13 @@ struct QSRV_API PDBProvider : public epics::pvAccess::ChannelProvider,
|
|||||||
QSRV_API
|
QSRV_API
|
||||||
void QSRVRegistrar_counters();
|
void QSRVRegistrar_counters();
|
||||||
|
|
||||||
|
class QSRV_API AsWritePvt {
|
||||||
|
void * pvt;
|
||||||
|
public:
|
||||||
|
explicit AsWritePvt(void * pvt): pvt(pvt) {}
|
||||||
|
~AsWritePvt() {
|
||||||
|
asTrapWriteAfterWrite(pvt);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif // PDB_H
|
#endif // PDB_H
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <dbAccess.h>
|
#include <dbAccess.h>
|
||||||
#include <dbChannel.h>
|
#include <dbChannel.h>
|
||||||
#include <dbStaticLib.h>
|
#include <dbStaticLib.h>
|
||||||
|
#include <asLib.h>
|
||||||
|
|
||||||
#include <pv/pvAccess.h>
|
#include <pv/pvAccess.h>
|
||||||
#include <pv/configuration.h>
|
#include <pv/configuration.h>
|
||||||
@ -349,12 +350,24 @@ void PDBGroupPut::put(pvd::PVStructure::shared_pointer const & value,
|
|||||||
// assume value may be a different struct each time... lot of wasted prep work
|
// assume value may be a different struct each time... lot of wasted prep work
|
||||||
const size_t npvs = channel->pv->members.size();
|
const size_t npvs = channel->pv->members.size();
|
||||||
std::vector<std::tr1::shared_ptr<PVIF> > putpvif(npvs);
|
std::vector<std::tr1::shared_ptr<PVIF> > putpvif(npvs);
|
||||||
|
std::vector<AsWritePvt> asWritePvt;
|
||||||
|
|
||||||
for(size_t i=0; i<npvs; i++)
|
for(size_t i=0; i<npvs; i++)
|
||||||
{
|
{
|
||||||
PDBGroupPV::Info& info = channel->pv->members[i];
|
PDBGroupPV::Info& info = channel->pv->members[i];
|
||||||
if(!info.allowProc) continue;
|
|
||||||
|
|
||||||
|
asWritePvt.push_back(AsWritePvt(
|
||||||
|
asTrapWriteWithData(channel->aspvt.at(i).aspvt,
|
||||||
|
std::string(channel->cred.user.begin(), channel->cred.user.end()).c_str(),
|
||||||
|
std::string(channel->cred.host.begin(), channel->cred.host.end()).c_str(),
|
||||||
|
info.chan,
|
||||||
|
info.chan->final_type,
|
||||||
|
info.chan->final_no_elements,
|
||||||
|
NULL
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
if(!info.allowProc) continue;
|
||||||
putpvif[i].reset(info.builder->attach(value, info.attachment));
|
putpvif[i].reset(info.builder->attach(value, info.attachment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <asLib.h>
|
||||||
#include <dbAccess.h>
|
#include <dbAccess.h>
|
||||||
#include <dbChannel.h>
|
#include <dbChannel.h>
|
||||||
#include <dbStaticLib.h>
|
#include <dbStaticLib.h>
|
||||||
@ -355,6 +356,17 @@ void PDBSinglePut::put(pvd::PVStructure::shared_pointer const & value,
|
|||||||
dbChannel *chan = channel->pv->chan;
|
dbChannel *chan = channel->pv->chan;
|
||||||
dbFldDes *fld = dbChannelFldDes(chan);
|
dbFldDes *fld = dbChannelFldDes(chan);
|
||||||
|
|
||||||
|
AsWritePvt asWritePvt (
|
||||||
|
asTrapWriteWithData(channel->aspvt.aspvt,
|
||||||
|
std::string(channel->cred.user.begin(), channel->cred.user.end()).c_str(),
|
||||||
|
std::string(channel->cred.host.begin(), channel->cred.host.end()).c_str(),
|
||||||
|
chan,
|
||||||
|
chan->final_type,
|
||||||
|
chan->final_no_elements,
|
||||||
|
NULL
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
pvd::Status ret;
|
pvd::Status ret;
|
||||||
if(!channel->aspvt.canWrite()) {
|
if(!channel->aspvt.canWrite()) {
|
||||||
ret = pvd::Status::error("Put not permitted");
|
ret = pvd::Status::error("Put not permitted");
|
||||||
|
Reference in New Issue
Block a user