This is Unofficial EPICS BASE Doxygen Site
epics::pvAccess Namespace Reference

Holds all PVA related. More...

Namespaces

 ca
 
 detail
 

Classes

class  AbstractServerResponseHandler
 
class  AtomicBoolean
 
class  AuthenticationPlugin
 Actor through which authentication exchanges are initiated. More...
 
class  AuthenticationPluginControl
 Callbacks for use by AuthenticationSession. More...
 
class  AuthenticationRegistry
 
class  AuthenticationSession
 
class  AuthNZHandler
 
class  AuthorizationPlugin
 
class  AuthorizationRegistry
 
class  BaseChannelRequester
 
class  BaseChannelRequesterFailureMessageTransportSender
 
class  BaseChannelRequesterMessageTransportSender
 
class  BeaconEmitter
 
class  BeaconHandler
 
class  BeaconServerStatusProvider
 
class  BlockingTCPAcceptor
 
class  BlockingTCPConnector
 
class  BlockingUDPConnector
 
class  BlockingUDPTransport
 
class  Channel
 
class  ChannelArray
 
class  ChannelArrayRequester
 
struct  ChannelBaseRequester
 Base for all Requesters (callbacks to client) More...
 
class  ChannelFind
 
class  ChannelFindRequester
 
class  ChannelGet
 
class  ChannelGetRequester
 
class  ChannelListRequester
 
class  ChannelListRequesterImpl
 
class  ChannelProcess
 
class  ChannelProcessRequester
 
class  ChannelProvider
 
class  ChannelProviderFactory
 
class  ChannelProviderRegistry
 
class  ChannelPut
 
class  ChannelPutGet
 
class  ChannelPutGetRequester
 
class  ChannelPutRequester
 
class  ChannelRequest
 
class  ChannelRequester
 
class  ChannelRPC
 
class  ChannelRPCRequester
 
class  ChannelRPCServiceImpl
 
class  ChannelSearchManager
 
class  ClientChannelImpl
 
class  ClientContextImpl
 
class  ClientFactory
 
struct  comp_osiSock_lt
 
class  Configuration
 
struct  ConfigurationBuilder
 
class  ConfigurationEnviron
 Lookup configuration strings from the process environment. More...
 
class  ConfigurationFactory
 
class  ConfigurationMap
 Lookup configuration strings from an in memory store. More...
 
class  ConfigurationProvider
 
class  ConfigurationProviderImpl
 
class  ConfigurationStack
 
class  Context
 
class  DefaultBeaconServerStatusProvider
 
struct  DefaultChannelRequester
 Used when ChannelProvider::createChannel() is passed a NULL ChannelRequester. More...
 
class  Destroyable
 Instance declaring destroy method. More...
 
class  EchoTransportSender
 
class  fair_queue
 
class  GetFieldRequester
 
class  HexDump
 
struct  ifaceNode
 
class  IntrospectionRegistry
 
class  Lockable
 
class  Monitor
 
class  MonitorElement
 An element for a monitorQueue. More...
 
class  MonitorFIFO
 
class  MonitorRequester
 Callback implemented by monitor clients. More...
 
struct  NetStats
 Expose statistics related to network transport. More...
 
struct  PeerInfo
 Information provded by a client to a server-type ChannelProvider. More...
 
class  PipelineChannelProvider
 
class  PipelineControl
 
class  PipelineServer
 
class  PipelineService
 
class  PipelineSession
 
class  ReferenceCountingLock
 
class  Requester
 Callback class for passing messages to a requester. More...
 
class  ResponseHandler
 
class  ResponseRequest
 
class  RPCChannel
 
class  RPCChannelProvider
 
class  RPCClient
 
class  RPCRequestException
 
class  RPCResponseCallback
 
class  RPCServer
 Serves (only) RPCServiceAsync and RPCService instances. More...
 
class  RPCService
 
class  RPCServiceAsync
 
class  ScopedLock
 
class  SearchInstance
 
class  SerializationHelper
 
class  ServerArrayHandler
 
class  ServerBadResponse
 
class  ServerCancelRequestHandler
 
class  ServerChannel
 
class  ServerChannelArrayRequesterImpl
 
class  ServerChannelFindRequesterImpl
 
class  ServerChannelGetRequesterImpl
 
class  ServerChannelProcessRequesterImpl
 
class  ServerChannelPutGetRequesterImpl
 
class  ServerChannelPutRequesterImpl
 
class  ServerChannelRequesterImpl
 
class  ServerChannelRPCRequesterImpl
 
class  ServerConnectionValidationHandler
 
class  ServerContext
 
class  ServerContextImpl
 
class  ServerCreateChannelHandler
 
class  ServerDestroyChannelHandler
 
class  ServerDestroyChannelHandlerTransportSender
 
class  ServerDestroyRequestHandler
 
class  ServerEchoHandler
 
class  ServerGetFieldHandler
 
class  ServerGetFieldHandlerTransportSender
 
class  ServerGetFieldRequesterImpl
 
class  ServerGetHandler
 
struct  ServerGUID
 
class  ServerMonitorHandler
 
class  ServerMonitorRequesterImpl
 
class  ServerNoopResponse
 
class  ServerProcessHandler
 
class  ServerPutGetHandler
 
class  ServerPutHandler
 
class  ServerResponseHandler
 
class  ServerRPCHandler
 
class  ServerSearchHandler
 
struct  SimpleChannelProviderFactory
 
struct  SingletonChannelProviderFactory
 
class  SyncChannelFind
 
struct  ThreadRunnerParam
 
class  Transport
 
class  TransportRegistry
 
class  TransportSendControl
 
class  TransportSender
 
class  Version
 
class  Wildcard
 

Typedefs

typedef std::tr1::shared_ptr< MonitorElementMonitorElementPtr
 
typedef std::vector< MonitorElementPtrMonitorElementPtrArray
 
typedef std::tr1::shared_ptr< MonitorMonitorPtr
 
typedef Monitor PipelineMonitor
 Pipeline (streaming) support API (optional). This is used by pvAccess to implement pipeline (streaming) monitors. More...
 
typedef epicsInt32 pvAccessID
 
typedef std::vector< BlockingUDPTransport::shared_pointer > BlockingUDPTransportVector
 
typedef ConfigurationEnviron SystemConfigurationImpl
 
typedef std::vector< osiSockAddrInetAddrVector
 
typedef std::vector< ifaceNodeIfaceNodeVector
 
typedef std::map< const short, epics::pvData::FieldConstPtrregistryMap_t
 
typedef std::tr1::shared_ptr< RequesterRequesterPtr
 

Enumerations

enum  AccessRights { none, read, readWrite }
 
enum  FlushStrategy { IMMEDIATE, DELAYED, USER_CONTROLED }
 The FlushStrategy enum. More...
 
enum  InetAddressType { inetAddressType_all, inetAddressType_unicast, inetAddressType_broadcast_multicast }
 
enum  QoS {
  QOS_DEFAULT = 0x00, QOS_REPLY_REQUIRED = 0x01, QOS_BESY_EFFORT = 0x02, QOS_PROCESS = 0x04,
  QOS_INIT = 0x08, QOS_DESTROY = 0x10, QOS_SHARE = 0x20, QOS_GET = 0x40,
  QOS_GET_PUT = 0x80
}
 
