refactor(core): Substitute tabs by spaces in source code

This commit is contained in:
estr Eckerstorfer Andreas 2024-09-13 11:55:57 +02:00 committed by Julius Pfrommer
parent c214e37aaa
commit 166d03c351
23 changed files with 8537 additions and 8537 deletions

View File

@ -556,7 +556,7 @@ ETH_openSendConnection(UA_EventLoopPOSIX *el, ETH_FD *conn, const UA_KeyValueMap
/* Store the structure for sendto */
conn->sll.sll_ifindex = ifindex;
conn->sll.sll_halen = ETH_ALEN;
conn->sll.sll_halen = ETH_ALEN;
memcpy(conn->sll.sll_addr, dest, ETHER_ADDR_LEN);
/* Generate the Ethernet header */

View File

@ -164,7 +164,7 @@ stateCallback(UA_Client *client, UA_SecureChannelState channelState,
monResponse.monitoredItemId);
#endif
#ifdef UA_ENABLE_METHODCALLS
#ifdef UA_ENABLE_METHODCALLS
UA_UInt32 reqId = 0;
UA_Variant input;
UA_Variant_init(&input);

View File

@ -945,8 +945,8 @@ void *subApp(void *arg) {
UA_ReaderGroup* currentReaderGroup;
UA_ServerCallback subCallback;
UA_UInt64 interval_ms;
struct timespec nextnanosleeptimeSubApplication;
UA_UInt64 monotonicOffsetValue = 0;
struct timespec nextnanosleeptimeSubApplication;
UA_UInt64 monotonicOffsetValue = 0;
server = threadArgPubSub1->server;
currentReaderGroup = (UA_ReaderGroup*)threadArgPubSub1->subData;

View File

@ -446,7 +446,7 @@ static void open62541ServerTask(void) {
UA_ServerConfig *config = UA_Server_getConfig(server);
UA_ServerConfig_setDefault(config);
addServerNodes(server);
addPubSubConfiguration(server);

View File

@ -121,7 +121,7 @@ fillTestDataSetMetaData(UA_DataSetMetaDataType *pMetaData) {
&UA_TYPES[UA_TYPES_FIELDMETADATA]);
for(size_t i = 0; i < pMetaData->fieldsSize; i++) {
/* UInt32 DataType */
/* UInt32 DataType */
UA_FieldMetaData_init (&pMetaData->fields[i]);
UA_NodeId_copy(&UA_TYPES[UA_TYPES_UINT32].typeId,
&pMetaData->fields[i].dataType);

View File

@ -376,7 +376,7 @@ enteringAckedStateCallback(UA_Server *server, const UA_NodeId *condition) {
static UA_StatusCode
enteringConfirmedStateCallback(UA_Server *server, const UA_NodeId *condition) {
/* Deactivate Alarm and put it out of the interesting state (by writing
/* Deactivate Alarm and put it out of the interesting state (by writing
* false to Retain field) when confirming*/
UA_Boolean activeStateId = false;
UA_Boolean retain = false;

View File

@ -75,14 +75,14 @@ helloWorldMethodCallback1(UA_Server *server,
memcpy(&tmp.data[tmp.length], inputStr->data, inputStr->length);
tmp.length += inputStr->length;
}
UA_Variant_setScalarCopy(output, &tmp, &UA_TYPES[UA_TYPES_STRING]);
UA_Variant_setScalarCopy(output, &tmp, &UA_TYPES[UA_TYPES_STRING]);
char* test = (char*)calloc(1,tmp.length+1);
memcpy(test, tmp.data, tmp.length);
UA_String_clear(&tmp);
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "'Hello World 1 (async)' was called and will take 3 seconds");
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, " Data 1: %s", test);
free(test);
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "'Hello World 1 (async)' has ended");
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "'Hello World 1 (async)' has ended");
return UA_STATUSCODE_GOOD;
}
@ -112,65 +112,65 @@ addHelloWorldMethod1(UA_Server *server) {
UA_QUALIFIEDNAME(1, "hello world"),
helloAttr, &helloWorldMethodCallback1,
1, &inputArgument, 1, &outputArgument, NULL, NULL);
/* Get the method node */
UA_NodeId id = UA_NODEID_NUMERIC(1, 62541);
UA_Server_setMethodNodeAsync(server, id, UA_TRUE);
/* Get the method node */
UA_NodeId id = UA_NODEID_NUMERIC(1, 62541);
UA_Server_setMethodNodeAsync(server, id, UA_TRUE);
}
static UA_StatusCode
helloWorldMethodCallback2(UA_Server *server,
const UA_NodeId *sessionId, void *sessionHandle,
const UA_NodeId *methodId, void *methodContext,
const UA_NodeId *objectId, void *objectContext,
size_t inputSize, const UA_Variant *input,
size_t outputSize, UA_Variant *output) {
UA_String *inputStr = (UA_String*)input->data;
UA_String tmp = UA_STRING_ALLOC("Hello ");
if (inputStr->length > 0) {
tmp.data = (UA_Byte *)UA_realloc(tmp.data, tmp.length + inputStr->length);
memcpy(&tmp.data[tmp.length], inputStr->data, inputStr->length);
tmp.length += inputStr->length;
}
UA_Variant_setScalarCopy(output, &tmp, &UA_TYPES[UA_TYPES_STRING]);
const UA_NodeId *sessionId, void *sessionHandle,
const UA_NodeId *methodId, void *methodContext,
const UA_NodeId *objectId, void *objectContext,
size_t inputSize, const UA_Variant *input,
size_t outputSize, UA_Variant *output) {
UA_String *inputStr = (UA_String*)input->data;
UA_String tmp = UA_STRING_ALLOC("Hello ");
if (inputStr->length > 0) {
tmp.data = (UA_Byte *)UA_realloc(tmp.data, tmp.length + inputStr->length);
memcpy(&tmp.data[tmp.length], inputStr->data, inputStr->length);
tmp.length += inputStr->length;
}
UA_Variant_setScalarCopy(output, &tmp, &UA_TYPES[UA_TYPES_STRING]);
char* test = (char*)calloc(1, tmp.length + 1);
memcpy(test, tmp.data, tmp.length);
UA_String_clear(&tmp);
UA_String_clear(&tmp);
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "'Hello World 2 (async)' was called and will take 1 seconds");
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, " Data 2: %s", test);
free(test);
UA_LOG_INFO(UA_Log_Stdout, UA_LOGCATEGORY_SERVER, "'Hello World 2 (async)' has ended");
return UA_STATUSCODE_GOOD;
return UA_STATUSCODE_GOOD;
}
static void
addHelloWorldMethod2(UA_Server *server) {
UA_Argument inputArgument;
UA_Argument_init(&inputArgument);
inputArgument.description = UA_LOCALIZEDTEXT("en-US", "A String");
inputArgument.name = UA_STRING("MyInput");
inputArgument.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
inputArgument.valueRank = UA_VALUERANK_SCALAR;
UA_Argument inputArgument;
UA_Argument_init(&inputArgument);
inputArgument.description = UA_LOCALIZEDTEXT("en-US", "A String");
inputArgument.name = UA_STRING("MyInput");
inputArgument.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
inputArgument.valueRank = UA_VALUERANK_SCALAR;
UA_Argument outputArgument;
UA_Argument_init(&outputArgument);
outputArgument.description = UA_LOCALIZEDTEXT("en-US", "A String");
outputArgument.name = UA_STRING("MyOutput");
outputArgument.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
outputArgument.valueRank = UA_VALUERANK_SCALAR;
UA_Argument outputArgument;
UA_Argument_init(&outputArgument);
outputArgument.description = UA_LOCALIZEDTEXT("en-US", "A String");
outputArgument.name = UA_STRING("MyOutput");
outputArgument.dataType = UA_TYPES[UA_TYPES_STRING].typeId;
outputArgument.valueRank = UA_VALUERANK_SCALAR;
UA_MethodAttributes helloAttr = UA_MethodAttributes_default;
helloAttr.description = UA_LOCALIZEDTEXT("en-US", "Say `Hello World` sync");
helloAttr.displayName = UA_LOCALIZEDTEXT("en-US", "Hello World sync");
helloAttr.executable = true;
helloAttr.userExecutable = true;
UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, 62542),
UA_MethodAttributes helloAttr = UA_MethodAttributes_default;
helloAttr.description = UA_LOCALIZEDTEXT("en-US", "Say `Hello World` sync");
helloAttr.displayName = UA_LOCALIZEDTEXT("en-US", "Hello World sync");
helloAttr.executable = true;
helloAttr.userExecutable = true;
UA_Server_addMethodNode(server, UA_NODEID_NUMERIC(1, 62542),
UA_NS0ID(OBJECTSFOLDER), UA_NS0ID(HASCOMPONENT),
UA_QUALIFIEDNAME(1, "hello world 2"),
helloAttr, &helloWorldMethodCallback2,
1, &inputArgument, 1, &outputArgument, NULL, NULL);
/* Get the method node */
UA_NodeId id = UA_NODEID_NUMERIC(1, 62542);
UA_Server_setMethodNodeAsync(server, id, UA_TRUE);
/* Get the method node */
UA_NodeId id = UA_NODEID_NUMERIC(1, 62542);
UA_Server_setMethodNodeAsync(server, id, UA_TRUE);
}
THREAD_CALLBACK(ThreadWorker) {
@ -214,7 +214,7 @@ int main(void) {
/* Add methods */
addHelloWorldMethod1(globalServer);
addHelloWorldMethod2(globalServer);
addHelloWorldMethod2(globalServer);
UA_Server_runUntilInterrupt(globalServer);

View File

@ -33,69 +33,69 @@ _UA_BEGIN_DECLS
* ^^^^^^^^^^^^^^^ */
typedef struct {
UA_Byte count;
UA_UInt16* dataSetWriterIds;
UA_Byte count;
UA_UInt16* dataSetWriterIds;
} UA_DataSetPayloadHeader;
typedef enum {
UA_FIELDENCODING_VARIANT = 0,
UA_FIELDENCODING_RAWDATA = 1,
UA_FIELDENCODING_DATAVALUE = 2,
UA_FIELDENCODING_UNKNOWN = 3
UA_FIELDENCODING_VARIANT = 0,
UA_FIELDENCODING_RAWDATA = 1,
UA_FIELDENCODING_DATAVALUE = 2,
UA_FIELDENCODING_UNKNOWN = 3
} UA_FieldEncoding;
typedef enum {
UA_DATASETMESSAGE_DATAKEYFRAME = 0,
UA_DATASETMESSAGE_DATADELTAFRAME = 1,
UA_DATASETMESSAGE_EVENT = 2,
UA_DATASETMESSAGE_KEEPALIVE = 3
UA_DATASETMESSAGE_DATAKEYFRAME = 0,
UA_DATASETMESSAGE_DATADELTAFRAME = 1,
UA_DATASETMESSAGE_EVENT = 2,
UA_DATASETMESSAGE_KEEPALIVE = 3
} UA_DataSetMessageType;
typedef struct {
UA_Boolean dataSetMessageValid;
UA_FieldEncoding fieldEncoding;
UA_Boolean dataSetMessageSequenceNrEnabled;
UA_Boolean timestampEnabled;
UA_Boolean statusEnabled;
UA_Boolean configVersionMajorVersionEnabled;
UA_Boolean configVersionMinorVersionEnabled;
UA_DataSetMessageType dataSetMessageType;
UA_Boolean picoSecondsIncluded;
UA_UInt16 dataSetMessageSequenceNr;
UA_UtcTime timestamp;
UA_UInt16 picoSeconds;
UA_UInt16 status;
UA_UInt32 configVersionMajorVersion;
UA_UInt32 configVersionMinorVersion;
UA_Boolean dataSetMessageValid;
UA_FieldEncoding fieldEncoding;
UA_Boolean dataSetMessageSequenceNrEnabled;
UA_Boolean timestampEnabled;
UA_Boolean statusEnabled;
UA_Boolean configVersionMajorVersionEnabled;
UA_Boolean configVersionMinorVersionEnabled;
UA_DataSetMessageType dataSetMessageType;
UA_Boolean picoSecondsIncluded;
UA_UInt16 dataSetMessageSequenceNr;
UA_UtcTime timestamp;
UA_UInt16 picoSeconds;
UA_UInt16 status;
UA_UInt32 configVersionMajorVersion;
UA_UInt32 configVersionMinorVersion;
} UA_DataSetMessageHeader;
typedef struct {
UA_UInt16 fieldCount;
UA_DataValue* dataSetFields;
UA_ByteString rawFields;
/* Json keys for the dataSetFields: TODO: own dataSetMessageType for json? */
UA_String* fieldNames;
/* This information is for proper en- and decoding needed */
UA_DataSetMetaDataType *dataSetMetaDataType;
UA_UInt16 fieldCount;
UA_DataValue* dataSetFields;
UA_ByteString rawFields;
/* Json keys for the dataSetFields: TODO: own dataSetMessageType for json? */
UA_String* fieldNames;
/* This information is for proper en- and decoding needed */
UA_DataSetMetaDataType *dataSetMetaDataType;
} UA_DataSetMessage_DataKeyFrameData;
typedef struct {
UA_UInt16 fieldIndex;
UA_DataValue fieldValue;
UA_UInt16 fieldIndex;
UA_DataValue fieldValue;
} UA_DataSetMessage_DeltaFrameField;
typedef struct {
UA_UInt16 fieldCount;
UA_DataSetMessage_DeltaFrameField* deltaFrameFields;
UA_UInt16 fieldCount;
UA_DataSetMessage_DeltaFrameField* deltaFrameFields;
} UA_DataSetMessage_DataDeltaFrameData;
typedef struct {
UA_DataSetMessageHeader header;
union {
UA_DataSetMessage_DataKeyFrameData keyFrameData;
UA_DataSetMessage_DataDeltaFrameData deltaFrameData;
} data;
size_t configuredSize;
UA_DataSetMessageHeader header;
union {
UA_DataSetMessage_DataKeyFrameData keyFrameData;
UA_DataSetMessage_DataDeltaFrameData deltaFrameData;
} data;
size_t configuredSize;
} UA_DataSetMessage;
/**
@ -103,73 +103,73 @@ typedef struct {
* ^^^^^^^^^^^^^^^ */
typedef enum {
UA_NETWORKMESSAGE_DATASET = 0,
UA_NETWORKMESSAGE_DISCOVERY_REQUEST = 1,
UA_NETWORKMESSAGE_DISCOVERY_RESPONSE = 2
UA_NETWORKMESSAGE_DATASET = 0,
UA_NETWORKMESSAGE_DISCOVERY_REQUEST = 1,
UA_NETWORKMESSAGE_DISCOVERY_RESPONSE = 2
} UA_NetworkMessageType;
typedef struct {
UA_UInt16* sizes;
UA_DataSetMessage* dataSetMessages;
UA_UInt16* sizes;
UA_DataSetMessage* dataSetMessages;
} UA_DataSetPayload;
typedef struct {
UA_Boolean writerGroupIdEnabled;
UA_Boolean groupVersionEnabled;
UA_Boolean networkMessageNumberEnabled;
UA_Boolean sequenceNumberEnabled;
UA_UInt16 writerGroupId;
UA_UInt32 groupVersion;
UA_UInt16 networkMessageNumber;
UA_UInt16 sequenceNumber;
UA_Boolean writerGroupIdEnabled;
UA_Boolean groupVersionEnabled;
UA_Boolean networkMessageNumberEnabled;
UA_Boolean sequenceNumberEnabled;
UA_UInt16 writerGroupId;
UA_UInt32 groupVersion;
UA_UInt16 networkMessageNumber;
UA_UInt16 sequenceNumber;
} UA_NetworkMessageGroupHeader;
typedef struct {
UA_Boolean networkMessageSigned;
UA_Boolean networkMessageEncrypted;
UA_Boolean securityFooterEnabled;
UA_Boolean forceKeyReset;
UA_UInt32 securityTokenId;
UA_Byte messageNonce[UA_NETWORKMESSAGE_MAX_NONCE_LENGTH];
UA_UInt16 messageNonceSize;
UA_UInt16 securityFooterSize;
UA_Boolean networkMessageSigned;
UA_Boolean networkMessageEncrypted;
UA_Boolean securityFooterEnabled;
UA_Boolean forceKeyReset;
UA_UInt32 securityTokenId;
UA_Byte messageNonce[UA_NETWORKMESSAGE_MAX_NONCE_LENGTH];
UA_UInt16 messageNonceSize;
UA_UInt16 securityFooterSize;
} UA_NetworkMessageSecurityHeader;
typedef struct {
UA_Byte version;
UA_Boolean messageIdEnabled;
UA_String messageId; /* For Json NetworkMessage */
UA_Boolean publisherIdEnabled;
UA_Boolean groupHeaderEnabled;
UA_Boolean payloadHeaderEnabled;
UA_Boolean dataSetClassIdEnabled;
UA_Boolean securityEnabled;
UA_Boolean timestampEnabled;
UA_Boolean picosecondsEnabled;
UA_Boolean chunkMessage;
UA_Boolean promotedFieldsEnabled;
UA_NetworkMessageType networkMessageType;
UA_PublisherId publisherId;
UA_Guid dataSetClassId;
UA_Byte version;
UA_Boolean messageIdEnabled;
UA_String messageId; /* For Json NetworkMessage */
UA_Boolean publisherIdEnabled;
UA_Boolean groupHeaderEnabled;
UA_Boolean payloadHeaderEnabled;
UA_Boolean dataSetClassIdEnabled;
UA_Boolean securityEnabled;
UA_Boolean timestampEnabled;
UA_Boolean picosecondsEnabled;
UA_Boolean chunkMessage;
UA_Boolean promotedFieldsEnabled;
UA_NetworkMessageType networkMessageType;
UA_PublisherId publisherId;
UA_Guid dataSetClassId;
UA_NetworkMessageGroupHeader groupHeader;
UA_NetworkMessageGroupHeader groupHeader;
union {
UA_DataSetPayloadHeader dataSetPayloadHeader;
} payloadHeader;
union {
UA_DataSetPayloadHeader dataSetPayloadHeader;
} payloadHeader;
UA_DateTime timestamp;
UA_UInt16 picoseconds;
UA_UInt16 promotedFieldsSize;
UA_Variant* promotedFields; /* BaseDataType */
UA_DateTime timestamp;
UA_UInt16 picoseconds;
UA_UInt16 promotedFieldsSize;
UA_Variant* promotedFields; /* BaseDataType */
UA_NetworkMessageSecurityHeader securityHeader;
UA_NetworkMessageSecurityHeader securityHeader;
union {
UA_DataSetPayload dataSetPayload;
} payload;
union {
UA_DataSetPayload dataSetPayload;
} payload;
UA_ByteString securityFooter;
UA_ByteString securityFooter;
} UA_NetworkMessage;
UA_EXPORT void

View File

@ -405,7 +405,7 @@ UA_ServerConfig_clear(UA_ServerConfig *config);
UA_DEPRECATED static UA_INLINE void
UA_ServerConfig_clean(UA_ServerConfig *config) {
UA_ServerConfig_clear(config);
UA_ServerConfig_clear(config);
}
/**

View File

@ -837,12 +837,12 @@ UA_Server_setReaderGroupEncryptionKeys(UA_Server *server, const UA_NodeId reader
* current PubSub configuration from the server. */
UA_EXPORT UA_StatusCode
UA_Server_loadPubSubConfigFromByteString(UA_Server *server,
const UA_ByteString buffer);
const UA_ByteString buffer);
/* Saves the current PubSub configuration of a server in a byteString. */
UA_EXPORT UA_StatusCode
UA_Server_writePubSubConfigurationToByteString(UA_Server *server,
UA_ByteString *buffer);
UA_ByteString *buffer);
#endif
/* Legacy API */

