refactor(core): Simplify UA_LOCK_ASSERT

This commit is contained in:
Julius Pfrommer 2024-09-10 08:16:06 +02:00 committed by Julius Pfrommer
parent de58380396
commit c73e7d64de
41 changed files with 299 additions and 295 deletions

View File

@ -90,7 +90,7 @@ processDelayed(UA_EventLoopPOSIX *el) {
UA_LOG_TRACE(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
"Process delayed callbacks");
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* First empty the linked list in the el. So a delayed callback can add
* (itself) to the list. New entries are then processed during the next
@ -219,7 +219,7 @@ UA_EventLoopPOSIX_start(UA_EventLoopPOSIX *el) {
static void
checkClosed(UA_EventLoopPOSIX *el) {
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_EventSource *es = el->eventLoop.eventSources;
while(es) {
@ -684,7 +684,7 @@ flushSelfPipe(UA_SOCKET s) {
UA_StatusCode
UA_EventLoopPOSIX_registerFD(UA_EventLoopPOSIX *el, UA_RegisteredFD *rfd) {
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
"Registering fd: %u", (unsigned)rfd->fd);
@ -705,13 +705,13 @@ UA_EventLoopPOSIX_registerFD(UA_EventLoopPOSIX *el, UA_RegisteredFD *rfd) {
UA_StatusCode
UA_EventLoopPOSIX_modifyFD(UA_EventLoopPOSIX *el, UA_RegisteredFD *rfd) {
/* Do nothing, it is enough if the data was changed in the rfd */
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
return UA_STATUSCODE_GOOD;
}
void
UA_EventLoopPOSIX_deregisterFD(UA_EventLoopPOSIX *el, UA_RegisteredFD *rfd) {
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
"Unregistering fd: %u", (unsigned)rfd->fd);
@ -746,7 +746,7 @@ UA_EventLoopPOSIX_deregisterFD(UA_EventLoopPOSIX *el, UA_RegisteredFD *rfd) {
static UA_FD
setFDSets(UA_EventLoopPOSIX *el, fd_set *readset, fd_set *writeset, fd_set *errset) {
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
FD_ZERO(readset);
FD_ZERO(writeset);
@ -778,7 +778,7 @@ setFDSets(UA_EventLoopPOSIX *el, fd_set *readset, fd_set *writeset, fd_set *errs
UA_StatusCode
UA_EventLoopPOSIX_pollFDs(UA_EventLoopPOSIX *el, UA_DateTime listenTimeout) {
UA_assert(listenTimeout >= 0);
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
fd_set readset, writeset, errset;
UA_FD highestfd = setFDSets(el, &readset, &writeset, &errset);

View File

@ -246,7 +246,7 @@ ETH_freeNetworkBuffer(UA_ConnectionManager *cm, uintptr_t connectionId,
/* Test if the ConnectionManager can be stopped */
static void
ETH_checkStopped(UA_POSIXConnectionManager *pcm) {
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex, 1);
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex);
if(pcm->fdsSize == 0 &&
pcm->cm.eventSource.state == UA_EVENTSOURCESTATE_STOPPING) {
@ -262,7 +262,7 @@ ETH_checkStopped(UA_POSIXConnectionManager *pcm) {
static void
ETH_close(UA_POSIXConnectionManager *pcm, ETH_FD *conn) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
"ETH %u\t| Closing connection",
@ -324,7 +324,7 @@ ETH_connectionSocketCallback(UA_ConnectionManager *cm, UA_RegisteredFD *rfd,
short event) {
UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)cm->eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
ETH_FD *conn = (ETH_FD*)rfd;
if(event == UA_FDEVENT_ERR) {
@ -432,7 +432,7 @@ ETH_openListenConnection(UA_EventLoopPOSIX *el, ETH_FD *conn,
const UA_KeyValueMap *params,
int ifindex, UA_UInt16 etherType,
UA_Boolean validate) {
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Bind the socket to interface and EtherType. Don't receive anything else. */
struct sockaddr_ll sll;
@ -516,7 +516,7 @@ ETH_openListenConnection(UA_EventLoopPOSIX *el, ETH_FD *conn,
static UA_StatusCode
ETH_openSendConnection(UA_EventLoopPOSIX *el, ETH_FD *conn, const UA_KeyValueMap *params,
UA_Byte source[ETHER_ADDR_LEN], int ifindex, UA_UInt16 etherType) {
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Parse the target address (has to exist) */
const UA_String *address = (const UA_String*)
@ -769,7 +769,7 @@ ETH_openConnection(UA_ConnectionManager *cm, const UA_KeyValueMap *params,
static void
ETH_shutdown(UA_POSIXConnectionManager *pcm, ETH_FD *conn) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex, 1);
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex);
UA_DelayedCallback *dc = &conn->rfd.dc;
if(dc->callback) {

View File

@ -50,7 +50,7 @@ static void
handlePOSIXInterruptEvent(UA_EventSource *es, UA_RegisteredFD *rfd, short event) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)es->eventLoop;
(void)el;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_RegisteredSignal *rs = (UA_RegisteredSignal*)rfd;
struct signalfd_siginfo fdsi;
@ -75,7 +75,7 @@ handlePOSIXInterruptEvent(UA_EventSource *es, UA_RegisteredFD *rfd, short event)
static void
activateSignal(UA_RegisteredSignal *rs) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)rs->rfd.es->eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
if(rs->active)
return;
@ -127,7 +127,7 @@ activateSignal(UA_RegisteredSignal *rs) {
static void
deactivateSignal(UA_RegisteredSignal *rs) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)rs->rfd.es->eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Only dectivate if active */
if(!rs->active)
@ -208,7 +208,7 @@ static void
activateSignal(UA_RegisteredSignal *rs) {
UA_assert(singletonIM != NULL);
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)singletonIM->im.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Register the signal on the OS level */
if(rs->active)
@ -231,7 +231,7 @@ static void
deactivateSignal(UA_RegisteredSignal *rs) {
UA_assert(singletonIM != NULL);
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)singletonIM->im.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Only dectivate if active */
if(!rs->active)
@ -386,7 +386,7 @@ static UA_StatusCode
freePOSIXInterruptmanager(UA_EventSource *es) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)es->eventLoop;
(void)el;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
if(es->state >= UA_EVENTSOURCESTATE_STARTING) {
UA_LOG_ERROR(es->eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,

View File

@ -56,7 +56,7 @@ TCP_setNoNagle(UA_FD sockfd) {
/* Test if the ConnectionManager can be stopped */
static void
TCP_checkStopped(UA_POSIXConnectionManager *pcm) {
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex, 1);
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex);
if(pcm->fdsSize == 0 &&
pcm->cm.eventSource.state == UA_EVENTSOURCESTATE_STOPPING) {
@ -139,7 +139,7 @@ static void
TCP_connectionSocketCallback(UA_ConnectionManager *cm, TCP_FD *conn,
short event) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)cm->eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
"TCP %u\t| Activity on the socket",
@ -238,7 +238,7 @@ static void
TCP_listenSocketCallback(UA_ConnectionManager *cm, TCP_FD *conn, short event) {
UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)cm->eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
"TCP %u\t| Callback on server socket",
@ -354,7 +354,7 @@ TCP_registerListenSocket(UA_POSIXConnectionManager *pcm, struct addrinfo *ai,
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate, UA_Boolean reuseaddr) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Translate INADDR_ANY to IPv4/IPv6 address */
char addrstr[UA_MAXHOSTNAME_LENGTH];
@ -542,7 +542,7 @@ TCP_registerListenSockets(UA_POSIXConnectionManager *pcm, const char *hostname,
UA_UInt16 port, void *application, void *context,
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate, UA_Boolean reuseaddr) {
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex, 1);
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex);
/* Create a string for the port */
char portstr[6];
@ -594,7 +594,7 @@ static void
TCP_shutdown(UA_ConnectionManager *cm, TCP_FD *conn) {
/* Already closing - nothing to do */
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)cm->eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
if(conn->rfd.dc.callback) {
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
@ -709,7 +709,7 @@ TCP_openPassiveConnection(UA_POSIXConnectionManager *pcm, const UA_KeyValueMap *
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Get the port parameter */
const UA_UInt16 *port = (const UA_UInt16*)
@ -768,7 +768,7 @@ TCP_openActiveConnection(UA_POSIXConnectionManager *pcm, const UA_KeyValueMap *p
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Get the connection parameters */
char hostname[UA_MAXHOSTNAME_LENGTH];

View File

@ -569,7 +569,7 @@ setupSendMultiCast(UA_FD fd, struct addrinfo *info, const UA_KeyValueMap *params
/* Test if the ConnectionManager can be stopped */
static void
UDP_checkStopped(UA_POSIXConnectionManager *pcm) {
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex, 1);
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex);
if(pcm->fdsSize == 0 &&
pcm->cm.eventSource.state == UA_EVENTSOURCESTATE_STOPPING) {
@ -585,7 +585,7 @@ UDP_checkStopped(UA_POSIXConnectionManager *pcm) {
static void
UDP_close(UA_POSIXConnectionManager *pcm, UDP_FD *conn) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
"UDP %u\t| Closing connection",
@ -643,7 +643,7 @@ static void
UDP_connectionSocketCallback(UA_POSIXConnectionManager *pcm, UDP_FD *conn,
short event) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
"UDP %u\t| Activity on the socket",
@ -742,7 +742,7 @@ UDP_registerListenSocket(UA_POSIXConnectionManager *pcm, UA_UInt16 port,
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Get logging information */
char hoststr[UA_MAXHOSTNAME_LENGTH];
@ -912,7 +912,7 @@ UDP_registerListenSockets(UA_POSIXConnectionManager *pcm, const char *hostname,
void *application, void *context,
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate) {
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex, 1);
UA_LOCK_ASSERT(&((UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop)->elMutex);
/* Get all the interface and IPv4/6 combinations for the configured hostname */
struct addrinfo hints, *res;
@ -964,7 +964,7 @@ UDP_registerListenSockets(UA_POSIXConnectionManager *pcm, const char *hostname,
static void
UDP_shutdown(UA_ConnectionManager *cm, UA_RegisteredFD *rfd) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)cm->eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
if(rfd->dc.callback) {
UA_LOG_DEBUG(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
@ -1128,7 +1128,7 @@ UDP_openSendConnection(UA_POSIXConnectionManager *pcm, const UA_KeyValueMap *par
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Get the connection parameters */
char hostname[UA_MAXHOSTNAME_LENGTH];
@ -1231,7 +1231,7 @@ UDP_openReceiveConnection(UA_POSIXConnectionManager *pcm, const UA_KeyValueMap *
UA_ConnectionManager_connectionCallback connectionCallback,
UA_Boolean validate) {
UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)pcm->cm.eventSource.eventLoop;
UA_LOCK_ASSERT(&el->elMutex, 1);
UA_LOCK_ASSERT(&el->elMutex);
/* Get the port */
const UA_UInt16 *port = (const UA_UInt16*)

View File

@ -339,41 +339,44 @@ extern UA_THREAD_LOCAL void * (*UA_reallocSingleton)(void *ptr, size_t size);
# define UA_LOCK_DESTROY(lock)
# define UA_LOCK(lock)
# define UA_UNLOCK(lock)
# define UA_LOCK_ASSERT(lock, num)
# define UA_LOCK_ASSERT(lock)
#elif defined(UA_ARCHITECTURE_WIN32)
typedef struct {
CRITICAL_SECTION mutex;
int mutexCounter;
bool flag; /* For assertions that we hold the mutex */
} UA_Lock;
static UA_INLINE void
UA_LOCK_INIT(UA_Lock *lock) {
InitializeCriticalSection(&lock->mutex);
lock->mutexCounter = 0;
lock->flag = false;
}
static UA_INLINE void
UA_LOCK_DESTROY(UA_Lock *lock) {
UA_assert(!lock->flag);
DeleteCriticalSection(&lock->mutex);
}
static UA_INLINE void
UA_LOCK(UA_Lock *lock) {
EnterCriticalSection(&lock->mutex);
UA_assert(++(lock->mutexCounter) == 1);
UA_assert(!lock->flag);
lock->flag = true;
}
static UA_INLINE void
UA_UNLOCK(UA_Lock *lock) {
UA_assert(--(lock->mutexCounter) == 0);
UA_assert(lock->flag);
lock->flag = false;
LeaveCriticalSection(&lock->mutex);
}
static UA_INLINE void
UA_LOCK_ASSERT(UA_Lock *lock, int num) {
UA_assert(lock->mutexCounter == num);
UA_LOCK_ASSERT(UA_Lock *lock) {
UA_assert(lock->flag);
}
#elif defined(UA_ARCHITECTURE_POSIX)
@ -382,39 +385,40 @@ UA_LOCK_ASSERT(UA_Lock *lock, int num) {
typedef struct {
pthread_mutex_t mutex;
int mutexCounter;
bool flag; /* For assertions that we hold the mutex */
} UA_Lock;
#define UA_LOCK_STATIC_INIT {PTHREAD_MUTEX_INITIALIZER, 0}
#define UA_LOCK_STATIC_INIT {PTHREAD_MUTEX_INITIALIZER, false}
static UA_INLINE void
UA_LOCK_INIT(UA_Lock *lock) {
pthread_mutex_init(&lock->mutex, NULL);
lock->mutexCounter = 0;
lock->flag = false;
}
static UA_INLINE void
UA_LOCK_DESTROY(UA_Lock *lock) {
UA_assert(!lock->flag);
pthread_mutex_destroy(&lock->mutex);
}
static UA_INLINE void
UA_LOCK(UA_Lock *lock) {
pthread_mutex_lock(&lock->mutex);
UA_assert(lock->mutexCounter == 0);
lock->mutexCounter++;
UA_assert(!lock->flag);
lock->flag = true;
}
static UA_INLINE void
UA_UNLOCK(UA_Lock *lock) {
UA_assert(lock->mutexCounter == 1);
lock->mutexCounter--;
UA_assert(lock->flag);
lock->flag = false;
pthread_mutex_unlock(&lock->mutex);
}
static UA_INLINE void
UA_LOCK_ASSERT(UA_Lock *lock, int num) {
UA_assert(lock->mutexCounter == num);
UA_LOCK_ASSERT(UA_Lock *lock) {
UA_assert(lock->flag);
}
#endif

View File

@ -272,7 +272,7 @@ static const char *sessionStateTexts[6] =
void
notifyClientState(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
if(client->connectStatus == client->oldConnectStatus &&
client->channel.state == client->oldChannelState &&
@ -322,7 +322,7 @@ notifyClientState(UA_Client *client) {
static UA_StatusCode
sendRequest(UA_Client *client, const void *request,
const UA_DataType *requestType, UA_UInt32 *requestId) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* Renew SecureChannel if necessary */
__Client_renewSecureChannel(client);
@ -751,7 +751,7 @@ __Client_AsyncService(UA_Client *client, const void *request,
UA_ClientAsyncServiceCallback callback,
const UA_DataType *responseType,
void *userdata, UA_UInt32 *requestId) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* Is the SecureChannel connected? */
if(client->channel.state != UA_SECURECHANNELSTATE_OPEN) {
@ -1022,7 +1022,7 @@ clientHouseKeeping(UA_Client *client, void *_) {
UA_StatusCode
__UA_Client_startup(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_EventLoop *el = client->config.eventLoop;
UA_CHECK_ERROR(el != NULL,

View File

@ -667,7 +667,7 @@ sendOPNAsync(UA_Client *client, UA_Boolean renew) {
UA_StatusCode
__Client_renewSecureChannel(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_EventLoop *el = client->config.eventLoop;
UA_DateTime now = el->dateTime_nowMonotonic(el);
@ -753,7 +753,7 @@ responseActivateSession(UA_Client *client, void *userdata,
static UA_StatusCode
activateSessionAsync(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
if(client->sessionState != UA_SESSIONSTATE_CREATED &&
client->sessionState != UA_SESSIONSTATE_ACTIVATED) {
@ -1087,7 +1087,7 @@ responseGetEndpoints(UA_Client *client, void *userdata,
static UA_StatusCode
requestGetEndpoints(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_GetEndpointsRequest request;
UA_GetEndpointsRequest_init(&request);
@ -1271,7 +1271,7 @@ createSessionCallback(UA_Client *client, void *userdata,
static UA_StatusCode
createSessionAsync(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* Generate the local nonce for the session */
UA_StatusCode res = UA_STATUSCODE_GOOD;
@ -1352,7 +1352,7 @@ initSecurityPolicy(UA_Client *client) {
static void
connectActivity(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_LOG_TRACE(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Client connect iterate");
@ -1639,7 +1639,7 @@ __Client_networkCallback(UA_ConnectionManager *cm, uintptr_t connectionId,
/* Initialize a TCP connection. Writes the result to client->connectStatus. */
static void
initConnect(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
if(client->channel.state != UA_SECURECHANNELSTATE_CLOSED) {
UA_LOG_WARNING(client->config.logging, UA_LOGCATEGORY_CLIENT,
"Client connection already initiated");
@ -1727,7 +1727,7 @@ initConnect(UA_Client *client) {
void
connectSync(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* EventLoop is started. Otherwise initConnect would have failed. */
UA_EventLoop *el = client->config.eventLoop;
@ -1774,7 +1774,7 @@ connectSync(UA_Client *client) {
UA_StatusCode
connectInternal(UA_Client *client, UA_Boolean async) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* Reset the connectStatus. This should be the only place where we can
* recover from a bad connectStatus. */
@ -1790,7 +1790,7 @@ connectInternal(UA_Client *client, UA_Boolean async) {
UA_StatusCode
connectSecureChannel(UA_Client *client, const char *endpointUrl) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_ClientConfig *cc = UA_Client_getConfig(client);
cc->noSession = true;
@ -1809,7 +1809,7 @@ __UA_Client_connect(UA_Client *client, UA_Boolean async) {
static UA_StatusCode
activateSessionSync(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* EventLoop is started. Otherwise activateSessionAsync would have failed. */
UA_EventLoop *el = client->config.eventLoop;

View File

@ -40,7 +40,7 @@ static UA_StatusCode
getEndpointsInternal(UA_Client *client, const UA_String endpointUrl,
size_t *endpointDescriptionsSize,
UA_EndpointDescription **endpointDescriptions) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_GetEndpointsRequest request;
UA_GetEndpointsRequest_init(&request);

View File

@ -53,7 +53,7 @@ MonitoredItem_delete(UA_Client *client, UA_Client_Subscription *sub,
static void
ua_Subscriptions_create(UA_Client *client, UA_Client_Subscription *newSub,
UA_CreateSubscriptionResponse *response) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_EventLoop *el = client->config.eventLoop;
@ -425,7 +425,7 @@ UA_Client_Subscriptions_deleteSingle(UA_Client *client, UA_UInt32 subscriptionId
static void
MonitoredItem_delete(UA_Client *client, UA_Client_Subscription *sub,
UA_Client_MonitoredItem *mon) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
ZIP_REMOVE(MonitorItemsTree, &sub->monitoredItems, mon);
if(mon->deleteCallback) {
@ -642,7 +642,7 @@ createDataChanges_async(UA_Client *client, const UA_CreateMonitoredItemsRequest
UA_Client_DeleteMonitoredItemCallback *deleteCallbacks,
UA_ClientAsyncServiceCallback createCallback, void *userdata,
UA_UInt32 *requestId) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_Client_Subscription *sub = findSubscription(client, request.subscriptionId);
if(!sub)
@ -1014,7 +1014,7 @@ UA_Client_MonitoredItems_modify_async(UA_Client *client,
/* Assume the request is already initialized */
UA_StatusCode
__Client_preparePublishRequest(UA_Client *client, UA_PublishRequest *request) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
/* Count acks */
UA_Client_NotificationsAckNumber *ack;
@ -1055,7 +1055,7 @@ __nextSequenceNumber(UA_UInt32 sequenceNumber) {
static void
processDataChangeNotification(UA_Client *client, UA_Client_Subscription *sub,
UA_DataChangeNotification *dataChangeNotification) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
for(size_t j = 0; j < dataChangeNotification->monitoredItemsSize; ++j) {
UA_MonitoredItemNotification *min = &dataChangeNotification->monitoredItems[j];
@ -1095,7 +1095,7 @@ processDataChangeNotification(UA_Client *client, UA_Client_Subscription *sub,
static void
processEventNotification(UA_Client *client, UA_Client_Subscription *sub,
UA_EventNotificationList *eventNotificationList) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
for(size_t j = 0; j < eventNotificationList->eventsSize; ++j) {
UA_EventFieldList *eventFieldList = &eventNotificationList->events[j];
@ -1136,7 +1136,7 @@ processEventNotification(UA_Client *client, UA_Client_Subscription *sub,
static void
processNotificationMessage(UA_Client *client, UA_Client_Subscription *sub,
UA_ExtensionObject *msg) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
if(msg->encoding != UA_EXTENSIONOBJECT_DECODED)
return;
@ -1181,7 +1181,7 @@ processNotificationMessage(UA_Client *client, UA_Client_Subscription *sub,
static void
__Client_Subscriptions_processPublishResponse(UA_Client *client, UA_PublishRequest *request,
UA_PublishResponse *response) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
UA_NotificationMessage *msg = &response->notificationMessage;
@ -1341,7 +1341,7 @@ __Client_Subscriptions_clear(UA_Client *client) {
void
__Client_Subscriptions_backgroundPublishInactivityCheck(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
if(client->sessionState < UA_SESSIONSTATE_ACTIVATED)
return;
@ -1377,7 +1377,7 @@ __Client_Subscriptions_backgroundPublishInactivityCheck(UA_Client *client) {
void
__Client_Subscriptions_backgroundPublish(UA_Client *client) {
UA_LOCK_ASSERT(&client->clientMutex, 1);
UA_LOCK_ASSERT(&client->clientMutex);
if(client->sessionState != UA_SESSIONSTATE_ACTIVATED)
return;

View File

@ -89,7 +89,7 @@ extractPubSubConfigFromExtensionObject(UA_PubSubManager *psm,
static UA_StatusCode
updatePubSubConfig(UA_PubSubManager *psm,
const UA_PubSubConfigurationDataType *configurationParameters) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(configurationParameters == NULL) {
UA_LOG_ERROR(psm->logging, UA_LOGCATEGORY_PUBSUB,
@ -148,7 +148,7 @@ createComponentsForConnection(UA_PubSubManager *psm,
const UA_PubSubConnectionDataType *connParams,
UA_NodeId connectionIdent, UA_UInt32 pdsCount,
const UA_NodeId *pdsIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* WriterGroups configuration */
UA_StatusCode res = UA_STATUSCODE_GOOD;
@ -186,7 +186,7 @@ createComponentsForConnection(UA_PubSubManager *psm,
static UA_StatusCode
createPubSubConnection(UA_PubSubManager *psm, const UA_PubSubConnectionDataType *connParams,
UA_UInt32 pdsCount, UA_NodeId *pdsIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PubSubConnectionConfig config;
memset(&config, 0, sizeof(UA_PubSubConnectionConfig));
@ -294,7 +294,7 @@ createWriterGroup(UA_PubSubManager *psm,
const UA_WriterGroupDataType *writerGroupParameters,
UA_NodeId connectionIdent, UA_UInt32 pdsCount,
const UA_NodeId *pdsIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_WriterGroupConfig config;
memset(&config, 0, sizeof(UA_WriterGroupConfig));
@ -363,7 +363,7 @@ addDataSetWriterWithPdsReference(UA_PubSubManager *psm, UA_NodeId writerGroupIde
const UA_DataSetWriterConfig *dsWriterConfig,
UA_UInt32 pdsCount, const UA_NodeId *pdsIdent,
UA_Boolean enable) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_NodeId dataSetWriterIdent;
UA_PublishedDataSetConfig pdsConfig;
@ -427,7 +427,7 @@ createDataSetWriter(UA_PubSubManager *psm,
const UA_DataSetWriterDataType *dataSetWriterParameters,
UA_NodeId writerGroupIdent, UA_UInt32 pdsCount,
const UA_NodeId *pdsIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_DataSetWriterConfig config;
memset(&config, 0, sizeof(UA_DataSetWriterConfig));
@ -461,7 +461,7 @@ static UA_StatusCode
createReaderGroup(UA_PubSubManager *psm,
const UA_ReaderGroupDataType *readerGroupParameters,
UA_NodeId connectionIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_ReaderGroupConfig config;
memset(&config, 0, sizeof(UA_ReaderGroupConfig));
@ -508,7 +508,7 @@ createReaderGroup(UA_PubSubManager *psm,
static UA_StatusCode
addSubscribedDataSet(UA_PubSubManager *psm, const UA_NodeId dsReaderIdent,
const UA_ExtensionObject *subscribedDataSet) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(subscribedDataSet->content.decoded.type ==
&UA_TYPES[UA_TYPES_TARGETVARIABLESDATATYPE]) {
@ -564,7 +564,7 @@ addSubscribedDataSet(UA_PubSubManager *psm, const UA_NodeId dsReaderIdent,
static UA_StatusCode
createDataSetReader(UA_PubSubManager *psm, const UA_DataSetReaderDataType *dsrParams,
UA_NodeId readerGroupIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* Prepare the config parameters */
UA_DataSetReaderConfig config;
@ -649,7 +649,7 @@ static UA_StatusCode
createPublishedDataSet(UA_PubSubManager *psm,
const UA_PublishedDataSetDataType *pdsParams,
UA_NodeId *pdsIdent) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PublishedDataSetConfig config;
memset(&config, 0, sizeof(UA_PublishedDataSetConfig));
@ -687,7 +687,7 @@ createPublishedDataSet(UA_PubSubManager *psm,
static UA_StatusCode
addDataSetFieldVariables(UA_PubSubManager *psm, const UA_NodeId *pdsIdent,
const UA_PublishedDataSetDataType *pdsParams) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PublishedDataItemsDataType *pdItems = (UA_PublishedDataItemsDataType *)
pdsParams->dataSetSource.content.decoded.data;
@ -727,7 +727,7 @@ addDataSetFieldVariables(UA_PubSubManager *psm, const UA_NodeId *pdsIdent,
static UA_StatusCode
createDataSetFields(UA_PubSubManager *psm, const UA_NodeId *pdsIdent,
const UA_PublishedDataSetDataType *pdsParams) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(pdsParams->dataSetSource.encoding != UA_EXTENSIONOBJECT_DECODED)
return UA_STATUSCODE_BADINTERNALERROR;
@ -1146,7 +1146,7 @@ generatePubSubConnectionDataType(UA_PubSubManager *psm,
static UA_StatusCode
generatePubSubConfigurationDataType(UA_PubSubManager *psm,
UA_PubSubConfigurationDataType *configDT) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PubSubConfigurationDataType_init(configDT);
configDT->publishedDataSets = (UA_PublishedDataSetDataType*)

View File

@ -211,7 +211,7 @@ delayedPubSubConnection_delete(void *application, void *context) {
* the connection callback. */
void
UA_PubSubConnection_delete(UA_PubSubManager *psm, UA_PubSubConnection *c) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* Disable (and disconnect) and set the deleteFlag. This prevents a
* reconnect and triggers the deletion when the last open socket is
@ -649,7 +649,7 @@ static UA_StatusCode
UA_PubSubConnection_connectUDP(UA_PubSubManager *psm, UA_PubSubConnection *c,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NetworkAddressUrlDataType *addressUrl = (UA_NetworkAddressUrlDataType*)
c->config.address.data;
@ -745,7 +745,7 @@ static UA_StatusCode
UA_PubSubConnection_connectETH(UA_PubSubManager *psm, UA_PubSubConnection *c,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NetworkAddressUrlDataType *addressUrl = (UA_NetworkAddressUrlDataType*)
c->config.address.data;
@ -813,7 +813,7 @@ static UA_StatusCode
UA_PubSubConnection_connect(UA_PubSubManager *psm, UA_PubSubConnection *c,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_EventLoop *el = UA_PubSubConnection_getEL(psm, c);
if(!el) {

View File

@ -745,7 +745,7 @@ addSubscribedDataSet(UA_PubSubManager *psm,
if(!psm)
return UA_STATUSCODE_BADINTERNALERROR;
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(!sdsConfig) {
UA_LOG_ERROR(psm->logging, UA_LOGCATEGORY_PUBSUB,

View File

@ -33,7 +33,7 @@ findPubSubSecurityPolicy(UA_PubSubManager *psm, const UA_String *securityPolicyU
if(!psm || !securityPolicyUri)
return NULL;
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_ServerConfig *config = &psm->sc.server->config;
for(size_t i = 0; i < config->pubSubConfig.securityPoliciesSize; i++) {
@ -60,7 +60,7 @@ UA_PubSubKeyStorage_clearKeyList(UA_PubSubKeyStorage *ks) {
void
UA_PubSubKeyStorage_delete(UA_PubSubManager *psm, UA_PubSubKeyStorage *ks) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* Remove callback */
if(!ks->callBackId) {
@ -166,7 +166,7 @@ UA_PubSubKeyStorage_addKeyRolloverCallback(UA_PubSubManager *psm,
if(!psm || !ks || !callback || timeToNextMs <= 0)
return UA_STATUSCODE_BADINVALIDARGUMENT;
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_EventLoop *el = psm->sc.server->config.eventLoop;
return el->addTimer(el, (UA_Callback)callback, psm, ks,
@ -215,7 +215,7 @@ static UA_StatusCode
setPubSubGroupEncryptingKey(UA_PubSubManager *psm, UA_NodeId PubSubGroupId,
UA_UInt32 securityTokenId, UA_ByteString signingKey,
UA_ByteString encryptingKey, UA_ByteString keyNonce) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_WriterGroup *wg = UA_WriterGroup_find(psm, PubSubGroupId);
if(wg)
return UA_WriterGroup_setEncryptionKeys(psm, wg, securityTokenId, signingKey,
@ -236,7 +236,7 @@ setPubSubGroupEncryptingKeyForMatchingSecurityGroupId(UA_PubSubManager *psm,
UA_ByteString signingKey,
UA_ByteString encryptingKey,
UA_ByteString keyNonce) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* Key storage is the same for all reader / writer groups, channel context isn't
* => Update channelcontext in all Writergroups / ReaderGroups which have the same
@ -273,7 +273,7 @@ UA_StatusCode
UA_PubSubKeyStorage_activateKeyToChannelContext(UA_PubSubManager *psm,
UA_NodeId pubSubGroupId,
UA_String securityGroupId) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(securityGroupId.data == NULL)
return UA_STATUSCODE_BADINVALIDARGUMENT;
@ -366,7 +366,7 @@ UA_PubSubKeyStorage_keyRolloverCallback(UA_PubSubManager *psm, UA_PubSubKeyStora
void
UA_PubSubKeyStorage_detachKeyStorage(UA_PubSubManager *psm, UA_PubSubKeyStorage *ks) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
ks->referenceCount--;
if(ks->referenceCount == 0) {
LIST_REMOVE(ks, keyStorageList);

View File

@ -494,7 +494,7 @@ UA_PubSubManager_clear(UA_PubSubManager *psm) {
return UA_STATUSCODE_BADINTERNALERROR;
}
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Remove Connections - this also remove WriterGroups and ReaderGroups */
UA_PubSubConnection *c, *tmpC;

View File

@ -26,7 +26,7 @@ typedef struct {
static UA_StatusCode
writePubSubNs0VariableArray(UA_Server *server, const UA_NodeId id, void *v,
size_t length, const UA_DataType *type) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Variant var;
UA_Variant_init(&var);
UA_Variant_setArray(&var, v, length, type);
@ -36,7 +36,7 @@ writePubSubNs0VariableArray(UA_Server *server, const UA_NodeId id, void *v,
static UA_NodeId
findSingleChildNode(UA_Server *server, UA_QualifiedName targetName,
UA_NodeId referenceTypeId, UA_NodeId startingNode){
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId resultNodeId;
UA_RelativePathElement rpe;
UA_RelativePathElement_init(&rpe);
@ -66,7 +66,7 @@ static void
onReadLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext,
const UA_NodeId *nodeid, void *context,
const UA_NumericRange *range, const UA_DataValue *data) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -251,7 +251,7 @@ static void
onWriteLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext,
const UA_NodeId *nodeId, void *nodeContext,
const UA_NumericRange *range, const UA_DataValue *data) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodePropertyContext *npc = (UA_NodePropertyContext *)nodeContext;
UA_PubSubManager *psm = getPSM(server);
@ -317,7 +317,7 @@ onWrite(UA_Server *server, const UA_NodeId *sessionId, void *sessionContext,
static UA_StatusCode
addVariableValueSource(UA_Server *server, UA_ValueCallback valueCallback,
UA_NodeId node, UA_NodePropertyContext *context){
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
setNodeContext(server, node, context);
return setVariableNode_valueCallback(server, node, valueCallback);
}
@ -325,7 +325,7 @@ addVariableValueSource(UA_Server *server, UA_ValueCallback valueCallback,
static UA_StatusCode
addPubSubConnectionConfig(UA_Server *server, UA_PubSubConnectionDataType *pubsubConnection,
UA_NodeId *connectionId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -367,7 +367,7 @@ addPubSubConnectionConfig(UA_Server *server, UA_PubSubConnectionDataType *pubsub
static UA_StatusCode
addWriterGroupConfig(UA_Server *server, UA_NodeId connectionId,
UA_WriterGroupDataType *writerGroup, UA_NodeId *writerGroupId){
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -411,7 +411,7 @@ static UA_StatusCode
addDataSetWriterConfig(UA_Server *server, const UA_NodeId *writerGroupId,
UA_DataSetWriterDataType *dataSetWriter,
UA_NodeId *dataSetWriterId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -452,7 +452,7 @@ static UA_StatusCode
addReaderGroupConfig(UA_Server *server, UA_NodeId connectionId,
UA_ReaderGroupDataType *readerGroup,
UA_NodeId *readerGroupId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -474,7 +474,7 @@ static UA_StatusCode
addSubscribedVariables(UA_Server *server, UA_NodeId dataSetReaderId,
UA_DataSetReaderDataType *dataSetReader,
UA_DataSetMetaDataType *pMetaData) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -562,7 +562,7 @@ static UA_StatusCode
addDataSetReaderConfig(UA_Server *server, UA_NodeId readerGroupId,
UA_DataSetReaderDataType *dataSetReader,
UA_NodeId *dataSetReaderId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -715,7 +715,7 @@ addPubSubConnectionLocked(UA_Server *server,
const UA_NodeId *objectId, void *objectContext,
size_t inputSize, const UA_Variant *input,
size_t outputSize, UA_Variant *output) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -843,7 +843,7 @@ removeConnectionAction(UA_Server *server,
UA_StatusCode
addDataSetReaderRepresentation(UA_Server *server, UA_DataSetReader *dataSetReader){
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(dataSetReader->config.name.length > 512)
return UA_STATUSCODE_BADCONFIGURATIONERROR;
@ -935,7 +935,7 @@ addDataSetReaderLocked(UA_Server *server,
const UA_NodeId *objectId, void *objectContext,
size_t inputSize, const UA_Variant *input,
size_t outputSize, UA_Variant *output) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId dataSetReaderId;
UA_DataSetReaderDataType *dataSetReader= (UA_DataSetReaderDataType *) input[0].data;
@ -1028,7 +1028,7 @@ removeDataSetFolderAction(UA_Server *server,
UA_StatusCode
addPublishedDataItemsRepresentation(UA_Server *server,
UA_PublishedDataSet *publishedDataSet) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retVal = UA_STATUSCODE_GOOD;
if(publishedDataSet->config.name.length > 512)
@ -1198,7 +1198,7 @@ removePublishedDataSetAction(UA_Server *server,
UA_StatusCode
addSubscribedDataSetRepresentation(UA_Server *server,
UA_SubscribedDataSet *subscribedDataSet) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode ret = UA_STATUSCODE_GOOD;
if(subscribedDataSet->config.name.length > 512)
@ -1325,7 +1325,7 @@ writeContentMask(UA_Server *server, const UA_NodeId *sessionId,
UA_StatusCode
addWriterGroupRepresentation(UA_Server *server, UA_WriterGroup *writerGroup) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retVal = UA_STATUSCODE_GOOD;
if(writerGroup->config.name.length > 512)
@ -1505,7 +1505,7 @@ addReserveIdsLocked(UA_Server *server,
const UA_NodeId *objectId, void *objectContext,
size_t inputSize, const UA_Variant *input,
size_t outputSize, UA_Variant *output){
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubManager *psm = getPSM(server);
if(!psm)
@ -1572,7 +1572,7 @@ addReserveIdsAction(UA_Server *server,
UA_StatusCode
addReaderGroupRepresentation(UA_Server *server, UA_ReaderGroup *readerGroup) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(readerGroup->config.name.length > 512)
return UA_STATUSCODE_BADCONFIGURATIONERROR;
char rgName[513];
@ -1653,7 +1653,7 @@ addReaderGroupAction(UA_Server *server,
#ifdef UA_ENABLE_PUBSUB_INFORMATIONMODEL
static UA_Boolean
isValidParentNode(UA_Server *server, UA_NodeId parentId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Boolean retval = true;
const UA_Node *parentNodeType;
const UA_NodeId parentNodeTypeId = UA_NS0ID(SECURITYGROUPFOLDERTYPE);
@ -1673,7 +1673,7 @@ isValidParentNode(UA_Server *server, UA_NodeId parentId) {
static UA_StatusCode
updateSecurityGroupProperties(UA_Server *server, UA_NodeId *securityGroupNodeId,
UA_SecurityGroupConfig *config) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retval = UA_STATUSCODE_BAD;
UA_Variant value;
@ -1714,7 +1714,7 @@ updateSecurityGroupProperties(UA_Server *server, UA_NodeId *securityGroupNodeId,
UA_StatusCode
addSecurityGroupRepresentation(UA_Server *server, UA_SecurityGroup *securityGroup) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retval = UA_STATUSCODE_BAD;
UA_SecurityGroupConfig *securityGroupConfig = &securityGroup->config;
@ -1766,7 +1766,7 @@ addSecurityGroupRepresentation(UA_Server *server, UA_SecurityGroup *securityGrou
UA_StatusCode
addDataSetWriterRepresentation(UA_Server *server, UA_DataSetWriter *dataSetWriter) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retVal = UA_STATUSCODE_GOOD;
if(dataSetWriter->config.name.length > 512)
@ -1872,7 +1872,7 @@ addDataSetWriterLocked(UA_Server *server,
const UA_NodeId *objectId, void *objectContext,
size_t inputSize, const UA_Variant *input,
size_t outputSize, UA_Variant *output) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId dataSetWriterId;
UA_DataSetWriterDataType *dataSetWriterData = (UA_DataSetWriterDataType *)input->data;
@ -1924,7 +1924,7 @@ setSecurityKeysLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessi
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_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Validate the arguments */
if(!server || !input)
@ -2025,7 +2025,7 @@ getSecurityKeysLocked(UA_Server *server, const UA_NodeId *sessionId, void *sessi
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_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Validate the arguments */
if(!server || !input)
@ -2376,7 +2376,7 @@ UA_deletePubSubConfigMethodCallback(UA_Server *server,
UA_StatusCode
initPubSubNS0(UA_Server *server) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retVal = UA_STATUSCODE_GOOD;
UA_String profileArray[1];
@ -2496,7 +2496,7 @@ initPubSubNS0(UA_Server *server) {
UA_StatusCode
connectDataSetReaderToDataSet(UA_Server *server, UA_NodeId dsrId, UA_NodeId sdsId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retVal = UA_STATUSCODE_GOOD;

View File

@ -125,7 +125,7 @@ UA_DataSetReader_create(UA_PubSubManager *psm, UA_NodeId readerGroupIdentifier,
if(!psm || !dataSetReaderConfig)
return UA_STATUSCODE_BADINVALIDARGUMENT;
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* Search the reader group by the given readerGroupIdentifier */
UA_ReaderGroup *rg = UA_ReaderGroup_find(psm, readerGroupIdentifier);
@ -261,7 +261,7 @@ UA_DataSetReader_create(UA_PubSubManager *psm, UA_NodeId readerGroupIdentifier,
UA_StatusCode
UA_DataSetReader_remove(UA_PubSubManager *psm, UA_DataSetReader *dsr) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_ReaderGroup *rg = dsr->linkedReaderGroup;
UA_assert(rg);
@ -448,7 +448,7 @@ UA_TargetVariables_clear(UA_TargetVariables *tvs) {
UA_StatusCode
DataSetReader_createTargetVariables(UA_PubSubManager *psm, UA_DataSetReader *dsr,
size_t tvsSize, const UA_FieldTargetVariable *tvs) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(UA_PubSubState_isEnabled(dsr->head.state)) {
UA_LOG_WARNING_PUBSUB(psm->logging, dsr,

View File

@ -181,7 +181,7 @@ UA_ReaderGroup_create(UA_PubSubManager *psm, UA_NodeId connectionId,
void
UA_ReaderGroup_remove(UA_PubSubManager *psm, UA_ReaderGroup *rg) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PubSubConnection *connection = rg->linkedConnection;
UA_assert(connection);
@ -233,7 +233,7 @@ UA_ReaderGroup_remove(UA_PubSubManager *psm, UA_ReaderGroup *rg) {
static UA_StatusCode
UA_ReaderGroup_freezeConfiguration(UA_PubSubManager *psm, UA_ReaderGroup *rg) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(rg->configurationFrozen)
return UA_STATUSCODE_GOOD;
@ -335,7 +335,7 @@ UA_ReaderGroup_unfreezeConfiguration(UA_ReaderGroup *rg) {
UA_StatusCode
UA_ReaderGroup_setPubSubState(UA_PubSubManager *psm, UA_ReaderGroup *rg,
UA_PubSubState targetState) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(rg->deleteFlag && targetState != UA_PUBSUBSTATE_DISABLED) {
UA_LOG_WARNING_PUBSUB(psm->logging, rg,
@ -908,7 +908,7 @@ static UA_StatusCode
UA_ReaderGroup_connectMQTT(UA_PubSubManager *psm, UA_ReaderGroup *rg,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubConnection *c = rg->linkedConnection;
UA_NetworkAddressUrlDataType *addressUrl = (UA_NetworkAddressUrlDataType*)
@ -982,7 +982,7 @@ UA_ReaderGroup_canConnect(UA_ReaderGroup *rg) {
UA_StatusCode
UA_ReaderGroup_connect(UA_PubSubManager *psm, UA_ReaderGroup *rg, UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Is this a ReaderGroup with custom TransportSettings beyond the
* PubSubConnection? */

View File

@ -164,7 +164,7 @@ updateSKSKeyStorage(UA_PubSubManager *psm, UA_SecurityGroup *sg) {
static UA_StatusCode
initializeKeyStorageWithKeys(UA_PubSubManager *psm, UA_SecurityGroup *sg) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PubSubSecurityPolicy *policy =
findPubSubSecurityPolicy(psm, &sg->config.securityPolicyUri);

View File

@ -139,7 +139,7 @@ UA_DataSetWriter_create(UA_PubSubManager *psm,
const UA_NodeId writerGroup, const UA_NodeId dataSet,
const UA_DataSetWriterConfig *dswConfig,
UA_NodeId *writerIdentifier) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(!dswConfig)
return UA_STATUSCODE_BADINVALIDARGUMENT;
@ -350,7 +350,7 @@ UA_DataSetWriter_prepareDataSet(UA_PubSubManager *psm, UA_DataSetWriter *dsw,
UA_StatusCode
UA_DataSetWriter_remove(UA_PubSubManager *psm, UA_DataSetWriter *dsw) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_WriterGroup *wg = dsw->linkedWriterGroup;
UA_assert(wg);

View File

@ -70,7 +70,7 @@ UA_WriterGroup_publishCallback_server(UA_Server *server, UA_WriterGroup *wg) {
UA_StatusCode
UA_WriterGroup_addPublishCallback(UA_PubSubManager *psm, UA_WriterGroup *wg) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
/* Already registered */
if(wg->publishCallbackId != 0)
@ -246,7 +246,7 @@ UA_WriterGroup_create(UA_PubSubManager *psm, const UA_NodeId connection,
void
UA_WriterGroup_remove(UA_PubSubManager *psm, UA_WriterGroup *wg) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
UA_PubSubConnection *connection = wg->linkedConnection;
UA_assert(connection);
@ -299,7 +299,7 @@ UA_WriterGroup_remove(UA_PubSubManager *psm, UA_WriterGroup *wg) {
static UA_StatusCode
UA_WriterGroup_freezeConfiguration(UA_PubSubManager *psm, UA_WriterGroup *wg) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(wg->configurationFrozen)
return UA_STATUSCODE_GOOD;
@ -527,7 +527,7 @@ UA_WriterGroupConfig_clear(UA_WriterGroupConfig *writerGroupConfig) {
UA_StatusCode
UA_WriterGroup_setPubSubState(UA_PubSubManager *psm, UA_WriterGroup *wg,
UA_PubSubState targetState) {
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex, 1);
UA_LOCK_ASSERT(&psm->sc.server->serviceMutex);
if(wg->deleteFlag && targetState != UA_PUBSUBSTATE_DISABLED) {
UA_LOG_WARNING_PUBSUB(psm->logging, wg,
@ -1289,7 +1289,7 @@ static UA_StatusCode
UA_WriterGroup_connectUDPUnicast(UA_PubSubManager *psm, UA_WriterGroup *wg,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Already connected? */
if(wg->sendChannel != 0 && !validate)
@ -1370,7 +1370,7 @@ static UA_StatusCode
UA_WriterGroup_connectMQTT(UA_PubSubManager *psm, UA_WriterGroup *wg,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_PubSubConnection *c = wg->linkedConnection;
UA_NetworkAddressUrlDataType *addressUrl = (UA_NetworkAddressUrlDataType*)
@ -1438,7 +1438,7 @@ static UA_StatusCode
UA_WriterGroup_connect(UA_PubSubManager *psm, UA_WriterGroup *wg,
UA_Boolean validate) {
UA_Server *server = psm->sc.server;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check if already connected or no WG TransportSettings */
if(!UA_WriterGroup_canConnect(wg) && !validate)

View File

@ -470,7 +470,7 @@ UA_Server_addTimedCallback(UA_Server *server, UA_ServerCallback callback,
UA_StatusCode
addRepeatedCallback(UA_Server *server, UA_ServerCallback callback,
void *data, UA_Double interval_ms, UA_UInt64 *callbackId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
return server->config.eventLoop->addTimer(
server->config.eventLoop, (UA_Callback)callback, server, data, interval_ms, NULL,
UA_TIMERPOLICY_CURRENTTIME, callbackId);
@ -489,7 +489,7 @@ UA_Server_addRepeatedCallback(UA_Server *server, UA_ServerCallback callback,
UA_StatusCode
changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId,
UA_Double interval_ms) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
return server->config.eventLoop->
modifyTimer(server->config.eventLoop, callbackId, interval_ms,
NULL, UA_TIMERPOLICY_CURRENTTIME);
@ -507,7 +507,7 @@ UA_Server_changeRepeatedCallbackInterval(UA_Server *server, UA_UInt64 callbackId
void
removeCallback(UA_Server *server, UA_UInt64 callbackId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_EventLoop *el = server->config.eventLoop;
if(el)
el->removeTimer(el, callbackId);
@ -709,7 +709,7 @@ UA_Server_getStatistics(UA_Server *server) {
void
setServerLifecycleState(UA_Server *server, UA_LifecycleState state) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->state == state)
return;

View File

@ -20,8 +20,8 @@ UA_AsyncOperation_delete(UA_AsyncOperation *ar) {
static void
UA_AsyncManager_sendAsyncResponse(UA_AsyncManager *am, UA_Server *server,
UA_AsyncResponse *ar) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&am->queueLock, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_LOCK_ASSERT(&am->queueLock);
/* Get the session */
UA_Session* session = getSessionById(server, &ar->sessionId);
@ -65,8 +65,8 @@ UA_AsyncManager_sendAsyncResponse(UA_AsyncManager *am, UA_Server *server,
static UA_Boolean
integrateOperationResult(UA_AsyncManager *am, UA_Server *server,
UA_AsyncOperation *ao) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&am->queueLock, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_LOCK_ASSERT(&am->queueLock);
/* Grab the open request, so we can continue to construct the response */
UA_AsyncResponse *ar = ao->parent;
@ -95,7 +95,7 @@ integrateOperationResult(UA_AsyncManager *am, UA_Server *server,
static UA_UInt32
processAsyncResults(UA_Server *server) {
UA_AsyncManager *am = &server->asyncManager;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UInt32 count = 0;
UA_AsyncOperation *ao;
@ -441,7 +441,7 @@ UA_Server_processServiceOperationsAsync(UA_Server *server, UA_Session *session,
UA_UInt32
UA_AsyncManager_cancel(UA_Server *server, UA_Session *session, UA_UInt32 requestHandle) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_AsyncManager *am = &server->asyncManager;
UA_LOCK(&am->queueLock);

View File

@ -835,7 +835,7 @@ createServerConnection(UA_BinaryProtocolManager *bpm, const UA_String *serverUrl
UA_Server *server = bpm->sc.server;
UA_ServerConfig *config = &server->config;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Extract the protocol, hostname and port from the url */
UA_String hostname = UA_STRING_NULL;
@ -1025,7 +1025,7 @@ attemptReverseConnect(UA_BinaryProtocolManager *bpm, reverse_connect_context *co
UA_ServerConfig *config = &server->config;
UA_EventLoop *el = config->eventLoop;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Find a TCP ConnectionManager */
UA_String tcpString = UA_STRING_STATIC("tcp");

View File

@ -906,7 +906,7 @@ addModellingRules(UA_Server *server) {
* example server time. */
UA_StatusCode
initNS0(UA_Server *server) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Initialize base nodes which are always required an cannot be created
* through the NS compiler */

View File

@ -240,7 +240,7 @@ createSubscriptionObject(UA_Server *server, UA_Session *session,
static UA_StatusCode
setSessionSubscriptionDiagnostics(UA_Server *server, UA_Session *session,
UA_DataValue *value) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Get the current session */
size_t sdSize = session->subscriptionsSize;

View File

@ -281,7 +281,7 @@ UA_Boolean
UA_Server_processRequest(UA_Server *server, UA_SecureChannel *channel,
UA_UInt32 requestId, UA_ServiceDescription *sd,
const UA_Request *request, UA_Response *response) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Set the authenticationToken from the create session request to help
* fuzzing cover more lines */

View File

@ -77,7 +77,7 @@ getUserWriteMask(UA_Server *server, const UA_Session *session,
if(session == &server->adminSession)
return 0xFFFFFFFF; /* the local admin user has all rights */
UA_UInt32 mask = head->writeMask;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UNLOCK(&server->serviceMutex);
mask &= server->config.accessControl.
getUserRightsMask(server, &server->config.accessControl,
@ -94,7 +94,7 @@ getUserAccessLevel(UA_Server *server, const UA_Session *session,
if(session == &server->adminSession)
return 0xFF; /* the local admin user has all rights */
UA_Byte retval = node->accessLevel;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UNLOCK(&server->serviceMutex);
retval &= server->config.accessControl.
getUserAccessLevel(server, &server->config.accessControl,
@ -110,7 +110,7 @@ getUserExecutable(UA_Server *server, const UA_Session *session,
const UA_MethodNode *node) {
if(session == &server->adminSession)
return true; /* the local admin user has all rights */
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UNLOCK(&server->serviceMutex);
UA_Boolean userExecutable = node->executable;
userExecutable &=
@ -154,7 +154,7 @@ static UA_StatusCode
readValueAttributeFromNode(UA_Server *server, UA_Session *session,
const UA_VariableNode *vn, UA_DataValue *v,
UA_NumericRange *rangeptr) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Update the value by the user callback */
if(vn->value.data.callback.onRead) {
UA_UNLOCK(&server->serviceMutex);
@ -194,7 +194,7 @@ readValueAttributeFromDataSource(UA_Server *server, UA_Session *session,
const UA_VariableNode *vn, UA_DataValue *v,
UA_TimestampsToReturn timestamps,
UA_NumericRange *rangeptr) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(!vn->value.dataSource.read)
return UA_STATUSCODE_BADINTERNALERROR;
UA_Boolean sourceTimeStamp = (timestamps == UA_TIMESTAMPSTORETURN_SOURCE ||
@ -638,7 +638,7 @@ void
Service_Read(UA_Server *server, UA_Session *session,
const UA_ReadRequest *request, UA_ReadResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing ReadRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check if the timestampstoreturn is valid */
if(request->timestampsToReturn > UA_TIMESTAMPSTORETURN_NEITHER) {
@ -659,7 +659,7 @@ Service_Read(UA_Server *server, UA_Session *session,
return;
}
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
response->responseHeader.serviceResult =
UA_Server_processServiceOperations(server, session,
@ -675,7 +675,7 @@ UA_DataValue
readWithSession(UA_Server *server, UA_Session *session,
const UA_ReadValueId *item,
UA_TimestampsToReturn timestampsToReturn) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_DataValue dv;
UA_DataValue_init(&dv);
@ -695,7 +695,7 @@ readWithSession(UA_Server *server, UA_Session *session,
UA_StatusCode
readWithReadValue(UA_Server *server, const UA_NodeId *nodeId,
const UA_AttributeId attributeId, void *v) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Call the read service */
UA_ReadValueId item;
@ -753,7 +753,7 @@ UA_StatusCode
readObjectProperty(UA_Server *server, const UA_NodeId objectId,
const UA_QualifiedName propertyName,
UA_Variant *value) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Create a BrowsePath to get the target NodeId */
UA_RelativePathElement rpe;
@ -1412,7 +1412,7 @@ writeNodeValueAttribute(UA_Server *server, UA_Session *session,
const UA_String *indexRange) {
UA_assert(node != NULL);
UA_assert(session != NULL);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Parse the range */
UA_NumericRange range;
@ -1824,7 +1824,7 @@ Service_Write(UA_Server *server, UA_Session *session,
UA_assert(session != NULL);
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing WriteRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxNodesPerWrite != 0 &&
request->nodesToWriteSize > server->config.maxNodesPerWrite) {
@ -1867,7 +1867,7 @@ UA_StatusCode
writeAttribute(UA_Server *server, UA_Session *session,
const UA_NodeId *nodeId, const UA_AttributeId attributeId,
const void *attr, const UA_DataType *attr_type) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_WriteValue wvalue;
UA_WriteValue_init(&wvalue);
@ -1907,7 +1907,7 @@ Service_HistoryRead(UA_Server *server, UA_Session *session,
const UA_HistoryReadRequest *request,
UA_HistoryReadResponse *response) {
UA_assert(session != NULL);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.historyDatabase.context == NULL) {
response->responseHeader.serviceResult = UA_STATUSCODE_BADNOTSUPPORTED;
return;
@ -2015,7 +2015,7 @@ Service_HistoryUpdate(UA_Server *server, UA_Session *session,
const UA_HistoryUpdateRequest *request,
UA_HistoryUpdateResponse *response) {
UA_assert(session != NULL);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
response->resultsSize = request->historyUpdateDetailsSize;
response->results = (UA_HistoryUpdateResult*)
@ -2089,7 +2089,7 @@ UA_StatusCode
writeObjectProperty(UA_Server *server, const UA_NodeId objectId,
const UA_QualifiedName propertyName,
const UA_Variant value) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_RelativePathElement rpe;
UA_RelativePathElement_init(&rpe);
rpe.referenceTypeId = UA_NS0ID(HASPROPERTY);

View File

@ -94,7 +94,7 @@ void Service_FindServers(UA_Server *server, UA_Session *session,
const UA_FindServersRequest *request,
UA_FindServersResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing FindServersRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Return the server itself? */
UA_Boolean foundSelf = false;
@ -217,7 +217,7 @@ void
Service_FindServersOnNetwork(UA_Server *server, UA_Session *session,
const UA_FindServersOnNetworkRequest *request,
UA_FindServersOnNetworkResponse *response) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_DiscoveryManager *dm = (UA_DiscoveryManager*)
getServerComponentByName(server, UA_STRING("discovery"));
@ -463,7 +463,7 @@ void
Service_GetEndpoints(UA_Server *server, UA_Session *session,
const UA_GetEndpointsRequest *request,
UA_GetEndpointsResponse *response) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* If the client expects to see a specific endpointurl, mirror it back. If
* not, clone the endpoints with the discovery url of all networklayers. */
@ -516,7 +516,7 @@ process_RegisterServer(UA_Server *server, UA_Session *session,
UA_StatusCode **responseConfigurationResults,
size_t *responseDiagnosticInfosSize,
UA_DiagnosticInfo *responseDiagnosticInfos) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_DiscoveryManager *dm = (UA_DiscoveryManager*)
getServerComponentByName(server, UA_STRING("discovery"));
@ -685,7 +685,7 @@ void Service_RegisterServer(UA_Server *server, UA_Session *session,
UA_RegisterServerResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing RegisterServerRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
process_RegisterServer(server, session, &request->requestHeader, &request->server, 0,
NULL, &response->responseHeader, 0, NULL, 0, NULL);
}
@ -695,7 +695,7 @@ void Service_RegisterServer2(UA_Server *server, UA_Session *session,
UA_RegisterServer2Response *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing RegisterServer2Request");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
process_RegisterServer(server, session, &request->requestHeader, &request->server,
request->discoveryConfigurationSize, request->discoveryConfiguration,
&response->responseHeader, &response->configurationResultsSize,

View File

@ -201,7 +201,7 @@ static void
callWithMethodAndObject(UA_Server *server, UA_Session *session,
const UA_CallMethodRequest *request, UA_CallMethodResult *result,
const UA_MethodNode *method, const UA_ObjectNode *object) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Verify the object's NodeClass */
if(object->head.nodeClass != UA_NODECLASS_OBJECT &&
@ -506,7 +506,7 @@ Operation_CallMethod(UA_Server *server, UA_Session *session, void *context,
void Service_Call(UA_Server *server, UA_Session *session,
const UA_CallRequest *request, UA_CallResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing CallRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxNodesPerMethodCall != 0 &&
request->methodsToCallSize > server->config.maxNodesPerMethodCall) {

View File

@ -219,7 +219,7 @@ checkAdjustMonitoredItemParams(UA_Server *server, UA_Session *session,
const UA_DataType* valueType,
UA_MonitoringParameters *params,
UA_ExtensionObject *filterResult) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check the filter */
if(mon->itemToMonitor.attributeId == UA_ATTRIBUTEID_EVENTNOTIFIER) {
@ -353,7 +353,7 @@ Operation_CreateMonitoredItem(UA_Server *server, UA_Session *session,
struct createMonContext *cmc,
const UA_MonitoredItemCreateRequest *request,
UA_MonitoredItemCreateResult *result) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check available capacity */
if(!cmc->localMon &&
@ -505,7 +505,7 @@ Service_CreateMonitoredItems(UA_Server *server, UA_Session *session,
UA_CreateMonitoredItemsResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing CreateMonitoredItemsRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check the upper bound for the number of items */
if(server->config.maxMonitoredItemsPerCall != 0 &&
@ -779,7 +779,7 @@ Service_ModifyMonitoredItems(UA_Server *server, UA_Session *session,
UA_ModifyMonitoredItemsResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing ModifyMonitoredItemsRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxMonitoredItemsPerCall != 0 &&
request->itemsToModifySize > server->config.maxMonitoredItemsPerCall) {
@ -834,7 +834,7 @@ Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
const UA_SetMonitoringModeRequest *request,
UA_SetMonitoringModeResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing SetMonitoringMode");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check the max number if items */
if(server->config.maxMonitoredItemsPerCall != 0 &&
@ -870,7 +870,7 @@ Service_SetMonitoringMode(UA_Server *server, UA_Session *session,
static void
Operation_DeleteMonitoredItem(UA_Server *server, UA_Session *session, UA_Subscription *sub,
const UA_UInt32 *monitoredItemId, UA_StatusCode *result) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_MonitoredItem *mon = UA_Subscription_getMonitoredItem(sub, *monitoredItemId);
if(!mon) {
*result = UA_STATUSCODE_BADMONITOREDITEMIDINVALID;
@ -885,7 +885,7 @@ Service_DeleteMonitoredItems(UA_Server *server, UA_Session *session,
UA_DeleteMonitoredItemsResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing DeleteMonitoredItemsRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxMonitoredItemsPerCall != 0 &&
request->monitoredItemIdsSize > server->config.maxMonitoredItemsPerCall) {

View File

@ -601,7 +601,7 @@ copyChild(UA_Server *server, UA_Session *session,
const UA_NodeId *destinationNodeId,
const UA_ReferenceDescription *rd) {
UA_assert(session);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Is there an existing child with the browsename? */
UA_NodeId existingChild = UA_NODEID_NULL;
@ -1028,7 +1028,7 @@ addNode_raw(UA_Server *server, UA_Session *session, void *nodeContext,
const UA_AddNodesItem *item, UA_NodeId *outNewNodeId) {
/* Do not check access for server */
if(session != &server->adminSession && server->config.accessControl.allowAddNode) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UNLOCK(&server->serviceMutex);
if(!server->config.accessControl.
allowAddNode(server, &server->config.accessControl,
@ -1217,7 +1217,7 @@ Operation_addNode_begin(UA_Server *server, UA_Session *session, void *nodeContex
static UA_StatusCode
recursiveCallConstructors(UA_Server *server, UA_Session *session,
const UA_NodeId *nodeId, const UA_Node *type) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Browse the children */
UA_BrowseDescription bd;
@ -1608,7 +1608,7 @@ Service_AddNodes(UA_Server *server, UA_Session *session,
const UA_AddNodesRequest *request,
UA_AddNodesResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing AddNodesRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxNodesPerNodeManagement != 0 &&
request->nodesToAddSize > server->config.maxNodesPerNodeManagement) {
@ -1631,7 +1631,7 @@ addNode(UA_Server *server, const UA_NodeClass nodeClass, const UA_NodeId request
const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
const void *attr, const UA_DataType *attributeType,
void *nodeContext, UA_NodeId *outNewNodeId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Create the AddNodesItem */
UA_AddNodesItem item;
@ -1796,7 +1796,7 @@ hasParentRef(const UA_NodeHead *head, const UA_ReferenceTypeSet *refSet,
static void
deconstructNodeSet(UA_Server *server, UA_Session *session,
UA_ReferenceTypeSet *hierarchRefsSet, RefTree *refTree) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Deconstruct the nodes based on the RefTree entries, parent nodes first */
for(size_t i = 0; i < refTree->size; i++) {
@ -1951,7 +1951,7 @@ deleteNodeSet(UA_Server *server, UA_Session *session,
static void
deleteNodeOperation(UA_Server *server, UA_Session *session, void *context,
const UA_DeleteNodesItem *item, UA_StatusCode *result) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Do not check access for server */
if(session != &server->adminSession && server->config.accessControl.allowDeleteNode) {
@ -2028,7 +2028,7 @@ Service_DeleteNodes(UA_Server *server, UA_Session *session,
UA_DeleteNodesResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing DeleteNodesRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxNodesPerNodeManagement != 0 &&
request->nodesToDeleteSize > server->config.maxNodesPerNodeManagement) {
@ -2057,7 +2057,7 @@ UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
UA_StatusCode
deleteNode(UA_Server *server, const UA_NodeId nodeId,
UA_Boolean deleteReferences) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_DeleteNodesItem item;
item.deleteTargetReferences = deleteReferences;
item.nodeId = nodeId;
@ -2075,7 +2075,7 @@ Operation_addReference(UA_Server *server, UA_Session *session, void *context,
const UA_AddReferencesItem *item, UA_StatusCode *retval) {
(void)context;
UA_assert(session);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check access rights */
if(session != &server->adminSession && server->config.accessControl.allowAddReference) {
@ -2203,7 +2203,7 @@ Service_AddReferences(UA_Server *server, UA_Session *session,
UA_AddReferencesResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing AddReferencesRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_assert(session);
if(server->config.maxNodesPerNodeManagement != 0 &&
@ -2250,7 +2250,7 @@ Operation_deleteReference(UA_Server *server, UA_Session *session, void *context,
/* Do not check access for server */
if(session != &server->adminSession &&
server->config.accessControl.allowDeleteReference) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UNLOCK(&server->serviceMutex);
if (!server->config.accessControl.
allowDeleteReference(server, &server->config.accessControl,
@ -2323,7 +2323,7 @@ Service_DeleteReferences(UA_Server *server, UA_Session *session,
UA_DeleteReferencesResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing DeleteReferencesRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->config.maxNodesPerNodeManagement != 0 &&
request->referencesToDeleteSize > server->config.maxNodesPerNodeManagement) {
@ -2484,7 +2484,7 @@ setDataSource(UA_Server *server, UA_Session *session,
UA_StatusCode
setVariableNode_dataSource(UA_Server *server, const UA_NodeId nodeId,
const UA_DataSource dataSource) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
return UA_Server_editNode(server, &server->adminSession, &nodeId,
UA_NODEATTRIBUTESMASK_VALUE, UA_REFERENCETYPESET_NONE,
UA_BROWSEDIRECTION_INVALID,
@ -2803,7 +2803,7 @@ UA_StatusCode
setMethodNode_callback(UA_Server *server,
const UA_NodeId methodNodeId,
UA_MethodCallback methodCallback) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
return UA_Server_editNode(server, &server->adminSession, &methodNodeId,
0, UA_REFERENCETYPESET_NONE, UA_BROWSEDIRECTION_INVALID,
(UA_EditNodeCallback)editMethodCallback,

View File

@ -30,7 +30,7 @@ UA_Server_removeSession(UA_Server *server, session_list_entry *sentry,
UA_ShutdownReason shutdownReason) {
UA_Session *session = &sentry->session;
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Remove the Subscriptions */
#ifdef UA_ENABLE_SUBSCRIPTIONS
@ -102,7 +102,7 @@ UA_Server_removeSession(UA_Server *server, session_list_entry *sentry,
UA_StatusCode
UA_Server_removeSessionByToken(UA_Server *server, const UA_NodeId *token,
UA_ShutdownReason shutdownReason) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
session_list_entry *entry;
LIST_FOREACH(entry, &server->sessions, pointers) {
if(UA_NodeId_equal(&entry->session.authenticationToken, token)) {
@ -115,7 +115,7 @@ UA_Server_removeSessionByToken(UA_Server *server, const UA_NodeId *token,
void
UA_Server_cleanupSessions(UA_Server *server, UA_DateTime nowMonotonic) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
session_list_entry *sentry, *temp;
LIST_FOREACH_SAFE(sentry, &server->sessions, pointers, temp) {
/* Session has timed out? */
@ -133,7 +133,7 @@ UA_Server_cleanupSessions(UA_Server *server, UA_DateTime nowMonotonic) {
UA_Session *
getSessionByToken(UA_Server *server, const UA_NodeId *token) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
session_list_entry *current = NULL;
LIST_FOREACH(current, &server->sessions, pointers) {
@ -158,7 +158,7 @@ getSessionByToken(UA_Server *server, const UA_NodeId *token) {
UA_Session *
getSessionById(UA_Server *server, const UA_NodeId *sessionId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
session_list_entry *current = NULL;
LIST_FOREACH(current, &server->sessions, pointers) {
@ -229,7 +229,7 @@ signCreateSessionResponse(UA_Server *server, UA_SecureChannel *channel,
UA_StatusCode
UA_Server_createSession(UA_Server *server, UA_SecureChannel *channel,
const UA_CreateSessionRequest *request, UA_Session **session) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(server->sessionCount >= server->config.maxSessions) {
UA_LOG_WARNING_CHANNEL(server->config.logging, channel,
@ -273,7 +273,7 @@ void
Service_CreateSession(UA_Server *server, UA_SecureChannel *channel,
const UA_CreateSessionRequest *request,
UA_CreateSessionResponse *response) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_LOG_DEBUG_CHANNEL(server->config.logging, channel, "Trying to create session");
if(channel->securityMode == UA_MESSAGESECURITYMODE_SIGN ||
@ -699,7 +699,7 @@ void
Service_ActivateSession(UA_Server *server, UA_SecureChannel *channel,
const UA_ActivateSessionRequest *req,
UA_ActivateSessionResponse *resp) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
const UA_EndpointDescription *ed = NULL;
const UA_UserTokenPolicy *utp = NULL;
const UA_SecurityPolicy *tokenSp = NULL;
@ -912,7 +912,7 @@ void
Service_CloseSession(UA_Server *server, UA_SecureChannel *channel,
const UA_CloseSessionRequest *request,
UA_CloseSessionResponse *response) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Part 4, 5.6.4: When the CloseSession Service is called before the Session
* is successfully activated, the Server shall reject the request if the

View File

@ -29,7 +29,7 @@ setSubscriptionSettings(UA_Server *server, UA_Subscription *subscription,
UA_UInt32 requestedMaxKeepAliveCount,
UA_UInt32 maxNotificationsPerPublish,
UA_Byte priority) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* re-parameterize the subscription */
UA_BOUNDEDVALUE_SETWBOUNDS(server->config.publishingIntervalLimits,
@ -55,7 +55,7 @@ void
Service_CreateSubscription(UA_Server *server, UA_Session *session,
const UA_CreateSubscriptionRequest *request,
UA_CreateSubscriptionResponse *response) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check limits for the number of subscriptions */
if(((server->config.maxSubscriptions != 0) &&
@ -132,7 +132,7 @@ Service_ModifySubscription(UA_Server *server, UA_Session *session,
UA_ModifySubscriptionResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing ModifySubscriptionRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Subscription *sub = UA_Session_getSubscriptionById(session, request->subscriptionId);
if(!sub) {
@ -197,7 +197,7 @@ Operation_SetPublishingMode(UA_Server *server, UA_Session *session,
const UA_Boolean *publishingEnabled,
const UA_UInt32 *subscriptionId,
UA_StatusCode *result) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Subscription *sub = UA_Session_getSubscriptionById(session, *subscriptionId);
if(!sub) {
*result = UA_STATUSCODE_BADSUBSCRIPTIONIDINVALID;
@ -219,7 +219,7 @@ Service_SetPublishingMode(UA_Server *server, UA_Session *session,
UA_SetPublishingModeResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing SetPublishingModeRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Boolean publishingEnabled = request->publishingEnabled; /* request is const */
response->responseHeader.serviceResult =
@ -237,7 +237,7 @@ Service_Publish(UA_Server *server, UA_Session *session,
const UA_PublishRequest *request, UA_UInt32 requestId) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing PublishRequest with RequestId %u", requestId);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Return an error if the session has no subscription */
if(TAILQ_EMPTY(&session->subscriptions))
@ -369,7 +369,7 @@ Service_DeleteSubscriptions(UA_Server *server, UA_Session *session,
UA_DeleteSubscriptionsResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing DeleteSubscriptionsRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
response->responseHeader.serviceResult =
UA_Server_processServiceOperations(server, session,
@ -384,7 +384,7 @@ Service_Republish(UA_Server *server, UA_Session *session,
UA_RepublishResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing RepublishRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Get the subscription */
UA_Subscription *sub = UA_Session_getSubscriptionById(session, request->subscriptionId);
@ -473,7 +473,7 @@ Operation_TransferSubscription(UA_Server *server, UA_Session *session,
/* Check with AccessControl if the transfer is allowed */
if(server->config.accessControl.allowTransferSubscription) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_UNLOCK(&server->serviceMutex);
if(!server->config.accessControl.
allowTransferSubscription(server, &server->config.accessControl,
@ -606,7 +606,7 @@ void Service_TransferSubscriptions(UA_Server *server, UA_Session *session,
UA_TransferSubscriptionsResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing TransferSubscriptionsRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
response->responseHeader.serviceResult =
UA_Server_processServiceOperations(server, session,

View File

@ -784,7 +784,7 @@ browse(struct BrowseContext *bc) {
/* Check AccessControl rights */
if(bc->session != &bc->server->adminSession) {
UA_LOCK_ASSERT(&bc->server->serviceMutex, 1);
UA_LOCK_ASSERT(&bc->server->serviceMutex);
UA_UNLOCK(&bc->server->serviceMutex);
if(!bc->server->config.accessControl.
allowBrowseNode(bc->server, &bc->server->config.accessControl,
@ -960,7 +960,7 @@ Operation_Browse(UA_Server *server, UA_Session *session, const UA_UInt32 *maxref
void Service_Browse(UA_Server *server, UA_Session *session,
const UA_BrowseRequest *request, UA_BrowseResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session, "Processing BrowseRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Test the number of operations in the request */
if(server->config.maxNodesPerBrowse != 0 &&
@ -1080,7 +1080,7 @@ Service_BrowseNext(UA_Server *server, UA_Session *session,
UA_BrowseNextResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing BrowseNextRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Boolean releaseContinuationPoints =
request->releaseContinuationPoints; /* request is const */
@ -1236,7 +1236,7 @@ Operation_TranslateBrowsePathToNodeIds(UA_Server *server, UA_Session *session,
const UA_UInt32 *nodeClassMask,
const UA_BrowsePath *path,
UA_BrowsePathResult *result) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(path->relativePath.elementsSize == 0) {
result->statusCode = UA_STATUSCODE_BADNOTHINGTODO;
@ -1362,8 +1362,8 @@ Operation_TranslateBrowsePathToNodeIds(UA_Server *server, UA_Session *session,
UA_BrowsePathResult
translateBrowsePathToNodeIds(UA_Server *server,
const UA_BrowsePath *browsePath) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
const UA_BrowsePath *browsePath) {
UA_LOCK_ASSERT(&server->serviceMutex);
UA_BrowsePathResult result;
UA_BrowsePathResult_init(&result);
UA_UInt32 nodeClassMask = 0; /* All node classes */
@ -1387,7 +1387,7 @@ Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
UA_TranslateBrowsePathsToNodeIdsResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing TranslateBrowsePathsToNodeIdsRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Test the number of operations in the request */
if(server->config.maxNodesPerTranslateBrowsePathsToNodeIds != 0 &&
@ -1408,7 +1408,7 @@ Service_TranslateBrowsePathsToNodeIds(UA_Server *server, UA_Session *session,
UA_BrowsePathResult
browseSimplifiedBrowsePath(UA_Server *server, const UA_NodeId origin,
size_t browsePathSize, const UA_QualifiedName *browsePath) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_BrowsePathResult bpr;
UA_BrowsePathResult_init(&bpr);
@ -1459,7 +1459,7 @@ void Service_RegisterNodes(UA_Server *server, UA_Session *session,
UA_RegisterNodesResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing RegisterNodesRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
//TODO: hang the nodeids to the session if really needed
if(request->nodesToRegisterSize == 0) {
@ -1486,7 +1486,7 @@ void Service_UnregisterNodes(UA_Server *server, UA_Session *session,
UA_UnregisterNodesResponse *response) {
UA_LOG_DEBUG_SESSION(server->config.logging, session,
"Processing UnRegisterNodesRequest");
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
//TODO: remove the nodeids from the session if really needed
if(request->nodesToUnregisterSize == 0)

View File

@ -26,7 +26,7 @@ void UA_Session_init(UA_Session *session) {
}
void UA_Session_clear(UA_Session *session, UA_Server* server) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Remove all Subscriptions. This may send out remaining publish
* responses. */

View File

@ -278,7 +278,7 @@ delayedFreeSubscription(void *app, void *context) {
void
UA_Subscription_delete(UA_Server *server, UA_Subscription *sub) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_EventLoop *el = server->config.eventLoop;
@ -944,7 +944,7 @@ UA_Subscription_publish(UA_Server *server, UA_Subscription *sub) {
void
UA_Subscription_resendData(UA_Server *server, UA_Subscription *sub) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_assert(server);
UA_assert(sub);
@ -1257,7 +1257,7 @@ removeMonitoredItemBackPointer(UA_Server *server, UA_Session *session,
void
UA_Server_registerMonitoredItem(UA_Server *server, UA_MonitoredItem *mon) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(mon->registered)
return;
@ -1289,7 +1289,7 @@ UA_Server_registerMonitoredItem(UA_Server *server, UA_MonitoredItem *mon) {
static void
UA_Server_unregisterMonitoredItem(UA_Server *server, UA_MonitoredItem *mon) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(!mon->registered)
return;
@ -1391,7 +1391,7 @@ delayedFreeMonitoredItem(void *app, void *context) {
void
UA_MonitoredItem_delete(UA_Server *server, UA_MonitoredItem *mon) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Remove the sampling callback */
UA_MonitoredItem_unregisterSampling(server, mon);
@ -1559,7 +1559,7 @@ UA_MonitoredItem_lockAndSample(UA_Server *server, UA_MonitoredItem *mon) {
UA_StatusCode
UA_MonitoredItem_registerSampling(UA_Server *server, UA_MonitoredItem *mon) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Sampling is already registered */
if(mon->samplingType != UA_MONITOREDITEMSAMPLINGTYPE_NONE)
@ -1601,7 +1601,7 @@ UA_MonitoredItem_registerSampling(UA_Server *server, UA_MonitoredItem *mon) {
void
UA_MonitoredItem_unregisterSampling(UA_Server *server, UA_MonitoredItem *mon) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
switch(mon->samplingType) {
case UA_MONITOREDITEMSAMPLINGTYPE_CYCLIC:

View File

@ -209,7 +209,7 @@ addConditionOptionalField(UA_Server *server, const UA_NodeId condition,
static UA_ConditionSource *
getConditionSource(UA_Server *server, const UA_NodeId *sourceId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_ConditionSource *cs;
LIST_FOREACH(cs, &server->conditionSources, listEntry) {
if(UA_NodeId_equal(&cs->conditionSourceId, sourceId))
@ -221,7 +221,7 @@ getConditionSource(UA_Server *server, const UA_NodeId *sourceId) {
static UA_Condition *
getCondition(UA_Server *server, const UA_NodeId *sourceId,
const UA_NodeId *conditionId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_ConditionSource *cs = getConditionSource(server, sourceId);
if(!cs)
return NULL;
@ -282,7 +282,7 @@ static UA_StatusCode
getConditionTwoStateVariableCallback(UA_Server *server, const UA_NodeId *branch,
UA_Condition *condition, UA_Boolean *removeBranch,
UA_TwoStateVariableCallbackType callbackType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode res = UA_STATUSCODE_GOOD;
/* That callbacks are defined in the userland. Release the server lock before. */
@ -327,7 +327,7 @@ static UA_StatusCode
callConditionTwoStateVariableCallback(UA_Server *server, const UA_NodeId *condition,
const UA_NodeId *conditionSource, UA_Boolean *removeBranch,
UA_TwoStateVariableCallbackType callbackType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_ConditionSource *source = getConditionSource(server, conditionSource);
if(!source)
@ -376,7 +376,7 @@ copyFieldParent(void *context, UA_ReferenceTarget *t) {
* EnabledState/Id) */
static UA_StatusCode
getFieldParentNodeId(UA_Server *server, const UA_NodeId *field, UA_NodeId *parent) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
*parent = UA_NODEID_NULL;
const UA_Node *fieldNode = UA_NODESTORE_GET(server, field);
@ -412,7 +412,7 @@ UA_Server_getFieldParentNodeId(UA_Server *server, const UA_NodeId *field, UA_Nod
static UA_StatusCode
getConditionFieldNodeId(UA_Server *server, const UA_NodeId *conditionNodeId,
const UA_QualifiedName* fieldName, UA_NodeId *outFieldNodeId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_BrowsePathResult bpr =
browseSimplifiedBrowsePath(server, *conditionNodeId, 1, fieldName);
@ -429,7 +429,7 @@ getConditionFieldPropertyNodeId(UA_Server *server, const UA_NodeId *originCondit
const UA_QualifiedName* variableFieldName,
const UA_QualifiedName* variablePropertyName,
UA_NodeId *outFieldPropertyNodeId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* 1) Find Variable Field of the Condition */
UA_BrowsePathResult bprConditionVariableField =
@ -457,7 +457,7 @@ getConditionFieldPropertyNodeId(UA_Server *server, const UA_NodeId *originCondit
static UA_StatusCode
getNodeIdValueOfConditionField(UA_Server *server, const UA_NodeId *condition,
UA_QualifiedName fieldName, UA_NodeId *outNodeId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
*outNodeId = UA_NODEID_NULL;
UA_NodeId nodeIdValue;
@ -609,7 +609,7 @@ static UA_StatusCode
updateConditionLastEventId(UA_Server *server, const UA_NodeId *triggeredEvent,
const UA_NodeId *conditionSource,
const UA_ByteString *lastEventId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Condition *cond = getCondition(server, conditionSource, triggeredEvent);
if(!cond) {
@ -634,7 +634,7 @@ updateConditionLastEventId(UA_Server *server, const UA_NodeId *triggeredEvent,
static void
setIsCallerAC(UA_Server *server, const UA_NodeId *condition,
const UA_NodeId *conditionSource, UA_Boolean isCallerAC) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Condition *cond = getCondition(server, conditionSource, condition);
if(!cond) {
@ -657,7 +657,7 @@ setIsCallerAC(UA_Server *server, const UA_NodeId *condition,
UA_Boolean
isConditionOrBranch(UA_Server *server, const UA_NodeId *condition,
const UA_NodeId *conditionSource, UA_Boolean *isCallerAC) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Condition *cond = getCondition(server, conditionSource, condition);
if(!cond) {
@ -680,7 +680,7 @@ isConditionOrBranch(UA_Server *server, const UA_NodeId *condition,
static UA_Boolean
isRetained(UA_Server *server, const UA_NodeId *condition) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Get EnabledStateId NodeId */
UA_NodeId retainNodeId;
@ -722,7 +722,7 @@ UA_Server_isRetained(UA_Server *server, const UA_NodeId *condition) {
static UA_Boolean
isTwoStateVariableInTrueState(UA_Server *server, const UA_NodeId *condition,
const UA_QualifiedName *twoStateVariable) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Get TwoStateVariableId NodeId */
UA_NodeId twoStateVariableIdNodeId;
@ -767,7 +767,7 @@ UA_Server_isTwoStateVariableInTrueState(UA_Server *server, const UA_NodeId *cond
static UA_StatusCode
enteringDisabledState(UA_Server *server, const UA_NodeId *conditionId,
const UA_NodeId *conditionSource) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Condition *cond = getCondition(server, conditionSource, conditionId);
if(!cond) {
@ -833,7 +833,7 @@ static UA_StatusCode
enteringEnabledState(UA_Server *server,
const UA_NodeId *conditionId,
const UA_NodeId *conditionSource) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Get Condition */
UA_Condition *cond = getCondition(server, conditionSource, conditionId);
@ -1669,7 +1669,7 @@ confirmMethodCallback(UA_Server *server, const UA_NodeId *sessionId,
static UA_StatusCode
setRefreshMethodEventFields(UA_Server *server, const UA_NodeId *refreshEventNodId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_QualifiedName fieldSeverity = UA_QUALIFIEDNAME(0, CONDITION_FIELD_SEVERITY);
UA_QualifiedName fieldSourceName = UA_QUALIFIEDNAME(0, CONDITION_FIELD_SOURCENAME);
@ -1714,7 +1714,7 @@ setRefreshMethodEventFields(UA_Server *server, const UA_NodeId *refreshEventNodI
static UA_StatusCode
createRefreshMethodEvents(UA_Server *server, UA_NodeId *outRefreshStartNodId,
UA_NodeId *outRefreshEndNodId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId refreshStartEventTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_REFRESHSTARTEVENTTYPE);
UA_NodeId refreshEndEventTypeNodeId = UA_NODEID_NUMERIC(0, UA_NS0ID_REFRESHENDEVENTTYPE);
@ -1733,7 +1733,7 @@ createRefreshMethodEvents(UA_Server *server, UA_NodeId *outRefreshStartNodId,
static UA_StatusCode
setRefreshMethodEvents(UA_Server *server, const UA_NodeId *refreshStartNodId,
const UA_NodeId *refreshEndNodId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Set Standard Fields for RefreshStart */
UA_StatusCode retval = setRefreshMethodEventFields(server, refreshStartNodId);
@ -1749,7 +1749,7 @@ setRefreshMethodEvents(UA_Server *server, const UA_NodeId *refreshStartNodId,
static UA_Boolean
isConditionSourceInMonitoredItem(UA_Server *server, const UA_MonitoredItem *monitoredItem,
const UA_NodeId *conditionSource){
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* TODO: check also other hierarchical references */
UA_ReferenceTypeSet refs = UA_REFTYPESET(UA_REFERENCETYPEINDEX_ORGANIZES);
@ -1762,7 +1762,7 @@ isConditionSourceInMonitoredItem(UA_Server *server, const UA_MonitoredItem *moni
static UA_StatusCode
refreshLogic(UA_Server *server, const UA_NodeId *refreshStartNodId,
const UA_NodeId *refreshEndNodId, UA_MonitoredItem *monitoredItem) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_assert(monitoredItem != NULL);
/* 1. Trigger RefreshStartEvent */
@ -1916,7 +1916,7 @@ refreshMethodCallback(UA_Server *server, const UA_NodeId *sessionId,
static UA_StatusCode
setConditionInConditionList(UA_Server *server, const UA_NodeId *conditionNodeId,
UA_ConditionSource *conditionSourceEntry) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Condition *conditionListEntry = (UA_Condition*)UA_malloc(sizeof(UA_Condition));
if(!conditionListEntry)
@ -1946,7 +1946,7 @@ setConditionInConditionList(UA_Server *server, const UA_NodeId *conditionNodeId,
static UA_StatusCode
appendConditionEntry(UA_Server *server, const UA_NodeId *conditionNodeId,
const UA_NodeId *conditionSourceNodeId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* See if the ConditionSource Entry already exists*/
UA_ConditionSource *source = getConditionSource(server, conditionSourceNodeId);
@ -1993,7 +1993,7 @@ deleteCondition(UA_Condition *cond) {
void
UA_ConditionList_delete(UA_Server *server) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_ConditionSource *source, *tmp_source;
LIST_FOREACH_SAFE(source, &server->conditionSources, listEntry, tmp_source) {
@ -2015,7 +2015,7 @@ UA_ConditionList_delete(UA_Server *server) {
UA_StatusCode
UA_getConditionId(UA_Server *server, const UA_NodeId *conditionNodeId,
UA_NodeId *outConditionId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Get ConditionSource Entry */
UA_ConditionSource *source;
@ -2044,7 +2044,7 @@ UA_getConditionId(UA_Server *server, const UA_NodeId *conditionNodeId,
* subtypes inverse reference. */
static UA_Boolean
doesHasEventSourceReferenceExist(UA_Server *server, const UA_NodeId nodeToCheck) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId hasEventSourceId = UA_NODEID_NUMERIC(0, UA_NS0ID_HASEVENTSOURCE);
const UA_Node* node = UA_NODESTORE_GET(server, &nodeToCheck);
@ -2068,7 +2068,7 @@ static UA_StatusCode
setStandardConditionFields(UA_Server *server, const UA_NodeId* condition,
const UA_NodeId* conditionType, const UA_NodeId* conditionSource,
const UA_QualifiedName* conditionName) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Set Fields */
/* 1.Set EventType */
@ -2269,7 +2269,7 @@ setStandardConditionFields(UA_Server *server, const UA_NodeId* condition,
static UA_StatusCode
setTwoStateVariableCallbacks(UA_Server *server, const UA_NodeId* condition,
const UA_NodeId* conditionType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Set EnabledState Callback */
UA_NodeId twoStateVariableIdNodeId = UA_NODEID_NULL;
@ -2348,7 +2348,7 @@ setTwoStateVariableCallbacks(UA_Server *server, const UA_NodeId* condition,
static UA_StatusCode
setConditionVariableCallbacks(UA_Server *server, const UA_NodeId *condition,
const UA_NodeId *conditionType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retval = UA_STATUSCODE_GOOD;
UA_QualifiedName conditionVariableName[2] = {
@ -2385,7 +2385,7 @@ setConditionVariableCallbacks(UA_Server *server, const UA_NodeId *condition,
static UA_StatusCode
setConditionMethodCallbacks(UA_Server *server, const UA_NodeId* condition,
const UA_NodeId* conditionType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId methodId[7] = {
{0, UA_NODEIDTYPE_NUMERIC, {UA_NS0ID_CONDITIONTYPE_DISABLE}},
@ -2416,7 +2416,7 @@ setConditionMethodCallbacks(UA_Server *server, const UA_NodeId* condition,
static UA_StatusCode
setStandardConditionCallbacks(UA_Server *server, const UA_NodeId* condition,
const UA_NodeId* conditionType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retval = setTwoStateVariableCallbacks(server, condition, conditionType);
CONDITION_ASSERT_RETURN_RETVAL(retval, "Set TwoStateVariable Callback failed",);
@ -2445,7 +2445,7 @@ static UA_StatusCode
addCondition_finish(UA_Server *server, const UA_NodeId conditionId,
const UA_NodeId conditionType, const UA_QualifiedName conditionName,
const UA_NodeId conditionSource, const UA_NodeId hierarchialReferenceType) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_StatusCode retval = addNode_finish(server, &server->adminSession, &conditionId);
CONDITION_ASSERT_RETURN_RETVAL(retval, "Finish node failed",);
@ -2616,7 +2616,7 @@ addOptionalVariableField(UA_Server *server, const UA_NodeId *originCondition,
const UA_QualifiedName *fieldName,
const UA_VariableNode *optionalVariableFieldNode,
UA_NodeId *outOptionalVariable) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_VariableAttributes vAttr = UA_VariableAttributes_default;
vAttr.valueRank = optionalVariableFieldNode->valueRank;
@ -2657,7 +2657,7 @@ addOptionalObjectField(UA_Server *server, const UA_NodeId *originCondition,
const UA_QualifiedName* fieldName,
const UA_ObjectNode *optionalObjectFieldNode,
UA_NodeId *outOptionalObject) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_ObjectAttributes oAttr = UA_ObjectAttributes_default;
oAttr.displayName = UA_Session_getNodeDisplayName(&server->adminSession,
@ -2695,7 +2695,7 @@ static UA_StatusCode
addConditionOptionalField(UA_Server *server, const UA_NodeId condition,
const UA_NodeId conditionType, const UA_QualifiedName fieldName,
UA_NodeId *outOptionalNode) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
#ifdef CONDITIONOPTIONALFIELDS_SUPPORT
/* Get optional Field NodId from ConditionType -> user should give the
@ -2782,7 +2782,7 @@ UA_Server_addConditionOptionalField(UA_Server *server, const UA_NodeId condition
static UA_StatusCode
setConditionField(UA_Server *server, const UA_NodeId condition,
const UA_Variant* value, const UA_QualifiedName fieldName) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(value->arrayLength != 0 || value->data <= UA_EMPTY_ARRAY_SENTINEL) {
//TODO implement logic for array variants!
@ -2815,7 +2815,7 @@ setConditionVariableFieldProperty(UA_Server *server, const UA_NodeId condition,
const UA_Variant* value,
const UA_QualifiedName variableFieldName,
const UA_QualifiedName variablePropertyName) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(value->arrayLength != 0 || value->data <= UA_EMPTY_ARRAY_SENTINEL) {
//TODO implement logic for array variants!
@ -2863,7 +2863,7 @@ UA_Server_setConditionVariableFieldProperty(UA_Server *server, const UA_NodeId c
static UA_StatusCode
triggerConditionEvent(UA_Server *server, const UA_NodeId condition,
const UA_NodeId conditionSource, UA_ByteString *outEventId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Check if enabled */
UA_ByteString eventId = UA_BYTESTRING_NULL;
@ -2945,7 +2945,7 @@ UA_Server_deleteCondition(UA_Server *server, const UA_NodeId condition,
static UA_StatusCode
getLowLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *lowLimit) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Variant value;
UA_StatusCode retval =
readObjectProperty(server, conditionId,
@ -2956,7 +2956,7 @@ getLowLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *lowLimit) {
static UA_StatusCode
getLowLowLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *lowLowLimit) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Variant value;
UA_StatusCode retval =
readObjectProperty(server, conditionId,
@ -2967,7 +2967,7 @@ getLowLowLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *lowLowLimit)
static UA_StatusCode
getHighLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *highLimit) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Variant value;
UA_StatusCode retval =
readObjectProperty(server, conditionId,
@ -2978,7 +2978,7 @@ getHighLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *highLimit) {
static UA_StatusCode
getHighHighLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *highHighLimit) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_Variant value;
UA_StatusCode retval =
readObjectProperty(server, conditionId,
@ -2990,7 +2990,7 @@ getHighHighLimit(UA_Server *server, UA_NodeId conditionId, UA_Double *highHighLi
static UA_StatusCode
setLimitState(UA_Server *server, const UA_NodeId conditionId,
UA_Double limitValue) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_NodeId limitState;
UA_Double lowLowLimit;

View File

@ -76,7 +76,7 @@ detectVariantDeadband(const UA_Variant *value, const UA_Variant *oldValue,
static UA_Boolean
detectValueChange(UA_Server *server, UA_MonitoredItem *mon, const UA_DataValue *dv) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Status changes are always reported */
if(dv->hasStatus != mon->lastValue.hasStatus ||
@ -152,7 +152,7 @@ void
UA_MonitoredItem_processSampledValue(UA_Server *server, UA_MonitoredItem *mon,
UA_DataValue *value) {
UA_assert(mon->itemToMonitor.attributeId != UA_ATTRIBUTEID_EVENTNOTIFIER);
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Has the value changed (with the filters applied)? */
UA_Boolean changed = detectValueChange(server, mon, value);
@ -183,7 +183,7 @@ UA_MonitoredItem_processSampledValue(UA_Server *server, UA_MonitoredItem *mon,
void
UA_MonitoredItem_sample(UA_Server *server, UA_MonitoredItem *mon) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_assert(mon->itemToMonitor.attributeId != UA_ATTRIBUTEID_EVENTNOTIFIER);
UA_Subscription *sub = mon->subscription;

View File

@ -286,7 +286,7 @@ UA_StatusCode
triggerEvent(UA_Server *server, const UA_NodeId eventNodeId,
const UA_NodeId origin, UA_ByteString *outEventId,
const UA_Boolean deleteEventNode) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
UA_LOG_DEBUG(server->config.logging, UA_LOGCATEGORY_SERVER,
"Events: An event is triggered on node %N", origin);

View File

@ -924,7 +924,7 @@ UA_StatusCode
evaluateWhereClause(UA_Server *server, UA_Session *session, const UA_NodeId *eventNode,
const UA_ContentFilter *contentFilter,
UA_ContentFilterResult *contentFilterResult) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* An empty filter always succeeds */
if(contentFilter->elementsSize == 0)
@ -970,7 +970,7 @@ evaluateWhereClause(UA_Server *server, UA_Session *session, const UA_NodeId *eve
static UA_Boolean
isValidEvent(UA_Server *server, const UA_NodeId *validEventParent,
const UA_NodeId *eventId) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
/* Find the eventType variableNode */
UA_QualifiedName findName = UA_QUALIFIEDNAME(0, "EventType");
@ -1022,7 +1022,7 @@ UA_StatusCode
filterEvent(UA_Server *server, UA_Session *session,
const UA_NodeId *eventNode, UA_EventFilter *filter,
UA_EventFieldList *efl, UA_EventFilterResult *result) {
UA_LOCK_ASSERT(&server->serviceMutex, 1);
UA_LOCK_ASSERT(&server->serviceMutex);
if(filter->selectClausesSize == 0)
return UA_STATUSCODE_BADEVENTFILTERINVALID;