enum  ApplicationCommands {
  CMD_BEACON = 0, CMD_CONNECTION_VALIDATION = 1, CMD_ECHO = 2, CMD_SEARCH = 3,
  CMD_SEARCH_RESPONSE = 4, CMD_AUTHNZ = 5, CMD_ACL_CHANGE = 6, CMD_CREATE_CHANNEL = 7,
  CMD_DESTROY_CHANNEL = 8, CMD_CONNECTION_VALIDATED = 9, CMD_GET = 10, CMD_PUT = 11,
  CMD_PUT_GET = 12, CMD_MONITOR = 13, CMD_ARRAY = 14, CMD_DESTROY_REQUEST = 15,
  CMD_PROCESS = 16, CMD_GET_FIELD = 17, CMD_MESSAGE = 18, CMD_MULTIPLE_DATA = 19,
  CMD_RPC = 20, CMD_CANCEL_REQUEST = 21, CMD_ORIGIN_TAG = 22
}
 
enum  ControlCommands { CMD_SET_MARKER = 0, CMD_ACK_MARKER = 1, CMD_SET_ENDIANESS = 2 }
 
enum  pvAccessLogLevel {
  logLevelAll = 0, logLevelTrace, logLevelDebug, logLevelInfo,
  logLevelWarn, logLevelError, logLevelFatal, logLevelOff
}
 
enum  MessageType { infoMessage, warningMessage, errorMessage, fatalErrorMessage }
 

Functions

void providerRegInit (void *)
 
epicsShareExtern void refTrackRegistrar ()
 
Channel::shared_pointer createPipelineChannel (ChannelProvider::shared_pointer const &provider, std::string const &channelName, ChannelRequester::shared_pointer const &channelRequester, PipelineService::shared_pointer const &pipelineService)
 
epicsShareFunc std::ostream & operator<< (std::ostream &o, const Version &v)
 
const std::string PVACCESS_DEFAULT_PROVIDER ("local")
 
const std::string PVACCESS_ALL_PROVIDERS ("<all>")
 
const std::string PVACCESS_DEBUG ("EPICS_PVA_DEBUG")
 
void initializeUDPTransports (bool serverFlag, BlockingUDPTransportVector &udpTransports, const IfaceNodeVector &ifaceList, const ResponseHandler::shared_pointer &responseHandler, BlockingUDPTransport::shared_pointer &sendTransport, int32 &listenPort, bool autoAddressList, const std::string &addressList, const std::string &ignoreAddressList)
 
epicsShareFunc void osdGetRoles (const std::string &account, PeerInfo::roles_t &roles)
 Query OS specific DB for role/group names assocated with a user account. More...
 
ChannelProvider::shared_pointer createClientProvider (const Configuration::shared_pointer &conf)
 
epicsShareFunc Channel::shared_pointer createRPCChannel (ChannelProvider::shared_pointer const &provider, std::string const &channelName, ChannelRequester::shared_pointer const &channelRequester, RPCServiceAsync::shared_pointer const &rpcService)
 
epicsShareFunc ServerContext::shared_pointer startPVAServer (std::string const &providerNames=PVACCESS_ALL_PROVIDERS, int timeToRun=0, bool runInSeparateThread=false, bool printInfo=false)
 
epicsShareFunc std::ostream & operator<< (std::ostream &strm, const HexDump &hex)
 
void encodeAsIPv6Address (ByteBuffer *buffer, const osiSockAddr *address)
 
bool decodeAsIPv6Address (ByteBuffer *buffer, osiSockAddr *address)
 
bool isMulticastAddress (const osiSockAddr *address)
 
void getSocketAddressList (InetAddrVector &ret, const std::string &list, int defaultPort, const InetAddrVector *appendList)
 
string inetAddressToString (const osiSockAddr &addr, bool displayPort, bool displayHex)
 
int discoverInterfaces (IfaceNodeVector &list, SOCKET socket, const osiSockAddr *pMatchAddr)
 
void pvAccessLog (pvAccessLogLevel level, const char *format,...)
 
void pvAccessSetLogLevel (pvAccessLogLevel level)
 
bool pvAccessIsLoggable (pvAccessLogLevel level)
 
epicsShareExtern std::string getMessageTypeName (MessageType messageType)
 

Variables

const epics::pvData::int8 PVA_MAGIC = static_cast<epics::pvData::int8>(0xCA)
 
const epics::pvData::int8 PVA_SERVER_PROTOCOL_REVISION = 2
 
const epics::pvData::int8 PVA_CLIENT_PROTOCOL_REVISION = 2
 
const epics::pvData::int8 PVA_PROTOCOL_REVISION EPICS_DEPRECATED = 1
 
const epics::pvData::int32 PVA_SERVER_PORT = 5075
 
const epics::pvData::int32 PVA_BROADCAST_PORT = 5076
 
const epics::pvData::int16 PVA_MESSAGE_HEADER_SIZE = 8
 
const epics::pvData::int32 MAX_UDP_UNFRAGMENTED_SEND = 1440
 
const epics::pvData::int32 MAX_UDP_RECV = 65487
 
const epics::pvData::int32 MAX_TCP_RECV = 1024*16
 
const epics::pvData::int32 MAX_SEARCH_BATCH_COUNT = 0x7FFF
 
const epics::pvData::int16 PVA_DEFAULT_PRIORITY = 0
 
const epics::pvData::uint32 MAX_CHANNEL_NAME_LENGTH = 500
 
const epics::pvData::int16 INVALID_DATA_TYPE = 0xFFFF
 
const epics::pvData::int32 INVALID_IOID = 0
 
epicsShareExtern const std::string PVACCESS_DEFAULT_PROVIDER
 
epicsShareExtern const std::string PVACCESS_ALL_PROVIDERS
 
epicsShareExtern const std::string PVACCESS_DEBUG
 
ConfigurationProvider::shared_pointer configurationProvider
 
Mutex conf_factory_mutex
 

Detailed Description

Holds all PVA related.

Typedef Documentation

typedef std::vector<BlockingUDPTransport::shared_pointer> epics::pvAccess::BlockingUDPTransportVector

Definition at line 403 of file blockingUDP.h.

Definition at line 33 of file inetAddressUtil.h.

Definition at line 21 of file inetAddressUtil.h.

typedef std::tr1::shared_ptr<MonitorElement> epics::pvAccess::MonitorElementPtr

Definition at line 40 of file monitor.h.

Definition at line 42 of file monitor.h.

typedef std::tr1::shared_ptr<Monitor> epics::pvAccess::MonitorPtr

Definition at line 44 of file monitor.h.

Pipeline (streaming) support API (optional). This is used by pvAccess to implement pipeline (streaming) monitors.

Definition at line 1563 of file pvAccess.h.

Definition at line 18 of file pvaDefs.h.

Definition at line 37 of file introspectionRegistry.h.

typedef std::tr1::shared_ptr<Requester> epics::pvAccess::RequesterPtr

Definition at line 31 of file requester.h.

Enumeration Type Documentation

Enumerator
none 

Neither read or write access is allowed.

read 

Read access is allowed but write access is not allowed.

readWrite 

Both read and write access are allowed.

Definition at line 71 of file pvAccess.h.

