8 #ifndef NTV2NUBACCESS_H
9 #define NTV2NUBACCESS_H
25 #define kConnectParamScheme "Scheme"
26 #define kConnectParamHost "Host"
27 #define kConnectParamPort "Port"
28 #define kConnectParamDevIndex "DeviceIndex"
29 #define kConnectParamDevSerial "DeviceSerial"
30 #define kConnectParamDevModel "DeviceModel"
31 #define kConnectParamDevID "DeviceID"
32 #define kConnectParamResource "ResourcePath"
33 #define kConnectParamQuery "Query"
36 #define kQParamVerboseLogging "verbose"
37 #define kQParamLogToStdout "stdout"
38 #define kQParamShowX509Cert "showcert"
39 #define kQParamShowParams "showparams"
40 #define kQParamDebugRegistry "debugregistry"
43 #define kLegalSchemeNTV2 "ntv2"
44 #define kLegalSchemeNTV2Local "ntv2local"
47 #define kFuncNameCreateClient "CreateClient"
48 #define kFuncNameCreateServer "CreateServer"
49 #define kFuncNameGetRegInfo "GetRegistrationInfo"
52 #define kNTV2PluginInfoKey_PluginsPath "PluginsPath"
53 #define kNTV2PluginInfoKey_PluginPath "PluginPath"
54 #define kNTV2PluginInfoKey_PluginSigPath "PluginSigPath"
55 #define kNTV2PluginInfoKey_PluginBaseName "PluginBaseName"
56 #define kNTV2PluginInfoKey_Fingerprint "serial number"
59 #define kNTV2PluginRegInfoKey_Vendor "Vendor"
60 #define kNTV2PluginRegInfoKey_CommonName "CommonName"
61 #define kNTV2PluginRegInfoKey_OrgUnit "OrgUnit"
62 #define kNTV2PluginRegInfoKey_ShortName "ShortName"
63 #define kNTV2PluginRegInfoKey_LongName "LongName"
64 #define kNTV2PluginRegInfoKey_Description "Description"
65 #define kNTV2PluginRegInfoKey_Copyright "Copyright"
66 #define kNTV2PluginRegInfoKey_NTV2SDKVersion "NTV2SDKVersion"
67 #define kNTV2PluginRegInfoKey_Version "Version"
68 #define kNTV2PluginRegInfoKey_CommitSHA "CommitSHA"
71 #define kNTV2PluginSigFileKey_X509Certificate "X509Certificate"
72 #define kNTV2PluginSigFileKey_Signature "Signature"
75 #define kNTV2PluginX500AttrKey_CommonName "CN"
76 #define kNTV2PluginX500AttrKey_LocalityName "L"
77 #define kNTV2PluginX500AttrKey_StateOrProvinceName "ST"
78 #define kNTV2PluginX500AttrKey_OrganizationName "O"
79 #define kNTV2PluginX500AttrKey_OrganizationalUnitName "OU"
80 #define kNTV2PluginX500AttrKey_CountryName "C"
92 inline size_t size (
void)
const {
return mDict.size();}
94 inline bool empty (
void)
const {
return mDict.empty();}
95 inline bool hasKey (
const std::string & inKey)
const {
return mDict.find(inKey) != mDict.end();}
96 std::string valueForKey (
const std::string & inKey)
const;
97 uint16_t u16ValueForKey (
const std::string & inKey,
const uint16_t inDefault = 0)
const;
99 size_t largestKeySize (
void)
const;
100 size_t largestValueSize (
void)
const;
101 std::ostream & Print (std::ostream & oss,
const bool inCompact =
true)
const;
102 bool serialize (std::string & outStr)
const;
108 inline void clear (
void) {mDict.clear();}
110 bool insert (
const std::string & inKey,
const std::string & inValue);
111 inline size_t erase (
const std::string & inKey) {
return hasKey(inKey) ? mDict.erase(inKey) : 0;}
114 bool deserialize (
const std::string & inStr);
115 #if !defined(NTV2_DEPRECATE_17_1)
118 #endif // !defined(NTV2_DEPRECATE_17_1)
122 typedef std::map<std::string, std::string>
Dict;
145 static bool IsSupportedScheme (
const std::string & inScheme);
149 void Reset (
const std::string inSpec =
"");
150 inline const std::string & DeviceSpec (
void)
const {
return mSpec;}
151 inline bool HasDeviceSpec (
void)
const {
return !DeviceSpec().empty();}
152 inline bool Successful (
void)
const {
return !Failed();}
153 inline bool Failed (
void)
const {
return DeviceSpec().empty() ?
true : HasErrors();}
157 inline size_t ErrorCount (
void)
const {
return mErrors.size();}
158 inline bool HasErrors (
void)
const {
return ErrorCount() > 0;}
159 inline std::string Error (
const size_t inIndex = 0)
const {
if (inIndex < mErrors.size())
return mErrors.at(inIndex);
return "";}
162 inline bool HasResult (
const std::string & inKey)
const {
return mResult.hasKey(inKey);}
163 std::string Result (
const std::string & inKey)
const {
return mResult.
valueForKey(inKey);}
164 std::string Resource (
const bool inStripLeadSlash =
true)
const;
165 std::ostream & PrintErrors (std::ostream & oss)
const;
166 std::ostream & Print (std::ostream & oss,
const bool inDumpResults =
false)
const;
167 std::string InfoString (
void)
const;
168 uint64_t DeviceSerial (
void)
const;
171 UWord DeviceIndex (
void)
const;
172 inline const NTV2Dictionary & QueryParams (
void)
const {
return mQueryParams;}
173 inline std::string QueryParam (
const std::string & inKey)
const {
return mQueryParams.
valueForKey(inKey);}
175 static void test (
void);
176 #endif // defined(_DEBUG)
180 bool ParseHexNumber (
size_t & pos, std::string & outToken);
181 bool ParseDecNumber (
size_t & pos, std::string & outToken);
182 bool ParseAlphaNumeric (
size_t & pos, std::string & outToken,
const std::string & inOtherChars =
"");
183 bool ParseScheme (
size_t & pos, std::string & outToken);
184 bool ParseSerialNum (
size_t & pos, std::string & outToken);
185 bool ParseDeviceID (
size_t & pos, std::string & outToken);
186 bool ParseModelName (
size_t & pos, std::string & outToken);
187 bool ParseDNSName (
size_t & pos, std::string & outDNSName);
188 bool ParseIPv4Address (
size_t & pos, std::string & outIPv4);
189 bool ParseHostAddressAndPortNumber (
size_t & pos, std::string & outAddr, std::string & outPort);
190 bool ParseResourcePath (
size_t & pos, std::string & outRsrc);
191 bool ParseParamAssignment (
size_t & pos, std::string & outKey, std::string & outValue);
193 inline int LargestResultKey (
void)
const {
return int(mResult.largestKeySize());}
194 inline int LargestResultValue (
void)
const {
return int(mResult.largestValueSize());}
195 inline char CharAt (
const size_t inPos) {
return inPos < mSpec.length() ? mSpec.at(inPos) : 0;}
196 inline size_t SpecLength (
void)
const {
return mSpec.length();}
197 inline size_t CurrentPosition (
void)
const {
return mPos;}
198 inline void AddError (
const std::string & inError) {mErrors.push_back(inError);}
199 static bool IsUpperLetter (
const char inChar);
200 static bool IsLowerLetter (
const char inChar);
201 static bool IsLetter (
const char inChar,
const bool inIncludeUnderscore =
false);
202 static bool IsDecimalDigit (
const char inChar);
203 static bool IsHexDigit (
const char inChar);
204 static bool IsLegalSerialNumChar (
const char inChar);
214 #if defined(NTV2_PREVENT_PLUGIN_LOAD)
216 #else // !defined(NTV2_PREVENT_PLUGIN_LOAD)
218 #endif // !defined(NTV2_PREVENT_PLUGIN_LOAD)
227 static std::string ShortSDKVersion (
void);
232 bool SetParams (
const NTV2ConfigParams & inNewParams,
const bool inAugment =
false);
267 virtual std::string HostName (
void)
const {
return ConnectParam(
kConnectParamHost);}
269 virtual std::string Name (
void)
const {
return "";}
270 virtual std::string Description (
void)
const;
271 virtual std::ostream & Print (std::ostream & oss)
const;
277 virtual bool NTV2Connect (
void);
279 virtual bool NTV2Disconnect (
void);
280 virtual bool IsConnected (
void)
const {
return false;}
288 virtual bool HasConnectParam (
const std::string & inParam)
const;
289 virtual std::string ConnectParam (
const std::string & inParam)
const;
290 virtual bool ConnectHasScheme (
void)
const;
291 virtual inline bool SetConnectParams (
const NTV2ConnectParams & inNewParams,
const bool inAugment =
false) {
return !IsConnected() &&
SetParams(inNewParams, inAugment);}
297 virtual bool NTV2ReadRegisterRemote (
const ULWord regNum,
ULWord & outRegValue,
const ULWord regMask,
const ULWord regShift);
299 virtual bool NTV2WriteRegisterRemote (
const ULWord regNum,
const ULWord regValue,
const ULWord regMask,
const ULWord regShift);
302 virtual bool NTV2DMATransferRemote (
const NTV2DMAEngine inDMAEngine,
const bool inIsRead,
304 const ULWord inCardOffsetBytes,
const ULWord inNumSegments,
305 const ULWord inSegmentHostPitch,
const ULWord inSegmentCardPitch,
306 const bool inSynchronous);
307 virtual bool NTV2MessageRemote (
NTV2_HEADER * pInMessage);
313 virtual bool NTV2GetBoolParamRemote (
const ULWord inParamID,
ULWord & outValue);
315 virtual bool NTV2GetNumericParamRemote (
const ULWord inParamID,
ULWord & outValue);
316 virtual bool NTV2GetSupportedRemote (
const ULWord inEnumsID,
ULWordSet & outSupported);
334 #if !defined(NTV2_DEPRECATE_16_3) // These functions are going away
336 virtual bool NTV2DriverGetBuildInformationRemote (
BUILD_INFO_STRUCT & buildInfo);
338 const UWord signalMask,
const bool testPatDMAEnb,
const ULWord testPatNum);
339 virtual bool NTV2ReadRegisterMultiRemote (
const ULWord numRegs,
ULWord & outFailedRegNum,
NTV2RegInfo outRegs[]);
340 virtual bool NTV2GetDriverVersionRemote (
ULWord & outDriverVersion);
341 #endif // !defined(NTV2_DEPRECATE_16_3)
348 virtual bool NTV2OpenRemote (
void);
349 virtual bool NTV2CloseRemote (
void);
352 uint32_t mSpare[1024];
389 virtual std::ostream & Print (std::ostream & oss)
const;
391 virtual inline bool IsRunning (
void)
const {
return mRunning;}
399 virtual bool HasConfigParam (
const std::string & inParam)
const;
400 virtual std::string ConfigParam (
const std::string & inParam)
const;
401 virtual inline bool SetConfigParams (
const NTV2ConfigParams & inNewParams,
const bool inAugment =
false) {
return SetParams(inNewParams, inAugment);}
407 virtual void RunServer (
void);
409 virtual inline void Stop (
void) {mTerminate =
true;}
419 uint32_t mSpare[1024];
465 #if !defined(NTV2_DEPRECATE_16_3) // Don't use these functions going forward
466 typedef NTV2RPCAPI* (*fpCreateNTV2SoftwareDevice) (
void * ,
const std::string & ,
const uint32_t );
467 #endif // !defined(NTV2_DEPRECATE_16_3)
470 #endif // NTV2NUBACCESS_H