wildcharMatcher removed, headers cleaned from using statements

This commit is contained in:
Matej Sekoranja
2011-10-20 15:10:31 +02:00
parent 4dcb439955
commit 4e22433de1
24 changed files with 241 additions and 635 deletions

View File

@@ -14,7 +14,6 @@ LIBSRCS += clientFactory.cpp
SRC_DIRS += $(PVACCESS)/utils
INC += hexDump.h
INC += wildcharMatcher.h
INC += inetAddressUtil.h
INC += logger.h
INC += introspectionRegistry.h
@@ -23,7 +22,6 @@ INC += namedLockPattern.h
INC += referenceCountingLock.h
INC += configuration.h
LIBSRCS += hexDump.cpp
LIBSRCS += wildcharMatcher.cpp
LIBSRCS += inetAddressUtil.cpp
LIBSRCS += logger.cpp
LIBSRCS += introspectionRegistry.cpp

View File

@@ -9,41 +9,35 @@
#include <pv/pvType.h>
using epics::pvData::int8;
using epics::pvData::int16;
using epics::pvData::int32;
using epics::pvData::uint32;
using epics::pvData::String;
namespace epics {
namespace pvAccess {
/** CA protocol magic number */
const int8 CA_MAGIC = 0xCA;
const epics::pvData::int8 CA_MAGIC = 0xCA;
/** CA protocol major revision (implemented by this library). */
const int8 CA_MAJOR_PROTOCOL_REVISION = 5;
const epics::pvData::int8 CA_MAJOR_PROTOCOL_REVISION = 5;
/** CA protocol minor revision (implemented by this library). */
const int8 CA_MINOR_PROTOCOL_REVISION = 0;
const epics::pvData::int8 CA_MINOR_PROTOCOL_REVISION = 0;
/** Unknown CA protocol minor revision. */
const int8 CA_UNKNOWN_MINOR_PROTOCOL_REVISION = 0;
const epics::pvData::int8 CA_UNKNOWN_MINOR_PROTOCOL_REVISION = 0;
/** CA version signature (e.g. 0x50). */
const int8 CA_VERSION = ((uint8_t)CA_MAJOR_PROTOCOL_REVISION<<4)|CA_MINOR_PROTOCOL_REVISION;
const epics::pvData::int8 CA_VERSION = ((uint8_t)CA_MAJOR_PROTOCOL_REVISION<<4)|CA_MINOR_PROTOCOL_REVISION;
/** CA protocol port base. */
const int32 CA_PORT_BASE = 5056;
const epics::pvData::int32 CA_PORT_BASE = 5056;
/** Default CA server port. */
const int32 CA_SERVER_PORT = CA_PORT_BASE+2*CA_MAJOR_PROTOCOL_REVISION;
const epics::pvData::int32 CA_SERVER_PORT = CA_PORT_BASE+2*CA_MAJOR_PROTOCOL_REVISION;
/** Default CA beacon port. */
const int32 CA_BROADCAST_PORT = CA_SERVER_PORT+1;
const epics::pvData::int32 CA_BROADCAST_PORT = CA_SERVER_PORT+1;
/** CA protocol message header size. */
const int16 CA_MESSAGE_HEADER_SIZE = 8;
const epics::pvData::int16 CA_MESSAGE_HEADER_SIZE = 8;
/**
* UDP maximum send message size.
@@ -51,34 +45,34 @@ namespace pvAccess {
* - 8(UDP) - some reserve (the MTU of Ethernet is currently independent
* of its speed variant)
*/
const int32 MAX_UDP_SEND = 1440;
const epics::pvData::int32 MAX_UDP_SEND = 1440;
/** UDP maximum receive message size. */
const int32 MAX_UDP_RECV = 0xFFFF+16;
const epics::pvData::int32 MAX_UDP_RECV = 0xFFFF+16;
/** TCP maximum receive message size. */
const int32 MAX_TCP_RECV = 1024*16;
const epics::pvData::int32 MAX_TCP_RECV = 1024*16;
/** Maximum number of search requests in one search message. */
const int32 MAX_SEARCH_BATCH_COUNT = 0xFFFF;
const epics::pvData::int32 MAX_SEARCH_BATCH_COUNT = 0xFFFF;
/** Default priority (corresponds to POSIX SCHED_OTHER) */
const int16 CA_DEFAULT_PRIORITY = 0;
const epics::pvData::int16 CA_DEFAULT_PRIORITY = 0;
/** Unreasonable channel name length. */
const uint32 UNREASONABLE_CHANNEL_NAME_LENGTH = 500;
const epics::pvData::uint32 UNREASONABLE_CHANNEL_NAME_LENGTH = 500;
/** Invalid data type. */
const int16 INVALID_DATA_TYPE = (int16)0xFFFF;
const epics::pvData::int16 INVALID_DATA_TYPE = 0xFFFF;
/** Invalid IOID. */
const int32 INVALID_IOID = 0;
const epics::pvData::int32 INVALID_IOID = 0;
/** All messages must be aligned to 8-bytes (64-bit). */
const int32 CA_ALIGNMENT = 8;
const epics::pvData::int32 CA_ALIGNMENT = 8;
/** Default CA provider name. */
const String PVACCESS_DEFAULT_PROVIDER = "local";
const epics::pvData::String PVACCESS_DEFAULT_PROVIDER = "local";
}
}

View File