Enumerator
CMD_BEACON 
CMD_CONNECTION_VALIDATION 
CMD_ECHO 
CMD_SEARCH 
CMD_SEARCH_RESPONSE 
CMD_AUTHNZ 
CMD_ACL_CHANGE 
CMD_CREATE_CHANNEL 
CMD_DESTROY_CHANNEL 
CMD_CONNECTION_VALIDATED 
CMD_GET 
CMD_PUT 
CMD_PUT_GET 
CMD_MONITOR 
CMD_ARRAY 
CMD_DESTROY_REQUEST 
CMD_PROCESS 
CMD_GET_FIELD 
CMD_MESSAGE 
CMD_MULTIPLE_DATA 
CMD_RPC 
CMD_CANCEL_REQUEST 
CMD_ORIGIN_TAG 

Definition at line 85 of file remote.h.

85  {
86  CMD_BEACON = 0,
88  CMD_ECHO = 2,
89  CMD_SEARCH = 3,
91  CMD_AUTHNZ = 5,
92  CMD_ACL_CHANGE = 6,
96  CMD_GET = 10,
97  CMD_PUT = 11,
98  CMD_PUT_GET = 12,
99  CMD_MONITOR = 13,
100  CMD_ARRAY = 14,
101  CMD_DESTROY_REQUEST = 15,
102  CMD_PROCESS = 16,
103  CMD_GET_FIELD = 17,
104  CMD_MESSAGE = 18,
105  CMD_MULTIPLE_DATA = 19,
106  CMD_RPC = 20,
107  CMD_CANCEL_REQUEST = 21,
108  CMD_ORIGIN_TAG = 22
109 };
Enumerator
CMD_SET_MARKER 
CMD_ACK_MARKER 
CMD_SET_ENDIANESS 

Definition at line 111 of file remote.h.

The FlushStrategy enum.

Enumerator
IMMEDIATE 
DELAYED 
USER_CONTROLED 

Definition at line 1221 of file pvAccess.h.

Enumerator
infoMessage 
warningMessage 
errorMessage 
fatalErrorMessage 

Definition at line 34 of file requester.h.

Enumerator
QOS_DEFAULT 

Default behavior.

QOS_REPLY_REQUIRED 

Require reply (acknowledgment for reliable operation).

QOS_BESY_EFFORT 

Best-effort option (no reply).

QOS_PROCESS 

Process option.

QOS_INIT 

Initialize option.

QOS_DESTROY 

Destroy option.

QOS_SHARE 

Share data option.

QOS_GET 

Get.

QOS_GET_PUT 

Get-put.

Definition at line 46 of file remote.h.

Function Documentation

ChannelProvider::shared_pointer epics::pvAccess::createClientProvider ( const Configuration::shared_pointer &  conf)

Definition at line 4747 of file clientContextImpl.cpp.

4748 {
4749  registerRefCounter("InternalClientContextImpl", &InternalClientContextImpl::num_instances);
4750  registerRefCounter("InternalChannelImpl", &InternalClientContextImpl::InternalChannelImpl::num_instances);
4751  registerRefCounter("InternalChannelImpl (Active)", &InternalClientContextImpl::InternalChannelImpl::num_active);
4752  registerRefCounter("BaseRequestImpl", &BaseRequestImpl::num_instances);
4753  registerRefCounter("BaseRequestImpl (Active)", &BaseRequestImpl::num_active);
4754  InternalClientContextImpl::shared_pointer internal(new InternalClientContextImpl(conf)),
4755  external(internal.get(), epics::pvAccess::Destroyable::cleaner(internal));
4756  const_cast<InternalClientContextImpl::weak_pointer&>(internal->m_external_this) = external;
4757  const_cast<InternalClientContextImpl::weak_pointer&>(internal->m_internal_this) = internal;
4758  internal->initialize();
4759  return external;
4760 }
void registerRefCounter(const char *name, const size_t *counter)
Definition: reftrack.cpp:59
epicsShareFunc Channel::shared_pointer epics::pvAccess::createPipelineChannel ( ChannelProvider::shared_pointer const &  provider,
std::string const &  channelName,
ChannelRequester::shared_pointer const &  channelRequester,
PipelineService::shared_pointer const &  pipelineService 
)

Definition at line 436 of file pipelineServer.cpp.

440 {
441  // TODO use std::make_shared
442  std::tr1::shared_ptr<PipelineChannel> tp(
443  new PipelineChannel(provider, channelName, channelRequester, pipelineService)
444  );
445  Channel::shared_pointer channel = tp;
446  return channel;
447 }
Channel::shared_pointer epics::pvAccess::createRPCChannel ( ChannelProvider::shared_pointer const &  provider,
std::string const &  channelName,
ChannelRequester::shared_pointer const &  channelRequester,
RPCServiceAsync::shared_pointer const &  rpcService 
)

Definition at line 229 of file rpcServer.cpp.

233 {
234  // TODO use std::make_shared
235  std::tr1::shared_ptr<RPCChannel> tp(
236  new RPCChannel(provider, channelName, channelRequester, rpcService)
237  );
238  Channel::shared_pointer channel = tp;
239  return channel;
240 }
epicsShareFunc bool epics::pvAccess::decodeAsIPv6Address ( epics::pvData::ByteBuffer buffer,
osiSockAddr address 
)

Decode IPv6 address (as IPv4 address).

Parameters
bufferbyte-buffer where to get encoded data.
addressaddress where to decode.
Returns
success status (true on success).

Definition at line 50 of file inetAddressUtil.cpp.

50  {
51 
52  // IPv4 compatible IPv6 address expected
53  // first 80-bit are 0
54  if (buffer->getLong() != 0) return false;
55  if (buffer->getShort() != 0) return false;
56  int16 ffff = buffer->getShort();
57  // allow all zeros address
58  //if (ffff != (int16)0xFFFF) return false;
59 
60  uint32 ipv4Addr = uint8(buffer->getByte());
61  ipv4Addr <<= 8;
62  ipv4Addr |= uint8(buffer->getByte());
63  ipv4Addr <<= 8;
64  ipv4Addr |= uint8(buffer->getByte());
65  ipv4Addr <<= 8;
66  ipv4Addr |= uint8(buffer->getByte());
67 
68  if (ffff != (int16)0xFFFF && ipv4Addr != (uint32_t)0)
69  return false;
70 
71  address->ia.sin_addr.s_addr = htonl(ipv4Addr);
72 
73  return true;
74 }
EPICS_ALWAYS_INLINE int8 getByte()
Definition: byteBuffer.h:617
struct sockaddr_in ia
Definition: osiSock.h:157
EPICS_ALWAYS_INLINE int16 getShort()
Definition: byteBuffer.h:623
EPICS_ALWAYS_INLINE int64 getLong()
Definition: byteBuffer.h:635
int16_t int16
Definition: pvType.h:79
uint8_t uint8
Definition: pvType.h:91
uint32_t uint32
Definition: pvType.h:99
epicsShareFunc int epics::pvAccess::discoverInterfaces ( IfaceNodeVector list,
SOCKET  socket,
const osiSockAddr pMatchAddr 
)

Definition at line 196 of file inetAddressUtil.cpp.

