7 #ifndef RESPONSEHANDLERS_H_
8 #define RESPONSEHANDLERS_H_
14 #include <pv/serverContext.h>
15 #include <pv/remote.h>
16 #include <pv/serverChannelImpl.h>
17 #include <pv/baseChannelRequester.h>
18 #include <pv/securityImpl.h>
25 class AbstractServerResponseHandler :
public ResponseHandler {
27 ServerContextImpl::shared_pointer _context;
29 AbstractServerResponseHandler(ServerContextImpl::shared_pointer
const & context,
std::string description) :
30 ResponseHandler(context.
get(), description), _context(context) {
33 virtual ~AbstractServerResponseHandler() {}
42 AbstractServerResponseHandler(context,
"Bad request") {
49 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
50 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
59 AbstractServerResponseHandler(context,
"Connection validation") {
64 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
65 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
74 AbstractServerResponseHandler(context, description) {
85 AbstractServerResponseHandler(context,
"Echo request") {
90 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
91 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
96 EchoTransportSender(osiSockAddr* echoFrom,
size_t payloadSize, epics::pvData::ByteBuffer& payloadBuffer) {
97 memcpy(&_echoFrom, echoFrom,
sizeof(osiSockAddr));
98 toEcho.resize(payloadSize);
100 payloadBuffer.getArray(&toEcho[0], payloadSize);
104 virtual ~EchoTransportSender() {}
106 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL {
107 control->startMessage(CMD_ECHO, toEcho.size(), toEcho.size());
108 control->setRecipient(_echoFrom);
109 if (toEcho.size() > 0) {
110 buffer->putArray<
char>(&toEcho[0], toEcho.size());
115 osiSockAddr _echoFrom;
133 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
134 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
138 class ServerChannelFindRequesterImpl:
139 public ChannelFindRequester,
141 public epics::pvData::TimerCallback,
142 public std::tr1::enable_shared_from_this<ServerChannelFindRequesterImpl>
145 ServerChannelFindRequesterImpl(ServerContextImpl::shared_pointer
const & context,
146 const PeerInfo::const_shared_pointer& peer,
147 epics::pvData::int32 expectedResponseCount);
148 virtual ~ServerChannelFindRequesterImpl() {}
150 ServerChannelFindRequesterImpl* set(
std::string _name, epics::pvData::int32 searchSequenceId,
151 epics::pvData::int32 cid, osiSockAddr
const & sendTo,
bool responseRequired,
bool serverSearch);
152 virtual void channelFindResult(
const epics::pvData::Status& status, ChannelFind::shared_pointer
const & channelFind,
bool wasFound) OVERRIDE FINAL;
154 virtual std::tr1::shared_ptr<const PeerInfo> getPeerInfo() OVERRIDE FINAL;
155 virtual
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
157 virtual
void callback() OVERRIDE FINAL;
158 virtual
void timerStopped() OVERRIDE FINAL;
163 epics::pvData::int32 _searchSequenceId;
164 epics::pvData::int32 _cid;
166 bool _responseRequired;
168 const ServerContextImpl::shared_pointer _context;
169 const PeerInfo::const_shared_pointer _peer;
170 mutable epics::pvData::Mutex _mutex;
171 const epics::pvData::int32 _expectedResponseCount;
172 epics::pvData::int32 _responseCount;
184 :AbstractServerResponseHandler(context,
"Create channel request")
188 virtual void handleResponse(osiSockAddr* responseFrom,
189 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
190 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
196 void disconnect(Transport::shared_pointer
const & transport);
200 class BlockingServerTCPTransportCodec;
203 class ServerChannelRequesterImpl :
204 public ChannelRequester,
205 public TransportSender,
206 public std::tr1::enable_shared_from_this<ServerChannelRequesterImpl>
208 friend class ServerCreateChannelHandler;
210 typedef std::tr1::shared_ptr<ServerChannelRequesterImpl> shared_pointer;
211 typedef std::tr1::shared_ptr<const ServerChannelRequesterImpl> const_shared_pointer;
213 ServerChannelRequesterImpl(Transport::shared_pointer
const & transport,
215 const pvAccessID cid);
217 virtual ~ServerChannelRequesterImpl() {}
218 static ChannelRequester::shared_pointer create(ChannelProvider::shared_pointer
const & provider,
219 Transport::shared_pointer
const & transport,
const std::string channelName,
220 const pvAccessID cid);
221 virtual void channelCreated(
const epics::pvData::Status& status, Channel::shared_pointer
const & channel) OVERRIDE FINAL;
222 virtual void channelStateChange(Channel::shared_pointer
const & c,
const Channel::ConnectionState isConnected) OVERRIDE FINAL;
223 virtual std::tr1::shared_ptr<const PeerInfo> getPeerInfo() OVERRIDE FINAL;
224 virtual std::
string getRequesterName() OVERRIDE FINAL;
225 virtual
void message(std::
string const & message, epics::pvData::MessageType messageType) OVERRIDE FINAL;
226 virtual
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
228 ServerChannel::weak_pointer _serverChannel;
229 std::tr1::weak_ptr<detail::BlockingServerTCPTransportCodec> _transport;
230 const std::
string _channelName;
231 const pvAccessID _cid;
233 epics::pvData::Status _status;
234 epics::pvData::Mutex _mutex;
245 AbstractServerResponseHandler(context,
"Destroy channel request") {
249 virtual void handleResponse(osiSockAddr* responseFrom,
250 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
251 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
255 class ServerDestroyChannelHandlerTransportSender :
public TransportSender
258 ServerDestroyChannelHandlerTransportSender(pvAccessID cid, pvAccessID sid): _cid(cid), _sid(sid) {
261 virtual ~ServerDestroyChannelHandlerTransportSender() {}
262 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL {
263 control->startMessage((epics::pvData::int8)CMD_DESTROY_CHANNEL, 2*
sizeof(epics::pvData::int32)/
sizeof(epics::pvData::int8));
264 buffer->putInt(_sid);
265 buffer->putInt(_cid);
281 AbstractServerResponseHandler(context,
"Get request") {
285 virtual void handleResponse(osiSockAddr* responseFrom,
286 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
287 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
290 class ServerChannelGetRequesterImpl :
291 public BaseChannelRequester,
293 public std::tr1::enable_shared_from_this<ServerChannelGetRequesterImpl>
296 typedef std::tr1::shared_ptr<ServerChannelGetRequesterImpl> shared_pointer;
297 typedef std::tr1::shared_ptr<const ServerChannelGetRequesterImpl> const_shared_pointer;
299 ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer
const & context,
300 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
301 Transport::shared_pointer
const & transport);
302 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
304 static ChannelGetRequester::shared_pointer create(ServerContextImpl::shared_pointer
const & context,
305 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
306 Transport::shared_pointer
const & transport,
307 epics::pvData::PVStructure::shared_pointer
const & pvRequest);
308 virtual ~ServerChannelGetRequesterImpl() {}
309 virtual void channelGetConnect(
const epics::pvData::Status& status, ChannelGet::shared_pointer
const & channelGet,
310 epics::pvData::Structure::const_shared_pointer
const & structure) OVERRIDE FINAL;
311 virtual void getDone(
const epics::pvData::Status& status, ChannelGet::shared_pointer
const & channelGet,
312 epics::pvData::PVStructure::shared_pointer
const & pvStructure,
313 epics::pvData::BitSet::shared_pointer
const & bitSet) OVERRIDE FINAL;
314 virtual void destroy() OVERRIDE FINAL;
316 ChannelGet::shared_pointer getChannelGet();
317 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return getChannelGet(); }
319 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
322 ChannelGet::shared_pointer _channelGet;
323 epics::pvData::PVStructure::shared_pointer _pvStructure;
324 epics::pvData::BitSet::shared_pointer _bitSet;
325 epics::pvData::Status _status;
337 AbstractServerResponseHandler(context,
"Put request") {
341 virtual void handleResponse(osiSockAddr* responseFrom,
342 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
343 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
346 class ServerChannelPutRequesterImpl :
347 public BaseChannelRequester,
349 public std::tr1::enable_shared_from_this<ServerChannelPutRequesterImpl>
352 typedef std::tr1::shared_ptr<ServerChannelPutRequesterImpl> shared_pointer;
353 typedef std::tr1::shared_ptr<const ServerChannelPutRequesterImpl> const_shared_pointer;
355 ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer
const & context,
356 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
357 Transport::shared_pointer
const & transport);
358 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
360 static ChannelPutRequester::shared_pointer create(ServerContextImpl::shared_pointer
const & context,
361 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
362 Transport::shared_pointer
const & transport,epics::pvData::PVStructure::shared_pointer
const & pvRequest);
364 virtual ~ServerChannelPutRequesterImpl() {}
365 virtual void channelPutConnect(
const epics::pvData::Status& status, ChannelPut::shared_pointer
const & channelPut,
366 epics::pvData::Structure::const_shared_pointer
const & structure) OVERRIDE FINAL;
367 virtual void putDone(
const epics::pvData::Status& status, ChannelPut::shared_pointer
const & channelPut) OVERRIDE FINAL;
368 virtual void getDone(
const epics::pvData::Status& status, ChannelPut::shared_pointer
const & channelPut,
369 epics::pvData::PVStructure::shared_pointer
const & pvStructure,
370 epics::pvData::BitSet::shared_pointer
const & bitSet) OVERRIDE FINAL;
371 virtual void destroy() OVERRIDE FINAL;
373 ChannelPut::shared_pointer getChannelPut();
374 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return getChannelPut(); }
376 epics::pvData::BitSet::shared_pointer getPutBitSet();
377 epics::pvData::PVStructure::shared_pointer getPutPVStructure();
378 void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
381 ChannelPut::shared_pointer _channelPut;
382 epics::pvData::BitSet::shared_pointer _bitSet;
383 epics::pvData::PVStructure::shared_pointer _pvStructure;
384 epics::pvData::Status _status;
395 AbstractServerResponseHandler(context,
"Put-get request") {
399 virtual void handleResponse(osiSockAddr* responseFrom,
400 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
401 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
404 class ServerChannelPutGetRequesterImpl :
405 public BaseChannelRequester,
407 public std::tr1::enable_shared_from_this<ServerChannelPutGetRequesterImpl>
410 typedef std::tr1::shared_ptr<ServerChannelPutGetRequesterImpl> shared_pointer;
411 typedef std::tr1::shared_ptr<const ServerChannelPutGetRequesterImpl> const_shared_pointer;
413 ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer
const & context,
414 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
415 Transport::shared_pointer
const & transport);
416 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
418 static ChannelPutGetRequester::shared_pointer create(ServerContextImpl::shared_pointer
const & context,
419 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
420 Transport::shared_pointer
const & transport,epics::pvData::PVStructure::shared_pointer
const & pvRequest);
421 virtual ~ServerChannelPutGetRequesterImpl() {}
423 virtual void channelPutGetConnect(
const epics::pvData::Status& status, ChannelPutGet::shared_pointer
const & channelPutGet,
424 epics::pvData::Structure::const_shared_pointer
const & putStructure,
425 epics::pvData::Structure::const_shared_pointer
const & getStructure) OVERRIDE FINAL;
426 virtual void getGetDone(
const epics::pvData::Status& status, ChannelPutGet::shared_pointer
const & channelPutGet,
427 epics::pvData::PVStructure::shared_pointer
const & pvStructure,
428 epics::pvData::BitSet::shared_pointer
const & bitSet) OVERRIDE FINAL;
429 virtual void getPutDone(
const epics::pvData::Status& status, ChannelPutGet::shared_pointer
const & channelPutGet,
430 epics::pvData::PVStructure::shared_pointer
const & pvStructure,
431 epics::pvData::BitSet::shared_pointer
const & bitSet) OVERRIDE FINAL;
432 virtual void putGetDone(
const epics::pvData::Status& status, ChannelPutGet::shared_pointer
const & channelPutGet,
433 epics::pvData::PVStructure::shared_pointer
const & pvStructure,
434 epics::pvData::BitSet::shared_pointer
const & bitSet) OVERRIDE FINAL;
435 virtual void destroy() OVERRIDE FINAL;
437 ChannelPutGet::shared_pointer getChannelPutGet();
438 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return getChannelPutGet(); }
440 epics::pvData::PVStructure::shared_pointer getPutGetPVStructure();
441 epics::pvData::BitSet::shared_pointer getPutGetBitSet();
443 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
446 ChannelPutGet::shared_pointer _channelPutGet;
447 epics::pvData::PVStructure::shared_pointer _pvPutStructure;
448 epics::pvData::BitSet::shared_pointer _pvPutBitSet;
449 epics::pvData::PVStructure::shared_pointer _pvGetStructure;
450 epics::pvData::BitSet::shared_pointer _pvGetBitSet;
451 epics::pvData::Status _status;
463 AbstractServerResponseHandler(context,
"Monitor request") {
467 virtual void handleResponse(osiSockAddr* responseFrom,
468 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
469 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
473 class ServerMonitorRequesterImpl :
474 public BaseChannelRequester,
476 public std::tr1::enable_shared_from_this<ServerMonitorRequesterImpl>
479 typedef std::tr1::shared_ptr<ServerMonitorRequesterImpl> shared_pointer;
480 typedef std::tr1::shared_ptr<const ServerMonitorRequesterImpl> const_shared_pointer;
482 ServerMonitorRequesterImpl(ServerContextImpl::shared_pointer
const & context,
483 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
484 Transport::shared_pointer
const & transport);
485 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
487 static shared_pointer create(ServerContextImpl::shared_pointer
const & context,
488 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
489 Transport::shared_pointer
const & transport,epics::pvData::PVStructure::shared_pointer
const & pvRequest);
490 virtual ~ServerMonitorRequesterImpl() {}
492 virtual void monitorConnect(
const epics::pvData::Status& status,
493 Monitor::shared_pointer
const & monitor,
494 epics::pvData::StructureConstPtr
const & structure) OVERRIDE FINAL;
495 virtual void unlisten(Monitor::shared_pointer
const & monitor) OVERRIDE FINAL;
496 virtual void monitorEvent(Monitor::shared_pointer
const & monitor) OVERRIDE FINAL;
497 virtual void destroy() OVERRIDE FINAL;
499 Monitor::shared_pointer getChannelMonitor();
500 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return std::tr1::shared_ptr<ChannelRequest>(); }
502 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
503 void ack(
size_t cnt);
506 Monitor::shared_pointer _channelMonitor;
507 epics::pvData::StructureConstPtr _structure;
508 epics::pvData::Status _status;
515 window_t _window_closed;
529 AbstractServerResponseHandler(context,
"Array request") {
533 virtual void handleResponse(osiSockAddr* responseFrom,
534 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
535 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
538 class ServerChannelArrayRequesterImpl :
539 public BaseChannelRequester,
541 public std::tr1::enable_shared_from_this<ServerChannelArrayRequesterImpl>
544 typedef std::tr1::shared_ptr<ServerChannelArrayRequesterImpl> shared_pointer;
545 typedef std::tr1::shared_ptr<const ServerChannelArrayRequesterImpl> const_shared_pointer;
547 ServerChannelArrayRequesterImpl(ServerContextImpl::shared_pointer
const & context,
548 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
549 Transport::shared_pointer
const & transport);
550 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
552 static ChannelArrayRequester::shared_pointer create(ServerContextImpl::shared_pointer
const & context,
553 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
554 Transport::shared_pointer
const & transport,epics::pvData::PVStructure::shared_pointer
const & pvRequest);
555 virtual ~ServerChannelArrayRequesterImpl() {}
557 virtual void channelArrayConnect(
const epics::pvData::Status& status,
558 ChannelArray::shared_pointer
const & channelArray,
559 epics::pvData::Array::const_shared_pointer
const & array) OVERRIDE FINAL;
560 virtual void getArrayDone(
const epics::pvData::Status& status,
561 ChannelArray::shared_pointer
const & channelArray,
562 epics::pvData::PVArray::shared_pointer
const & pvArray) OVERRIDE FINAL;
563 virtual void putArrayDone(
const epics::pvData::Status& status,
564 ChannelArray::shared_pointer
const & channelArray) OVERRIDE FINAL;
565 virtual void setLengthDone(
const epics::pvData::Status& status,
566 ChannelArray::shared_pointer
const & channelArray) OVERRIDE FINAL;
567 virtual void getLengthDone(
const epics::pvData::Status& status,
568 ChannelArray::shared_pointer
const & channelArray,
569 std::size_t length) OVERRIDE FINAL;
570 virtual void destroy() OVERRIDE FINAL;
572 ChannelArray::shared_pointer getChannelArray();
573 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return getChannelArray(); }
575 epics::pvData::PVArray::shared_pointer getPVArray();
576 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
580 ChannelArray::shared_pointer _channelArray;
581 epics::pvData::PVArray::shared_pointer _pvArray;
584 epics::pvData::Status _status;
595 AbstractServerResponseHandler(context,
"Destroy request") {
599 virtual void handleResponse(osiSockAddr* responseFrom,
600 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
601 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
604 void failureResponse(Transport::shared_pointer
const & transport, pvAccessID ioid,
const epics::pvData::Status& errorStatus);
616 AbstractServerResponseHandler(context,
"Cancel request") {
620 virtual void handleResponse(osiSockAddr* responseFrom,
621 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
622 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
625 void failureResponse(Transport::shared_pointer
const & transport, pvAccessID ioid,
const epics::pvData::Status& errorStatus);
637 AbstractServerResponseHandler(context,
"Process request") {
641 virtual void handleResponse(osiSockAddr* responseFrom,
642 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
643 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
646 class ServerChannelProcessRequesterImpl :
647 public BaseChannelRequester,
649 public std::tr1::enable_shared_from_this<ServerChannelProcessRequesterImpl>
652 typedef std::tr1::shared_ptr<ServerChannelProcessRequesterImpl> shared_pointer;
653 typedef std::tr1::shared_ptr<const ServerChannelProcessRequesterImpl> const_shared_pointer;
655 ServerChannelProcessRequesterImpl(ServerContextImpl::shared_pointer
const & context,
656 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
657 Transport::shared_pointer
const & transport);
658 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
660 static ChannelProcessRequester::shared_pointer create(ServerContextImpl::shared_pointer
const & context,
661 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
662 Transport::shared_pointer
const & transport, epics::pvData::PVStructure::shared_pointer
const & pvRequest);
663 virtual ~ServerChannelProcessRequesterImpl() {}
665 virtual void channelProcessConnect(
const epics::pvData::Status& status, ChannelProcess::shared_pointer
const & channelProcess) OVERRIDE FINAL;
666 virtual void processDone(
const epics::pvData::Status& status, ChannelProcess::shared_pointer
const & channelProcess) OVERRIDE FINAL;
667 virtual void destroy() OVERRIDE FINAL;
669 ChannelProcess::shared_pointer getChannelProcess();
670 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return getChannelProcess(); }
672 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
676 ChannelProcess::shared_pointer _channelProcess;
677 epics::pvData::Status _status;
688 AbstractServerResponseHandler(context,
"Get field request") {
692 virtual void handleResponse(osiSockAddr* responseFrom,
693 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
694 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
696 void getFieldFailureResponse(Transport::shared_pointer
const & transport,
const pvAccessID ioid,
const epics::pvData::Status& errorStatus);
699 class ServerGetFieldRequesterImpl :
700 public BaseChannelRequester,
702 public std::tr1::enable_shared_from_this<ServerGetFieldRequesterImpl>
705 typedef std::tr1::shared_ptr<ServerGetFieldRequesterImpl> shared_pointer;
706 typedef std::tr1::shared_ptr<const ServerGetFieldRequesterImpl> const_shared_pointer;
708 ServerGetFieldRequesterImpl(ServerContextImpl::shared_pointer
const & context,
709 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
710 Transport::shared_pointer
const & transport);
712 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return std::tr1::shared_ptr<ChannelRequest>(); }
714 virtual ~ServerGetFieldRequesterImpl() {}
715 virtual void getDone(
const epics::pvData::Status& status, epics::pvData::FieldConstPtr
const & field) OVERRIDE FINAL;
716 virtual void destroy() OVERRIDE FINAL;
717 virtual
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
720 epics::pvData::Status _status;
721 epics::pvData::FieldConstPtr _field;
724 class ServerGetFieldHandlerTransportSender : public TransportSender
727 ServerGetFieldHandlerTransportSender(
const pvAccessID ioid,
const epics::pvData::Status& status, Transport::shared_pointer
const & ):
728 _ioid(ioid), _status(status) {
731 virtual ~ServerGetFieldHandlerTransportSender() {}
733 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL {
734 control->startMessage((epics::pvData::int8)CMD_GET_FIELD,
sizeof(epics::pvData::int32)/
sizeof(epics::pvData::int8));
735 buffer->putInt(_ioid);
736 _status.serialize(buffer, control);
740 const pvAccessID _ioid;
741 const epics::pvData::Status _status;
754 AbstractServerResponseHandler(context,
"RPC request") {
758 virtual void handleResponse(osiSockAddr* responseFrom,
759 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
760 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
763 class ServerChannelRPCRequesterImpl :
764 public BaseChannelRequester,
766 public std::tr1::enable_shared_from_this<ServerChannelRPCRequesterImpl>
769 typedef std::tr1::shared_ptr<ServerChannelRPCRequesterImpl> shared_pointer;
770 typedef std::tr1::shared_ptr<const ServerChannelRPCRequesterImpl> const_shared_pointer;
772 ServerChannelRPCRequesterImpl(ServerContextImpl::shared_pointer
const & context,
773 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
774 Transport::shared_pointer
const & transport);
775 void activate(epics::pvData::PVStructure::shared_pointer
const & pvRequest);
777 static ChannelRPCRequester::shared_pointer create(ServerContextImpl::shared_pointer
const & context,
778 std::tr1::shared_ptr<ServerChannel>
const & channel,
const pvAccessID ioid,
779 Transport::shared_pointer
const & transport,epics::pvData::PVStructure::shared_pointer
const & pvRequest);
780 virtual ~ServerChannelRPCRequesterImpl() {}
782 virtual void channelRPCConnect(
const epics::pvData::Status& status, ChannelRPC::shared_pointer
const & channelRPC) OVERRIDE FINAL;
783 virtual void requestDone(
const epics::pvData::Status& status,
784 ChannelRPC::shared_pointer
const & channelRPC,
785 epics::pvData::PVStructure::shared_pointer
const & pvResponse) OVERRIDE FINAL;
786 virtual void destroy() OVERRIDE FINAL;
790 ChannelRPC::shared_pointer getChannelRPC();
791 virtual std::tr1::shared_ptr<ChannelRequest> getOperation() OVERRIDE FINAL {
return getChannelRPC(); }
793 virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
796 ChannelRPC::shared_pointer _channelRPC;
797 epics::pvData::PVStructure::shared_pointer _pvResponse;
798 epics::pvData::Status _status;
811 virtual void handleResponse(osiSockAddr* responseFrom,
812 Transport::shared_pointer
const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
813 std::size_t payloadSize, epics::pvData::ByteBuffer* payloadBuffer) OVERRIDE FINAL;
821 AuthNZHandler handle_authnz;
Requester for ChannelPut.
ConnectionState
Channel connection status.
Get field request handler.
Connection validation message handler.
virtual void handleResponse(osiSockAddr *responseFrom, Transport::shared_pointer const &transport, epics::pvData::int8 version, epics::pvData::int8 command, std::size_t payloadSize, epics::pvData::ByteBuffer *payloadBuffer)
Handle response.
Requester for ChannelPutGet.
Interface defining response handler.
constexpr __tuple_element_t< __i, tuple< _Elements... > > & get(tuple< _Elements... > &__t) noexcept
Requester for channelProcess.
virtual void handleResponse(osiSockAddr *responseFrom, Transport::shared_pointer const &transport, epics::pvData::int8 version, epics::pvData::int8 command, std::size_t payloadSize, epics::pvData::ByteBuffer *payloadBuffer)
Handle response.
Callback implemented by monitor clients.
virtual void handleResponse(osiSockAddr *responseFrom, Transport::shared_pointer const &transport, epics::pvData::int8 version, epics::pvData::int8 command, std::size_t payloadSize, epics::pvData::ByteBuffer *payloadBuffer)
Handle response.
Completion notification for Channel::getField()
Destroy channel request handler.
virtual void handleResponse(osiSockAddr *responseFrom, Transport::shared_pointer const &transport, epics::pvData::int8 version, epics::pvData::int8 command, std::size_t payloadSize, epics::pvData::ByteBuffer *payloadBuffer)
Handle response.
Interface defining transport sender (instance sending data over transport).
Requester for channelGet.
Search channel request handler.
PVAS request handler - main handler which dispatches requests to appropriate handlers.
The Requester for a ChannelArray.
Notifications associated with Channel::createChannelRPC()
Create channel request handler.