@@ -13,8 +13,6 @@
namespace epics {
namespace pvAccess {
using epics::pvData::String;
class Version : public epics::pvData::NoDefaultMethods {
public:
/**
@@ -26,7 +24,7 @@ namespace pvAccess {
* @param maintenanceVersion maintenance version.
* @param developmentVersion development version.
*/
Version(String productName, String implementationLangugage,
Version(epics::pvData::String productName, epics::pvData::String implementationLangugage,
int majorVersion, int minorVersion,
int maintenanceVersion, int developmentVersion) :
_productName(productName),
@@ -39,13 +37,13 @@ namespace pvAccess {
}
/** The name of the product */
inline const String getProductName() const {
inline const epics::pvData::String getProductName() const {
return _productName;
}
/** Implementation Language: C++
*/
inline const String getImplementationLanguage() const {
inline const epics::pvData::String getImplementationLanguage() const {
return _implementationLanguage;
}
@@ -103,28 +101,28 @@ namespace pvAccess {
}
/**
* Get the long version string. Version String formatted like <BR/><CODE>
* Get the long version string. Version epics::pvData::String formatted like <BR/><CODE>
* "<B>ProductName </B> \[<B>ImplementationLanguage</B>\] 'v'v.r[.dd|<B>D</B>nn]"
* </CODE> <BR/>e.g. <BR/><CODE>"<B>CAJ </B> [<B>Java</B>] v1.0.1"</CODE>
* <BR/>
*
* @return String denoting current version
* @return epics::pvData::String denoting current version
*/
const String getLongVersionString() const;
const epics::pvData::String getLongVersionString() const;
/**
* Get the basic version string. Version String formatted like <BR/><CODE>
* Get the basic version string. Version epics::pvData::String formatted like <BR/><CODE>
* "<B>ProductName </B> 'v'v.r[.dd|<B>D</B>nn]"
* </CODE> <BR/>e.g. <BR/><CODE>"<B>CAJ </B> v1.0.1"</CODE>
* <BR/>
*
* @return String denoting current version
* @return epics::pvData::String denoting current version
*/
const String getVersionString() const;
const epics::pvData::String getVersionString() const;
private:
String _productName;
String _implementationLanguage;
epics::pvData::String _productName;
epics::pvData::String _implementationLanguage;
int _majorVersion;
int _minorVersion;
int _maintenanceVersion;

View File

@@ -831,7 +831,7 @@ namespace epics { namespace pvAccess {
* @param requester The requester;
* @return The request structure if an invalid request was given.
*/
virtual epics::pvData::PVStructure::shared_pointer createRequest(String request) = 0;
virtual epics::pvData::PVStructure::shared_pointer createRequest(epics::pvData::String request) = 0;
};
extern CreateRequest::shared_pointer getCreateRequest();

View File

@@ -34,8 +34,6 @@
#include <map>
#include <deque>
using epics::pvData::int64;
namespace epics {
namespace pvAccess {
@@ -57,14 +55,14 @@ namespace epics {
protected:
BlockingTCPTransport(Context::shared_pointer const & context, SOCKET channel,
std::auto_ptr<ResponseHandler>& responseHandler, int receiveBufferSize,
int16 priority);
epics::pvData::int16 priority);
public:
virtual bool isClosed() {
return _closed.get();
}
virtual void setRemoteMinorRevision(int8 minorRevision) {
virtual void setRemoteMinorRevision(epics::pvData::int8 minorRevision) {
_remoteTransportRevision = minorRevision;
}
@@ -76,8 +74,8 @@ namespace epics {
_remoteTransportSocketReceiveBufferSize = socketReceiveBufferSize;
}
virtual const String getType() const {
return String("TCP");
virtual const epics::pvData::String getType() const {
return epics::pvData::String("TCP");
}
virtual void aliveNotification() {
@@ -92,7 +90,7 @@ namespace epics {
return &_socketAddress;
}
virtual int16 getPriority() const {
virtual epics::pvData::int16 getPriority() const {
return _priority;
}
@@ -131,7 +129,7 @@ namespace epics {
bool waitUntilVerified(double timeout);
virtual void flush(bool lastMessageCompleted);
virtual void startMessage(int8 command, int ensureCapacity);
virtual void startMessage(epics::pvData::int8 command, int ensureCapacity);
virtual void endMessage();
virtual void flushSerializeBuffer() {
@@ -229,7 +227,7 @@ namespace epics {
* NOTE: Priority cannot just be changed, since it is registered
* in transport registry with given priority.
*/
int16 _priority;
epics::pvData::int16 _priority;
// TODO to be implemeneted
/**
@@ -250,7 +248,7 @@ namespace epics {
/**
* Marker "period" in bytes (every X bytes marker should be set).
*/
int64 _markerPeriodBytes;
epics::pvData::int64 _markerPeriodBytes;
SendQueueFlushStrategy _flushStrategy;
@@ -274,7 +272,7 @@ namespace epics {
/**
* Remote side transport revision (minor).
*/
int8 _remoteTransportRevision;
epics::pvData::int8 _remoteTransportRevision;
/**
* Remote side transport receive buffer size.
@@ -308,7 +306,7 @@ namespace epics {
/**
* Next planned marker position.
*/
int64 _nextMarkerPosition;
epics::pvData::int64 _nextMarkerPosition;
/**
* Send pending flag.
@@ -320,14 +318,14 @@ namespace epics {
*/
int _lastMessageStartPosition;
int8 _lastSegmentedMessageType;
int8 _lastSegmentedMessageCommand;
epics::pvData::int8 _lastSegmentedMessageType;
epics::pvData::int8 _lastSegmentedMessageCommand;
bool _flushRequested;
int _sendBufferSentPosition;
int8 _byteOrderFlag;
epics::pvData::int8 _byteOrderFlag;
@@ -346,9 +344,9 @@ namespace epics {
int _storedPosition;
int _storedLimit;
int8 _version;
int8 _packetType;
int8 _command;
epics::pvData::int8 _version;
epics::pvData::int8 _packetType;
epics::pvData::int8 _command;
int _payloadSize;
ReceiveStage _stage;
@@ -356,7 +354,7 @@ namespace epics {
/**
* Total bytes received.
*/
int64 _totalBytesReceived;
epics::pvData::int64 _totalBytesReceived;
@@ -402,13 +400,13 @@ namespace epics {
* Total bytes sent.
* NOTE: synced by _flowControlMutex
*/
int64 _totalBytesSent;
epics::pvData::int64 _totalBytesSent;
/**
* Calculated remote free buffer size.
* NOTE: synced by _flowControlMutex
*/
int64 _remoteBufferFreeSpace;
epics::pvData::int64 _remoteBufferFreeSpace;
epics::pvData::Mutex _flowControlMutex;
@@ -450,14 +448,14 @@ namespace epics {
private:
BlockingClientTCPTransport(Context::shared_pointer const & context, SOCKET channel,
std::auto_ptr<ResponseHandler>& responseHandler, int receiveBufferSize,
TransportClient::shared_pointer client, int8 remoteTransportRevision,
float beaconInterval, int16 priority);
TransportClient::shared_pointer client, epics::pvData::int8 remoteTransportRevision,
float beaconInterval, epics::pvData::int16 priority);
public:
static BlockingClientTCPTransport::shared_pointer create(Context::shared_pointer const & context, SOCKET channel,
std::auto_ptr<ResponseHandler>& responseHandler, int receiveBufferSize,
TransportClient::shared_pointer client, int8 remoteTransportRevision,
float beaconInterval, int16 priority)
TransportClient::shared_pointer client, epics::pvData::int8 remoteTransportRevision,
float beaconInterval, epics::pvData::int16 priority)
{
BlockingClientTCPTransport::shared_pointer thisPointer(
new BlockingClientTCPTransport(context, channel, responseHandler, receiveBufferSize,
@@ -595,7 +593,7 @@ namespace epics {
virtual Transport::shared_pointer connect(TransportClient::shared_pointer const & client,
std::auto_ptr<ResponseHandler>& responseHandler, osiSockAddr& address,
int8 transportRevision, int16 priority);
epics::pvData::int8 transportRevision, epics::pvData::int16 priority);
private:
/**
* Lock timeout

View File

@@ -16,6 +16,8 @@
#include <sys/types.h>
#include <sstream>
using namespace epics::pvData;
namespace epics {
namespace pvAccess {

View File

@@ -62,8 +62,8 @@ namespace epics {
return &_bindAddress;
}
virtual const String getType() const {
return String("UDP");
virtual const epics::pvData::String getType() const {
return epics::pvData::String("UDP");
}
virtual int getReceiveBufferSize() const {
@@ -72,11 +72,11 @@ namespace epics {
virtual int getSocketReceiveBufferSize() const;
virtual int16 getPriority() const {
virtual epics::pvData::int16 getPriority() const {
return CA_DEFAULT_PRIORITY;
}
virtual void setRemoteMinorRevision(int8 minor) {
virtual void setRemoteMinorRevision(epics::pvData::int8 minor) {
// noop
}
@@ -120,7 +120,7 @@ namespace epics {
_receiveBuffer->align(alignment);
}
virtual void startMessage(int8 command, int ensureCapacity);
virtual void startMessage(epics::pvData::int8 command, int ensureCapacity);
virtual void endMessage();
virtual void flush(bool lastMessageCompleted) {
@@ -168,9 +168,9 @@ namespace epics {
return _ignoredAddresses;
}
bool send(ByteBuffer* buffer, const osiSockAddr& address);
bool send(epics::pvData::ByteBuffer* buffer, const osiSockAddr& address);
bool send(ByteBuffer* buffer);
bool send(epics::pvData::ByteBuffer* buffer);
/**
* Get list of send addresses.
@@ -302,7 +302,7 @@ namespace epics {
*/
virtual Transport::shared_pointer connect(TransportClient::shared_pointer const & client,
std::auto_ptr<ResponseHandler>& responseHandler, osiSockAddr& bindAddress,
int8 transportRevision, int16 priority);
epics::pvData::int8 transportRevision, epics::pvData::int16 priority);
private:

View File

@@ -17,6 +17,7 @@
#include <sys/types.h>
using namespace std;
using namespace epics::pvData;
namespace epics {
namespace pvAccess {

View File

@@ -21,11 +21,6 @@
#include <deque>
using epics::pvData::Mutex;
using epics::pvData::String;
using epics::pvData::int32;
using epics::pvData::int64;
namespace epics { namespace pvAccess {
//TODO check the const of parameters
@@ -53,7 +48,7 @@ public:
*
* @return channel channel name.
*/
virtual String getSearchInstanceName() = 0;
virtual epics::pvData::String getSearchInstanceName() = 0;
/**
* Removes the owner of this search instance.
*/
@@ -68,7 +63,7 @@ public:
*
* @throws BaseException if the ownerMutex is NULL.
*/
virtual void addAndSetListOwnership(List* newOwner, Mutex* ownerMutex, int32 index) = 0;
virtual void addAndSetListOwnership(List* newOwner, epics::pvData::Mutex* ownerMutex, epics::pvData::int32 index) = 0;
/**
* Removes this search instance from the owner list and also removes the list as the owner of this
* search instance.
@@ -79,18 +74,18 @@ public:
/**
* Returns the index of the owner.
*/
virtual int32 getOwnerIndex() = 0;
virtual epics::pvData::int32 getOwnerIndex() = 0;
/**
* Generates request message.
*/
virtual bool generateSearchRequestMessage(ByteBuffer* requestMessage, TransportSendControl* control) = 0;
virtual bool generateSearchRequestMessage(epics::pvData::ByteBuffer* requestMessage, TransportSendControl* control) = 0;
/**
* Search response from server (channel found).
* @param minorRevision server minor CA revision.
* @param serverAddress server address.
*/
virtual void searchResponse(int8 minorRevision, osiSockAddr* serverAddress) = 0;
virtual void searchResponse(epics::pvData::int8 minorRevision, osiSockAddr* serverAddress) = 0;
};
/**
@@ -102,21 +97,21 @@ public:
virtual ~BaseSearchInstance() {};
void initializeSearchInstance();
virtual pvAccessID getSearchInstanceID() = 0;
virtual String getSearchInstanceName() = 0;
virtual epics::pvData::String getSearchInstanceName() = 0;
virtual void unsetListOwnership();
virtual void addAndSetListOwnership(List* newOwner, Mutex* ownerMutex, int32 index);
virtual void addAndSetListOwnership(List* newOwner, epics::pvData::Mutex* ownerMutex, epics::pvData::int32 index);
virtual void removeAndUnsetListOwnership();
virtual int32 getOwnerIndex();
virtual epics::pvData::int32 getOwnerIndex();
/**
* Send search message.
* @return success status.
*/
virtual bool generateSearchRequestMessage(ByteBuffer* requestMessage, TransportSendControl* control);
virtual bool generateSearchRequestMessage(epics::pvData::ByteBuffer* requestMessage, TransportSendControl* control);
private:
Mutex _mutex;
epics::pvData::Mutex _mutex;
List* _owner;
Mutex* _ownerMutex;
int32 _ownerIndex;
epics::pvData::Mutex* _ownerMutex;
epics::pvData::int32 _ownerIndex;
const static int DATA_COUNT_POSITION;
const static int PAYLOAD_POSITION;
@@ -134,7 +129,7 @@ public:
* @param timerIndex this timer instance index.
* @param allowBoost is boost allowed flag.
*/
SearchTimer(ChannelSearchManager* csmanager,int32 timerIndex, bool allowBoost, bool allowSlowdown);
SearchTimer(ChannelSearchManager* csmanager,epics::pvData::int32 timerIndex, bool allowBoost, bool allowSlowdown);
/**
* Destructor.
*/
@@ -167,12 +162,12 @@ public:
* @param isSequenceNumberValid valid flag of <code>responseSequenceNumber</code>.
* @param responseTime time of search response.
*/
void searchResponse(int32 responseSequenceNumber, bool isSequenceNumberValid, int64 responseTime);
void searchResponse(epics::pvData::int32 responseSequenceNumber, bool isSequenceNumberValid, epics::pvData::int64 responseTime);
/**
* Calculate search time period.
* @return search time period.
*/
const int64 period();
const epics::pvData::int64 period();
private:
/**
* Instance of the channel search manager with which this search timer
@@ -182,11 +177,11 @@ private:
/**
* Number of search attempts in one frame.
*/
int32 _searchAttempts;
epics::pvData::int32 _searchAttempts;
/**
* Number of search responses in one frame.
*/
int32 _searchRespones;
epics::pvData::int32 _searchRespones;
/**
* Number of frames per search try.
*/
@@ -198,15 +193,15 @@ private:
/**
* Start sequence number (first frame number within a search try).
*/
int32 _startSequenceNumber;
epics::pvData::int32 _startSequenceNumber;
/**
* End sequence number (last frame number within a search try).
*/
int32 _endSequenceNumber;
epics::pvData::int32 _endSequenceNumber;
/**
* This timer index.
*/
const int32 _timerIndex;
const epics::pvData::int32 _timerIndex;
/**
* Flag indicating whether boost is allowed.
*/
@@ -237,27 +232,27 @@ private:
/**
* Time of last response check.
*/
int64 _timeAtResponseCheck;
epics::pvData::int64 _timeAtResponseCheck;
/**
* Mutex for request pending channel list.
* epics::pvData::Mutex for request pending channel list.
*/
Mutex _requestPendingChannelsMutex;
epics::pvData::Mutex _requestPendingChannelsMutex;
/**
* Mutex for request pending channel list.
* epics::pvData::Mutex for request pending channel list.
*/
Mutex _responsePendingChannelsMutex;
epics::pvData::Mutex _responsePendingChannelsMutex;
/**
* General mutex.
*/
Mutex _mutex;
epics::pvData::Mutex _mutex;
/**
* Volatile varialbe mutex.
*/
Mutex _volMutex;
epics::pvData::Mutex _volMutex;
/**
* Max search tries per frame.
*/
static const int32 MAX_FRAMES_PER_TRY;
static const epics::pvData::int32 MAX_FRAMES_PER_TRY;
};
class MockTransportSendControl: public TransportSendControl
@@ -266,7 +261,7 @@ public:
void endMessage() {}
void flush(bool lastMessageCompleted) {}
void setRecipient(const osiSockAddr& sendTo) {}
void startMessage(int8 command, int ensureCapacity) {}
void startMessage(epics::pvData::int8 command, int ensureCapacity) {}
void ensureBuffer(int size) {}
void alignBuffer(int alignment) {}
void flushSerializeBuffer() {}
@@ -297,7 +292,7 @@ public:
* Get number of registered channels.
* @return number of registered channels.
*/
int32 registeredChannelCount();
epics::pvData::int32 registeredChannelCount();
/**
* Register channel.
* @param channel to register.
@@ -315,7 +310,7 @@ public:
* @param minorRevision server minor CA revision.
* @param serverAddress server address.
*/
void searchResponse(int32 cid, int32 seqNo, int8 minorRevision, osiSockAddr* serverAddress);
void searchResponse(epics::pvData::int32 cid, epics::pvData::int32 seqNo, epics::pvData::int8 minorRevision, osiSockAddr* serverAddress);
/**
* Beacon anomaly detected.
* Boost searching of all channels.
@@ -325,11 +320,11 @@ private:
/**
* Minimal RTT (ms).
*/
static const int64 MIN_RTT;
static const epics::pvData::int64 MIN_RTT;
/**
* Maximal RTT (ms).
*/
static const int64 MAX_RTT;
static const epics::pvData::int64 MAX_RTT;
/**
* Rate to be considered as OK.
*/
@@ -354,39 +349,39 @@ private:
/**
* Number of timers in timers array.
*/
int32 _numberOfTimers;
epics::pvData::int32 _numberOfTimers;
/**
* Index of a timer to be used when beacon anomaly is detected.
*/
int32 _beaconAnomalyTimerIndex;
epics::pvData::int32 _beaconAnomalyTimerIndex;
/**
* Search (datagram) sequence number.
*/
int32 _sequenceNumber;
epics::pvData::int32 _sequenceNumber;
/**
* Max search period (in ms).
*/
static const int64 MAX_SEARCH_PERIOD;
static const epics::pvData::int64 MAX_SEARCH_PERIOD;
/**
* Max search period (in ms) - lower limit.
*/
static const int64 MAX_SEARCH_PERIOD_LOWER_LIMIT;
static const epics::pvData::int64 MAX_SEARCH_PERIOD_LOWER_LIMIT;
/**
* Beacon anomaly search period (in ms).
*/
static const int64 BEACON_ANOMALY_SEARCH_PERIOD;
static const epics::pvData::int64 BEACON_ANOMALY_SEARCH_PERIOD;
/**
* Max number of timers.
*/
static const int32 MAX_TIMERS;
static const epics::pvData::int32 MAX_TIMERS;
/**
* Send byte buffer (frame)
*/
ByteBuffer* _sendBuffer;
epics::pvData::ByteBuffer* _sendBuffer;
/**
* Time of last frame send.
*/
int64 _timeAtLastSend;
epics::pvData::int64 _timeAtLastSend;
/**
* Set of registered channels.
*/
@@ -398,15 +393,15 @@ private:
/**
* General mutex.
*/
Mutex _mutex;
epics::pvData::Mutex _mutex;
/**
* Channel mutex.
*/
Mutex _channelMutex;
epics::pvData::Mutex _channelMutex;
/**
* Volatile variable mutex.
*/
Mutex _volMutex;
epics::pvData::Mutex _volMutex;
/**
* Mock transport send control
*/
@@ -435,13 +430,13 @@ private:
* @param channel channel whose search failed.
* @param timerIndex index of timer which tries to search.
*/
void searchResponseTimeout(SearchInstance* channel, int32 timerIndex);
void searchResponseTimeout(SearchInstance* channel, epics::pvData::int32 timerIndex);
/**
* Boost searching of a channel.
* @param channel channel to boost searching.
* @param timerIndex to what timer-index to boost
*/
void boostSearching(SearchInstance* channel, int32 timerIndex);
void boostSearching(SearchInstance* channel, epics::pvData::int32 timerIndex);
/**
* Update (recalculate) round-trip estimate.
* @param rtt new sample of round-trip value.
@@ -456,12 +451,12 @@ private:
* Get search (UDP) frame sequence number.
* @return search (UDP) frame sequence number.
*/
int32 getSequenceNumber();
epics::pvData::int32 getSequenceNumber();
/**
* Get time at last send (when sendBuffer was flushed).
* @return time at last send.
*/
int64 getTimeAtLastSend();
epics::pvData::int64 getTimeAtLastSend();
};
}}

View File

@@ -70,7 +70,7 @@ namespace epics {
QOS_GET_PUT = 0x80
};
typedef int32 pvAccessID;
typedef epics::pvData::int32 pvAccessID;
enum MessageCommands {
CMD_BEACON = 0,
@@ -106,7 +106,7 @@ namespace epics {
virtual ~TransportSendControl() {}
virtual void startMessage(int8 command, int ensureCapacity) = 0;
virtual void startMessage(epics::pvData::int8 command, int ensureCapacity) = 0;
virtual void endMessage() = 0;
virtual void flush(bool lastMessageCompleted) = 0;
@@ -157,13 +157,13 @@ namespace epics {
* Get protocol type (tcp, udp, ssl, etc.).
* @return protocol type.
*/
virtual const String getType() const = 0;
virtual const epics::pvData::String getType() const = 0;
/**
* Transport protocol major revision.
* @return protocol major revision.
*/
virtual int8 getMajorRevision() const {
virtual epics::pvData::int8 getMajorRevision() const {
return CA_MAJOR_PROTOCOL_REVISION;
}
@@ -171,7 +171,7 @@ namespace epics {
* Transport protocol minor revision.
* @return protocol minor revision.
*/
virtual int8 getMinorRevision() const {
virtual epics::pvData::int8 getMinorRevision() const {
return CA_MINOR_PROTOCOL_REVISION;
}
@@ -191,13 +191,13 @@ namespace epics {
* Transport priority.
* @return protocol priority.
*/
virtual int16 getPriority() const = 0;
virtual epics::pvData::int16 getPriority() const = 0;
/**
* Set remote transport protocol minor revision.
* @param minor protocol minor revision.
*/
virtual void setRemoteMinorRevision(int8 minor) = 0;
virtual void setRemoteMinorRevision(epics::pvData::int8 minor) = 0;
/**
* Set remote transport receive buffer size.
@@ -310,7 +310,7 @@ namespace epics {
*/
virtual void
handleResponse(osiSockAddr* responseFrom, Transport::shared_pointer const & transport,
int8 version, int8 command, int payloadSize,
epics::pvData::int8 version, epics::pvData::int8 command, int payloadSize,
epics::pvData::ByteBuffer* payloadBuffer) = 0;
};
@@ -322,7 +322,7 @@ namespace epics {
/**
* @param description
*/
AbstractResponseHandler(Context* context, String description) :
AbstractResponseHandler(Context* context, epics::pvData::String description) :
_description(description),
_debug(context->getConfiguration()->getPropertyAsBoolean("PVACCESS_DEBUG", false)) {
}
@@ -330,14 +330,14 @@ namespace epics {
virtual ~AbstractResponseHandler() {}
virtual void handleResponse(osiSockAddr* responseFrom, Transport::shared_pointer const & transport,
int8 version, int8 command, int payloadSize,
epics::pvData::int8 version, epics::pvData::int8 command, int payloadSize,
epics::pvData::ByteBuffer* payloadBuffer);
protected:
/**
* Response hanlder description.
*/
String _description;
epics::pvData::String _description;
/**
* Debug flag.
@@ -403,7 +403,7 @@ namespace epics {
*/
virtual Transport::shared_pointer connect(TransportClient::shared_pointer const & client,
std::auto_ptr<ResponseHandler>& responseHandler, osiSockAddr& address,
int8 transportRevision, int16 priority) = 0;
epics::pvData::int8 transportRevision, epics::pvData::int16 priority) = 0;
};
@@ -565,7 +565,7 @@ namespace epics {
* @param version
* @param payloadBuffer
*/
virtual void response(Transport::shared_pointer const & transport, int8 version, ByteBuffer* payloadBuffer) = 0;
virtual void response(Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::ByteBuffer* payloadBuffer) = 0;
};

View File

@@ -59,20 +59,20 @@ namespace epics {
typedef std::tr1::weak_ptr<const ClientContextImpl> const_weak_pointer;
virtual ChannelSearchManager::shared_pointer getChannelSearchManager() = 0;
virtual void checkChannelName(String& name) = 0;
virtual void checkChannelName(epics::pvData::String& name) = 0;
virtual void registerChannel(ChannelImpl::shared_pointer const & channel) = 0;
virtual void unregisterChannel(ChannelImpl::shared_pointer const & channel) = 0;
virtual void destroyChannel(ChannelImpl::shared_pointer const & channel, bool force) = 0;
virtual ChannelImpl::shared_pointer createChannelInternal(String name, ChannelRequester::shared_pointer const & requester, short priority, std::auto_ptr<InetAddrVector>& addresses) = 0;
virtual ChannelImpl::shared_pointer createChannelInternal(epics::pvData::String name, ChannelRequester::shared_pointer const & requester, short priority, std::auto_ptr<InetAddrVector>& addresses) = 0;
virtual ResponseRequest::shared_pointer getResponseRequest(pvAccessID ioid) = 0;
virtual pvAccessID registerResponseRequest(ResponseRequest::shared_pointer const & request) = 0;
virtual ResponseRequest::shared_pointer unregisterResponseRequest(pvAccessID ioid) = 0;
virtual Transport::shared_pointer getTransport(TransportClient::shared_pointer const & client, osiSockAddr* serverAddress, int8 minorRevision, int16 priority) = 0;
virtual Transport::shared_pointer getTransport(TransportClient::shared_pointer const & client, osiSockAddr* serverAddress, epics::pvData::int8 minorRevision, epics::pvData::int16 priority) = 0;
virtual void beaconAnomalyNotify() = 0;

View File

@@ -11,8 +11,6 @@
#include <pv/requester.h>
#include <pv/destroyable.h>
using epics::pvData::Status;
namespace epics {
namespace pvAccess {
@@ -23,21 +21,21 @@ public:
const pvAccessID ioid, Transport::shared_pointer const & transport);
virtual ~BaseChannelRequester() {};
bool startRequest(int32 qos);
bool startRequest(epics::pvData::int32 qos);
void stopRequest();
int32 getPendingRequest();
String getRequesterName();
void message(const String message, const epics::pvData::MessageType messageType);
static void message(Transport::shared_pointer const & transport, const pvAccessID ioid, const String message, const epics::pvData::MessageType messageType);
static void sendFailureMessage(const int8 command, Transport::shared_pointer const & transport, const pvAccessID ioid, const int8 qos, const Status status);
epics::pvData::int32 getPendingRequest();
epics::pvData::String getRequesterName();
void message(const epics::pvData::String message, const epics::pvData::MessageType messageType);
static void message(Transport::shared_pointer const & transport, const pvAccessID ioid, const epics::pvData::String message, const epics::pvData::MessageType messageType);
static void sendFailureMessage(const epics::pvData::int8 command, Transport::shared_pointer const & transport, const pvAccessID ioid, const epics::pvData::int8 qos, const epics::pvData::Status status);
static const Status okStatus;
static const Status badCIDStatus;
static const Status badIOIDStatus;
static const Status noReadACLStatus;
static const Status noWriteACLStatus;
static const Status noProcessACLStatus;
static const Status otherRequestPendingStatus;
static const epics::pvData::Status okStatus;
static const epics::pvData::Status badCIDStatus;
static const epics::pvData::Status badIOIDStatus;
static const epics::pvData::Status noReadACLStatus;
static const epics::pvData::Status noWriteACLStatus;
static const epics::pvData::Status noProcessACLStatus;
static const epics::pvData::Status otherRequestPendingStatus;
protected:
const pvAccessID _ioid;
Transport::shared_pointer _transport;
@@ -45,36 +43,36 @@ protected:
epics::pvData::Mutex _mutex;
private:
ServerContextImpl::shared_pointer _context;
static const int32 NULL_REQUEST;
int32 _pendingRequest;
static const epics::pvData::int32 NULL_REQUEST;
epics::pvData::int32 _pendingRequest;
};
class BaseChannelRequesterMessageTransportSender : public TransportSender
{
public:
BaseChannelRequesterMessageTransportSender(const pvAccessID _ioid, const String message,const epics::pvData::MessageType messageType);
BaseChannelRequesterMessageTransportSender(const pvAccessID _ioid, const epics::pvData::String message,const epics::pvData::MessageType messageType);
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
void lock();
void unlock();
private:
const pvAccessID _ioid;
const String _message;
const epics::pvData::String _message;
const epics::pvData::MessageType _messageType;
};
class BaseChannelRequesterFailureMessageTransportSender : public TransportSender
{
public:
BaseChannelRequesterFailureMessageTransportSender(const int8 command, Transport::shared_pointer const & transport, const pvAccessID ioid, const int8 qos, const Status& status);
BaseChannelRequesterFailureMessageTransportSender(const epics::pvData::int8 command, Transport::shared_pointer const & transport, const pvAccessID ioid, const epics::pvData::int8 qos, const epics::pvData::Status& status);
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
void lock();
void unlock();
private:
const int8 _command;
const epics::pvData::int8 _command;
const pvAccessID _ioid;
const int8 _qos;
const Status _status;
const epics::pvData::int8 _qos;
const epics::pvData::Status _status;
Transport::shared_pointer _transport;
};

View File

@@ -52,7 +52,7 @@ namespace epics { namespace pvAccess {
void lock();
void unlock();
void send(ByteBuffer* buffer, TransportSendControl* control);
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
void timerStopped();
@@ -93,7 +93,7 @@ namespace epics { namespace pvAccess {
/**
* Beacon sequence ID.
*/
int16 _beaconSequenceID;
epics::pvData::int16 _beaconSequenceID;
/**
* Startup timestamp (when clients detect a change, they will consider server restarted).
@@ -113,7 +113,7 @@ namespace epics { namespace pvAccess {
/**
* Limit on number of beacons issued.
*/
int16 _beaconCountLimit;
epics::pvData::int16 _beaconCountLimit;
/**
* Server address.
@@ -123,7 +123,7 @@ namespace epics { namespace pvAccess {
/**
* Server port.
*/
int32 _serverPort;
epics::pvData::int32 _serverPort;
/**
* Server status provider implementation (optional).

View File

@@ -1922,7 +1922,7 @@ void ServerRPCHandler::handleResponse(osiSockAddr* responseFrom,
ChannelRPC::shared_pointer channelRPC = request->getChannelRPC();
{
ScopedLock lock(channelRPC); // TODO not really needed if channelRPC->request() is reads from the same thread
BitSet::shared_pointer changedBitSet = request->getAgrumentsBitSet();
BitSet::shared_pointer changedBitSet = request->getArgumentsBitSet();
changedBitSet->deserialize(payloadBuffer, transport.get());
request->getPvArguments()->deserialize(payloadBuffer, transport.get(), changedBitSet.get());
}
@@ -2023,7 +2023,7 @@ PVStructure::shared_pointer ServerChannelRPCRequesterImpl::getPvArguments()
return _pvArguments;
}
BitSet::shared_pointer ServerChannelRPCRequesterImpl::getAgrumentsBitSet()
BitSet::shared_pointer ServerChannelRPCRequesterImpl::getArgumentsBitSet()
{
//Lock guard(_mutex);
return _argumentsBitSet;

View File

@@ -10,9 +10,6 @@
#include <pv/serverChannelImpl.h>
#include <pv/baseChannelRequester.h>
using epics::pvData::BitSet;
using epics::pvData::PVStructure;
namespace epics {
namespace pvAccess {
@@ -22,7 +19,7 @@ namespace epics {
protected:
ServerContextImpl::shared_pointer _context;
public:
AbstractServerResponseHandler(ServerContextImpl::shared_pointer const & context, String description) :
AbstractServerResponseHandler(ServerContextImpl::shared_pointer const & context, epics::pvData::String description) :
AbstractResponseHandler(context.get(), description), _context(context) {
}
@@ -43,7 +40,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -58,7 +55,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
private:
/**
@@ -78,7 +75,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -87,7 +84,7 @@ namespace epics {
*/
class ServerNoopResponse : public AbstractServerResponseHandler {
public:
ServerNoopResponse(ServerContextImpl::shared_pointer const & context, String description) :
ServerNoopResponse(ServerContextImpl::shared_pointer const & context, epics::pvData::String description) :
AbstractServerResponseHandler(context, description) {
}
};
@@ -102,7 +99,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -115,7 +112,7 @@ namespace epics {
virtual ~EchoTransportSender() {
}
virtual void send(ByteBuffer* buffer, TransportSendControl* control) {
virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) {
control->startMessage(CMD_ECHO, 0);
control->setRecipient(_echoFrom);
// TODO content
@@ -142,7 +139,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -155,13 +152,13 @@ namespace epics {
{
public:
// TODO
static std::map<String, std::tr1::weak_ptr<ChannelProvider> > s_channelNameToProvider;
static std::map<epics::pvData::String, std::tr1::weak_ptr<ChannelProvider> > s_channelNameToProvider;
ServerSearchHandler(ServerContextImpl::shared_pointer const & context);
virtual ~ServerSearchHandler();
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
private:
@@ -175,24 +172,24 @@ namespace epics {
public std::tr1::enable_shared_from_this<ServerChannelFindRequesterImpl>
{
public:
ServerChannelFindRequesterImpl(ServerContextImpl::shared_pointer const & context, int32 expectedResponseCount);
ServerChannelFindRequesterImpl(ServerContextImpl::shared_pointer const & context, epics::pvData::int32 expectedResponseCount);
void clear();
ServerChannelFindRequesterImpl* set(String _name, int32 searchSequenceId, int32 cid, osiSockAddr* sendTo, bool responseRequired);
ServerChannelFindRequesterImpl* set(epics::pvData::String _name, epics::pvData::int32 searchSequenceId, epics::pvData::int32 cid, osiSockAddr* sendTo, bool responseRequired);
void channelFindResult(const epics::pvData::Status& status, ChannelFind::shared_pointer const & channelFind, bool wasFound);
void lock();
void unlock();
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
private:
String _name;
int32 _searchSequenceId;
int32 _cid;
epics::pvData::String _name;
epics::pvData::int32 _searchSequenceId;
epics::pvData::int32 _cid;
osiSockAddr* _sendTo;
bool _responseRequired;
bool _wasFound;
ServerContextImpl::shared_pointer _context;
epics::pvData::Mutex _mutex;
int32 _expectedResponseCount;
int32 _responseCount;
epics::pvData::int32 _expectedResponseCount;
epics::pvData::int32 _responseCount;
};
/****************************************************************************************/
@@ -208,7 +205,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
private:
@@ -225,20 +222,20 @@ namespace epics {
typedef std::tr1::shared_ptr<ServerChannelRequesterImpl> shared_pointer;
typedef std::tr1::shared_ptr<const ServerChannelRequesterImpl> const_shared_pointer;
protected:
ServerChannelRequesterImpl(Transport::shared_pointer const & transport, const String channelName, const pvAccessID cid);
ServerChannelRequesterImpl(Transport::shared_pointer const & transport, const epics::pvData::String channelName, const pvAccessID cid);
public:
static ChannelRequester::shared_pointer create(ChannelProvider::shared_pointer const & provider, Transport::shared_pointer const & transport, const String channelName, const pvAccessID cid);
static ChannelRequester::shared_pointer create(ChannelProvider::shared_pointer const & provider, Transport::shared_pointer const & transport, const epics::pvData::String channelName, const pvAccessID cid);
void channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel);
void channelStateChange(Channel::shared_pointer const & c, const Channel::ConnectionState isConnected);
String getRequesterName();
void message(const String message, const epics::pvData::MessageType messageType);
epics::pvData::String getRequesterName();
void message(const epics::pvData::String message, const epics::pvData::MessageType messageType);
void lock();
void unlock();
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
private:
ServerChannel::weak_pointer _serverChannel;
Transport::weak_pointer _transport;
const String _channelName;
const epics::pvData::String _channelName;
const pvAccessID _cid;
epics::pvData::Status _status;
epics::pvData::Mutex _mutex;
@@ -257,7 +254,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -269,7 +266,7 @@ namespace epics {
}
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) {
control->startMessage((int8)CMD_DESTROY_CHANNEL, 2*sizeof(int32)/sizeof(int8));
control->startMessage((epics::pvData::int8)CMD_DESTROY_CHANNEL, 2*sizeof(epics::pvData::int32)/sizeof(epics::pvData::int8));
buffer->putInt(_sid);
buffer->putInt(_cid);
}
@@ -299,7 +296,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -352,7 +349,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -383,8 +380,8 @@ namespace epics {
void destroy();
ChannelPut::shared_pointer getChannelPut();
BitSet::shared_pointer getBitSet();
PVStructure::shared_pointer getPVStructure();
epics::pvData::BitSet::shared_pointer getBitSet();
epics::pvData::PVStructure::shared_pointer getPVStructure();
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
private:
ChannelPut::shared_pointer _channelPut;
@@ -405,7 +402,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -437,7 +434,7 @@ namespace epics {
void destroy();
ChannelPutGet::shared_pointer getChannelPutGet();
PVStructure::shared_pointer getPVPutStructure();
epics::pvData::PVStructure::shared_pointer getPVPutStructure();
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
private:
ChannelPutGet::shared_pointer _channelPutGet;
@@ -459,7 +456,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -511,7 +508,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -565,7 +562,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
private:
@@ -585,7 +582,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -634,7 +631,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
private:
void getFieldFailureResponse(Transport::shared_pointer const & transport, const pvAccessID ioid, const epics::pvData::Status& errorStatus);
@@ -673,7 +670,7 @@ namespace epics {
}
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) {
control->startMessage((int8)CMD_GET_FIELD, sizeof(int32)/sizeof(int8));
control->startMessage((epics::pvData::int8)CMD_GET_FIELD, sizeof(epics::pvData::int32)/sizeof(epics::pvData::int8));
buffer->putInt(_ioid);
_transport->getIntrospectionRegistry()->serializeStatus(buffer, control, _status);
}
@@ -706,7 +703,7 @@ namespace epics {
}
virtual void handleResponse(osiSockAddr* responseFrom,
Transport::shared_pointer const & transport, int8 version, int8 command,
Transport::shared_pointer const & transport, epics::pvData::int8 version, epics::pvData::int8 command,
int payloadSize, epics::pvData::ByteBuffer* payloadBuffer);
};
@@ -741,11 +738,11 @@ namespace epics {
/**
* @return the pvArguments
*/
PVStructure::shared_pointer getPvArguments();
epics::pvData::PVStructure::shared_pointer getPvArguments();
/**
* @return the agrumentsBitSet
* @return the agrumentsepics::pvData::BitSet
*/
BitSet::shared_pointer getAgrumentsBitSet();
epics::pvData::BitSet::shared_pointer getArgumentsBitSet();
void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control);
private:
ChannelRPC::shared_pointer _channelRPC;

View File

@@ -56,7 +56,7 @@ public:
* @see AccessRights
* @return bit-mask encoded access rights.
*/
int16 getAccessRights();
epics::pvData::int16 getAccessRights();
/**
* Register request

View File

@@ -49,7 +49,7 @@ public:
* the method would block until <code>destroy()</code> is called.
* @throws BaseException if server is already destroyed.
*/
virtual void run(int32 seconds) = 0;
virtual void run(epics::pvData::int32 seconds) = 0;
/**
* Shutdown (stop executing run() method) of this context.
@@ -113,7 +113,7 @@ public:
//**************** derived from ServerContext ****************//
const Version& getVersion();
void initialize(ChannelAccess::shared_pointer const & channelAccess);
void run(int32 seconds);
void run(epics::pvData::int32 seconds);
void shutdown();
void destroy();
void printInfo();
@@ -204,25 +204,25 @@ public:
* Get receiver buffer (payload) size.
* @return max payload size.
*/
int32 getReceiveBufferSize();
epics::pvData::int32 getReceiveBufferSize();
/**
* Get server port.
* @return server port.
*/
int32 getServerPort();
epics::pvData::int32 getServerPort();
/**
* Set server port number.
* @param port new server port number.
*/
void setServerPort(int32 port);
void setServerPort(epics::pvData::int32 port);
/**
* Get broadcast port.
* @return broadcast port.
*/
int32 getBroadcastPort();
epics::pvData::int32 getBroadcastPort();
/**
* Get ignore search address list.
@@ -276,22 +276,22 @@ private:
/**
* Major version.
*/
static const int32 VERSION_MAJOR;
static const epics::pvData::int32 VERSION_MAJOR;
/**
* Minor version.
*/
static const int32 VERSION_MINOR;
static const epics::pvData::int32 VERSION_MINOR;
/**
* Maintenance version.
*/
static const int32 VERSION_MAINTENANCE;
static const epics::pvData::int32 VERSION_MAINTENANCE;
/**
* Development version.
*/
static const int32 VERSION_DEVELOPMENT;
static const epics::pvData::int32 VERSION_DEVELOPMENT;
/**
* Initialization status.
@@ -323,17 +323,17 @@ private:
/**
* Broadcast port number to listen to.
*/
int32 _broadcastPort;
epics::pvData::int32 _broadcastPort;
/**
* Port number for the server to listen to.
*/
int32 _serverPort;
epics::pvData::int32 _serverPort;
/**
* Length in bytes of the maximum buffer (payload) size that may pass through CA.
*/
int32 _receiveBufferSize;
epics::pvData::int32 _receiveBufferSize;
/**
* Timer.

View File

@@ -20,20 +20,11 @@
#include <iostream>
// TODO check for memory leaks
// TODO to be removed out of header
using epics::pvData::ByteBuffer;
using epics::pvData::FieldConstPtr;
using epics::pvData::StructureConstPtr;
using epics::pvData::SerializableControl;
using epics::pvData::DeserializableControl;
using epics::pvData::PVStructurePtr;
using std::string;
using epics::pvData::int8;
namespace epics {
namespace pvAccess {
typedef std::map<const short,FieldConstPtr> registryMap_t;
typedef std::map<const short,epics::pvData::FieldConstPtr> registryMap_t;
/**
@@ -46,7 +37,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
IntrospectionRegistry(bool serverSide);
virtual ~IntrospectionRegistry();
void printKeysAndValues(string name);
void printKeysAndValues(std::string name);
/**
* Resets registry, i.e. must be done when transport is changed (server restarted).
*/
@@ -58,7 +49,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*
* @return <code>Field</code> instance for given ID.
*/
FieldConstPtr getIntrospectionInterface(const short id);
epics::pvData::FieldConstPtr getIntrospectionInterface(const short id);
/**
* Registers introspection interface with given ID. Always INCOMING.
@@ -66,7 +57,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param id id of the introspection interface to register
* @param field introspection interface to register
*/
void registerIntrospectionInterface(const short id, FieldConstPtr field);
void registerIntrospectionInterface(const short id, epics::pvData::FieldConstPtr field);
/**
* Registers introspection interface and get it's ID. Always OUTGOING.
@@ -78,7 +69,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*
* @return id of given introspection interface
*/
short registerIntrospectionInterface(FieldConstPtr field, bool& existing);
short registerIntrospectionInterface(epics::pvData::FieldConstPtr field, bool& existing);
/**
* Serializes introspection interface
@@ -87,7 +78,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param buffer
* @param control
*/
void serialize(FieldConstPtr field, ByteBuffer* buffer, SerializableControl* control);
void serialize(epics::pvData::FieldConstPtr field, epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control);
/**
* Deserializes introspection interface
@@ -99,7 +90,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*
* @return <code>Field</code> deserialized from the buffer.
*/
FieldConstPtr deserialize(ByteBuffer* buffer, DeserializableControl* control);
epics::pvData::FieldConstPtr deserialize(epics::pvData::ByteBuffer* buffer, epics::pvData::DeserializableControl* control);
/**
* Serializes introspection interface. But this time really fully not like
@@ -111,7 +102,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param buffer
* @param control
*/
static void serializeFull(FieldConstPtr field, ByteBuffer* buffer, SerializableControl* control);
static void serializeFull(epics::pvData::FieldConstPtr field, epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control);
/**
* Deserializes introspection interface
@@ -123,26 +114,26 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*
* @return <code>Field</code> deserialized from the buffer.
*/
static FieldConstPtr deserializeFull(ByteBuffer* buffer, DeserializableControl* control);
static epics::pvData::FieldConstPtr deserializeFull(epics::pvData::ByteBuffer* buffer, epics::pvData::DeserializableControl* control);
/**
* Null type.
*/
const static int8 NULL_TYPE_CODE;
const static epics::pvData::int8 NULL_TYPE_CODE;
/**
* Serialization contains only an ID (that was assigned by one of the previous <code>FULL_WITH_ID</code> descriptions).
*/
const static int8 ONLY_ID_TYPE_CODE;
const static epics::pvData::int8 ONLY_ID_TYPE_CODE;
/**
* Serialization contains an ID (that can be used later, if cached) and full interface description.
*/
const static int8 FULL_WITH_ID_TYPE_CODE;
const static epics::pvData::int8 FULL_WITH_ID_TYPE_CODE;
static void serialize(FieldConstPtr field, StructureConstPtr parent, ByteBuffer* buffer,
SerializableControl* control, IntrospectionRegistry* registry);
static void serialize(epics::pvData::FieldConstPtr field, epics::pvData::StructureConstPtr parent, epics::pvData::ByteBuffer* buffer,
epics::pvData::SerializableControl* control, IntrospectionRegistry* registry);
/**
@@ -151,8 +142,8 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param registry
* @param structure
*/
static void serializeStructureField(ByteBuffer* buffer, SerializableControl* control,
IntrospectionRegistry* registry, StructureConstPtr structure);
static void serializeStructureField(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control,
IntrospectionRegistry* registry, epics::pvData::StructureConstPtr structure);
/**
* @param buffer
@@ -160,7 +151,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param registry
* @param structure
*/
static FieldConstPtr deserialize(ByteBuffer* buffer, DeserializableControl* control, IntrospectionRegistry* registry);
static epics::pvData::FieldConstPtr deserialize(epics::pvData::ByteBuffer* buffer, epics::pvData::DeserializableControl* control, IntrospectionRegistry* registry);
/**
* Deserialize Structure.
@@ -169,26 +160,26 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param registry
* @return deserialized Structure instance.
*/
static StructureConstPtr deserializeStructureField(ByteBuffer* buffer, DeserializableControl* control, IntrospectionRegistry* registry);
static epics::pvData::StructureConstPtr deserializeStructureField(epics::pvData::ByteBuffer* buffer, epics::pvData::DeserializableControl* control, IntrospectionRegistry* registry);
/**
* Serialize optional PVStructrue.
* @param buffer data buffer.
*/
void serializeStructure(ByteBuffer* buffer, SerializableControl* control, PVStructurePtr pvStructure);
void serializeStructure(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, epics::pvData::PVStructurePtr pvStructure);
/**
* Deserialize optional PVStructrue.
* @param payloadBuffer data buffer.
* @return deserialized PVStructure, can be <code>null</code>.
*/
PVStructurePtr deserializeStructure(ByteBuffer* payloadBuffer, DeserializableControl* control);
epics::pvData::PVStructurePtr deserializeStructure(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control);
/**
* Serialize PVRequest.
* @param buffer data buffer.
*/
void serializePVRequest(ByteBuffer* buffer, SerializableControl* control, PVStructurePtr pvRequest);
void serializePVRequest(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, epics::pvData::PVStructurePtr pvRequest);
/**
* Deserialize PVRequest.
@@ -197,7 +188,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*
* @return deserialized PVRequest, can be <code>null</code>.
*/
PVStructurePtr deserializePVRequest(ByteBuffer* payloadBuffer, DeserializableControl* control);
epics::pvData::PVStructurePtr deserializePVRequest(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control);
/**
* Deserialize Structure and create PVStructure instance.
@@ -207,7 +198,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*
* @return PVStructure instance, can be <code>null</code>.
*/
PVStructurePtr deserializeStructureAndCreatePVStructure(ByteBuffer* payloadBuffer, DeserializableControl* control);
epics::pvData::PVStructurePtr deserializeStructureAndCreatePVStructure(epics::pvData::ByteBuffer* payloadBuffer, epics::pvData::DeserializableControl* control);
/**
* Serialize status.
@@ -216,7 +207,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param control serialization control.
* @param status status to serialize.
*/
void serializeStatus(ByteBuffer* buffer, SerializableControl* control, const epics::pvData::Status &status);
void serializeStatus(epics::pvData::ByteBuffer* buffer, epics::pvData::SerializableControl* control, const epics::pvData::Status &status);
/**
* Deserialize status.
@@ -224,7 +215,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
* @param buffer data buffer.
* @param control serialization control.
*/
void deserializeStatus(epics::pvData::Status &status, ByteBuffer* buffer, DeserializableControl* control);
void deserializeStatus(epics::pvData::Status &status, epics::pvData::ByteBuffer* buffer, epics::pvData::DeserializableControl* control);
private:
registryMap_t _registry;
@@ -244,7 +235,7 @@ typedef std::map<const short,FieldConstPtr> registryMap_t;
*/
static epics::pvData::FieldCreate* _fieldCreate;
bool registryContainsValue(FieldConstPtr field, short& key);
bool registryContainsValue(epics::pvData::FieldConstPtr field, short& key);
};
}}

View File

@@ -50,7 +50,7 @@ private:
typedef std::map<const osiSockAddr*,prioritiesMapSharedPtr_t,comp_osiSockAddrPtr> transportsMap_t;
transportsMap_t _transports;
int32 _transportCount;
epics::pvData::int32 _transportCount;
epics::pvData::Mutex _mutex;
};

View File

@@ -1,272 +0,0 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#include <pv/wildcharMatcher.h>
#include <iostream>
using std::cout;
using namespace epics::pvData;
namespace epics {
namespace pvAccess {
/** Wildchar matcher debug */
const bool WCM_DEBUG = false;
/** Value of initial state */
const int WCM_INITIAL = 0;
/** Value of final state */
const int WCM_FINAL = 2;
/** Value of error state */
const int WCM_ERROR = 99;
/** Any character (except control, unless escaped) */
const int WCM_TOKEN_CHAR = 0;
/** Token for end of set: ] */
const int WCM_TOKEN_END = 1;
/** Token for negation: */
const int WCM_TOKEN_NOT = 2;
/** Token for range specification: - */
const int WCM_TOKEN_MINUS = 3;
/**
* Transition table holds the nextState used in set parsing. Rows define
* states, columns define tokens. transitions[1][3] = 5 means: if in state
* 1 next token is 3, goto state 5
*/
const int TRANSITIONS[][4] = { { 1, WCM_FINAL, 3, 4 }, { 1, WCM_FINAL,
WCM_ERROR, 5 }, { WCM_ERROR, WCM_ERROR, WCM_ERROR, WCM_ERROR },
{ 1, WCM_FINAL, WCM_ERROR, 4 }, { 6, WCM_ERROR, WCM_ERROR,
WCM_ERROR }, { 6, WCM_FINAL, WCM_ERROR, WCM_ERROR }, {
1, WCM_FINAL, WCM_ERROR, WCM_ERROR } };
int getToken(const char ch) {
switch(ch) {
case ']':
return WCM_TOKEN_END;
case '!':
return WCM_TOKEN_NOT;
case '-':
return WCM_TOKEN_MINUS;
default:
return WCM_TOKEN_CHAR;
}
}
bool testSet(const String pattern, int offset, const char ch) {
int n = pattern.length();
int state = WCM_INITIAL;
int nextToken = ' ';
char nextChar = ' ';
char ch1 = ' ';
bool found = false;
bool negate = false;
while(!found) {
// Check for offset in case of final state, which is over the limit,
// if ] is at the end of the string.
if(offset<n) {
nextChar = pattern.at(offset);
if(nextChar=='\\') {
// Any escaped sequence is two characters, otherwise error will
// be throws, since this is an invalid sequence anyway
nextChar = pattern.at(offset+1);
nextToken = WCM_TOKEN_CHAR;
offset++;
}
else {
nextToken = getToken(nextChar);
}
}
switch(state) {
case WCM_INITIAL:
if(nextToken==WCM_TOKEN_NOT) {
negate = true;
break;
}
// No break, states 0, 1, 3, 6 have same next condition.
case 1:
if(nextToken==WCM_TOKEN_END) return found^negate;
case 3:
case 6:
if(nextToken==WCM_TOKEN_CHAR) {
found = (ch==nextChar);
ch1 = nextChar;
}
break;
case 4:
// condition [-a...
found = (ch<=nextChar);
break;
case 5:
if(nextToken==WCM_TOKEN_CHAR) found = ((ch>=ch1)&&(ch
<=nextChar)); // condition ...a-z...
if(nextToken==WCM_TOKEN_END) found = (ch>=ch1); // condition ...a-]
break;
}
if(WCM_DEBUG) {
cout<<"( "<<state<<" -> "<<TRANSITIONS[state][nextToken]
<<" ) token = "<<nextToken<<" char = "<<nextChar
<<", found = "<<found<<", negate = "<<negate;
}
// Lookup next state in transition table and check for valid pattern
state = TRANSITIONS[state][nextToken];
if(state==WCM_ERROR) return false;
// don't bother, this is a no match anyway
// throw new RuntimeException("Invalid pattern");
if(state==WCM_FINAL) return found^negate;
offset++;
}
return found^negate;
}
bool parse(const String pattern, const int ofp, const String str,
const int ofs) {
int lp = pattern.length();
int ls = str.length();
int ip = ofp; // index into pattern string
int is = ofs; // index into test string
char chp, chs;
if(WCM_DEBUG) {
if((ip>-1)&&(is>-1)&&(ip<lp)&&(is<ls)) {
cout<<"parse: "<<pattern.substr(ip)<<" "<<str.substr(is);
}
}
// Match happens only, if we parse both strings exactly to the end
while(ip<lp) {
chp = pattern.at(ip);
if(WCM_DEBUG) {
if((ip>-1)&&(is>-1)&&(ip<lp)&&(is<ls)) {
cout<<pattern.substr(ip)<<" "<<str.substr(is);
}
}
switch(chp) {
case '[':
{
// Each set must be close with a ], otherwise it is invalid.
int end = pattern.find(']', ip);
if(end==-1) return false;
// Is this set followed by a *
bool isWildchar = ((end+1)<lp)&&(pattern.at(end+1)=='*');
if(is<ls)
chs = str.at(is);
else
return parse(pattern, end+2, str, is);
// Does this character match
bool thisChar = testSet(pattern, ip+1, chs);
// Check for single character match only if there is no
// * at the end.
if(!thisChar&&!isWildchar) return false; // Return only if this character does not match
if(isWildchar) {
// If this character does not match, maybe this set
// can be skipped entirely
if(!thisChar) {
ip = end+2;
break;
}
// Special case when this character matches, although
// it should not: a[a-z]*z == az
if(parse(pattern, end+2, str, is)) return true;
// Try to match next character
if(parse(pattern, ip, str, is+1)) return true;
}
// Single character matched, set was processed, since
// no * was at the end.
ip = end+1;
is++;
break;
}
case '?':
// Obvious
ip++;
is++;
break;
case '*':
{
// Trailing asterisk means that string matches till the end.
// Also, checks if this is last char in the string
if(ip+1==lp) return true;
// Skip the *
do {
ip++;
chp = pattern.at(ip);
} while((ip+1<lp)&&(chp=='*'));
// But perform a special check and solve it by recursing
// from new position
if(chp=='?'&&parse(pattern, ip, str, is)) return true;
// Iterate through all possible matches in the test string
int i = is;
while(i<ls) {
// Stupid brute force, but isn't as bad as it seems.
// Try all possible matches in the test string.
if(parse(pattern, ip, str, i)) return true;
i++;
}
break;
}
default:
// Literal match
if(is==ls||pattern.at(ip)!=str.at(is)) return false;
ip++;
is++;
}
}
// There could be several * at the end of the pattern, although the
// test string is at the end.
while((ip<lp)&&((pattern.at(ip))=='*'))
ip++;
// Same condition as with while loop
return (is==ls)&&(ip==lp);
}
bool match(const String pattern, const String str) {
return parse(pattern, 0, str, 0);
}
}
}

View File

@@ -1,61 +0,0 @@
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* pvAccessCPP is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
#ifndef WILDCHARMATCHER_H_
#define WILDCHARMATCHER_H_
#include <pv/pvType.h>
namespace epics {
namespace pvAccess {
/**
* DFA for parsing set strings. DFA was obtained from JFlex using the rule
* : macro: CHAR = [^-\]\!] (everything except ], ! and - rule :
* [!]?(-{CHAR})?(({CHAR}-{CHAR})|({CHAR}))({CHAR}-)?\] Result of
* optimized NDFA is Character classes: class 0: [0-'
* ']['"'-',']['.'-'\']['^'-65535] class 1: [']'] class 2: ['!'] class
* 3: ['-'] Transition graph (for class goto state) State 0: 0 -> 1, 1 ->
* 2, 2 -> 3, 3 -> 4 State 1: 0 -> 1, 1 -> 2, 3 -> 5 State [FINAL] State
* 3: 0 -> 1, 1 -> 2, 3 -> 4 State 4: 0 -> 6 State 5: 0 -> 6, 1 -> 2 State
* 6: 0 -> 1, 1 -> 2
*
* @param pattern DOCUMENT ME!
* @param offset DOCUMENT ME!
* @param ch DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
bool testSet(const epics::pvData::String pattern, int offset, const char ch);
/**
* Recursive method for parsing the string. To avoid copying the strings,
* the method accepts offset indices into both parameters.
*
* @param pattern Pattern used in parsing
* @param ofp Offset into pattern string (ofp > 0)
* @param str String to test
* @param ofs Offset into test string (ofs > 0);
*
* @return boolean Do the strings match
*/
bool parse(const epics::pvData::String pattern, const int ofp, const epics::pvData::String str,
const int ofs);
/**
* DOCUMENT ME!
*
* @param pattern DOCUMENT ME!
* @param str DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
bool match(const epics::pvData::String pattern, const epics::pvData::String str);
}
}
#endif /* WILDCHARMATCHER_H_ */

View File

@@ -10,6 +10,7 @@
epicsMessageQueueId join1;
epicsMessageQueueId join2;
using std::string;
using namespace epics::pvData;
using namespace epics::pvAccess;

View File

@@ -5,7 +5,6 @@ include $(TOP)/configure/CONFIG
ifdef GTEST
PROD_HOST += testUtils
testUtils_SRCS += hexDumpTest.cpp
testUtils_SRCS += wildcharMatcherTest.cpp
testUtils_SRCS += inetAddressUtilsTest.cpp
testUtils_SRCS += atomicBooleanTest.cpp
testUtils_LIBS += pvAccess pvData Com gtest_main

View File

@@ -1,33 +0,0 @@
#include <gtest/gtest.h>
#include <pv/wildcharMatcher.h>
using namespace epics::pvAccess;
TEST(wildcharMatcher, testSet)
{
EXPECT_TRUE (testSet("[abc]", 1, 'a'));
EXPECT_TRUE (testSet("[abc]", 1, 'b'));
EXPECT_TRUE (testSet("[abc]", 1, 'c'));
EXPECT_FALSE(testSet("[abc]", 1, 'd'));
EXPECT_TRUE (testSet("[!abc]", 1, 'd'));
EXPECT_FALSE(testSet("[a-c]", 1, 'd'));
EXPECT_TRUE (testSet("[!a-c]", 1, 'd'));
EXPECT_TRUE (testSet("[ac-f]", 1, 'd'));
EXPECT_FALSE(testSet("[!ac-f]", 1, 'd'));
}
TEST(wildcharMatcher, testMatch)
{
epics::pvData::String testString = "Test string for matcher";
EXPECT_TRUE (match("*", testString));
EXPECT_FALSE(match("test*", testString));
EXPECT_TRUE (match("*est*", testString));
EXPECT_TRUE (match("?est*", testString));
EXPECT_FALSE(match("??est*", testString));
EXPECT_TRUE (match("*string*", testString));
EXPECT_FALSE(match("*[abc]tring*", testString));
EXPECT_TRUE (match("*[!abc]tring*", testString));
EXPECT_TRUE (match("*[p-z]tring*", testString));
}