197 {
198  static const unsigned nelem = 100;
199  int status;
200  struct ifconf ifconf;
201  struct ifreq *pIfreqList;
202  struct ifreq *pIfreqListEnd;
203  struct ifreq *pifreq;
204  struct ifreq *pnextifreq;
205  int match;
206 
207  /*
208  * use pool so that we avoid using too much stack space
209  *
210  * nelem is set to the maximum interfaces
211  * on one machine here
212  */
213  pIfreqList = (struct ifreq *) calloc ( nelem, sizeof(*pifreq) );
214  if (!pIfreqList) {
215  errlogPrintf ("discoverInterfaces(): no memory to complete request\n");
216  return -1;
217  }
218 
219  ifconf.ifc_len = nelem * sizeof(*pifreq);
220  ifconf.ifc_req = pIfreqList;
221  status = socket_ioctl (socket, SIOCGIFCONF, &ifconf);
222  if (status < 0 || ifconf.ifc_len == 0) {
223  errlogPrintf ("discoverInterfaces(): unable to fetch network interface configuration\n");
224  free (pIfreqList);
225  return -1;
226  }
227 
228  pIfreqListEnd = (struct ifreq *) (ifconf.ifc_len + (char *) pIfreqList);
229  pIfreqListEnd--;
230 
231  for ( pifreq = pIfreqList; pifreq <= pIfreqListEnd; pifreq = pnextifreq ) {
232  uint32_t current_ifreqsize;
233 
234  /*
235  * find the next ifreq
236  */
237  pnextifreq = ifreqNext (pifreq);
238 
239  /* determine ifreq size */
240  current_ifreqsize = ifreqSize ( pifreq );
241  /* copy current ifreq to aligned bufferspace (to start of pIfreqList buffer) */
242  /* be careful as we re-use part of this space several times below.
243  * Any member other than ifr_name is invalidated by an ioctl() call
244  */
245  memmove(pIfreqList, pifreq, current_ifreqsize);
246 
247  /*
248  * If its not an internet interface then dont use it
249  */
250  if ( pIfreqList->ifr_addr.sa_family != AF_INET ) {
251  continue;
252  }
253 
254  /*
255  * if it isnt a wildcarded interface then look for
256  * an exact match
257  */
258  match = 0;
259  if ( pMatchAddr && pMatchAddr->sa.sa_family != AF_UNSPEC ) {
260  if ( pMatchAddr->sa.sa_family != AF_INET ) {
261  continue;
262  }
263  if ( pMatchAddr->ia.sin_addr.s_addr != htonl (INADDR_ANY) ) {
264  struct sockaddr_in *pInetAddr = (struct sockaddr_in *) &pIfreqList->ifr_addr;
265  if ( pInetAddr->sin_addr.s_addr != pMatchAddr->ia.sin_addr.s_addr ) {
266  continue;
267  }
268  else
269  match = 1;
270  }
271  }
272 
273  ifaceNode node;
274  node.addr.sa = pIfreqList->ifr_addr;
275 
276  status = socket_ioctl ( socket, SIOCGIFFLAGS, pIfreqList );
277  if ( status ) {
278  errlogPrintf ("discoverInterfaces(): net intf flags fetch for \"%s\" failed\n", pIfreqList->ifr_name);
279  continue;
280  }
281 
282  unsigned short ifflags = pIfreqList->ifr_flags;
283  node.loopback = ifflags & IFF_LOOPBACK;
284 
285  /*
286  * dont bother with interfaces that have been disabled
287  */
288  if ( ! ( ifflags & IFF_UP ) ) {
289  continue;
290  }
291 
292  /*
293  * dont use the loop back interface, unless it maches pMatchAddr
294  */
295  if (!match) {
296  if ( ifflags & IFF_LOOPBACK ) {
297  continue;
298  }
299  }
300 
301  /*
302  * If this is an interface that supports
303  * broadcast fetch the broadcast address.
304  *
305  * Otherwise if this is a point to point
306  * interface then use the destination address.
307  *
308  * Otherwise CA will not query through the
309  * interface.
310  */
311  if ( ifflags & IFF_BROADCAST ) {
312  status = socket_ioctl (socket, SIOCGIFBRDADDR, pIfreqList);
313  if ( status ) {
314  errlogPrintf ("discoverInterfaces(): net intf \"%s\": bcast addr fetch fail\n", pIfreqList->ifr_name);
315  continue;
316  }
317  node.bcast.sa = pIfreqList->ifr_broadaddr;
318 
319  status = socket_ioctl (socket, SIOCGIFNETMASK, pIfreqList);
320  if ( status ) {
321  errlogPrintf ("discoverInterfaces(): net intf \"%s\": netmask fetch fail\n", pIfreqList->ifr_name);
322  continue;
323  }
324  node.mask.sa = pIfreqList->ifr_netmask;
325 
326  checkNode(node);
327 
328  node.validBcast = true;
329  }
330 #if defined (IFF_POINTOPOINT)
331  else if ( ifflags & IFF_POINTOPOINT ) {
332  status = socket_ioctl ( socket, SIOCGIFDSTADDR, pIfreqList);
333  if ( status ) {
334  continue;
335  }
336  node.peer.sa = pIfreqList->ifr_dstaddr;
337  node.validP2P = true;
338  }
339 #endif
340  else {
341  // if it is a match, accept the interface even if it does not support broadcast (i.e. 127.0.0.1 or point to point)
342  if (!match)
343  {
344  continue;
345  }
346  }
347 
348  list.push_back(node);
349  }
350 
351  free ( pIfreqList );
352  return 0;
353 }
pvd::Status status
struct sockaddr sa
Definition: osiSock.h:158
struct sockaddr_in ia
Definition: osiSock.h:157
#define socket_ioctl(A, B, C)
Definition: osdSock.h:34
int errlogPrintf(const char *pFormat,...)
Definition: errlog.c:105
if(yy_init)
Definition: scan.c:972
epicsShareFunc void epics::pvAccess::encodeAsIPv6Address ( epics::pvData::ByteBuffer buffer,
const osiSockAddr address 
)

Encode IPv4 address as IPv6 address.

Parameters
bufferbyte-buffer where to put encoded data.
addressaddress to encode.

Definition at line 35 of file inetAddressUtil.cpp.

35  {
36  // IPv4 compatible IPv6 address
37  // first 80-bit are 0
38  buffer->putLong(0);
39  buffer->putShort(0);
40  // next 16-bits are 1
41  buffer->putShort(0xFFFF);
42  // following IPv4 address in big-endian (network) byte order
43  uint32_t ipv4Addr = ntohl(address->ia.sin_addr.s_addr);
44  buffer->putByte((int8)((ipv4Addr>>24)&0xFF));
45  buffer->putByte((int8)((ipv4Addr>>16)&0xFF));
46  buffer->putByte((int8)((ipv4Addr>>8)&0xFF));
47  buffer->putByte((int8)(ipv4Addr&0xFF));
48 }
int8_t int8
Definition: pvType.h:75
struct sockaddr_in ia
Definition: osiSock.h:157
EPICS_ALWAYS_INLINE void putByte(int8 value)
Definition: byteBuffer.h:525
EPICS_ALWAYS_INLINE void putLong(int64 value)
Definition: byteBuffer.h:543
EPICS_ALWAYS_INLINE void putShort(int16 value)
Definition: byteBuffer.h:531
string epics::pvAccess::getMessageTypeName ( MessageType  messageType)

Definition at line 25 of file requester.cpp.