View File

@ -467,7 +467,7 @@ static size_t mbedtls_get_san_list_deep(const mbedtls_write_san_list* sanlist) {
}
int mbedtls_x509write_crt_set_subject_alt_name(mbedtls_x509write_cert *ctx, const mbedtls_write_san_list* sanlist) {
int ret = 0;
int ret = 0;
size_t sandeep = 0;
const mbedtls_write_san_list* cur = sanlist;
unsigned char* buf;

View File

@ -316,7 +316,7 @@ mbedtls_getSequenceListDeep(const mbedtls_x509_sequence *sanlist) {
static UA_StatusCode
mbedtls_x509write_csrSetSubjectAltName(mbedtls_x509write_csr *ctx, const mbedtls_x509_sequence* sanlist) {
int ret = 0;
int ret = 0;
const mbedtls_x509_sequence* cur = sanlist;
unsigned char *buf;
unsigned char *pc;

View File

@ -347,9 +347,9 @@ verifyCertificate(UA_CertificateGroup *certGroup, const UA_ByteString *certifica
goto cleanup;
}
#if defined(OPENSSL_API_COMPAT) && OPENSSL_API_COMPAT < 0x10100000L
(void) X509_STORE_CTX_trusted_stack(storeCtx, context->trustedCertificates);
(void) X509_STORE_CTX_trusted_stack(storeCtx, context->trustedCertificates);
#else
(void) X509_STORE_CTX_set0_trusted_stack(storeCtx, context->trustedCertificates);
(void) X509_STORE_CTX_set0_trusted_stack(storeCtx, context->trustedCertificates);
#endif
/* Set crls to ctx */

View File

@ -566,7 +566,7 @@ __Client_Service(UA_Client *client, const void *request,
UA_EventLoop *el = client->config.eventLoop;
if(!el || el->state != UA_EVENTLOOPSTATE_STARTED) {
respHeader->serviceResult = UA_STATUSCODE_BADINTERNALERROR;
return;
return;
}
/* Check that the SecureChannel is open and also a Session active (if we

View File

@ -763,7 +763,7 @@ UA_Server_loadPubSubConfigFromByteString(UA_Server *server,
return UA_STATUSCODE_BADINVALIDARGUMENT;
}
UA_LOCK(&server->serviceMutex);
UA_LOCK(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm) {
@ -797,8 +797,8 @@ UA_Server_loadPubSubConfigFromByteString(UA_Server *server,
}
cleanup:
UA_UNLOCK(&server->serviceMutex);
UA_ExtensionObject_clear(&decodedFile);
UA_UNLOCK(&server->serviceMutex);
UA_ExtensionObject_clear(&decodedFile);
return res;
}
@ -1232,8 +1232,8 @@ UA_Server_writePubSubConfigurationToByteString(UA_Server *server,
"Saving PubSub config was successful");
cleanup:
UA_UNLOCK(&server->serviceMutex);
UA_PubSubConfigurationDataType_clear(&config);
UA_UNLOCK(&server->serviceMutex);
UA_PubSubConfigurationDataType_clear(&config);
return res;
}

View File

@ -824,11 +824,11 @@ addMdnsRecordForNetworkLayer(UA_DiscoveryManager *dm, const UA_String serverName
return retval;
}
if (hostname.length == 0) {
gethostname(hoststr, sizeof(hoststr)-1);
hoststr[sizeof(hoststr)-1] = '\0';
hostname.data = (unsigned char *) hoststr;
hostname.length = strlen(hoststr);
if(hostname.length == 0) {
gethostname(hoststr, sizeof(hoststr)-1);
hoststr[sizeof(hoststr)-1] = '\0';
hostname.data = (unsigned char *) hoststr;
hostname.length = strlen(hoststr);
}
retval = UA_Discovery_addRecord(dm, serverName, hostname, port, path, UA_DISCOVERY_TCP, true,
dm->sc.server->config.mdnsConfig.serverCapabilities,

View File

@ -30,7 +30,7 @@ typedef struct UA_AsyncResponse UA_AsyncResponse;
typedef struct UA_AsyncOperation {
TAILQ_ENTRY(UA_AsyncOperation) pointers;
UA_CallMethodRequest request;
UA_CallMethodResult response;
UA_CallMethodResult response;
size_t index; /* Index of the operation in the array of ops in
* request/response */
UA_AsyncResponse *parent; /* Always non-NULL. The parent is only removed
@ -42,7 +42,7 @@ struct UA_AsyncResponse {
UA_UInt32 requestId;
UA_NodeId sessionId;
UA_UInt32 requestHandle;
UA_DateTime timeout;
UA_DateTime timeout;
UA_AsyncOperationType operationType;
union {
UA_CallResponse callResponse;

View File

@ -142,15 +142,15 @@ UA_String_isEmpty(const UA_String *s) {
static UA_Byte
lowercase(UA_Byte c) {
if(((int)c) - 'A' < 26) return c | 32;
return c;
if(((int)c) - 'A' < 26) return c | 32;
return c;
}
static int
casecmp(const UA_Byte *l, const UA_Byte *r, size_t n) {
if(!n--) return 0;
for(; *l && *r && n && (*l == *r || lowercase(*l) == lowercase(*r)); l++, r++, n--);
return lowercase(*l) - lowercase(*r);
if(!n--) return 0;
for(; *l && *r && n && (*l == *r || lowercase(*l) == lowercase(*r)); l++, r++, n--);
return lowercase(*l) - lowercase(*r);
}
/* Do not expose UA_String_equal_ignorecase to public API as it currently only handles

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -270,12 +270,12 @@ START_TEST(parseRelativePathWithServer) {
UA_Server *server = UA_Server_newForUnitTest();
/* Add a custom non-hierarchical reference type */
UA_NodeId refTypeId;
UA_ReferenceTypeAttributes refattr = UA_ReferenceTypeAttributes_default;
refattr.displayName = UA_LOCALIZEDTEXT(NULL, "MyRef");
refattr.inverseName = UA_LOCALIZEDTEXT(NULL, "RefMy");
UA_QualifiedName browseName = UA_QUALIFIEDNAME(1, "MyRef");
UA_StatusCode res =
UA_NodeId refTypeId;
UA_ReferenceTypeAttributes refattr = UA_ReferenceTypeAttributes_default;
refattr.displayName = UA_LOCALIZEDTEXT(NULL, "MyRef");
refattr.inverseName = UA_LOCALIZEDTEXT(NULL, "RefMy");
UA_QualifiedName browseName = UA_QUALIFIEDNAME(1, "MyRef");
UA_StatusCode res =
UA_Server_addReferenceTypeNode(server, UA_NODEID_NULL,
UA_NODEID_NUMERIC(0, UA_NS0ID_NONHIERARCHICALREFERENCES),
UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),

View File

@ -648,15 +648,15 @@ START_TEST(ObjectWithDynamicVariableChild) {
static UA_NodeId
findReference(const UA_NodeId sourceId, const UA_NodeId refTypeId) {
UA_BrowseDescription * bDesc = UA_BrowseDescription_new();
UA_NodeId_copy(&sourceId, &bDesc->nodeId);
bDesc->browseDirection = UA_BROWSEDIRECTION_FORWARD;
bDesc->includeSubtypes = true;
bDesc->resultMask = UA_BROWSERESULTMASK_REFERENCETYPEID;
UA_BrowseResult bRes = UA_Server_browse(server, 0, bDesc);
ck_assert(bRes.statusCode == UA_STATUSCODE_GOOD);
UA_BrowseDescription * bDesc = UA_BrowseDescription_new();
UA_NodeId_copy(&sourceId, &bDesc->nodeId);
bDesc->browseDirection = UA_BROWSEDIRECTION_FORWARD;
bDesc->includeSubtypes = true;
bDesc->resultMask = UA_BROWSERESULTMASK_REFERENCETYPEID;
UA_BrowseResult bRes = UA_Server_browse(server, 0, bDesc);
ck_assert(bRes.statusCode == UA_STATUSCODE_GOOD);
UA_NodeId outNodeId = UA_NODEID_NULL;
UA_NodeId outNodeId = UA_NODEID_NULL;
for(size_t i = 0; i < bRes.referencesSize; i++) {
UA_ReferenceDescription rDesc = bRes.references[i];
if(UA_NodeId_equal(&rDesc.referenceTypeId, &refTypeId)) {
@ -665,73 +665,73 @@ findReference(const UA_NodeId sourceId, const UA_NodeId refTypeId) {
}
}
UA_BrowseDescription_clear(bDesc);
UA_BrowseDescription_delete(bDesc);
UA_BrowseResult_clear(&bRes);
return outNodeId;
UA_BrowseDescription_clear(bDesc);
UA_BrowseDescription_delete(bDesc);
UA_BrowseResult_clear(&bRes);
return outNodeId;
}
static UA_NodeId
registerRefType(char *forwName, char *invName) {
UA_NodeId outNodeId;
UA_ReferenceTypeAttributes refattr = UA_ReferenceTypeAttributes_default;
refattr.displayName = UA_LOCALIZEDTEXT(NULL, forwName);
refattr.inverseName = UA_LOCALIZEDTEXT(NULL, invName );
UA_QualifiedName browseName = UA_QUALIFIEDNAME(1, forwName);
UA_StatusCode st =
UA_NodeId outNodeId;
UA_ReferenceTypeAttributes refattr = UA_ReferenceTypeAttributes_default;
refattr.displayName = UA_LOCALIZEDTEXT(NULL, forwName);
refattr.inverseName = UA_LOCALIZEDTEXT(NULL, invName );
UA_QualifiedName browseName = UA_QUALIFIEDNAME(1, forwName);
UA_StatusCode st =
UA_Server_addReferenceTypeNode(server, UA_NODEID_NULL,
UA_NODEID_NUMERIC(0, UA_NS0ID_NONHIERARCHICALREFERENCES),
UA_NODEID_NUMERIC(0, UA_NS0ID_HASSUBTYPE),
browseName, refattr, NULL, &outNodeId);
ck_assert(st == UA_STATUSCODE_GOOD);
return outNodeId;
ck_assert(st == UA_STATUSCODE_GOOD);
return outNodeId;
}
static UA_NodeId
addObjInstance(const UA_NodeId parentNodeId, char *dispName) {
UA_NodeId outNodeId;
UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
oAttr.displayName = UA_LOCALIZEDTEXT(NULL, dispName);
UA_QualifiedName browseName = UA_QUALIFIEDNAME(1, dispName);
UA_StatusCode st =
UA_NodeId outNodeId;
UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
oAttr.displayName = UA_LOCALIZEDTEXT(NULL, dispName);
UA_QualifiedName browseName = UA_QUALIFIEDNAME(1, dispName);
UA_StatusCode st =
UA_Server_addObjectNode(server, UA_NODEID_NULL,
parentNodeId, UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
browseName, UA_NODEID_NUMERIC(0, UA_NS0ID_BASEOBJECTTYPE),
oAttr, NULL, &outNodeId);
ck_assert(st == UA_STATUSCODE_GOOD);
return outNodeId;
ck_assert(st == UA_STATUSCODE_GOOD);
return outNodeId;
}
START_TEST(AddDoubleReference) {
// create two different reference types
UA_NodeId ref1TypeId = registerRefType("HasRef1", "IsRefOf1");
UA_NodeId ref2TypeId = registerRefType("HasRef2", "IsRefOf2");
// create two different reference types
UA_NodeId ref1TypeId = registerRefType("HasRef1", "IsRefOf1");
UA_NodeId ref2TypeId = registerRefType("HasRef2", "IsRefOf2");
// create two different object instances
// create two different object instances
UA_NodeId objectsNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_OBJECTSFOLDER);
UA_NodeId sourceId = addObjInstance(objectsNodeId, "obj1");
UA_NodeId targetId = addObjInstance(objectsNodeId, "obj2");
UA_NodeId sourceId = addObjInstance(objectsNodeId, "obj1");
UA_NodeId targetId = addObjInstance(objectsNodeId, "obj2");
// connect them twice, one time per reference type
UA_ExpandedNodeId targetExpId;
targetExpId.nodeId = targetId;
targetExpId.namespaceUri = UA_STRING_NULL;
targetExpId.serverIndex = 0;
UA_StatusCode st;
st = UA_Server_addReference(server, sourceId, ref1TypeId, targetExpId, true);
ck_assert(st == UA_STATUSCODE_GOOD);
st = UA_Server_addReference(server, sourceId, ref2TypeId, targetExpId, true);
ck_assert(st == UA_STATUSCODE_GOOD);
// connect them twice, one time per reference type
UA_ExpandedNodeId targetExpId;
targetExpId.nodeId = targetId;
targetExpId.namespaceUri = UA_STRING_NULL;
targetExpId.serverIndex = 0;
UA_StatusCode st;
st = UA_Server_addReference(server, sourceId, ref1TypeId, targetExpId, true);
ck_assert(st == UA_STATUSCODE_GOOD);
st = UA_Server_addReference(server, sourceId, ref2TypeId, targetExpId, true);
ck_assert(st == UA_STATUSCODE_GOOD);
/* repetition fails */
st = UA_Server_addReference(server, sourceId, ref2TypeId, targetExpId, true);
ck_assert(st != UA_STATUSCODE_GOOD);
st = UA_Server_addReference(server, sourceId, ref2TypeId, targetExpId, true);
ck_assert(st != UA_STATUSCODE_GOOD);
// check references where added
UA_NodeId targetCheckId;
targetCheckId = findReference(sourceId, ref1TypeId);
ck_assert(UA_NodeId_equal(&targetCheckId, &targetId));
targetCheckId = findReference(sourceId, ref2TypeId);
ck_assert(UA_NodeId_equal(&targetCheckId, &targetId));
// check references where added
UA_NodeId targetCheckId;
targetCheckId = findReference(sourceId, ref1TypeId);
ck_assert(UA_NodeId_equal(&targetCheckId, &targetId));
targetCheckId = findReference(sourceId, ref2TypeId);
ck_assert(UA_NodeId_equal(&targetCheckId, &targetId));
} END_TEST

View File

@ -239,12 +239,12 @@ int main(int argc, char **argv) {
}
size_t c = fread(&buf.data[pos], sizeof(UA_Byte), length - pos, in);
if(ferror(in)) {
fprintf(stderr, "Reading from input failed\n");
goto cleanup;
}
if(ferror(in)) {
fprintf(stderr, "Reading from input failed\n");
goto cleanup;
}
pos += c;
} while (!feof(in));
} while (!feof(in));
if(pos == 0) {
fprintf(stderr, "No input\n");