PeerInfo in pva/server.h and pva/sharedstate.h
This commit is contained in:
@@ -17,6 +17,7 @@ namespace epics{namespace pvAccess{
|
||||
class ChannelProvider;
|
||||
class Channel;
|
||||
class ChannelRequester;
|
||||
struct PeerInfo; // see pv/security.h
|
||||
}} // epics::pvAccess
|
||||
|
||||
//! See @ref pvas API
|
||||
@@ -168,7 +169,10 @@ public:
|
||||
friend struct Impl;
|
||||
bool isclaimed;
|
||||
std::string cname;
|
||||
Search(const std::string& name) :isclaimed(false),cname(name) {}
|
||||
const ::epics::pvAccess::PeerInfo* peerinfo;
|
||||
Search(const std::string& name, const ::epics::pvAccess::PeerInfo* peer)
|
||||
:isclaimed(false),cname(name),peerinfo(peer)
|
||||
{}
|
||||
public:
|
||||
//! The name being queried
|
||||
const std::string& name() const { return cname; }
|
||||
@@ -176,6 +180,10 @@ public:
|
||||
bool claimed() const { return isclaimed; }
|
||||
//! Has been claimed()
|
||||
void claim() { isclaimed = true; }
|
||||
//! Information about peer making search request.
|
||||
//! May be NULL if not information is available.
|
||||
//! @since >7.1.0
|
||||
const ::epics::pvAccess::PeerInfo* peer() const { return peerinfo; }
|
||||
};
|
||||
typedef std::vector<Search> search_type;
|
||||
|
||||
|
||||
@@ -242,6 +242,10 @@ public:
|
||||
//! The name of the channel through which this request was made (eg. for logging purposes).
|
||||
std::string channelName() const;
|
||||
|
||||
//! Information about peer transport and authentication.
|
||||
//! @returns May be NULL if no information is available
|
||||
const epics::pvAccess::PeerInfo* peer() const;
|
||||
|
||||
void complete(); //!< shorthand for successful completion w/o data (Put or RPC with void return)
|
||||
//! Complete with success or error w/o data.
|
||||
void complete(const epics::pvData::Status& sts);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "pva/server.h"
|
||||
#include "pv/pvAccess.h"
|
||||
#include "pv/security.h"
|
||||
#include "pv/reftrack.h"
|
||||
|
||||
namespace pvd = epics::pvData;
|
||||
@@ -216,8 +217,9 @@ struct DynamicProvider::Impl : public pva::ChannelProvider
|
||||
{
|
||||
bool found = false;
|
||||
{
|
||||
pva::PeerInfo::const_shared_pointer info(requester->getPeerInfo());
|
||||
search_type search;
|
||||
search.push_back(DynamicProvider::Search(name));
|
||||
search.push_back(DynamicProvider::Search(name, info ? info.get() : 0));
|
||||
|
||||
handler->hasChannels(search);
|
||||
|
||||
|
||||
@@ -300,6 +300,11 @@ std::string Operation::channelName() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
const pva::PeerInfo* Operation::peer() const
|
||||
{
|
||||
return impl->info ? impl->info.get() : 0;
|
||||
}
|
||||
|
||||
void Operation::complete()
|
||||
{
|
||||
impl->complete(pvd::Status(), 0);
|
||||
|
||||
@@ -34,7 +34,11 @@ struct PutOP : public pvas::Operation::Impl
|
||||
const pvd::BitSet& changed)
|
||||
:Impl(pvRequest, value, changed)
|
||||
,op(op)
|
||||
{}
|
||||
{
|
||||
pva::ChannelRequester::shared_pointer req(op->channel->getChannelRequester());
|
||||
if(req)
|
||||
info = req->getPeerInfo();
|
||||
}
|
||||
virtual ~PutOP() {}
|
||||
|
||||
virtual pva::Channel::shared_pointer getChannel() OVERRIDE FINAL
|
||||
|
||||
@@ -32,7 +32,11 @@ struct RPCOP : public pvas::Operation::Impl
|
||||
const pvd::PVStructure::const_shared_pointer& value)
|
||||
:Impl(pvRequest, value, pvd::BitSet().set(0))
|
||||
,op(op)
|
||||
{}
|
||||
{
|
||||
pva::ChannelRequester::shared_pointer req(op->channel->getChannelRequester());
|
||||
if(req)
|
||||
info = req->getPeerInfo();
|
||||
}
|
||||
virtual ~RPCOP() {}
|
||||
|
||||
virtual pva::Channel::shared_pointer getChannel() OVERRIDE FINAL
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "pva/sharedstate.h"
|
||||
#include <pv/pvAccess.h>
|
||||
#include <pv/security.h>
|
||||
#include <pv/reftrack.h>
|
||||
|
||||
#define FOR_EACH(TYPE, IT, END, OBJ) for(TYPE IT((OBJ).begin()), END((OBJ).end()); IT != END; ++IT)
|
||||
@@ -135,6 +136,8 @@ struct Operation::Impl
|
||||
|
||||
const pvd::PVStructure::const_shared_pointer pvRequest, value;
|
||||
const pvd::BitSet changed;
|
||||
//! const after sub-class ctor
|
||||
pva::PeerInfo::const_shared_pointer info;
|
||||
|
||||
bool done;
|
||||
int debugLvl;
|
||||
|
||||
Reference in New Issue
Block a user