26 {
27  switch(messageType) {
28  case infoMessage: return "info";
29  case warningMessage: return "warning";
30  case errorMessage: return "error";
31  case fatalErrorMessage: return "fatalError";
32  default: return "unknown";
33  }
34 }
epicsShareFunc void epics::pvAccess::getSocketAddressList ( InetAddrVector ret,
const std::string &  list,
int  defaultPort,
const InetAddrVector appendList = NULL 
)

Parse space delimited addresss[:port] string and populate array of InetSocketAddress.

Parameters
retresults stored hre
listspace delimited addresss[:port] string.
defaultPortport take if not specified.
appendListlist to be appended.
Returns
array of InetSocketAddress.

Definition at line 82 of file inetAddressUtil.cpp.

84  {
85  ret.clear();
86 
87  // skip leading spaces
88  size_t len = list.length();
89  size_t subStart = 0;
90  while (subStart < len && isspace(list[subStart]))
91  subStart++;
92 
93  // parse string
94  size_t subEnd;
95  while((subEnd = list.find(' ', subStart))!=std::string::npos) {
96  string address = list.substr(subStart, (subEnd-subStart));
97  osiSockAddr addr;
98  if (aToIPAddr(address.c_str(), defaultPort, &addr.ia) == 0)
99  ret.push_back(addr);
100  subStart = list.find_first_not_of(" \t\r\n\v", subEnd);
101  }
102 
103  if(subStart!=std::string::npos && subStart<len) {
104  osiSockAddr addr;
105  if (aToIPAddr(list.substr(subStart).c_str(), defaultPort, &addr.ia) == 0)
106  ret.push_back(addr);
107  }
108 
109  if(appendList!=NULL) {
110  for(size_t i = 0; i<appendList->size(); i++)
111  ret.push_back((*appendList)[i]);
112  }
113 }
LIBCOM_API int epicsStdCall aToIPAddr(const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP)
Definition: aToIPAddr.c:78
int i
Definition: scan.c:967
struct sockaddr_in ia
Definition: osiSock.h:157
#define NULL
Definition: catime.c:38
epicsShareFunc std::string epics::pvAccess::inetAddressToString ( const osiSockAddr addr,
bool  displayPort,
bool  displayHex 
)

Definition at line 115 of file inetAddressUtil.cpp.

116  {
117  stringstream saddr;
118 
119  int ipa = ntohl(addr.ia.sin_addr.s_addr);
120 
121  saddr<<((int)(ipa>>24)&0xFF)<<'.';
122  saddr<<((int)(ipa>>16)&0xFF)<<'.';
123  saddr<<((int)(ipa>>8)&0xFF)<<'.';
124  saddr<<((int)ipa&0xFF);
125  if(displayPort) saddr<<":"<<ntohs(addr.ia.sin_port);
126  if(displayHex) saddr<<" ("<<hex<<ntohl(addr.ia.sin_addr.s_addr)
127  <<")";
128 
129  return saddr.str();
130 }
struct sockaddr_in ia
Definition: osiSock.h:157
Definition: tool_lib.h:64
void epics::pvAccess::initializeUDPTransports ( bool  serverFlag,
BlockingUDPTransportVector udpTransports,
const IfaceNodeVector ifaceList,
const ResponseHandler::shared_pointer &  responseHandler,
BlockingUDPTransport::shared_pointer &  sendTransport,
int32 listenPort,
bool  autoAddressList,
const std::string &  addressList,
const std::string &  ignoreAddressList 
)

Definition at line 576 of file blockingUDPTransport.cpp.

585 {
586  BlockingUDPConnector connector(serverFlag);
587 
588  const int8_t protoVer = serverFlag ? PVA_SERVER_PROTOCOL_REVISION : PVA_CLIENT_PROTOCOL_REVISION;
589 
590  //
591  // Create UDP transport for sending (to all network interfaces)
592  //
593 
594  osiSockAddr anyAddress;
595  memset(&anyAddress, 0, sizeof(anyAddress));
596  anyAddress.ia.sin_family = AF_INET;
597  anyAddress.ia.sin_port = htons(0);
598  anyAddress.ia.sin_addr.s_addr = htonl(INADDR_ANY);
599 
600  sendTransport = connector.connect(responseHandler, anyAddress, protoVer);
601  if (!sendTransport)
602  {
603  THROW_BASE_EXCEPTION("Failed to initialize UDP transport.");
604  }
605 
606  // to allow automatic assignment of listen port (for testing)
607  if (listenPort == 0)
608  {
609  listenPort = ntohs(sendTransport->getRemoteAddress().ia.sin_port);
610  LOG(logLevelDebug, "Dynamic listen UDP port set to %u.", (unsigned)listenPort);
611  }
612 
613  // TODO current implementation shares the port (aka beacon and search port)
614  int32 sendPort = listenPort;
615 
616  //
617  // compile auto address list - where to send packets
618  //
619 
620  InetAddrVector autoBCastAddr;
621  for (IfaceNodeVector::const_iterator iter = ifaceList.begin(); iter != ifaceList.end(); iter++)
622  {
623  ifaceNode node = *iter;
624 
625  // in practice, interface will have either destination (PPP)
626  // or broadcast, but never both.
627  if (node.validP2P && node.peer.ia.sin_family != AF_UNSPEC)
628  {
629  node.peer.ia.sin_port = htons(sendPort);
630  autoBCastAddr.push_back(node.peer);
631  }
632  if (node.validBcast && node.bcast.ia.sin_family != AF_UNSPEC)
633  {
634  node.bcast.ia.sin_port = htons(sendPort);
635  autoBCastAddr.push_back(node.bcast);
636  }
637  }
638 
639  //
640  // set send address list
641  //
642  {
643  InetAddrVector list;
644  getSocketAddressList(list, addressList, sendPort, autoAddressList ? &autoBCastAddr : NULL);
645 
646  // avoid duplicates in address list
647  {
648  InetAddrVector dedup;
649 
650  for (InetAddrVector::const_iterator iter = list.begin(); iter != list.end(); iter++)
651  {
652  bool match = false;
653 
654  for(InetAddrVector::const_iterator inner = dedup.begin(); !match && inner != dedup.end(); inner++)
655  {
656  match = iter->ia.sin_family==inner->ia.sin_family && iter->ia.sin_addr.s_addr==inner->ia.sin_addr.s_addr;
657  }
658 
659  if(!match)
660  dedup.push_back(*iter);
661  }
662  list.swap(dedup);
663  }
664 
665  std::vector<bool> isunicast(list.size());
666 
667  if (list.empty()) {
669  "No %s broadcast addresses found or specified - empty address list!", serverFlag ? "server" : "client");
670  }
671 
672  for (size_t i = 0; i < list.size(); i++) {
673 
674  isunicast[i] = !isMulticastAddress(&list[i]);
675 
676  for (IfaceNodeVector::const_iterator iter = ifaceList.begin(); isunicast[i] && iter != ifaceList.end(); iter++)
677  {
678  ifaceNode node = *iter;
679  // compare with all iface bcasts
680  if(node.validBcast && list[i].ia.sin_family==iter->bcast.ia.sin_family
681  && list[i].ia.sin_addr.s_addr==iter->bcast.ia.sin_addr.s_addr) {
682  isunicast[i] = false;
683  }
684  }
686  "Broadcast address #%zu: %s. (%sunicast)", i, inetAddressToString(list[i]).c_str(),
687  isunicast[i]?"":"not ");
688  }
689 
690  sendTransport->setSendAddresses(list, isunicast);
691  }
692 
693  sendTransport->start();
694  udpTransports.push_back(sendTransport);
695 
696  // TODO configurable local NIF, address
697  osiSockAddr loAddr;
698  memset(&loAddr, 0, sizeof(loAddr));
699  loAddr.ia.sin_family = AF_INET;
700  loAddr.ia.sin_port = ntohs(0);
701  loAddr.ia.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
702 
703  // TODO configurable local multicast address
704  std::string mcastAddress("224.0.0.128");
705 
706  osiSockAddr group;
707  aToIPAddr(mcastAddress.c_str(), listenPort, &group.ia);
708 
709  //
710  // set ignore address list
711  //
712  InetAddrVector ignoreAddressVector;
713  getSocketAddressList(ignoreAddressVector, ignoreAddressList, 0, 0);
714 
715  //
716  // Setup UDP trasport(s) (per interface)
717  //
718 
719  InetAddrVector tappedNIF;
720 
721  for (IfaceNodeVector::const_iterator iter = ifaceList.begin(); iter != ifaceList.end(); iter++)
722  {
723  ifaceNode node = *iter;
724 
725  LOG(logLevelDebug, "Setting up UDP for interface %s/%s, broadcast %s, dest %s.",
726  inetAddressToString(node.addr, false).c_str(),
727  node.validBcast ? inetAddressToString(node.mask, false).c_str() : "<none>",
728  node.validBcast ? inetAddressToString(node.bcast, false).c_str() : "<none>",
729  node.validP2P ? inetAddressToString(node.peer, false).c_str() : "<none>");
730  try
731  {
732  // where to bind (listen) address
733  osiSockAddr listenLocalAddress;
734  memset(&listenLocalAddress, 0, sizeof(listenLocalAddress));
735  listenLocalAddress.ia.sin_family = AF_INET;
736  listenLocalAddress.ia.sin_port = htons(listenPort);
737  listenLocalAddress.ia.sin_addr.s_addr = node.addr.ia.sin_addr.s_addr;
738 
739  BlockingUDPTransport::shared_pointer transport = connector.connect(
740  responseHandler, listenLocalAddress, protoVer);
741  if (!transport)
742  continue;
743  listenLocalAddress = transport->getRemoteAddress();
744 
745  transport->setIgnoredAddresses(ignoreAddressVector);
746 
747  tappedNIF.push_back(listenLocalAddress);
748 
749 
750  BlockingUDPTransport::shared_pointer transport2;
751 
752  if(!node.validBcast || node.bcast.sa.sa_family != AF_INET ||
753  node.bcast.ia.sin_addr.s_addr == listenLocalAddress.ia.sin_addr.s_addr) {
754  // warning if not point-to-point
755  LOG(node.bcast.sa.sa_family != AF_INET ? logLevelDebug : logLevelWarn,
756  "Unable to find broadcast address of interface %s.", inetAddressToString(node.addr, false).c_str());
757  }
758 #if !defined(_WIN32)
759  else
760  {
761  /* An oddness of BSD sockets (not winsock) is that binding to
762  * INADDR_ANY will receive unicast and broadcast, but binding to
763  * a specific interface address receives only unicast. The trick
764  * is to bind a second socket to the interface broadcast address,
765  * which will then receive only broadcasts.
766  */
767 
768  osiSockAddr bcastAddress;
769  memset(&bcastAddress, 0, sizeof(bcastAddress));
770  bcastAddress.ia.sin_family = AF_INET;
771  bcastAddress.ia.sin_port = htons(listenPort);
772  bcastAddress.ia.sin_addr.s_addr = node.bcast.ia.sin_addr.s_addr;
773 
774  transport2 = connector.connect(responseHandler, bcastAddress, protoVer);
775  if (transport2)
776  {
777  /* The other wrinkle is that nothing should be sent from this second
778  * socket. So replies are made through the unicast socket.
779  *
780  transport2->setReplyTransport(transport);
781  */
782  // NOTE: search responses all always send from sendTransport
783 
784  transport2->setIgnoredAddresses(ignoreAddressVector);
785 
786  tappedNIF.push_back(bcastAddress);
787  }
788  }
789 #endif
790 
791  transport->setMutlicastNIF(loAddr, true);
792  transport->setLocalMulticastAddress(group);
793 
794  transport->start();
795  udpTransports.push_back(transport);
796 
797  if (transport2)
798  {
799  transport2->start();
800  udpTransports.push_back(transport2);
801  }
802  }
803  catch (std::exception& e)
804  {
805  THROW_BASE_EXCEPTION_CAUSE("Failed to initialize UDP transport.", e);
806  }
807  catch (...)
808  {
809  THROW_BASE_EXCEPTION("Failed to initialize UDP transport.");
810  }
811  }
812 
813 
814  //
815  // Setup local multicasting
816  //
817 
818  // WIN32 do not allow binding to multicast address, use any address w/ port
819 #if defined(_WIN32)
820  anyAddress.ia.sin_port = htons(listenPort);
821 #endif
822 
823  BlockingUDPTransport::shared_pointer localMulticastTransport;
824  try
825  {
826  // NOTE: multicast receiver socket must be "bound" to INADDR_ANY or multicast address
827  localMulticastTransport = connector.connect(
828  responseHandler,
829 #if !defined(_WIN32)
830  group,
831 #else
832  anyAddress,
833 #endif
834  protoVer);
835  if (!localMulticastTransport)
836  throw std::runtime_error("Failed to bind UDP socket.");
837 
838  localMulticastTransport->setTappedNIF(tappedNIF);
839  localMulticastTransport->join(group, loAddr);
840  localMulticastTransport->start();
841  udpTransports.push_back(localMulticastTransport);
842 
843  LOG(logLevelDebug, "Local multicast enabled on %s/%s.",
844  inetAddressToString(loAddr, false).c_str(),
845  inetAddressToString(group).c_str());
846  }
847  catch (std::exception& ex)
848  {
849  LOG(logLevelDebug, "Failed to initialize local multicast, functionality disabled. Reason: %s.", ex.what());
850  }
851 }
#define INADDR_LOOPBACK
Definition: osdSock.h:76
LIBCOM_API int epicsStdCall aToIPAddr(const char *pAddrString, unsigned short defaultPort, struct sockaddr_in *pIP)
Definition: aToIPAddr.c:78
int i
Definition: scan.c:967
const epics::pvData::int8 PVA_CLIENT_PROTOCOL_REVISION
Definition: pvaConstants.h:32
struct sockaddr_in ia
Definition: osiSock.h:157
#define NULL
Definition: catime.c:38
#define LOG(level, format,...)
Definition: logger.h:48
std::vector< osiSockAddr > InetAddrVector
const epics::pvData::int8 PVA_SERVER_PROTOCOL_REVISION
Definition: pvaConstants.h:31
bool isMulticastAddress(const osiSockAddr *address)
#define THROW_BASE_EXCEPTION(msg)
void getSocketAddressList(InetAddrVector &ret, const std::string &list, int defaultPort, const InetAddrVector *appendList)
#define THROW_BASE_EXCEPTION_CAUSE(msg, cause)
string inetAddressToString(const osiSockAddr &addr, bool displayPort, bool displayHex)
int32_t int32
Definition: pvType.h:83
epicsShareFunc bool epics::pvAccess::isMulticastAddress ( const osiSockAddr address)

Check if an IPv4 address is a multicast address.

Parameters
addressIPv4 address to check.
Returns
true if the adress is a multicast address.

Definition at line 76 of file inetAddressUtil.cpp.

76  {
77  uint32_t ipv4Addr = ntohl(address->ia.sin_addr.s_addr);
78  uint8_t msB = (uint8_t)((ipv4Addr>>24)&0xFF);
79  return msB >= 224 && msB <= 239;
80 }
struct sockaddr_in ia
Definition: osiSock.h:157
epicsShareFunc std::ostream & epics::pvAccess::operator<< ( std::ostream &  strm,
const HexDump hex 
)

Definition at line 69 of file hexDump.cpp.

70 {
71  const size_t len = std::min(hex.buflen, hex._limit);
72  // find address width in hex chars
73  // find bit width, rounded up to 8 bits, divide down to bytes
74  const size_t addrwidth = bits2bytes(ilog2(len))*2u;
75  size_t nlines = len/hex._perLine;
76 
77  if(len%hex._perLine)
78  nlines++;
79 
80  for(size_t l=0; l<nlines; l++)
81  {
82  size_t start = l*hex._perLine;
83  strm<<"0x"<<std::hex<<std::setw(addrwidth)<<std::setfill('0')<<start;
84 
85  // print hex chars
86  for(size_t col=0; col<hex._perLine; col++)
87  {
88  if(col%hex._groupBy == 0) {
89  strm<<' ';
90  }
91  if(start+col < len) {
92  strm<<std::hex<<std::setw(2)<<std::setfill('0')<<unsigned(hex.buf[start+col]&0xff);
93  } else {
94  strm<<" ";
95  }
96  }
97 
98  strm<<' ';
99 
100  // printable ascii
101  for(size_t col=0; col<hex._perLine && start+col<len; col++)
102  {
103  if(col%hex._groupBy == 0) {
104  strm<<' ';
105  }
106  char val = hex.buf[start+col]&0xff;
107  if(val>=' ' && val<='~') {
108  strm<<val;
109  } else {
110  strm<<'.';
111  }
112  }
113 
114  strm<<'\n';
115  }
116 
117  return strm;
118 }
#define min(x, y)
Definition: flexdef.h:78
Definition: tool_lib.h:64
std::ostream & epics::pvAccess::operator<< ( std::ostream &  o,
const Version v 
)

Definition at line 69 of file pvaVersion.cpp.

69  {
70  return o << v.getVersionString();
71 }
void epics::pvAccess::osdGetRoles ( const std::string &  account,
PeerInfo::roles_t roles 
)

Query OS specific DB for role/group names assocated with a user account.

Parameters
accountUser name
rolesRole names are added to this set. Existing names are not removed.

Definition at line 51 of file getgroups.cpp.

52 {
53  passwd *user = getpwnam(account.c_str());
54  if(!user)
55  return; // don't know who this is
56 
57  typedef std::set<gid_t> gids_t;
58  gids_t gids;
59 
60  gids.insert(user->pw_gid); // include primary group
61 
62  /* List supplementary groups.
63  *
64  * Rant...
65  * getgrouplist() differs subtly when the *count is too short.
66  * Some libc (Mac) don't update the count
67  * Some libc (glibc) don't write a truncated list.
68  *
69  * We might also use getgrent(), but this isn't reentrant, and
70  * would anyway require visiting all groups.
71  * The GNU alternative getgrent_r() would require us to allocate
72  * enough space to hold the list of all members of the largest
73  * group. This may be hundreds.
74  *
75  * So we iterate with getgrouplist() as the lesser evil...
76  */
77  {
78  // start with a guess
79  std::vector<osi_gid_t> gtemp(16, (osi_gid_t)-1);
80 
81  while(true) {
82  int gcount = int(gtemp.size());
83  int ret = getgrouplist(user->pw_name, user->pw_gid, &gtemp[0], &gcount);
84 
85  if(ret>=0 && gcount>=0 && gcount <= int(gtemp.size())) {
86  // success
87  gtemp.resize(gcount);
88  break;
89 
90  } else if(ret>=0) {
91  // success, but invalid count? give up
92  gtemp.clear();
93  break;
94 
95  } else if(gcount == int(gtemp.size())) {
96  // too small, but gcount not updated. (Mac)
97  // arbitrary increase to size and retry
98  gtemp.resize(gtemp.size()*2u, (osi_gid_t)-1);
99 
100  } else if(gcount > int(gtemp.size())) {
101  // too small, gcount holds actual size. retry
102  gtemp.resize(gcount, (osi_gid_t)-1);
103 
104  } else {
105  // too small, but gcount got smaller? give up
106  gtemp.clear();
107  break;
108  }
109  }
110 
111  for(size_t i=0, N=gtemp.size(); i<N; i++)
112  gids.insert(gtemp[i]);
113  }
114 
115  // map GIDs to names
116  for(gids_t::iterator it(gids.begin()), end(gids.end()); it!=end; it++) {
117  group* gr = getgrgid(*it);
118  if(!gr)
119  continue;
120  roles.insert(gr->gr_name);
121  }
122 }
int i
Definition: scan.c:967
gid_t osi_gid_t
Definition: getgroups.cpp:31
void epics::pvAccess::providerRegInit ( void *  )

Definition at line 208 of file ChannelAccessFactory.cpp.

209 {
212 
213  providerRegGbl = new providerRegGbl_t;
214  providerRegGbl->clients->add("pva", createClientProvider);
215 
216  registerRefCounter("ServerContextImpl", &ServerContextImpl::num_instances);
217  registerRefCounter("ServerChannel", &ServerChannel::num_instances);
218  registerRefCounter("Transport (ABC)", &Transport::num_instances);
219  registerRefCounter("BlockingTCPTransportCodec", &detail::BlockingTCPTransportCodec::num_instances);
220  registerRefCounter("BlockingUDPTransport", &BlockingUDPTransport::num_instances);
221  registerRefCounter("ChannelProvider (ABC)", &ChannelProvider::num_instances);
222  registerRefCounter("Channel (ABC)", &Channel::num_instances);
223  registerRefCounter("ChannelRequester (ABC)", &ChannelRequester::num_instances);
224  registerRefCounter("ChannelBaseRequester (ABC)", &ChannelBaseRequester::num_instances);
225  registerRefCounter("ChannelRequest (ABC)", &ChannelRequest::num_instances);
226  registerRefCounter("ResponseHandler (ABC)", &ResponseHandler::num_instances);
227  registerRefCounter("MonitorFIFO", &MonitorFIFO::num_instances);
232  registerRefCounter("pvas::SharedPV", &pvas::SharedPV::num_instances);
233 }
LIBCOM_API void epicsStdCall epicsSignalInstallSigPipeIgnore(void)
Definition: osdSignal.cpp:17
static size_t num_instances
ChannelProvider::shared_pointer createClientProvider(const Configuration::shared_pointer &conf)
LIBCOM_API void epicsStdCall epicsSignalInstallSigAlarmIgnore(void)
Definition: osdSignal.cpp:18
void registerRefCounter(const char *name, const size_t *counter)
Definition: reftrack.cpp:59
void registerRefTrackServer()
Definition: server.cpp:281
const std::string epics::pvAccess::PVACCESS_ALL_PROVIDERS ( "<all>"  )
const std::string epics::pvAccess::PVACCESS_DEBUG ( "EPICS_PVA_DEBUG"  )
const std::string epics::pvAccess::PVACCESS_DEFAULT_PROVIDER ( "local"  )
epicsShareFunc bool epics::pvAccess::pvAccessIsLoggable ( pvAccessLogLevel  level)

Definition at line 64 of file logger.cpp.

65 {
66  return level >= g_pvAccessLogLevel;
67 }
epicsShareFunc void epics::pvAccess::pvAccessLog ( pvAccessLogLevel  level,
const char *  format,
  ... 
)

Definition at line 36 of file logger.cpp.

37 {
38  // TODO lock
39  if (level >= g_pvAccessLogLevel)
40  {
41  char timeText[TIMETEXTLEN];
42  epicsTimeStamp tsNow;
43 
44  epicsTimeGetCurrent(&tsNow);
45  epicsTimeToStrftime(timeText, TIMETEXTLEN, "%Y-%m-%dT%H:%M:%S.%03f", &tsNow);
46 
47  printf("%s ", timeText);
48 
49  va_list arg;
50  va_start(arg, format);
51  vprintf(format, arg);
52  va_end(arg);
53 
54  printf("\n");
55  fflush(stdout); // needed for WIN32
56  }
57 }
#define printf
Definition: epicsStdio.h:41
LIBCOM_API size_t epicsStdCall epicsTimeToStrftime(char *pBuff, size_t bufLength, const char *pFormat, const epicsTimeStamp *pTS)
Convert epicsTimeStamp to string. See epicsTime::strftime()
Definition: epicsTime.cpp:1120
int epicsStdCall epicsTimeGetCurrent(epicsTimeStamp *pDest)
Get current time into *pDest.
#define stdout
Definition: epicsStdio.h:30
EPICS time stamp, for use from C code.
Definition: epicsTime.h:33
#define TIMETEXTLEN
Definition: logger.cpp:32
epicsShareFunc void epicsShareFunc void epics::pvAccess::pvAccessSetLogLevel ( pvAccessLogLevel  level)

Definition at line 59 of file logger.cpp.

60 {
61  g_pvAccessLogLevel = level;
62 }
void epics::pvAccess::refTrackRegistrar ( )

Definition at line 84 of file reftrackioc.cpp.

85 {
86  epics::iocshRegister<int, &refshow>("refshow", "detail level");
87  epics::iocshRegister<&refsave>("refsave");
88  epics::iocshRegister<int, &refdiff>("refdiff", "detail level");
89  epics::iocshRegister<double, int, &refmon>("refmon", "update period", "detail level");
90 }
ServerContext::shared_pointer epics::pvAccess::startPVAServer ( std::string const &  providerNames = PVACCESS_ALL_PROVIDERS,
int  timeToRun = 0,
bool  runInSeparateThread = false,
bool  printInfo = false 
)

Definition at line 544 of file serverContext.cpp.

545 {
546  ServerContext::shared_pointer ret(ServerContext::create(ServerContext::Config()
547  .config(ConfigurationBuilder()
548  .add("EPICS_PVAS_PROVIDER_NAMES", providerNames)
549  .push_map()
550  .push_env() // environment takes precidence (top of stack)
551  .build())));
552  if(printInfo)
553  ret->printInfo();
554 
555  if(!runInSeparateThread) {
556  ret->run(timeToRun);
557  ret->shutdown();
558  } else if(timeToRun!=0) {
559  LOG(logLevelWarn, "startPVAServer() timeToRun!=0 only supported when runInSeparateThread==false\n");
560  }
561 
562  return ret;
563 }
#define LOG(level, format,...)
Definition: logger.h:48

Variable Documentation

Mutex epics::pvAccess::conf_factory_mutex

Definition at line 244 of file configuration.cpp.

ConfigurationProvider::shared_pointer epics::pvAccess::configurationProvider

Definition at line 243 of file configuration.cpp.

PVA protocol revision (implemented by this library).

PVA version signature used to report this implementation version in header.

Definition at line 35 of file pvaConstants.h.

const epics::pvData::int16 epics::pvAccess::INVALID_DATA_TYPE = 0xFFFF

Invalid data type.

Definition at line 76 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::INVALID_IOID = 0

Invalid IOID.

Definition at line 79 of file pvaConstants.h.

const epics::pvData::uint32 epics::pvAccess::MAX_CHANNEL_NAME_LENGTH = 500

Unreasonable channel name length.

Definition at line 73 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::MAX_SEARCH_BATCH_COUNT = 0x7FFF

Maximum number of search requests in one search message.

Definition at line 67 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::MAX_TCP_RECV = 1024*16

TCP maximum receive message size.

Definition at line 64 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::MAX_UDP_RECV = 65487

UDP maximum receive message size. MAX_UDP: 65535 (max UDP packet size) - 20/40(IPv4/IPv6) - 8(UDP)

Definition at line 61 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::MAX_UDP_UNFRAGMENTED_SEND = 1440

UDP maximum send message size. MAX_UDP: 1500 (max of ethernet and 802.{2,3} MTU) - 20/40(IPv4/IPv6)

  • 8(UDP) - some reserve (the MTU of Ethernet is currently independent of its speed variant)

Definition at line 55 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::PVA_BROADCAST_PORT = 5076

Default PVA beacon port.

Definition at line 44 of file pvaConstants.h.

const epics::pvData::int8 epics::pvAccess::PVA_CLIENT_PROTOCOL_REVISION = 2

Definition at line 32 of file pvaConstants.h.

const epics::pvData::int16 epics::pvAccess::PVA_DEFAULT_PRIORITY = 0

Default priority (corresponds to POSIX SCHED_OTHER)

Definition at line 70 of file pvaConstants.h.

const epics::pvData::int8 epics::pvAccess::PVA_MAGIC = static_cast<epics::pvData::int8>(0xCA)

PVA protocol magic number

Definition at line 29 of file pvaConstants.h.

const epics::pvData::int16 epics::pvAccess::PVA_MESSAGE_HEADER_SIZE = 8

PVA protocol message header size.

Definition at line 47 of file pvaConstants.h.

const epics::pvData::int32 epics::pvAccess::PVA_SERVER_PORT = 5075

Default PVA server port.

Definition at line 41 of file pvaConstants.h.

const epics::pvData::int8 epics::pvAccess::PVA_SERVER_PROTOCOL_REVISION = 2

Definition at line 31 of file pvaConstants.h.

epicsShareExtern const std::string epics::pvAccess::PVACCESS_ALL_PROVIDERS

"All-providers registered" PVA provider name.

Definition at line 85 of file pvaConstants.h.

epicsShareExtern const std::string epics::pvAccess::PVACCESS_DEBUG

Name of the system env. variable to turn on debugging.

Definition at line 88 of file pvaConstants.h.

epicsShareExtern const std::string epics::pvAccess::PVACCESS_DEFAULT_PROVIDER

Default PVA provider name.

Definition at line 82 of file pvaConstants.h.