UA_Timer_init:
   47|     20|UA_Timer_init(UA_Timer *t) {
   48|     20|    memset(t, 0, sizeof(UA_Timer));
   49|     20|    UA_LOCK_INIT(&t->timerMutex);
   50|     20|}
UA_Timer_remove:
  221|     20|UA_Timer_remove(UA_Timer *t, UA_UInt64 callbackId) {
  222|     20|    UA_LOCK(&t->timerMutex);
  223|     20|    UA_TimerEntry *te = ZIP_FIND(UA_TimerIdTree, &t->idTree, &callbackId);
  ------------------
  |  |   73|     20|#define ZIP_FIND(name, head, key) name##_ZIP_FIND(head, key)
  ------------------
  224|     20|    if(!te) {
  ------------------
  |  Branch (224:8): [True: 20, False: 0]
  ------------------
  225|     20|        UA_UNLOCK(&t->timerMutex);
  226|     20|        return;
  227|     20|    }
  228|       |
  229|       |    /* The entry is either in the timer tree or in the process tree. If in the
  230|       |     * process tree, leave a sentinel (callback == NULL) to delete it during
  231|       |     * processing. Do not edit the process tree while iterating over it. */
  232|      0|    UA_Boolean processing = (ZIP_REMOVE(UA_TimerTree, &t->tree, te) == NULL);
  ------------------
  |  |   78|      0|#define ZIP_REMOVE(name, head, elm) name##_ZIP_REMOVE(head, elm)
  ------------------
  233|      0|    if(!processing) {
  ------------------
  |  Branch (233:8): [True: 0, False: 0]
  ------------------
  234|      0|        ZIP_REMOVE(UA_TimerIdTree, &t->idTree, te);
  ------------------
  |  |   78|      0|#define ZIP_REMOVE(name, head, elm) name##_ZIP_REMOVE(head, elm)
  ------------------
  235|      0|        UA_free(te);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  236|      0|    } else {
  237|      0|        te->cb = NULL;
  238|      0|    }
  239|       |
  240|      0|    UA_UNLOCK(&t->timerMutex);
  241|      0|}
UA_Timer_clear:
  333|     20|UA_Timer_clear(UA_Timer *t) {
  334|     20|    UA_LOCK(&t->timerMutex);
  335|       |
  336|     20|    ZIP_ITER(UA_TimerIdTree, &t->idTree, freeEntryCallback, NULL);
  ------------------
  |  |   94|     20|#define ZIP_ITER(name, head, cb, ctx) name##_ZIP_ITER(head, cb, ctx)
  ------------------
  337|     20|    t->tree.root = NULL;
  338|     20|    t->idTree.root = NULL;
  339|     20|    t->idCounter = 0;
  340|       |
  341|     20|    UA_UNLOCK(&t->timerMutex);
  342|       |
  343|     20|#if UA_MULTITHREADING >= 100
  344|     20|    UA_LOCK_DESTROY(&t->timerMutex);
  345|     20|#endif
  346|     20|}

UA_EventLoop_new_POSIX:
  564|     20|UA_EventLoop_new_POSIX(const UA_Logger *logger) {
  565|       |#ifdef UA_ARCHITECTURE_WIN32
  566|       |    /* Start the WSA networking subsystem on Windows */
  567|       |    WSADATA wsaData;
  568|       |    int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
  569|       |    if(iResult != 0) {
  570|       |        UA_LOG_ERROR(logger, UA_LOGCATEGORY_EVENTLOOP,
  571|       |                     "Initializing the WSA subsystem failed: %d", iResult);
  572|       |        return NULL;
  573|       |    }
  574|       |#endif
  575|       |
  576|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)
  577|     20|        UA_calloc(1, sizeof(UA_EventLoopPOSIX));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  578|     20|    if(!el)
  ------------------
  |  Branch (578:8): [True: 0, False: 20]
  ------------------
  579|      0|        return NULL;
  580|       |
  581|     20|    UA_LOCK_INIT(&el->elMutex);
  582|     20|    UA_Timer_init(&el->timer);
  583|       |
  584|       |    /* Initialize the queue */
  585|     20|    el->delayedTail = &el->delayedHead1;
  586|     20|    el->delayedHead2 = (UA_DelayedCallback*)0x01; /* sentinel value */
  587|       |
  588|       |    /* Set the public EventLoop content */
  589|     20|    el->eventLoop.logger = logger;
  590|       |
  591|       |    /* Initialize the clock source to the default */
  592|     20|#if defined(UA_ARCHITECTURE_POSIX)
  593|     20|    el->clockSource = CLOCK_REALTIME;
  594|     20|# ifdef CLOCK_MONOTONIC_RAW
  595|     20|    el->clockSourceMonotonic = CLOCK_MONOTONIC_RAW;
  596|       |# else
  597|       |    el->clockSourceMonotonic = CLOCK_MONOTONIC;
  598|       |# endif
  599|     20|#endif
  600|       |
  601|       |    /* Set the method pointers for the interface */
  602|     20|    el->eventLoop.start = (UA_StatusCode (*)(UA_EventLoop*))UA_EventLoopPOSIX_start;
  603|     20|    el->eventLoop.stop = (void (*)(UA_EventLoop*))UA_EventLoopPOSIX_stop;
  604|     20|    el->eventLoop.free = (UA_StatusCode (*)(UA_EventLoop*))UA_EventLoopPOSIX_free;
  605|     20|    el->eventLoop.run = (UA_StatusCode (*)(UA_EventLoop*, UA_UInt32))UA_EventLoopPOSIX_run;
  606|     20|    el->eventLoop.cancel = (void (*)(UA_EventLoop*))UA_EventLoopPOSIX_cancel;
  607|       |
  608|     20|    el->eventLoop.dateTime_now = UA_EventLoopPOSIX_DateTime_now;
  609|     20|    el->eventLoop.dateTime_nowMonotonic =
  610|     20|        UA_EventLoopPOSIX_DateTime_nowMonotonic;
  611|     20|    el->eventLoop.dateTime_localTimeUtcOffset =
  612|     20|        UA_EventLoopPOSIX_DateTime_localTimeUtcOffset;
  613|       |
  614|     20|    el->eventLoop.nextTimer = UA_EventLoopPOSIX_nextTimer;
  615|     20|    el->eventLoop.addTimer = UA_EventLoopPOSIX_addTimer;
  616|     20|    el->eventLoop.modifyTimer = UA_EventLoopPOSIX_modifyTimer;
  617|     20|    el->eventLoop.removeTimer = UA_EventLoopPOSIX_removeTimer;
  618|     20|    el->eventLoop.addDelayedCallback = UA_EventLoopPOSIX_addDelayedCallback;
  619|     20|    el->eventLoop.removeDelayedCallback = UA_EventLoopPOSIX_removeDelayedCallback;
  620|       |
  621|     20|    el->eventLoop.registerEventSource =
  622|     20|        (UA_StatusCode (*)(UA_EventLoop*, UA_EventSource*))
  623|     20|        UA_EventLoopPOSIX_registerEventSource;
  624|     20|    el->eventLoop.deregisterEventSource =
  625|     20|        (UA_StatusCode (*)(UA_EventLoop*, UA_EventSource*))
  626|     20|        UA_EventLoopPOSIX_deregisterEventSource;
  627|       |
  628|     20|    el->eventLoop.lock = UA_EventLoopPOSIX_lock;
  629|     20|    el->eventLoop.unlock = UA_EventLoopPOSIX_unlock;
  630|       |
  631|     20|    return &el->eventLoop;
  632|     20|}
eventloop_posix.c:UA_EventLoopPOSIX_free:
  515|     20|UA_EventLoopPOSIX_free(UA_EventLoopPOSIX *el) {
  516|     20|    UA_LOCK(&el->elMutex);
  517|       |
  518|       |    /* Check if the EventLoop can be deleted */
  519|     20|    if(el->eventLoop.state != UA_EVENTLOOPSTATE_STOPPED &&
  ------------------
  |  Branch (519:8): [True: 20, False: 0]
  ------------------
  520|     20|       el->eventLoop.state != UA_EVENTLOOPSTATE_FRESH) {
  ------------------
  |  Branch (520:8): [True: 0, False: 20]
  ------------------
  521|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  522|      0|                       "Cannot delete a running EventLoop");
  523|      0|        UA_UNLOCK(&el->elMutex);
  524|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  525|      0|    }
  526|       |
  527|       |    /* Deregister and delete all the EventSources */
  528|     80|    while(el->eventLoop.eventSources) {
  ------------------
  |  Branch (528:11): [True: 60, False: 20]
  ------------------
  529|     60|        UA_EventSource *es = el->eventLoop.eventSources;
  530|     60|        UA_EventLoopPOSIX_deregisterEventSource(el, es);
  531|     60|        es->free(es);
  532|     60|    }
  533|       |
  534|       |    /* Remove the repeated timed callbacks */
  535|     20|    UA_Timer_clear(&el->timer);
  536|       |
  537|       |    /* Process remaining delayed callbacks */
  538|     20|    processDelayed(el);
  539|       |
  540|       |#ifdef UA_ARCHITECTURE_WIN32
  541|       |    /* Stop the Windows networking subsystem */
  542|       |    WSACleanup();
  543|       |#endif
  544|       |
  545|     20|    UA_KeyValueMap_clear(&el->eventLoop.params);
  546|       |
  547|       |    /* Clean up */
  548|     20|    UA_UNLOCK(&el->elMutex);
  549|     20|    UA_LOCK_DESTROY(&el->elMutex);
  550|     20|    UA_free(el);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  551|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  552|     20|}
eventloop_posix.c:processDelayed:
  136|     20|processDelayed(UA_EventLoopPOSIX *el) {
  137|     20|    UA_LOG_TRACE(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  138|     20|                 "Process delayed callbacks");
  139|       |
  140|     20|    UA_LOCK_ASSERT(&el->elMutex);
  141|       |
  142|       |    /* Reset and get the old head and tail */
  143|     20|    UA_atomic(UA_DelayedCallback *) dc = NULL;
  ------------------
  |  |  310|     20|# define UA_atomic(T) T
  ------------------
  144|     20|    UA_atomic(UA_atomic(UA_DelayedCallback*)*) tail = NULL;
  ------------------
  |  |  310|     20|# define UA_atomic(T) T
  ------------------
  145|     20|    resetDelayedQueue(el, &dc, &tail);
  146|       |
  147|       |    /* tail points to the location where the next element shall be inserted: The
  148|       |     * next-pointer of the last element. Since the next-pointer is the first
  149|       |     * struct member, we can directly cast to the last element. */
  150|     20|    UA_DelayedCallback *last = (UA_DelayedCallback*)(uintptr_t)tail;
  151|       |
  152|       |    /* Loop until we reach the tail (or head and tail are both NULL) */
  153|     20|    UA_DelayedCallback *next;
  154|     20|    for(; dc; dc = next) {
  ------------------
  |  Branch (154:11): [True: 0, False: 20]
  ------------------
  155|      0|        next = dc->next;
  156|      0|        while(!next && dc != last)
  ------------------
  |  Branch (156:15): [True: 0, False: 0]
  |  Branch (156:24): [True: 0, False: 0]
  ------------------
  157|      0|            next = UA_atomic_load(&dc->next);
  ------------------
  |  |  312|      0|    __atomic_load_n(addr, __ATOMIC_SEQ_CST)
  ------------------
  158|      0|        if(!dc->callback)
  ------------------
  |  Branch (158:12): [True: 0, False: 0]
  ------------------
  159|      0|            continue;
  160|      0|        dc->callback(dc->application, dc->context);
  161|      0|    }
  162|     20|}
eventloop_posix.c:resetDelayedQueue:
   79|     20|                  UA_atomic(UA_atomic(UA_DelayedCallback*)*)* oldTail) {
   80|     20|    if(el->delayedHead1 <= (UA_DelayedCallback *)0x01 &&
  ------------------
  |  Branch (80:8): [True: 20, False: 0]
  ------------------
   81|     20|       el->delayedHead2 <= (UA_DelayedCallback *)0x01)
  ------------------
  |  Branch (81:8): [True: 20, False: 0]
  ------------------
   82|     20|        return; /* The queue is empty */
   83|       |
   84|       |    /* Get the location of the active and the inactive head */
   85|      0|    UA_Boolean active1 = (el->delayedHead1 != (UA_DelayedCallback*)0x01);
   86|      0|    UA_atomic(UA_DelayedCallback*)* activeHead = (active1) ? &el->delayedHead1 : &el->delayedHead2;
  ------------------
  |  |  310|      0|# define UA_atomic(T) T
  ------------------
  |  Branch (86:50): [True: 0, False: 0]
  ------------------
   87|      0|    UA_atomic(UA_DelayedCallback*)* inactiveHead = (active1) ? &el->delayedHead2 : &el->delayedHead1;
  ------------------
  |  |  310|      0|# define UA_atomic(T) T
  ------------------
  |  Branch (87:52): [True: 0, False: 0]
  ------------------
   88|       |
   89|       |    /* Set NULL to the inactive head. This indicates it is now active. */
   90|      0|    UA_atomic_store(inactiveHead, NULL);
  ------------------
  |  |  314|      0|    __atomic_store_n(addr, newval, __ATOMIC_SEQ_CST)
  ------------------
   91|       |
   92|       |    /* Set a sentinel value to "inactivate" the active head. Return the old
   93|       |     * active head. Parallel threads may continue to add elements below the old
   94|       |     * "activeHead" if they already have a pointer. */
   95|      0|    UA_atomic_xchg(activeHead, (UA_DelayedCallback*)0x01, oldHead);
  ------------------
  |  |  316|      0|    do {                                                                \
  |  |  317|      0|        *old = __atomic_exchange_n(addr, newval, __ATOMIC_SEQ_CST);     \
  |  |  318|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (318:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
   96|       |
   97|       |    /* Make the inactiveHead the new "active" by pointing to it from the tail.
   98|       |     * Also return the old tail. From the consumer-thread we can then iterate
   99|       |     * the linked-list until we find the old tail as the last element. */
  100|      0|    UA_atomic_xchg(&el->delayedTail, inactiveHead, oldTail);
  ------------------
  |  |  316|      0|    do {                                                                \
  |  |  317|      0|        *old = __atomic_exchange_n(addr, newval, __ATOMIC_SEQ_CST);     \
  |  |  318|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (318:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  101|      0|}
eventloop_posix.c:UA_EventLoopPOSIX_removeTimer:
   52|     20|                              UA_UInt64 callbackId) {
   53|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
   54|     20|    UA_Timer_remove(&el->timer, callbackId);
   55|     20|}
eventloop_posix.c:UA_EventLoopPOSIX_registerEventSource:
  410|     60|                                      UA_EventSource *es) {
  411|     60|    UA_LOCK(&el->elMutex);
  412|       |
  413|       |    /* Already registered? */
  414|     60|    if(es->state != UA_EVENTSOURCESTATE_FRESH) {
  ------------------
  |  Branch (414:8): [True: 0, False: 60]
  ------------------
  415|      0|        UA_LOG_ERROR(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
  416|      0|                     "Cannot register the EventSource \"%.*s\": "
  417|      0|                     "already registered",
  418|      0|                     (int)es->name.length, (char*)es->name.data);
  419|      0|        UA_UNLOCK(&el->elMutex);
  420|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  421|      0|    }
  422|       |
  423|       |    /* Add to linked list */
  424|     60|    es->next = el->eventLoop.eventSources;
  425|     60|    el->eventLoop.eventSources = es;
  426|       |
  427|     60|    es->eventLoop = &el->eventLoop;
  428|     60|    es->state = UA_EVENTSOURCESTATE_STOPPED;
  429|       |
  430|       |    /* Start if the entire EventLoop is started */
  431|     60|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  432|     60|    if(el->eventLoop.state == UA_EVENTLOOPSTATE_STARTED)
  ------------------
  |  Branch (432:8): [True: 0, False: 60]
  ------------------
  433|      0|        res = es->start(es);
  434|       |
  435|     60|    UA_UNLOCK(&el->elMutex);
  436|     60|    return res;
  437|     60|}
eventloop_posix.c:UA_EventLoopPOSIX_deregisterEventSource:
  441|     60|                                        UA_EventSource *es) {
  442|     60|    UA_LOCK(&el->elMutex);
  443|       |
  444|     60|    if(es->state != UA_EVENTSOURCESTATE_STOPPED) {
  ------------------
  |  Branch (444:8): [True: 0, False: 60]
  ------------------
  445|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  446|      0|                       "Cannot deregister the EventSource %.*s: "
  447|      0|                       "Has to be stopped first",
  448|      0|                       (int)es->name.length, es->name.data);
  449|      0|        UA_UNLOCK(&el->elMutex);
  450|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  451|      0|    }
  452|       |
  453|       |    /* Remove from the linked list */
  454|     60|    UA_EventSource **s = &el->eventLoop.eventSources;
  455|     60|    while(*s) {
  ------------------
  |  Branch (455:11): [True: 60, False: 0]
  ------------------
  456|     60|        if(*s == es) {
  ------------------
  |  Branch (456:12): [True: 60, False: 0]
  ------------------
  457|     60|            *s = es->next;
  458|     60|            break;
  459|     60|        }
  460|      0|        s = &(*s)->next;
  461|      0|    }
  462|       |
  463|       |    /* Set the state to non-registered */
  464|     60|    es->state = UA_EVENTSOURCESTATE_FRESH;
  465|       |
  466|     60|    UA_UNLOCK(&el->elMutex);
  467|     60|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  468|     60|}
eventloop_posix.c:UA_EventLoopPOSIX_lock:
  555|     60|UA_EventLoopPOSIX_lock(UA_EventLoop *public_el) {
  556|     60|    UA_LOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  557|     60|}
eventloop_posix.c:UA_EventLoopPOSIX_unlock:
  559|     60|UA_EventLoopPOSIX_unlock(UA_EventLoop *public_el) {
  560|     60|    UA_UNLOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  561|     60|}

UA_InterruptManager_new_POSIX:
  595|     20|UA_InterruptManager_new_POSIX(const UA_String eventSourceName) {
  596|     20|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)
  597|     20|        UA_calloc(1, sizeof(UA_POSIXInterruptManager));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  598|     20|    if(!pim)
  ------------------
  |  Branch (598:8): [True: 0, False: 20]
  ------------------
  599|      0|        return NULL;
  600|       |
  601|       |    /* Initialize the FD as invalid before adding the interrupt manager to the
  602|       |     * global array */
  603|     20|    pim->readfd.fd = UA_INVALID_FD;
  ------------------
  |  |  331|     20|#define UA_INVALID_FD UA_INVALID_SOCKET
  |  |  ------------------
  |  |  |  |  209|     20|#define UA_INVALID_SOCKET -1
  |  |  ------------------
  ------------------
  604|     20|    pim->writefd = UA_INVALID_FD;
  ------------------
  |  |  331|     20|#define UA_INVALID_FD UA_INVALID_SOCKET
  |  |  ------------------
  |  |  |  |  209|     20|#define UA_INVALID_SOCKET -1
  |  |  ------------------
  ------------------
  605|     20|    pim->managerSlot = NULL;
  606|       |
  607|     20|    if(!registerInterruptManager(pim)) {
  ------------------
  |  Branch (607:8): [True: 0, False: 20]
  ------------------
  608|      0|        UA_free(pim);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  609|      0|        return NULL;
  610|      0|    }
  611|       |
  612|     20|    UA_InterruptManager *im = &pim->im;
  613|     20|    im->eventSource.eventSourceType = UA_EVENTSOURCETYPE_INTERRUPTMANAGER;
  614|     20|    UA_String_copy(&eventSourceName, &im->eventSource.name);
  615|     20|    im->eventSource.start = startPOSIXInterruptManager;
  616|     20|    im->eventSource.stop = stopPOSIXInterruptManager;
  617|     20|    im->eventSource.free = freePOSIXInterruptmanager;
  618|     20|    im->registerInterrupt = registerPOSIXInterrupt;
  619|     20|    im->deregisterInterrupt = deregisterPOSIXInterrupt;
  620|     20|    return im;
  621|     20|}
eventloop_posix_interrupt.c:registerInterruptManager:
   63|     20|registerInterruptManager(UA_POSIXInterruptManager *pim) {
   64|     20|    for(size_t i = 0; i < UA_MAX_INTERRUPT_MANAGERS; i++) {
  ------------------
  |  |   14|     20|#define UA_MAX_INTERRUPT_MANAGERS 8
  ------------------
  |  Branch (64:23): [True: 20, False: 0]
  ------------------
   65|     20|        UA_POSIXInterruptManager *prev = NULL;
   66|     20|        UA_atomic_cmpxchg(&interruptManagers[i], &prev, pim);
  ------------------
  |  |  320|     20|    __atomic_compare_exchange_n(addr, expected, newval, false,          \
  |  |  321|     20|                                __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
  ------------------
   67|     20|        if(prev == NULL) {
  ------------------
  |  Branch (67:12): [True: 20, False: 0]
  ------------------
   68|     20|            pim->managerSlot = &interruptManagers[i];
   69|     20|            return true;
   70|     20|        }
   71|     20|    }
   72|      0|    return false;
   73|     20|}
eventloop_posix_interrupt.c:freePOSIXInterruptmanager:
  566|     20|freePOSIXInterruptmanager(UA_EventSource *es) {
  567|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)es->eventLoop;
  568|     20|    (void)el;
  569|     20|    UA_LOCK_ASSERT(&el->elMutex);
  570|       |
  571|     20|    if(es->state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (571:8): [True: 0, False: 20]
  ------------------
  572|      0|        UA_LOG_ERROR(es->eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
  573|      0|                     "Interrupt\t| The EventSource must be stopped "
  574|      0|                     "before it can be deleted");
  575|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  576|      0|    }
  577|       |
  578|       |    /* Deactivate and remove all registered signals */
  579|     20|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)es;
  580|     20|    UA_RegisteredSignal *rs, *rs_tmp;
  581|     20|    LIST_FOREACH_SAFE(rs, &pim->signals, listPointers, rs_tmp) {
  ------------------
  |  |  195|     20|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     20|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     20|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 20]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     20|        (var) = (tvar))
  ------------------
  582|      0|        deactivateSignal(rs);
  583|      0|        LIST_REMOVE(rs, listPointers);
  ------------------
  |  |  228|      0|#define LIST_REMOVE(elm, field) do {					\
  |  |  229|      0|    if ((elm)->field.le_next != NULL)				\
  |  |  ------------------
  |  |  |  Branch (229:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  230|      0|        (elm)->field.le_next->field.le_prev =			\
  |  |  231|      0|            (elm)->field.le_prev;				\
  |  |  232|      0|    *(elm)->field.le_prev = (elm)->field.le_next;			\
  |  |  233|      0|    _Q_INVALIDATE((elm)->field.le_prev);				\
  |  |  234|      0|    _Q_INVALIDATE((elm)->field.le_next);				\
  |  |  235|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (235:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  584|      0|        UA_free(rs);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  585|      0|    }
  586|       |
  587|     20|    UA_String_clear(&es->name);
  588|     20|    unregisterInterruptManager(pim);
  589|     20|    UA_free(es);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  590|       |
  591|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  592|     20|}
eventloop_posix_interrupt.c:unregisterInterruptManager:
   76|     20|unregisterInterruptManager(UA_POSIXInterruptManager *pim) {
   77|     20|    UA_assert(*pim->managerSlot == pim);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (77:5): [True: 20, False: 0]
  ------------------
   78|     20|    UA_atomic_store(pim->managerSlot, NULL);
  ------------------
  |  |  314|     20|    __atomic_store_n(addr, newval, __ATOMIC_SEQ_CST)
  ------------------
   79|       |    pim->managerSlot = NULL;
   80|     20|}

UA_ConnectionManager_new_POSIX_TCP:
 1247|     20|UA_ConnectionManager_new_POSIX_TCP(const UA_String eventSourceName) {
 1248|     20|    UA_POSIXConnectionManager *cm = (UA_POSIXConnectionManager*)
 1249|     20|        UA_calloc(1, sizeof(UA_POSIXConnectionManager));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 1250|     20|    if(!cm)
  ------------------
  |  Branch (1250:8): [True: 0, False: 20]
  ------------------
 1251|      0|        return NULL;
 1252|       |
 1253|     20|    cm->cm.eventSource.eventSourceType = UA_EVENTSOURCETYPE_CONNECTIONMANAGER;
 1254|     20|    UA_String_copy(&eventSourceName, &cm->cm.eventSource.name);
 1255|     20|    cm->cm.eventSource.start = (UA_StatusCode (*)(UA_EventSource *))TCP_eventSourceStart;
 1256|     20|    cm->cm.eventSource.stop = (void (*)(UA_EventSource *))TCP_eventSourceStop;
 1257|     20|    cm->cm.eventSource.free = (UA_StatusCode (*)(UA_EventSource *))TCP_eventSourceDelete;
 1258|     20|    cm->cm.protocol = UA_STRING((char*)(uintptr_t)tcpName);
 1259|     20|    cm->cm.openConnection = TCP_openConnection;
 1260|     20|    cm->cm.allocNetworkBuffer = UA_EventLoopPOSIX_allocNetworkBuffer;
 1261|     20|    cm->cm.freeNetworkBuffer = UA_EventLoopPOSIX_freeNetworkBuffer;
 1262|     20|    cm->cm.sendWithConnection = TCP_sendWithConnection;
 1263|     20|    cm->cm.closeConnection = TCP_shutdownConnection;
 1264|     20|    return &cm->cm;
 1265|     20|}
eventloop_posix_tcp.c:TCP_eventSourceDelete:
 1227|     20|TCP_eventSourceDelete(UA_ConnectionManager *cm) {
 1228|     20|    UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
 1229|     20|    if(cm->eventSource.state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (1229:8): [True: 0, False: 20]
  ------------------
 1230|      0|        UA_LOG_ERROR(cm->eventSource.eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
 1231|      0|                     "TCP\t| The EventSource must be stopped before it can be deleted");
 1232|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 1233|      0|    }
 1234|       |
 1235|     20|    UA_ByteString_clear(&pcm->rxBuffer);
 1236|     20|    UA_ByteString_clear(&pcm->txBuffer);
 1237|     20|    UA_KeyValueMap_clear(&cm->eventSource.params);
 1238|     20|    UA_String_clear(&cm->eventSource.name);
 1239|     20|    UA_free(cm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1240|       |
 1241|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 1242|     20|}

UA_ConnectionManager_new_POSIX_UDP:
 1457|     20|UA_ConnectionManager_new_POSIX_UDP(const UA_String eventSourceName) {
 1458|     20|    UA_POSIXConnectionManager *cm = (UA_POSIXConnectionManager*)
 1459|     20|        UA_calloc(1, sizeof(UA_POSIXConnectionManager));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 1460|     20|    if(!cm)
  ------------------
  |  Branch (1460:8): [True: 0, False: 20]
  ------------------
 1461|      0|        return NULL;
 1462|       |
 1463|     20|    cm->cm.eventSource.eventSourceType = UA_EVENTSOURCETYPE_CONNECTIONMANAGER;
 1464|     20|    UA_String_copy(&eventSourceName, &cm->cm.eventSource.name);
 1465|     20|    cm->cm.eventSource.start = (UA_StatusCode (*)(UA_EventSource *))UDP_eventSourceStart;
 1466|     20|    cm->cm.eventSource.stop = (void (*)(UA_EventSource *))UDP_eventSourceStop;
 1467|     20|    cm->cm.eventSource.free = (UA_StatusCode (*)(UA_EventSource *))UDP_eventSourceDelete;
 1468|     20|    cm->cm.protocol = UA_STRING((char*)(uintptr_t)udpName);
 1469|     20|    cm->cm.openConnection = UDP_openConnection;
 1470|     20|    cm->cm.allocNetworkBuffer = UA_EventLoopPOSIX_allocNetworkBuffer;
 1471|     20|    cm->cm.freeNetworkBuffer = UA_EventLoopPOSIX_freeNetworkBuffer;
 1472|     20|    cm->cm.sendWithConnection = UDP_sendWithConnection;
 1473|     20|    cm->cm.closeConnection = UDP_shutdownConnection;
 1474|     20|    return &cm->cm;
 1475|     20|}
eventloop_posix_udp.c:UDP_eventSourceDelete:
 1437|     20|UDP_eventSourceDelete(UA_ConnectionManager *cm) {
 1438|     20|    UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
 1439|     20|    if(cm->eventSource.state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (1439:8): [True: 0, False: 20]
  ------------------
 1440|      0|        UA_LOG_ERROR(cm->eventSource.eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
 1441|      0|                     "UDP\t| The EventSource must be stopped before it can be deleted");
 1442|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 1443|      0|    }
 1444|       |
 1445|     20|    UA_ByteString_clear(&pcm->rxBuffer);
 1446|     20|    UA_ByteString_clear(&pcm->txBuffer);
 1447|     20|    UA_KeyValueMap_clear(&cm->eventSource.params);
 1448|     20|    UA_String_clear(&cm->eventSource.name);
 1449|     20|    UA_free(cm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1450|       |
 1451|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 1452|     20|}

__ZIP_ITER:
  197|     20|           void *context, void *elm) {
  198|     20|    if(!elm)
  ------------------
  |  Branch (198:8): [True: 20, False: 0]
  ------------------
  199|     20|        return NULL;
  200|      0|    zip_elem *left = ZIP_ENTRY_PTR(elm)->left;
  ------------------
  |  |   17|      0|#define ZIP_ENTRY_PTR(x) ((zip_entry*)((char*)x + fieldoffset))
  ------------------
  201|      0|    zip_elem *right = ZIP_ENTRY_PTR(elm)->right;
  ------------------
  |  |   17|      0|#define ZIP_ENTRY_PTR(x) ((zip_entry*)((char*)x + fieldoffset))
  ------------------
  202|      0|    void *res = __ZIP_ITER(fieldoffset, cb, context, left);
  203|      0|    if(res)
  ------------------
  |  Branch (203:8): [True: 0, False: 0]
  ------------------
  204|      0|        return res;
  205|      0|    res = cb(context, elm);
  206|      0|    if(res)
  ------------------
  |  Branch (206:8): [True: 0, False: 0]
  ------------------
  207|      0|        return res;
  208|      0|    return __ZIP_ITER(fieldoffset, cb, context, right);
  209|      0|}

timer.c:UA_TimerIdTree_ZIP_FIND:
  117|     20|name##_ZIP_FIND(struct name *head, const keytype *key) {                \
  118|     20|    struct type *cur = ZIP_ROOT(head);                                  \
  ------------------
  |  |   69|     20|#define ZIP_ROOT(head) (head)->root
  ------------------
  119|     20|    while(cur) {                                                        \
  ------------------
  |  Branch (119:11): [True: 0, False: 20]
  ------------------
  120|      0|        enum ZIP_CMP eq = cmp(key, &cur->keyfield);                     \
  121|      0|        if(eq == ZIP_CMP_EQ)                                            \
  ------------------
  |  Branch (121:12): [True: 0, False: 0]
  ------------------
  122|      0|            break;                                                      \
  123|      0|        if(eq == ZIP_CMP_LESS)                                          \
  ------------------
  |  Branch (123:12): [True: 0, False: 0]
  ------------------
  124|      0|            cur = ZIP_LEFT(cur, field);                                 \
  ------------------
  |  |   70|      0|#define ZIP_LEFT(elm, field) (elm)->field.left
  ------------------
  125|      0|        else                                                            \
  126|      0|            cur = ZIP_RIGHT(cur, field);                                \
  ------------------
  |  |   71|      0|#define ZIP_RIGHT(elm, field) (elm)->field.right
  ------------------
  127|      0|    }                                                                   \
  128|     20|    return cur;                                                         \
  129|     20|}                                                                       \

eventloop_posix.c:UA_LOG_TRACE:
   75|     20|UA_LOG_TRACE(const UA_Logger *logger, UA_LogCategory category, const char *msg, ...) {
   76|       |#if UA_LOGLEVEL <= 100
   77|       |    if(!logger || !logger->log)
   78|       |        return;
   79|       |    va_list args; va_start(args, msg);
   80|       |    logger->log(logger->context, UA_LOGLEVEL_TRACE, category, msg, args);
   81|       |    va_end(args);
   82|       |#else
   83|     20|    (void) logger;
   84|     20|    (void) category;
   85|     20|    (void) msg;
   86|     20|#endif
   87|     20|}

UA_mbedTLS_LoadLocalCertificate:
  759|     20|                                UA_ByteString *target) {
  760|     20|    UA_ByteString data = UA_mbedTLS_CopyDataFormatAware(certData);
  761|     20|    if(!data.data) {
  ------------------
  |  Branch (761:8): [True: 20, False: 0]
  ------------------
  762|     20|        UA_ByteString_init(target);
  763|     20|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|     20|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  764|     20|    }
  765|      0|    mbedtls_x509_crt cert;
  766|      0|    mbedtls_x509_crt_init(&cert);
  767|       |
  768|      0|    int mbedErr = mbedtls_x509_crt_parse(&cert, data.data, data.length);
  769|       |
  770|      0|    UA_StatusCode result = UA_STATUSCODE_BADINVALIDARGUMENT;
  ------------------
  |  |  730|      0|#define UA_STATUSCODE_BADINVALIDARGUMENT ((UA_StatusCode) 0x80AB0000)
  ------------------
  771|       |
  772|      0|    if (!mbedErr) {
  ------------------
  |  Branch (772:9): [True: 0, False: 0]
  ------------------
  773|      0|        UA_ByteString tmp;
  774|      0|        tmp.data = cert.raw.p;
  775|      0|        tmp.length = cert.raw.len;
  776|       |
  777|      0|        result = UA_ByteString_copy(&tmp, target);
  778|      0|    } else {
  779|      0|        UA_ByteString_init(target);
  780|      0|    }
  781|       |
  782|      0|    UA_ByteString_clear(&data);
  783|      0|    mbedtls_x509_crt_free(&cert);
  784|      0|    return result;
  785|     20|}
UA_mbedTLS_CopyDataFormatAware:
  790|     20|UA_mbedTLS_CopyDataFormatAware(const UA_ByteString *data) {
  791|     20|    UA_ByteString result;
  792|     20|    UA_ByteString_init(&result);
  793|       |
  794|     20|    if (!data->length)
  ------------------
  |  Branch (794:9): [True: 20, False: 0]
  ------------------
  795|     20|        return result;
  796|       |
  797|      0|    if (data->length && data->data[0] == '-') {
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  |  Branch (797:25): [True: 0, False: 0]
  ------------------
  798|      0|        UA_StatusCode res = UA_ByteString_allocBuffer(&result, data->length + 1);
  799|      0|        if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (799:12): [True: 0, False: 0]
  ------------------
  800|      0|            return result;
  801|      0|        memcpy(result.data, data->data, data->length);
  802|      0|        result.data[data->length] = '\0';
  803|      0|    } else {
  804|      0|        UA_ByteString_copy(data, &result);
  805|      0|    }
  806|       |
  807|      0|    return result;
  808|      0|}

UA_CertificateGroup_AcceptAll:
   23|     20|void UA_CertificateGroup_AcceptAll(UA_CertificateGroup *certGroup) {
   24|       |    /* Clear the structure, as it may have already been initialized. */
   25|     20|    UA_NodeId groupId = certGroup->certificateGroupId;
   26|     20|    if(certGroup->clear)
  ------------------
  |  Branch (26:8): [True: 0, False: 20]
  ------------------
   27|      0|        certGroup->clear(certGroup);
   28|     20|    UA_NodeId_copy(&groupId, &certGroup->certificateGroupId);
   29|     20|    certGroup->verifyCertificate = verifyCertificateAllowAll;
   30|     20|    certGroup->clear = clearVerifyAllowAll;
   31|     20|    certGroup->getTrustList = NULL;
   32|     20|    certGroup->setTrustList = NULL;
   33|     20|    certGroup->addToTrustList = NULL;
   34|     20|    certGroup->removeFromTrustList = NULL;
   35|     20|    certGroup->getRejectedList = NULL;
   36|       |    certGroup->getCertificateCrls = NULL;
   37|     20|}
ua_certificategroup_none.c:clearVerifyAllowAll:
   19|     20|clearVerifyAllowAll(UA_CertificateGroup *certGroup) {
   20|       |
   21|     20|}

UA_SecurityPolicy_None:
  152|     20|                       const UA_Logger *logger) {
  153|       |
  154|     20|    memset(sp, 0, sizeof(UA_SecurityPolicy));
  155|     20|    sp->logger = logger;
  156|     20|    sp->policyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
  157|     20|    sp->certificateGroupId = UA_NODEID_NULL;
  158|     20|    sp->certificateTypeId = UA_NODEID_NULL;
  159|     20|    sp->securityLevel = 0;
  160|     20|    sp->policyType = UA_SECURITYPOLICYTYPE_NONE;
  161|       |
  162|       |    /* Symmetric Signature */
  163|     20|    UA_SecurityPolicySignatureAlgorithm *symSig = &sp->symSignatureAlgorithm;
  164|     20|    symSig->uri = UA_STRING_NULL;
  165|     20|    symSig->verify = verify_none;
  166|     20|    symSig->sign = sign_none;
  167|     20|    symSig->getLocalSignatureSize = length_none;
  168|     20|    symSig->getRemoteSignatureSize = length_none;
  169|     20|    symSig->getLocalKeyLength = length_none;
  170|     20|    symSig->getRemoteKeyLength = length_none;
  171|       |
  172|       |    /* Symmetric Encryption */
  173|     20|    UA_SecurityPolicyEncryptionAlgorithm *symEnc = &sp->symEncryptionAlgorithm;
  174|     20|    symEnc->uri = UA_STRING_NULL;
  175|     20|    symEnc->encrypt = encrypt_none;
  176|     20|    symEnc->decrypt = decrypt_none;
  177|     20|    symEnc->getLocalKeyLength = length_none;
  178|     20|    symEnc->getRemoteKeyLength = length_none;
  179|     20|    symEnc->getRemoteBlockSize = length_none;
  180|     20|    symEnc->getRemotePlainTextBlockSize = length_none;
  181|       |
  182|       |    /* This only works for none since symmetric and asymmetric crypto modules do
  183|       |     * the same i.e. nothing */
  184|     20|    sp->asymSignatureAlgorithm = sp->symSignatureAlgorithm;
  185|     20|    sp->asymEncryptionAlgorithm = sp->symEncryptionAlgorithm;
  186|       |
  187|       |    /* Use the same signing algorithm as for asymmetric signing */
  188|     20|    sp->certSignatureAlgorithm = sp->asymSignatureAlgorithm;
  189|       |
  190|       |    /* Direct Method Pointers */
  191|     20|    sp->newChannelContext = newContext_none;
  192|     20|    sp->deleteChannelContext = deleteContext_none;
  193|     20|    sp->setLocalSymEncryptingKey = setContextValue_none;
  194|     20|    sp->setLocalSymSigningKey = setContextValue_none;
  195|     20|    sp->setLocalSymIv = setContextValue_none;
  196|     20|    sp->setRemoteSymEncryptingKey = setContextValue_none;
  197|     20|    sp->setRemoteSymSigningKey = setContextValue_none;
  198|     20|    sp->setRemoteSymIv = setContextValue_none;
  199|     20|    sp->compareCertificate = compareCertificate_none;
  200|     20|    sp->generateKey = generateKey_none;
  201|     20|    sp->generateNonce = generateNonce_none;
  202|     20|    sp->nonceLength = 0;
  203|     20|    sp->makeCertThumbprint = makeThumbprint_none;
  204|     20|    sp->compareCertThumbprint = compareThumbprint_none;
  205|     20|    sp->updateCertificate = updateCertificate_none;
  206|     20|    sp->createSigningRequest = NULL;
  207|     20|    sp->clear = policy_clear_none;
  208|       |
  209|     20|#ifdef UA_ENABLE_ENCRYPTION_MBEDTLS
  210|     20|    UA_mbedTLS_LoadLocalCertificate(&localCertificate, &sp->localCertificate);
  211|       |#elif defined(UA_ENABLE_ENCRYPTION_OPENSSL) || defined(UA_ENABLE_ENCRYPTION_LIBRESSL)
  212|       |    UA_OpenSSL_LoadLocalCertificate(&localCertificate, &sp->localCertificate,
  213|       |                                    EVP_PKEY_NONE);
  214|       |#else
  215|       |    UA_ByteString_copy(&localCertificate, &sp->localCertificate);
  216|       |#endif
  217|       |
  218|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  219|     20|}
ua_securitypolicy_none.c:policy_clear_none:
  146|     20|policy_clear_none(UA_SecurityPolicy *policy) {
  147|     20|    UA_ByteString_clear(&policy->localCertificate);
  148|     20|}

UA_Client_new:
 1955|     20|UA_Client * UA_Client_new(void) {
 1956|     20|    UA_ClientConfig config;
 1957|     20|    memset(&config, 0, sizeof(UA_ClientConfig));
 1958|       |    /* Set up basic usable config including logger and event loop */
 1959|     20|    UA_StatusCode res = UA_ClientConfig_setDefault(&config);
 1960|     20|    if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (1960:8): [True: 0, False: 20]
  ------------------
 1961|      0|        return NULL;
 1962|     20|    return UA_Client_newWithConfig(&config);
 1963|     20|}
UA_ClientConfig_setDefault:
 2033|     20|UA_ClientConfig_setDefault(UA_ClientConfig *config) {
 2034|       |    /* The following fields are untouched and OK to leave as NULL or 0:
 2035|       |     *  clientContext
 2036|       |     *  userIdentityToken
 2037|       |     *  securityMode
 2038|       |     *  securityPolicyUri
 2039|       |     *  endpoint
 2040|       |     *  userTokenPolicy
 2041|       |     *  customDataTypes
 2042|       |     *  connectivityCheckInterval
 2043|       |     *  stateCallback
 2044|       |     *  inactivityCallback
 2045|       |     *  outStandingPublishRequests
 2046|       |     *  subscriptionInactivityCallback
 2047|       |     *  sessionLocaleIds
 2048|       |     *  sessionLocaleIdsSize */
 2049|       |
 2050|     20|    if(config->timeout == 0)
  ------------------
  |  Branch (2050:8): [True: 20, False: 0]
  ------------------
 2051|     20|        config->timeout = 5 * 1000; /* 5 seconds */
 2052|     20|    if(config->secureChannelLifeTime == 0)
  ------------------
  |  Branch (2052:8): [True: 20, False: 0]
  ------------------
 2053|     20|        config->secureChannelLifeTime = 10 * 60 * 1000; /* 10 minutes */
 2054|       |
 2055|     20|    if(config->logging == NULL)
  ------------------
  |  Branch (2055:8): [True: 20, False: 0]
  ------------------
 2056|     20|        config->logging = UA_Log_Stdout_new(UA_LOGLEVEL_INFO);
 2057|       |
 2058|       |    /* EventLoop */
 2059|     20|    if(config->eventLoop == NULL) {
  ------------------
  |  Branch (2059:8): [True: 20, False: 0]
  ------------------
 2060|       |#if defined(UA_ARCHITECTURE_ZEPHYR)
 2061|       |        config->eventLoop = UA_EventLoop_new_Zephyr(config->logging);
 2062|       |#elif defined(UA_ARCHITECTURE_LWIP)
 2063|       |        config->eventLoop = UA_EventLoop_new_LWIP(config->logging, NULL);
 2064|       |#else
 2065|     20|        config->eventLoop = UA_EventLoop_new_POSIX(config->logging);
 2066|     20|#endif
 2067|     20|        config->externalEventLoop = false;
 2068|       |
 2069|       |        /* Add the TCP connection manager */
 2070|       |#if defined(UA_ARCHITECTURE_ZEPHYR)
 2071|       |        UA_ConnectionManager *tcpCM =
 2072|       |            UA_ConnectionManager_new_Zephyr_TCP(UA_STRING("tcp connection manager"));
 2073|       |#elif defined(UA_ARCHITECTURE_LWIP)
 2074|       |        UA_ConnectionManager *tcpCM =
 2075|       |            UA_ConnectionManager_new_LWIP_TCP(UA_STRING("tcp connection manager"));
 2076|       |#else
 2077|     20|        UA_ConnectionManager *tcpCM =
 2078|     20|            UA_ConnectionManager_new_POSIX_TCP(UA_STRING("tcp connection manager"));
 2079|     20|#endif
 2080|     20|        config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)tcpCM);
 2081|       |
 2082|       |#if defined(UA_ARCHITECTURE_LWIP)
 2083|       |        UA_ConnectionManager *udpCM =
 2084|       |            UA_ConnectionManager_new_LWIP_UDP(UA_STRING("udp connection manager"));
 2085|       |        if(udpCM)
 2086|       |            config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)udpCM);
 2087|       |#elif !defined(UA_ARCHITECTURE_ZEPHYR)
 2088|       |        /* Add the UDP connection manager */
 2089|     20|        UA_ConnectionManager *udpCM =
 2090|     20|            UA_ConnectionManager_new_POSIX_UDP(UA_STRING("udp connection manager"));
 2091|     20|        config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)udpCM);
 2092|     20|#endif
 2093|       |
 2094|     20|#if !defined(UA_ARCHITECTURE_ZEPHYR) && !defined(UA_ARCHITECTURE_LWIP)
 2095|       |        /* Add the interrupt manager */
 2096|     20|        UA_InterruptManager *im = UA_InterruptManager_new_POSIX(UA_STRING("interrupt manager"));
 2097|     20|        if(im) {
  ------------------
  |  Branch (2097:12): [True: 20, False: 0]
  ------------------
 2098|     20|            config->eventLoop->registerEventSource(config->eventLoop, &im->eventSource);
 2099|     20|        } else {
 2100|      0|            UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_APPLICATION,
 2101|      0|                         "Cannot create the Interrupt Manager (only relevant if used)");
 2102|      0|        }
 2103|     20|#endif
 2104|     20|    }
 2105|       |
 2106|     20|    if(config->localConnectionConfig.recvBufferSize == 0)
  ------------------
  |  Branch (2106:8): [True: 20, False: 0]
  ------------------
 2107|     20|        config->localConnectionConfig = UA_ConnectionConfig_default;
 2108|       |
 2109|     20|    if(!config->certificateVerification.logging) {
  ------------------
  |  Branch (2109:8): [True: 20, False: 0]
  ------------------
 2110|     20|        config->certificateVerification.logging = config->logging;
 2111|     20|    }
 2112|       |
 2113|     20|#ifdef UA_ENABLE_ENCRYPTION
 2114|       |    /* Limits for TrustList */
 2115|     20|    config->maxTrustListSize = 0;
 2116|     20|    config->maxRejectedListSize = 0;
 2117|     20|#endif
 2118|       |
 2119|     20|    if(!config->certificateVerification.verifyCertificate) {
  ------------------
  |  Branch (2119:8): [True: 20, False: 0]
  ------------------
 2120|       |        /* Certificate Verification that accepts every certificate. Can be
 2121|       |         * overwritten when the policy is specialized. */
 2122|     20|        UA_CertificateGroup_AcceptAll(&config->certificateVerification);
 2123|     20|    }
 2124|       |
 2125|       |    /* With encryption enabled, the applicationUri needs to match the URI from
 2126|       |     * the certificate */
 2127|     20|    if(!config->clientDescription.applicationUri.data)
  ------------------
  |  Branch (2127:8): [True: 20, False: 0]
  ------------------
 2128|     20|        config->clientDescription.applicationUri = UA_STRING_ALLOC(APPLICATION_URI);
  ------------------
  |  |  220|     20|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
 2129|     20|    if(config->clientDescription.applicationType == 0)
  ------------------
  |  Branch (2129:8): [True: 20, False: 0]
  ------------------
 2130|     20|        config->clientDescription.applicationType = UA_APPLICATIONTYPE_CLIENT;
 2131|       |
 2132|     20|    if(config->securityPoliciesSize == 0) {
  ------------------
  |  Branch (2132:8): [True: 20, False: 0]
  ------------------
 2133|     20|        config->securityPolicies = (UA_SecurityPolicy*)UA_malloc(sizeof(UA_SecurityPolicy));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
 2134|     20|        if(!config->securityPolicies)
  ------------------
  |  Branch (2134:12): [True: 0, False: 20]
  ------------------
 2135|      0|            return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   31|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2136|     20|        UA_StatusCode retval = UA_SecurityPolicy_None(config->securityPolicies,
 2137|     20|                                                      UA_BYTESTRING_NULL, config->logging);
 2138|     20|        if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2138:12): [True: 0, False: 20]
  ------------------
 2139|      0|            UA_free(config->securityPolicies);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2140|      0|            config->securityPolicies = NULL;
 2141|      0|            return retval;
 2142|      0|        }
 2143|     20|        config->securityPoliciesSize = 1;
 2144|     20|    }
 2145|       |
 2146|     20|    if(config->requestedSessionTimeout == 0)
  ------------------
  |  Branch (2146:8): [True: 20, False: 0]
  ------------------
 2147|     20|        config->requestedSessionTimeout = 1200000;
 2148|       |
 2149|     20|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2150|     20|    if(config->outStandingPublishRequests == 0)
  ------------------
  |  Branch (2150:8): [True: 20, False: 0]
  ------------------
 2151|     20|        config->outStandingPublishRequests = 10;
 2152|     20|#endif
 2153|       |
 2154|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2155|     20|}

UA_Log_Stdout_withLevel:
  113|     20|UA_Log_Stdout_withLevel(UA_LogLevel minlevel) {
  114|     20|    UA_Logger logger =
  115|       |        {UA_Log_Stdout_log, (void*)(uintptr_t)minlevel, NULL};
  116|     20|    return logger;
  117|     20|}
UA_Log_Stdout_new:
  120|     20|UA_Log_Stdout_new(UA_LogLevel minlevel) {
  121|     20|    UA_Logger *logger = (UA_Logger*)UA_malloc(sizeof(UA_Logger));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  122|     20|    if(!logger)
  ------------------
  |  Branch (122:8): [True: 0, False: 20]
  ------------------
  123|      0|        return NULL;
  124|     20|    *logger = UA_Log_Stdout_withLevel(minlevel);
  125|     20|    logger->clear = UA_Log_Stdout_clear;
  126|     20|    return logger;
  127|     20|}
ua_log_stdout.c:UA_Log_Stdout_clear:
  105|     20|UA_Log_Stdout_clear(UA_Logger *logger) {
  106|     20|    UA_free(logger);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  107|     20|}

UA_Client_newWithConfig:
  107|     20|UA_Client_newWithConfig(const UA_ClientConfig *config) {
  108|     20|    if(!config)
  ------------------
  |  Branch (108:8): [True: 0, False: 20]
  ------------------
  109|      0|        return NULL;
  110|     20|    UA_Client *client = (UA_Client*)UA_malloc(sizeof(UA_Client));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  111|     20|    if(!client)
  ------------------
  |  Branch (111:8): [True: 0, False: 20]
  ------------------
  112|      0|        return NULL;
  113|     20|    memset(client, 0, sizeof(UA_Client));
  114|     20|    client->config = *config;
  115|       |
  116|     20|    UA_SecureChannel_init(&client->channel);
  117|     20|    client->channel.config = client->config.localConnectionConfig;
  118|     20|    client->connectStatus = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  119|       |
  120|     20|#if UA_MULTITHREADING >= 100
  121|     20|    UA_LOCK_INIT(&client->clientMutex);
  122|     20|#endif
  123|       |
  124|       |    /* Initialize the namespace mapping */
  125|     20|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  126|     20|    size_t initialNs = 2 + config->namespacesSize;
  127|     20|    client->namespaces = (UA_String*)UA_calloc(initialNs, sizeof(UA_String));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  128|     20|    if(!client->namespaces)
  ------------------
  |  Branch (128:8): [True: 0, False: 20]
  ------------------
  129|      0|        goto error;
  130|       |
  131|     20|    client->namespacesSize = initialNs;
  132|     20|    client->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
  ------------------
  |  |  220|     20|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
  133|     20|    client->namespaces[1] = UA_STRING_NULL; /* Gets set when we connect to the server */
  134|     20|    for(size_t i = 0; i < config->namespacesSize; i++) {
  ------------------
  |  Branch (134:23): [True: 0, False: 20]
  ------------------
  135|      0|        res |= UA_String_copy(&client->namespaces[i+2], &config->namespaces[i]);
  136|      0|    }
  137|     20|    if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (137:8): [True: 0, False: 20]
  ------------------
  138|      0|        goto error;
  139|       |
  140|     20|    return client;
  141|       |
  142|      0|error:
  143|      0|    memset(&client->config, 0, sizeof(UA_ClientConfig));
  144|      0|    UA_Client_delete(client);
  145|       |    return NULL;
  146|     20|}
UA_ClientConfig_clear:
  149|     20|UA_ClientConfig_clear(UA_ClientConfig *config) {
  150|     20|    UA_ApplicationDescription_clear(&config->clientDescription);
  151|     20|    UA_String_clear(&config->endpointUrl);
  152|     20|    UA_ExtensionObject_clear(&config->userIdentityToken);
  153|       |
  154|       |    /* Delete the SecurityPolicies for Authentication */
  155|     20|    if(config->authSecurityPolicies != 0) {
  ------------------
  |  Branch (155:8): [True: 0, False: 20]
  ------------------
  156|      0|        for(size_t i = 0; i < config->authSecurityPoliciesSize; i++)
  ------------------
  |  Branch (156:27): [True: 0, False: 0]
  ------------------
  157|      0|            config->authSecurityPolicies[i].clear(&config->authSecurityPolicies[i]);
  158|      0|        UA_free(config->authSecurityPolicies);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  159|      0|        config->authSecurityPolicies = 0;
  160|      0|    }
  161|     20|    UA_String_clear(&config->securityPolicyUri);
  162|     20|    UA_String_clear(&config->authSecurityPolicyUri);
  163|       |
  164|     20|    UA_EndpointDescription_clear(&config->endpoint);
  165|     20|    UA_UserTokenPolicy_clear(&config->userTokenPolicy);
  166|       |
  167|     20|    UA_String_clear(&config->applicationUri);
  168|       |
  169|     20|    if(config->certificateVerification.clear)
  ------------------
  |  Branch (169:8): [True: 20, False: 0]
  ------------------
  170|     20|        config->certificateVerification.clear(&config->certificateVerification);
  171|       |
  172|       |    /* Delete the SecurityPolicies */
  173|     20|    if(config->securityPolicies != 0) {
  ------------------
  |  Branch (173:8): [True: 20, False: 0]
  ------------------
  174|     40|        for(size_t i = 0; i < config->securityPoliciesSize; i++)
  ------------------
  |  Branch (174:27): [True: 20, False: 20]
  ------------------
  175|     20|            config->securityPolicies[i].clear(&config->securityPolicies[i]);
  176|     20|        UA_free(config->securityPolicies);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  177|     20|        config->securityPolicies = 0;
  178|     20|    }
  179|       |
  180|       |    /* Stop and delete the EventLoop */
  181|     20|    UA_EventLoop *el = config->eventLoop;
  182|     20|    if(el && !config->externalEventLoop) {
  ------------------
  |  Branch (182:8): [True: 20, False: 0]
  |  Branch (182:14): [True: 20, False: 0]
  ------------------
  183|     20|        if(el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (183:12): [True: 0, False: 20]
  ------------------
  184|      0|           el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (184:12): [True: 0, False: 0]
  ------------------
  185|      0|            el->stop(el);
  186|      0|            while(el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (186:19): [True: 0, False: 0]
  ------------------
  187|      0|                el->run(el, 100);
  188|      0|            }
  189|      0|        }
  190|     20|        el->free(el);
  191|     20|        config->eventLoop = NULL;
  192|     20|    }
  193|       |
  194|       |    /* Logging */
  195|     20|    if(config->logging != NULL && config->logging->clear != NULL)
  ------------------
  |  Branch (195:8): [True: 20, False: 0]
  |  Branch (195:35): [True: 20, False: 0]
  ------------------
  196|     20|        config->logging->clear(config->logging);
  197|     20|    config->logging = NULL;
  198|       |
  199|     20|    UA_String_clear(&config->sessionName);
  200|     20|    if(config->sessionLocaleIdsSize > 0 && config->sessionLocaleIds) {
  ------------------
  |  Branch (200:8): [True: 0, False: 20]
  |  Branch (200:44): [True: 0, False: 0]
  ------------------
  201|      0|        UA_Array_delete(config->sessionLocaleIds,
  202|      0|                        config->sessionLocaleIdsSize, &UA_TYPES[UA_TYPES_LOCALEID]);
  ------------------
  |  | 5276|      0|#define UA_TYPES_LOCALEID 131
  ------------------
  203|      0|    }
  204|     20|    config->sessionLocaleIds = NULL;
  205|     20|    config->sessionLocaleIdsSize = 0;
  206|       |
  207|       |    /* Custom Data Types */
  208|     20|    UA_cleanupDataTypeWithCustom(config->customDataTypes);
  209|       |
  210|     20|#ifdef UA_ENABLE_ENCRYPTION
  211|       |    config->privateKeyPasswordCallback = NULL;
  212|     20|#endif
  213|     20|}
UA_Client_delete:
  279|     20|UA_Client_delete(UA_Client* client) {
  280|     20|    UA_Client_disconnect(client);
  281|     20|    UA_Client_clear(client);
  282|     20|    UA_ClientConfig_clear(&client->config);
  283|     20|    UA_free(client);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  284|     20|}
UA_Client_getConfig:
  300|     20|UA_Client_getConfig(UA_Client *client) {
  301|     20|    if(!client)
  ------------------
  |  Branch (301:8): [True: 0, False: 20]
  ------------------
  302|      0|        return NULL;
  303|     20|    return &client->config;
  304|     20|}
notifyClientState:
  327|     40|notifyClientState(UA_Client *client) {
  328|     40|    UA_LOCK_ASSERT(&client->clientMutex);
  329|       |
  330|     40|    if(client->connectStatus == client->oldConnectStatus &&
  ------------------
  |  Branch (330:8): [True: 20, False: 20]
  ------------------
  331|     20|       client->channel.state == client->oldChannelState &&
  ------------------
  |  Branch (331:8): [True: 20, False: 0]
  ------------------
  332|     20|       client->sessionState == client->oldSessionState)
  ------------------
  |  Branch (332:8): [True: 20, False: 0]
  ------------------
  333|     20|        return;
  334|       |
  335|       |#if UA_LOGLEVEL <= 300
  336|       |    UA_Boolean info = (client->connectStatus != UA_STATUSCODE_GOOD);
  337|       |    if(client->oldChannelState != client->channel.state)
  338|       |        info |= (client->channel.state == UA_SECURECHANNELSTATE_OPEN ||
  339|       |                 client->channel.state == UA_SECURECHANNELSTATE_CLOSED);
  340|       |    if(client->oldSessionState != client->sessionState)
  341|       |        info |= (client->sessionState == UA_SESSIONSTATE_CREATED ||
  342|       |                 client->sessionState == UA_SESSIONSTATE_ACTIVATED ||
  343|       |                 client->sessionState == UA_SESSIONSTATE_CLOSED);
  344|       |
  345|       |    const char *channelStateText = channelStateTexts[client->channel.state];
  346|       |    const char *sessionStateText = sessionStateTexts[client->sessionState];
  347|       |    const char *connectStatusText = UA_StatusCode_name(client->connectStatus);
  348|       |
  349|       |    if(info)
  350|       |        UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
  351|       |                    "Client Status: ChannelState: %s, SessionState: %s, ConnectStatus: %s",
  352|       |                    channelStateText, sessionStateText, connectStatusText);
  353|       |    else
  354|       |        UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
  355|       |                     "Client Status: ChannelState: %s, SessionState: %s, ConnectStatus: %s",
  356|       |                     channelStateText, sessionStateText, connectStatusText);
  357|       |#endif
  358|       |
  359|     20|    client->oldConnectStatus = client->connectStatus;
  360|     20|    client->oldChannelState = client->channel.state;
  361|     20|    client->oldSessionState = client->sessionState;
  362|       |
  363|     20|    if(client->config.stateCallback)
  ------------------
  |  Branch (363:8): [True: 0, False: 20]
  ------------------
  364|      0|        client->config.stateCallback(client, client->channel.state,
  365|      0|                                     client->sessionState, client->connectStatus);
  366|     20|}
processServiceResponse:
  617|     20|                       UA_ByteString *message) {
  618|     20|    if(!UA_SecureChannel_isConnected(channel)) {
  ------------------
  |  Branch (618:8): [True: 0, False: 20]
  ------------------
  619|      0|        if(messageType == UA_MESSAGETYPE_MSG) {
  ------------------
  |  Branch (619:12): [True: 0, False: 0]
  ------------------
  620|      0|            UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Discard MSG message "
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  621|      0|                                 "with RequestId %u as the SecureChannel is not connected",
  622|      0|                                 requestId);
  623|      0|        } else {
  624|      0|            UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Discard message "
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|      0|                                 "as the SecureChannel is not connected");
  626|      0|        }
  627|      0|        return UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  739|      0|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
  628|      0|    }
  629|       |
  630|     20|    switch(messageType) {
  631|      0|    case UA_MESSAGETYPE_RHE:
  ------------------
  |  Branch (631:5): [True: 0, False: 20]
  ------------------
  632|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process RHE message");
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  633|      0|        processRHEMessage(client, message);
  634|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  635|      0|    case UA_MESSAGETYPE_ACK:
  ------------------
  |  Branch (635:5): [True: 0, False: 20]
  ------------------
  636|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process ACK message");
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  637|      0|        processACKResponse(client, message);
  638|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  639|      0|    case UA_MESSAGETYPE_OPN:
  ------------------
  |  Branch (639:5): [True: 0, False: 20]
  ------------------
  640|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process OPN message");
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  641|      0|        processOPNResponse(client, message);
  642|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  643|      0|    case UA_MESSAGETYPE_ERR:
  ------------------
  |  Branch (643:5): [True: 0, False: 20]
  ------------------
  644|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process ERR message");
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  645|      0|        processERRResponse(client, message);
  646|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  647|      0|    case UA_MESSAGETYPE_MSG:
  ------------------
  |  Branch (647:5): [True: 0, False: 20]
  ------------------
  648|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process MSG message "
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  649|      0|                             "with RequestId %u", requestId);
  650|      0|        return processMSGResponse(client, requestId, message);
  651|     20|    default:
  ------------------
  |  Branch (651:5): [True: 20, False: 0]
  ------------------
  652|     20|        UA_LOG_TRACE_CHANNEL(client->config.logging, channel,
  ------------------
  |  |  483|     20|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, TRACE, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|     80|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 20]
  |  |  |  |  |  Branch (34:28): [Folded, False: 20]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  653|     20|                             "Invalid message type");
  654|     20|        channel->state = UA_SECURECHANNELSTATE_CLOSING;
  655|     20|        return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID;
  ------------------
  |  |  484|     20|#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID ((UA_StatusCode) 0x807E0000)
  ------------------
  656|     20|    }
  657|     20|}
__Client_Service:
  662|     20|                 const UA_DataType *responseType) {
  663|     20|    UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
  664|       |
  665|       |    /* Initialize. Response is valied in case of aborting. */
  666|     20|    UA_init(response, responseType);
  667|       |
  668|       |    /* Verify that the EventLoop is running */
  669|     20|    UA_EventLoop *el = client->config.eventLoop;
  670|     20|    if(!el || el->state != UA_EVENTLOOPSTATE_STARTED) {
  ------------------
  |  Branch (670:8): [True: 0, False: 20]
  |  Branch (670:15): [True: 20, False: 0]
  ------------------
  671|     20|        respHeader->serviceResult = UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|     20|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  672|     20|        return;
  673|     20|    }
  674|       |
  675|       |    /* Check that the SecureChannel is open and also a Session active (if we
  676|       |     * want a Session). Otherwise reopen. */
  677|      0|    if(!isFullyConnected(client)) {
  ------------------
  |  Branch (677:8): [True: 0, False: 0]
  ------------------
  678|      0|        UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
  679|      0|                    "Re-establish the connection for the synchronous service call");
  680|      0|        connectSync(client);
  681|      0|        if(client->connectStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (681:12): [True: 0, False: 0]
  ------------------
  682|      0|            respHeader->serviceResult = client->connectStatus;
  683|      0|            return;
  684|      0|        }
  685|      0|    }
  686|       |
  687|       |    /* Store the channelId to detect if the channel was changed by a
  688|       |     * reconnection within the EventLoop run method. */
  689|      0|    UA_UInt32 channelId = client->channel.securityToken.channelId;
  690|       |
  691|       |    /* Send the request */
  692|      0|    UA_UInt32 requestId = 0;
  693|      0|    UA_StatusCode retval = sendRequest(client, request, requestType, &requestId);
  694|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (694:8): [True: 0, False: 0]
  ------------------
  695|       |        /* If sending failed, the status is set to closing. The SecureChannel is
  696|       |         * the actually closed in the next iteration of the EventLoop. */
  697|      0|        UA_assert(client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  ------------------
  |  |  395|      0|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (697:9): [True: 0, False: 0]
  |  Branch (697:9): [True: 0, False: 0]
  ------------------
  698|      0|                  client->channel.state == UA_SECURECHANNELSTATE_CLOSED);
  699|      0|        UA_LOG_WARNING(client->config.logging, UA_LOGCATEGORY_CLIENT,
  700|      0|                       "Sending the request failed with status %s",
  701|      0|                       UA_StatusCode_name(retval));
  702|      0|        notifyClientState(client);
  703|      0|        respHeader->serviceResult = retval;
  704|      0|        return;
  705|      0|    }
  706|       |
  707|       |    /* Temporarily insert an AsyncServiceCall */
  708|      0|    const UA_RequestHeader *rh = (const UA_RequestHeader*)request;
  709|      0|    AsyncServiceCall ac;
  710|      0|    ac.callback = NULL;
  711|      0|    ac.userdata = NULL;
  712|      0|    ac.responseType = responseType;
  713|      0|    ac.syncResponse = (UA_Response*)response;
  714|      0|    ac.requestId = requestId;
  715|      0|    ac.start = el->dateTime_nowMonotonic(el); /* Start timeout after sending */
  716|      0|    ac.timeout = rh->timeoutHint;
  717|      0|    ac.requestHandle = rh->requestHandle;
  718|      0|    if(ac.timeout == 0)
  ------------------
  |  Branch (718:8): [True: 0, False: 0]
  ------------------
  719|      0|        ac.timeout = UA_UINT32_MAX; /* 0 -> unlimited */
  ------------------
  |  |  109|      0|#define UA_UINT32_MAX 4294967295UL
  ------------------
  720|       |
  721|      0|    LIST_INSERT_HEAD(&client->asyncServiceCalls, &ac, pointers);
  ------------------
  |  |  221|      0|#define LIST_INSERT_HEAD(head, elm, field) do {				\
  |  |  222|      0|    if (((elm)->field.le_next = (head)->lh_first) != NULL)		\
  |  |  ------------------
  |  |  |  Branch (222:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  223|      0|        (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
  |  |  224|      0|    (head)->lh_first = (elm);					\
  |  |  225|      0|    (elm)->field.le_prev = &(head)->lh_first;			\
  |  |  226|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (226:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  722|       |
  723|       |    /* Time until which the request has to be answered */
  724|      0|    UA_DateTime maxDate = ac.start + ((UA_DateTime)ac.timeout * UA_DATETIME_MSEC);
  ------------------
  |  |  284|      0|#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
  |  |  ------------------
  |  |  |  |  283|      0|#define UA_DATETIME_USEC 10LL
  |  |  ------------------
  ------------------
  725|       |
  726|       |    /* Run the EventLoop until the request was processed, the request has timed
  727|       |     * out or the client connection fails */
  728|      0|    UA_UInt32 timeout_remaining = ac.timeout;
  729|      0|    while(true) {
  ------------------
  |  Branch (729:11): [True: 0, Folded]
  ------------------
  730|       |        /* Unlock before dropping into the EventLoop. The client lock is
  731|       |         * re-taken in the network callback if an event occurs. */
  732|      0|        retval = el->run(el, timeout_remaining);
  733|       |
  734|       |        /* Was the response received? In that case we can directly return. The
  735|       |         * ac was already removed from the internal linked list. */
  736|      0|        if(ac.syncResponse == NULL)
  ------------------
  |  Branch (736:12): [True: 0, False: 0]
  ------------------
  737|      0|            return;
  738|       |
  739|       |        /* Check the status. Do not try to resend if the connection breaks.
  740|       |         * Leave this to the application-level user. For example, we do not want
  741|       |         * to call a method twice is the connection broke after sending the
  742|       |         * request. */
  743|      0|        if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (743:12): [True: 0, False: 0]
  ------------------
  744|      0|            break;
  745|       |
  746|       |        /* The connection was lost */
  747|      0|        retval = client->connectStatus;
  748|      0|        if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (748:12): [True: 0, False: 0]
  ------------------
  749|      0|            break;
  750|       |
  751|       |        /* The channel is no longer the same or was closed */
  752|      0|        if(channelId != client->channel.securityToken.channelId) {
  ------------------
  |  Branch (752:12): [True: 0, False: 0]
  ------------------
  753|      0|            retval = UA_STATUSCODE_BADSECURECHANNELCLOSED;
  ------------------
  |  |  508|      0|#define UA_STATUSCODE_BADSECURECHANNELCLOSED ((UA_StatusCode) 0x80860000)
  ------------------
  754|      0|            break;
  755|      0|        }
  756|       |
  757|       |        /* Update the remaining timeout or break */
  758|      0|        UA_DateTime now = ac.start = el->dateTime_nowMonotonic(el);
  759|      0|        if(now > maxDate) {
  ------------------
  |  Branch (759:12): [True: 0, False: 0]
  ------------------
  760|      0|            retval = UA_STATUSCODE_BADTIMEOUT;
  ------------------
  |  |   58|      0|#define UA_STATUSCODE_BADTIMEOUT ((UA_StatusCode) 0x800A0000)
  ------------------
  761|      0|            break;
  762|      0|        }
  763|      0|        timeout_remaining = (UA_UInt32)((maxDate - now) / UA_DATETIME_MSEC);
  ------------------
  |  |  284|      0|#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
  |  |  ------------------
  |  |  |  |  283|      0|#define UA_DATETIME_USEC 10LL
  |  |  ------------------
  ------------------
  764|      0|    }
  765|       |
  766|       |    /* Detach from the internal async service list */
  767|      0|    LIST_REMOVE(&ac, pointers);
  ------------------
  |  |  228|      0|#define LIST_REMOVE(elm, field) do {					\
  |  |  229|      0|    if ((elm)->field.le_next != NULL)				\
  |  |  ------------------
  |  |  |  Branch (229:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  230|      0|        (elm)->field.le_next->field.le_prev =			\
  |  |  231|      0|            (elm)->field.le_prev;				\
  |  |  232|      0|    *(elm)->field.le_prev = (elm)->field.le_next;			\
  |  |  233|      0|    _Q_INVALIDATE((elm)->field.le_prev);				\
  |  |  234|      0|    _Q_INVALIDATE((elm)->field.le_next);				\
  |  |  235|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (235:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  768|       |
  769|       |    /* Return the status code */
  770|      0|    respHeader->serviceResult = retval;
  771|      0|}
__Client_AsyncService_removeAll:
  803|     60|__Client_AsyncService_removeAll(UA_Client *client, UA_StatusCode statusCode) {
  804|       |    /* Make this function reentrant. One of the async callbacks could indirectly
  805|       |     * operate on the list. Moving all elements to a local list before iterating
  806|       |     * that. */
  807|     60|    UA_AsyncServiceList asyncServiceCalls = client->asyncServiceCalls;
  808|     60|    LIST_INIT(&client->asyncServiceCalls);
  ------------------
  |  |  202|     60|#define	LIST_INIT(head) do {						\
  |  |  203|     60|    LIST_FIRST(head) = LIST_END(head);				\
  |  |  ------------------
  |  |  |  |  184|     60|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |                   LIST_FIRST(head) = LIST_END(head);				\
  |  |  ------------------
  |  |  |  |  185|     60|#define	LIST_END(head)			NULL
  |  |  ------------------
  |  |  204|     60|} while (0)
  |  |  ------------------
  |  |  |  Branch (204:10): [Folded, False: 60]
  |  |  ------------------
  ------------------
  809|     60|    if(asyncServiceCalls.lh_first)
  ------------------
  |  Branch (809:8): [True: 0, False: 60]
  ------------------
  810|      0|        asyncServiceCalls.lh_first->pointers.le_prev = &asyncServiceCalls.lh_first;
  811|       |
  812|       |    /* Cancel and remove the elements from the local list */
  813|     60|    AsyncServiceCall *ac, *ac_tmp;
  814|     60|    LIST_FOREACH_SAFE(ac, &asyncServiceCalls, pointers, ac_tmp) {
  ------------------
  |  |  195|     60|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     60|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     60|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 60]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     60|        (var) = (tvar))
  ------------------
  815|       |        LIST_REMOVE(ac, pointers);
  ------------------
  |  |  228|      0|#define LIST_REMOVE(elm, field) do {					\
  |  |  229|      0|    if ((elm)->field.le_next != NULL)				\
  |  |  ------------------
  |  |  |  Branch (229:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  230|      0|        (elm)->field.le_next->field.le_prev =			\
  |  |  231|      0|            (elm)->field.le_prev;				\
  |  |  232|      0|    *(elm)->field.le_prev = (elm)->field.le_next;			\
  |  |  233|      0|    _Q_INVALIDATE((elm)->field.le_prev);				\
  |  |  234|      0|    _Q_INVALIDATE((elm)->field.le_next);				\
  |  |  235|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (235:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  816|      0|        __Client_AsyncService_cancel(client, ac, statusCode);
  817|      0|    }
  818|     60|}
UA_Client_removeCallback:
  962|     20|UA_Client_removeCallback(UA_Client *client, UA_UInt64 callbackId) {
  963|     20|    if(!client->config.eventLoop)
  ------------------
  |  Branch (963:8): [True: 0, False: 20]
  ------------------
  964|      0|        return;
  965|     20|    lockClient(client);
  966|     20|    client->config.eventLoop->removeTimer(client->config.eventLoop, callbackId);
  967|     20|    unlockClient(client);
  968|     20|}
lockClient:
 1277|     60|void lockClient(UA_Client *client) {
 1278|     60|    if(UA_LIKELY(client->config.eventLoop && client->config.eventLoop->lock))
  ------------------
  |  |  574|    120|# define UA_LIKELY(x) __builtin_expect((x), 1)
  |  |  ------------------
  |  |  |  Branch (574:23): [True: 60, False: 0]
  |  |  |  Branch (574:41): [True: 60, False: 0]
  |  |  |  Branch (574:41): [True: 60, False: 0]
  |  |  ------------------
  ------------------
 1279|     60|        client->config.eventLoop->lock(client->config.eventLoop);
 1280|     60|    UA_LOCK(&client->clientMutex);
 1281|     60|}
unlockClient:
 1283|     60|void unlockClient(UA_Client *client) {
 1284|     60|    if(UA_LIKELY(client->config.eventLoop && client->config.eventLoop->unlock))
  ------------------
  |  |  574|    120|# define UA_LIKELY(x) __builtin_expect((x), 1)
  |  |  ------------------
  |  |  |  Branch (574:23): [True: 60, False: 0]
  |  |  |  Branch (574:41): [True: 60, False: 0]
  |  |  |  Branch (574:41): [True: 60, False: 0]
  |  |  ------------------
  ------------------
 1285|     60|        client->config.eventLoop->unlock(client->config.eventLoop);
 1286|     60|    UA_UNLOCK(&client->clientMutex);
 1287|     60|}
ua_client.c:UA_Client_clear:
  223|     20|UA_Client_clear(UA_Client *client) {
  224|       |    /* Prevent new async service calls in UA_Client_AsyncService_removeAll */
  225|     20|    UA_SessionState oldState = client->sessionState;
  226|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
  227|       |
  228|       |    /* Delete the async service calls with BADHSUTDOWN */
  229|     20|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSHUTDOWN);
  ------------------
  |  |   64|     20|#define UA_STATUSCODE_BADSHUTDOWN ((UA_StatusCode) 0x800C0000)
  ------------------
  230|       |
  231|       |    /* Reset to the old state to properly close the session */
  232|     20|    client->sessionState = oldState;
  233|       |
  234|     20|    UA_Client_disconnect(client);
  235|       |
  236|       |    /* Prevent reconnection attempts during the EventLoop teardown
  237|       |     * in UA_ClientConfig_clear */
  238|     20|    client->connectStatus = UA_STATUSCODE_BADSHUTDOWN;
  ------------------
  |  |   64|     20|#define UA_STATUSCODE_BADSHUTDOWN ((UA_StatusCode) 0x800C0000)
  ------------------
  239|       |
  240|     20|    UA_String_clear(&client->discoveryUrl);
  241|     20|    UA_EndpointDescription_clear(&client->endpoint);
  242|       |
  243|     20|    UA_ByteString_clear(&client->serverSessionNonce);
  244|     20|    UA_ByteString_clear(&client->clientSessionNonce);
  245|       |
  246|       |    /* Delete the subscriptions */
  247|     20|#ifdef UA_ENABLE_SUBSCRIPTIONS
  248|     20|    __Client_Subscriptions_clear(client);
  249|     20|#endif
  250|       |
  251|       |    /* Remove the internal regular callback */
  252|     20|    UA_Client_removeCallback(client, client->houseKeepingCallbackId);
  253|     20|    client->houseKeepingCallbackId = 0;
  254|       |
  255|       |    /* Clean up the SecureChannel */
  256|     20|    UA_SecureChannel_clear(&client->channel);
  257|       |
  258|       |    /* Free the namespace mapping */
  259|     20|    UA_Array_delete(client->namespaces, client->namespacesSize,
  260|     20|                    &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|     20|#define UA_TYPES_STRING 11
  ------------------
  261|     20|    client->namespaces = NULL;
  262|     20|    client->namespacesSize = 0;
  263|       |
  264|       |    /* Call the application notification callback */
  265|     20|    UA_ClientConfig *config = &client->config;
  266|     20|    if(config->lifecycleNotificationCallback)
  ------------------
  |  Branch (266:8): [True: 0, False: 20]
  ------------------
  267|      0|        config->lifecycleNotificationCallback(client, UA_APPLICATIONNOTIFICATIONTYPE_LIFECYCLE_STOPPED,
  ------------------
  |  |  217|      0|    ((0x01ULL << 32) | 0x04)
  ------------------
  268|      0|                                              UA_KEYVALUEMAP_NULL);
  269|     20|    if(config->globalNotificationCallback)
  ------------------
  |  Branch (269:8): [True: 0, False: 20]
  ------------------
  270|      0|        config->globalNotificationCallback(client, UA_APPLICATIONNOTIFICATIONTYPE_LIFECYCLE_STOPPED,
  ------------------
  |  |  217|      0|    ((0x01ULL << 32) | 0x04)
  ------------------
  271|      0|                                           UA_KEYVALUEMAP_NULL);
  272|       |
  273|     20|#if UA_MULTITHREADING >= 100
  274|     20|    UA_LOCK_DESTROY(&client->clientMutex);
  275|     20|#endif
  276|     20|}

closeSecureChannel:
 2760|     40|closeSecureChannel(UA_Client *client) {
 2761|       |    /* If we close SecureChannel when the Session is still active, set to
 2762|       |     * created. Otherwise the Session would remain active until the connection
 2763|       |     * callback is called for the closing connection. */
 2764|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (2764:8): [True: 0, False: 40]
  ------------------
 2765|      0|        client->sessionState = UA_SESSIONSTATE_CREATED;
 2766|       |
 2767|       |    /* Prevent recursion */
 2768|     40|    if(client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  ------------------
  |  Branch (2768:8): [True: 40, False: 0]
  ------------------
 2769|      0|       client->channel.state == UA_SECURECHANNELSTATE_CLOSED)
  ------------------
  |  Branch (2769:8): [True: 0, False: 0]
  ------------------
 2770|     40|        return;
 2771|       |
 2772|      0|    UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2773|      0|                         "Closing the channel");
 2774|       |
 2775|      0|    disconnectListenSockets(client);
 2776|       |
 2777|       |    /* Send CLO if the SecureChannel is open */
 2778|      0|    if(client->channel.state == UA_SECURECHANNELSTATE_OPEN) {
  ------------------
  |  Branch (2778:8): [True: 0, False: 0]
  ------------------
 2779|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  485|      0|    UA_MACRO_EXPAND(UA_LOG_CHANNEL_INTERNAL(LOGGER, DEBUG, CHANNEL, __VA_ARGS__, ""))
  |  |  ------------------
  |  |  |  |   34|      0|#define UA_MACRO_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  |  Branch (34:28): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2780|      0|                             "Sending the CLO message");
 2781|       |
 2782|      0|        UA_EventLoop *el = client->config.eventLoop;
 2783|       |
 2784|       |        /* Manually set up the header (otherwise done in sendRequest) */
 2785|      0|        UA_CloseSecureChannelRequest request;
 2786|      0|        UA_CloseSecureChannelRequest_init(&request);
 2787|      0|        request.requestHeader.requestHandle = ++client->requestHandle;
 2788|      0|        request.requestHeader.timestamp = el->dateTime_now(el);
 2789|      0|        request.requestHeader.timeoutHint = client->config.timeout;
 2790|      0|        request.requestHeader.authenticationToken = client->authenticationToken;
 2791|      0|        UA_SecureChannel_sendCLO(&client->channel, ++client->requestId, &request);
 2792|      0|    }
 2793|       |
 2794|       |    /* The connection is eventually closed in the next callback from the
 2795|       |     * ConnectionManager with the appropriate status code. Don't set the
 2796|       |     * connection closed right away! */
 2797|      0|    UA_SecureChannel_shutdown(&client->channel, UA_SHUTDOWNREASON_CLOSE);
 2798|      0|}
cleanupSession:
 2817|     40|cleanupSession(UA_Client *client) {
 2818|     40|    UA_NodeId_clear(&client->sessionId);
 2819|     40|    UA_NodeId_clear(&client->authenticationToken);
 2820|     40|    client->requestHandle = 0;
 2821|       |
 2822|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2823|       |    /* We need to clean up the subscriptions */
 2824|     40|    __Client_Subscriptions_clear(client);
 2825|     40|#endif
 2826|       |
 2827|       |    /* Delete outstanding async services */
 2828|     40|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSESSIONCLOSED);
  ------------------
  |  |  151|     40|#define UA_STATUSCODE_BADSESSIONCLOSED ((UA_StatusCode) 0x80260000)
  ------------------
 2829|       |
 2830|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2831|     40|    client->currentlyOutStandingPublishRequests = 0;
 2832|     40|#endif
 2833|       |
 2834|     40|    client->sessionState = UA_SESSIONSTATE_CLOSED;
 2835|       |
 2836|       |    /* Clean the latest server's ephemeral public key */
 2837|     40|    UA_ByteString_clear(&client->serverEphemeralPubKey);
 2838|     40|    if(client->utpSp && client->utpSpContext) {
  ------------------
  |  Branch (2838:8): [True: 0, False: 40]
  |  Branch (2838:25): [True: 0, False: 0]
  ------------------
 2839|      0|        client->utpSp->deleteChannelContext(client->utpSp, client->utpSpContext);
 2840|      0|        client->utpSp = NULL;
 2841|       |        client->utpSpContext = NULL;
 2842|      0|    }
 2843|     40|}
UA_Client_disconnect:
 2896|     40|UA_Client_disconnect(UA_Client *client) {
 2897|     40|    lockClient(client);
 2898|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (2898:8): [True: 20, False: 20]
  ------------------
 2899|     20|        sendCloseSession(client);
 2900|     40|    cleanupSession(client);
 2901|     40|    disconnectSecureChannel(client, true);
 2902|     40|    unlockClient(client);
 2903|     40|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2904|     40|}
ua_client_connect.c:disconnectSecureChannel:
 2846|     40|disconnectSecureChannel(UA_Client *client, UA_Boolean sync) {
 2847|       |    /* Clean the DiscoveryUrl and endpoint description when the connection is
 2848|       |     * explicitly closed */
 2849|     40|    UA_String_clear(&client->discoveryUrl);
 2850|     40|    UA_EndpointDescription_clear(&client->endpoint);
 2851|       |
 2852|       |    /* Close the SecureChannel */
 2853|     40|    closeSecureChannel(client);
 2854|       |
 2855|       |    /* Manually set the status to closed to prevent an automatic reconnection.
 2856|       |     * Notify the client at the end. */
 2857|     40|    if(client->connectStatus == UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2857:8): [True: 20, False: 20]
  ------------------
 2858|     20|        client->connectStatus = UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  739|     20|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
 2859|       |
 2860|       |    /* In the synchronous case, loop until the client has actually closed. */
 2861|     40|    UA_EventLoop *el = client->config.eventLoop;
 2862|     40|    if(sync && el &&
  ------------------
  |  Branch (2862:8): [True: 40, False: 0]
  |  Branch (2862:16): [True: 40, False: 0]
  ------------------
 2863|     40|       el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (2863:8): [True: 0, False: 40]
  ------------------
 2864|      0|       el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (2864:8): [True: 0, False: 0]
  ------------------
 2865|      0|        while(client->channel.state != UA_SECURECHANNELSTATE_CLOSED) {
  ------------------
  |  Branch (2865:15): [True: 0, False: 0]
  ------------------
 2866|      0|            UA_StatusCode runStatus = el->run(el, 100);
 2867|      0|            if(runStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2867:16): [True: 0, False: 0]
  ------------------
 2868|      0|                UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
 2869|      0|                             "EventLoop run returned %s during synchronous disconnect, "
 2870|      0|                             "stopping wait loop", UA_StatusCode_name(runStatus));
 2871|      0|                break;
 2872|      0|            }
 2873|      0|        }
 2874|      0|    }
 2875|       |
 2876|     40|    notifyClientState(client);
 2877|     40|}
ua_client_connect.c:sendCloseSession:
 2801|     20|sendCloseSession(UA_Client *client) {
 2802|     20|    UA_CloseSessionRequest request;
 2803|     20|    UA_CloseSessionRequest_init(&request);
 2804|     20|    request.deleteSubscriptions = true;
 2805|     20|    UA_CloseSessionResponse response;
 2806|     20|    __Client_Service(client, &request, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST],
  ------------------
  |  | 7322|     20|#define UA_TYPES_CLOSESESSIONREQUEST 181
  ------------------
 2807|     20|                        &response, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
  ------------------
  |  | 7360|     20|#define UA_TYPES_CLOSESESSIONRESPONSE 182
  ------------------
 2808|     20|    UA_CloseSessionRequest_clear(&request);
 2809|     20|    UA_CloseSessionResponse_clear(&response);
 2810|       |
 2811|       |    /* Set after sending the message to prevent immediate reoping during the
 2812|       |     * service call */
 2813|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
 2814|     20|}

__Client_Subscriptions_clear:
 1598|     60|__Client_Subscriptions_clear(UA_Client *client) {
 1599|     60|    UA_Client_NotificationsAckNumber *n;
 1600|     60|    UA_Client_NotificationsAckNumber *tmp;
 1601|     60|    LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
  ------------------
  |  |  195|     60|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     60|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     60|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 60]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     60|        (var) = (tvar))
  ------------------
 1602|      0|        LIST_REMOVE(n, listEntry);
  ------------------
  |  |  228|      0|#define LIST_REMOVE(elm, field) do {					\
  |  |  229|      0|    if ((elm)->field.le_next != NULL)				\
  |  |  ------------------
  |  |  |  Branch (229:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  230|      0|        (elm)->field.le_next->field.le_prev =			\
  |  |  231|      0|            (elm)->field.le_prev;				\
  |  |  232|      0|    *(elm)->field.le_prev = (elm)->field.le_next;			\
  |  |  233|      0|    _Q_INVALIDATE((elm)->field.le_prev);				\
  |  |  234|      0|    _Q_INVALIDATE((elm)->field.le_next);				\
  |  |  235|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (235:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1603|      0|        UA_free(n);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1604|      0|    }
 1605|       |
 1606|     60|    UA_Client_Subscription *sub;
 1607|     60|    UA_Client_Subscription *tmps;
 1608|     60|    LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps)
  ------------------
  |  |  195|     60|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     60|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     60|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 60]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     60|        (var) = (tvar))
  ------------------
 1609|      0|        __Client_Subscription_deleteInternal(client, sub); /* force local removal */
 1610|       |
 1611|     60|    client->monitoredItemHandles = 0;
 1612|     60|}

UA_SecureChannel_init:
   30|     20|UA_SecureChannel_init(UA_SecureChannel *channel) {
   31|       |    /* Normal linked lists are initialized by zeroing out */
   32|     20|    memset(channel, 0, sizeof(UA_SecureChannel));
   33|       |    TAILQ_INIT(&channel->chunks);
  ------------------
  |  |  457|     20|#define	TAILQ_INIT(head) do {						\
  |  |  458|     20|    (head)->tqh_first = NULL;					\
  |  |  459|     20|    (head)->tqh_last = &(head)->tqh_first;				\
  |  |  460|     20|} while (0)
  |  |  ------------------
  |  |  |  Branch (460:10): [Folded, False: 20]
  |  |  ------------------
  ------------------
   34|     20|}
UA_SecureChannel_isConnected:
  119|     20|UA_SecureChannel_isConnected(UA_SecureChannel *channel) {
  120|     20|    return (channel->state > UA_SECURECHANNELSTATE_CLOSED &&
  ------------------
  |  Branch (120:13): [True: 20, False: 0]
  ------------------
  121|     20|            channel->state < UA_SECURECHANNELSTATE_CLOSING);
  ------------------
  |  Branch (121:13): [True: 20, False: 0]
  ------------------
  122|     20|}
UA_SecureChannel_deleteBuffered:
  177|     20|UA_SecureChannel_deleteBuffered(UA_SecureChannel *channel) {
  178|     20|    deleteChunks(channel);
  179|     20|    if(channel->unprocessedCopied)
  ------------------
  |  Branch (179:8): [True: 0, False: 20]
  ------------------
  180|      0|        UA_ByteString_clear(&channel->unprocessed);
  181|     20|}
UA_SecureChannel_clear:
  200|     20|UA_SecureChannel_clear(UA_SecureChannel *channel) {
  201|       |    /* No sessions must be attached to this any longer */
  202|     20|    UA_assert(channel->sessions == NULL);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (202:5): [True: 20, False: 0]
  ------------------
  203|       |
  204|       |    /* Delete the channel context for the security policy */
  205|     20|    UA_SecurityPolicy *sp = channel->securityPolicy;
  206|     20|    if(sp) {
  ------------------
  |  Branch (206:8): [True: 0, False: 20]
  ------------------
  207|      0|        sp->deleteChannelContext(sp, channel->channelContext);
  208|      0|        channel->securityPolicy = NULL;
  209|      0|        channel->channelContext = NULL;
  210|      0|        channel->enhancedSecurity = false;     /* No policy => not enhanced */
  211|      0|        channel->legacySequenceNumbers = true; /* No policy => legacy */
  212|      0|    }
  213|       |
  214|       |    /* Remove remaining delayed callback */
  215|     20|    if(channel->connectionManager &&
  ------------------
  |  Branch (215:8): [True: 0, False: 20]
  ------------------
  216|      0|       channel->connectionManager->eventSource.eventLoop) {
  ------------------
  |  Branch (216:8): [True: 0, False: 0]
  ------------------
  217|      0|        UA_EventLoop *el = channel->connectionManager->eventSource.eventLoop;
  218|      0|        el->removeDelayedCallback(el, &channel->unprocessedDelayed);
  219|      0|    }
  220|       |
  221|       |    /* The EventLoop connection is no longer valid */
  222|     20|    channel->connectionId = 0;
  223|     20|    channel->connectionManager = NULL;
  224|       |
  225|       |    /* Clean up the SecurityToken */
  226|     20|    UA_ChannelSecurityToken_clear(&channel->securityToken);
  227|     20|    UA_ChannelSecurityToken_clear(&channel->altSecurityToken);
  228|       |
  229|       |    /* Clean up certificate and nonces */
  230|     20|    UA_ByteString_clear(&channel->remoteCertificate);
  231|     20|    UA_ByteString_clear(&channel->localNonce);
  232|     20|    UA_ByteString_clear(&channel->remoteNonce);
  233|       |
  234|       |    /* Clean up the v1.05.07 SecureChannel elements */
  235|     20|    UA_ByteString_clear(&channel->firstRequestSignature);
  236|     20|    UA_ByteString_clear(&channel->currentIKM);
  237|     20|    UA_ByteString_clear(&channel->channelThumbprint);
  238|       |
  239|       |    /* Clean up endpointUrl and remoteAddress */
  240|     20|    UA_String_clear(&channel->endpointUrl);
  241|     20|    UA_String_clear(&channel->remoteAddress);
  242|       |
  243|       |    /* Delete remaining chunks */
  244|     20|    UA_SecureChannel_deleteBuffered(channel);
  245|       |
  246|       |    /* Clean up namespace mapping */
  247|     20|    UA_NamespaceMapping_delete(channel->namespaceMapping);
  248|     20|    channel->namespaceMapping = NULL;
  249|       |
  250|       |    /* Reset the SecureChannel for reuse (in the client) */
  251|     20|    channel->securityMode = UA_MESSAGESECURITYMODE_INVALID;
  252|     20|    channel->shutdownReason = UA_SHUTDOWNREASON_CLOSE;
  253|     20|    memset(&channel->config, 0, sizeof(UA_ConnectionConfig));
  254|     20|    channel->receiveSequenceNumber = 0;
  255|     20|    channel->sendSequenceNumber = 0;
  256|       |
  257|       |    /* Set the state to closed */
  258|     20|    channel->state = UA_SECURECHANNELSTATE_CLOSED;
  259|     20|    channel->renewState = UA_SECURECHANNELRENEWSTATE_NORMAL;
  260|     20|}
ua_securechannel.c:deleteChunks:
  166|     20|deleteChunks(UA_SecureChannel *channel) {
  167|     20|    UA_Chunk *chunk, *chunk_tmp;
  168|     20|    TAILQ_FOREACH_SAFE(chunk, &channel->chunks, pointers, chunk_tmp) {
  ------------------
  |  |  437|     20|    for ((var) = TAILQ_FIRST(head);					\
  |  |  ------------------
  |  |  |  |  420|     20|#define	TAILQ_FIRST(head)		((head)->tqh_first)
  |  |  ------------------
  |  |  438|     20|        (var) != TAILQ_END(head) &&					\
  |  |  ------------------
  |  |  |  |  421|     40|#define	TAILQ_END(head)			NULL
  |  |  ------------------
  |  |  |  Branch (438:9): [True: 0, False: 20]
  |  |  ------------------
  |  |  439|     20|        ((tvar) = TAILQ_NEXT(var, field), 1);			\
  |  |  ------------------
  |  |  |  |  422|      0|#define	TAILQ_NEXT(elm, field)		((elm)->field.tqe_next)
  |  |  ------------------
  |  |  |  Branch (439:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  440|     20|        (var) = (tvar))
  ------------------
  169|       |        TAILQ_REMOVE(&channel->chunks, chunk, pointers);
  ------------------
  |  |  496|      0|#define TAILQ_REMOVE(head, elm, field) do {				\
  |  |  497|      0|    if (((elm)->field.tqe_next) != NULL)				\
  |  |  ------------------
  |  |  |  Branch (497:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  498|      0|        (elm)->field.tqe_next->field.tqe_prev =			\
  |  |  499|      0|            (elm)->field.tqe_prev;				\
  |  |  500|      0|    else								\
  |  |  501|      0|        (head)->tqh_last = (elm)->field.tqe_prev;		\
  |  |  502|      0|    *(elm)->field.tqe_prev = (elm)->field.tqe_next;			\
  |  |  503|      0|    _Q_INVALIDATE((elm)->field.tqe_prev);				\
  |  |  504|      0|    _Q_INVALIDATE((elm)->field.tqe_next);				\
  |  |  505|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (505:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  170|      0|        UA_Chunk_delete(chunk);
  171|      0|    }
  172|     20|    channel->chunksCount = 0;
  173|     20|    channel->chunksLength = 0;
  174|     20|}

UA_cleanupDataTypeWithCustom:
  180|     20|UA_cleanupDataTypeWithCustom(UA_DataTypeArray *customTypes) {
  181|     20|    while(customTypes) {
  ------------------
  |  Branch (181:11): [True: 0, False: 20]
  ------------------
  182|      0|        UA_DataTypeArray *next = customTypes->next;
  183|      0|        if(customTypes->cleanup) {
  ------------------
  |  Branch (183:12): [True: 0, False: 0]
  ------------------
  184|      0|            for(size_t i = 0; i < customTypes->typesSize; ++i) {
  ------------------
  |  Branch (184:31): [True: 0, False: 0]
  ------------------
  185|      0|                UA_DataType *type = &customTypes->types[i];
  186|      0|                UA_DataType_clear(type);
  187|      0|            }
  188|      0|            UA_free(customTypes->types);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  189|      0|            UA_free(customTypes);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  190|      0|        }
  191|      0|        customTypes = next;
  192|      0|    }
  193|     20|}
UA_STRING:
  220|    120|UA_STRING(char *chars) {
  221|    120|    UA_String s = {0, NULL};
  222|    120|    if(!chars)
  ------------------
  |  Branch (222:8): [True: 0, False: 120]
  ------------------
  223|      0|        return s;
  224|    120|    s.length = strlen(chars);
  225|    120|    s.data = (UA_Byte*)chars;
  226|    120|    return s;
  227|    120|}
UA_String_fromChars:
  230|     40|UA_String_fromChars(const char *src) {
  231|     40|    UA_String s; s.length = 0; s.data = NULL;
  232|     40|    if(!src)
  ------------------
  |  Branch (232:8): [True: 0, False: 40]
  ------------------
  233|      0|        return s;
  234|     40|    s.length = strlen(src);
  235|     40|    if(s.length > 0) {
  ------------------
  |  Branch (235:8): [True: 40, False: 0]
  ------------------
  236|     40|        s.data = (u8*)UA_malloc(s.length);
  ------------------
  |  |   18|     40|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  237|     40|        if(UA_UNLIKELY(!s.data)) {
  ------------------
  |  |  575|     40|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (575:25): [True: 0, False: 40]
  |  |  ------------------
  ------------------
  238|      0|            s.length = 0;
  239|      0|            return s;
  240|      0|        }
  241|     40|        memcpy(s.data, src, s.length);
  242|     40|    } else {
  243|      0|        s.data = (u8*)UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  755|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
  244|      0|    }
  245|     40|    return s;
  246|     40|}
UA_init:
 1922|     20|void UA_init(void *p, const UA_DataType *type) {
 1923|     20|    memset(p, 0, type->memSize);
 1924|     20|}
UA_copy:
 2093|     80|UA_copy(const void *src, void *dst, const UA_DataType *type) {
 2094|     80|    memset(dst, 0, type->memSize); /* init */
 2095|     80|    UA_StatusCode retval = copyJumpTable[type->typeKind](src, dst, type);
 2096|     80|    if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     80|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2096:8): [True: 0, False: 80]
  ------------------
 2097|      0|        UA_clear(dst, type);
 2098|     80|    return retval;
 2099|     80|}
UA_clear:
 2196|    920|UA_clear(void *p, const UA_DataType *type) {
 2197|    920|    clearJumpTable[type->typeKind](p, type);
 2198|    920|    memset(p, 0, type->memSize); /* init */
 2199|    920|}
UA_Array_copy:
 2674|     60|              void **dst, const UA_DataType *type) {
 2675|     60|    if(size == 0) {
  ------------------
  |  Branch (2675:8): [True: 0, False: 60]
  ------------------
 2676|      0|        if(src == NULL)
  ------------------
  |  Branch (2676:12): [True: 0, False: 0]
  ------------------
 2677|      0|            *dst = NULL;
 2678|      0|        else
 2679|      0|            *dst= UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  755|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
 2680|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2681|      0|    }
 2682|       |
 2683|       |    /* Check the array consistency -- defensive programming in case the user
 2684|       |     * manually created an inconsistent array */
 2685|     60|    if(UA_UNLIKELY(!type || !src))
  ------------------
  |  |  575|    120|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (575:25): [True: 0, False: 60]
  |  |  |  Branch (575:43): [True: 0, False: 60]
  |  |  |  Branch (575:43): [True: 0, False: 60]
  |  |  ------------------
  ------------------
 2686|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 2687|       |
 2688|       |    /* calloc, so we don't have to check retval in every iteration of copying */
 2689|     60|    *dst = UA_calloc(size, type->memSize);
  ------------------
  |  |   20|     60|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 2690|     60|    if(!*dst)
  ------------------
  |  Branch (2690:8): [True: 0, False: 60]
  ------------------
 2691|      0|        return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   31|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2692|       |
 2693|     60|    if(type->pointerFree) {
  ------------------
  |  Branch (2693:8): [True: 60, False: 0]
  ------------------
 2694|     60|        memcpy(*dst, src, type->memSize * size);
 2695|     60|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2696|     60|    }
 2697|       |
 2698|      0|    uintptr_t ptrs = (uintptr_t)src;
 2699|      0|    uintptr_t ptrd = (uintptr_t)*dst;
 2700|      0|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2701|      0|    for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2701:23): [True: 0, False: 0]
  ------------------
 2702|      0|        retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
 2703|      0|        ptrs += type->memSize;
 2704|      0|        ptrd += type->memSize;
 2705|      0|    }
 2706|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2706:8): [True: 0, False: 0]
  ------------------
 2707|      0|        UA_Array_delete(*dst, size, type);
 2708|       |        *dst = NULL;
 2709|      0|    }
 2710|      0|    return retval;
 2711|     60|}
UA_Array_delete:
 2802|  1.94k|UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
 2803|  1.94k|    if(!type->pointerFree) {
  ------------------
  |  Branch (2803:8): [True: 220, False: 1.72k]
  ------------------
 2804|    220|        uintptr_t ptr = (uintptr_t)p;
 2805|    260|        for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2805:27): [True: 40, False: 220]
  ------------------
 2806|     40|            UA_clear((void*)ptr, type);
 2807|     40|            ptr += type->memSize;
 2808|     40|        }
 2809|    220|    }
 2810|  1.94k|    UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
  ------------------
  |  |   19|  1.94k|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2811|  1.94k|}
UA_NamespaceMapping_clear:
 3006|     20|UA_NamespaceMapping_clear(UA_NamespaceMapping *nm) {
 3007|     20|    if(!nm)
  ------------------
  |  Branch (3007:8): [True: 20, False: 0]
  ------------------
 3008|     20|        return;
 3009|      0|    UA_Array_delete(nm->namespaceUris, nm->namespaceUrisSize, &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|      0|#define UA_TYPES_STRING 11
  ------------------
 3010|      0|    UA_Array_delete(nm->local2remote, nm->local2remoteSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 3011|      0|    UA_Array_delete(nm->remote2local, nm->remote2localSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 3012|      0|}
UA_NamespaceMapping_delete:
 3015|     20|UA_NamespaceMapping_delete(UA_NamespaceMapping *nm) {
 3016|     20|    UA_NamespaceMapping_clear(nm);
 3017|     20|    UA_free(nm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 3018|     20|}
ua_types.c:String_copy:
  281|     60|String_copy(const void *src, void *dst, const UA_DataType *_) {
  282|     60|    const UA_String *srcS = (const UA_String*)src;
  283|     60|    UA_String *dstS = (UA_String *)dst;
  284|     60|    UA_StatusCode res =
  285|     60|        UA_Array_copy(srcS->data, srcS->length, (void**)&dstS->data,
  286|     60|                      &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|     60|#define UA_TYPES_BYTE 2
  ------------------
  287|     60|    if(res == UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (287:8): [True: 60, False: 0]
  ------------------
  288|     60|        dstS->length = srcS->length;
  289|     60|    return res;
  290|     60|}
ua_types.c:NodeId_copy:
  790|     20|NodeId_copy(const void *src, void *dst, const UA_DataType *_) {
  791|     20|    const UA_NodeId *srcN = (const UA_NodeId*)src;
  792|     20|    UA_NodeId *dstN = (UA_NodeId *)dst;
  793|     20|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  794|     20|    switch(srcN->identifierType) {
  795|     20|    case UA_NODEIDTYPE_NUMERIC:
  ------------------
  |  Branch (795:5): [True: 20, False: 0]
  ------------------
  796|     20|        *dstN = *srcN;
  797|     20|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  798|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (798:5): [True: 0, False: 20]
  ------------------
  799|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (799:5): [True: 0, False: 20]
  ------------------
  800|      0|        retval |= String_copy(&srcN->identifier.string,
  801|      0|                              &dstN->identifier.string, NULL);
  802|      0|        break;
  803|      0|    case UA_NODEIDTYPE_GUID:
  ------------------
  |  Branch (803:5): [True: 0, False: 20]
  ------------------
  804|      0|        dstN->identifier.guid = srcN->identifier.guid;
  805|      0|        break;
  806|      0|    default:
  ------------------
  |  Branch (806:5): [True: 0, False: 20]
  ------------------
  807|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  808|     20|    }
  809|      0|    dstN->namespaceIndex = srcN->namespaceIndex;
  810|      0|    dstN->identifierType = srcN->identifierType;
  811|      0|    return retval;
  812|     20|}
ua_types.c:nopClear:
 2158|    600|static void nopClear(void *p, const UA_DataType *type) { }
ua_types.c:String_clear:
  293|  1.72k|String_clear(void *p, const UA_DataType *_) {
  294|  1.72k|    UA_String *s = (UA_String*)p;
  295|  1.72k|    UA_Array_delete(s->data, s->length, &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|  1.72k|#define UA_TYPES_BYTE 2
  ------------------
  296|  1.72k|}
ua_types.c:NodeId_clear:
  778|    160|NodeId_clear(void *p, const UA_DataType *_) {
  779|    160|    UA_NodeId *id = (UA_NodeId*)p;
  780|    160|    switch(id->identifierType) {
  781|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (781:5): [True: 0, False: 160]
  ------------------
  782|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (782:5): [True: 0, False: 160]
  ------------------
  783|      0|        String_clear(&id->identifier.string, NULL);
  784|      0|        break;
  785|    160|    default: break;
  ------------------
  |  Branch (785:5): [True: 160, False: 0]
  ------------------
  786|    160|    }
  787|    160|}
ua_types.c:LocalizedText_clear:
 1830|    100|LocalizedText_clear(void *p, const UA_DataType *_) {
 1831|    100|    UA_LocalizedText *lt = (UA_LocalizedText *)p;
 1832|    100|    String_clear(&lt->locale, NULL);
 1833|       |    String_clear(&lt->text, NULL);
 1834|    100|}
ua_types.c:ExtensionObject_clear:
 1252|     60|ExtensionObject_clear(void *p, const UA_DataType *_) {
 1253|     60|    UA_ExtensionObject *eo = (UA_ExtensionObject *)p;
 1254|     60|    switch(eo->encoding) {
 1255|     60|    case UA_EXTENSIONOBJECT_ENCODED_NOBODY:
  ------------------
  |  Branch (1255:5): [True: 60, False: 0]
  ------------------
 1256|     60|    case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING:
  ------------------
  |  Branch (1256:5): [True: 0, False: 60]
  ------------------
 1257|     60|    case UA_EXTENSIONOBJECT_ENCODED_XML:
  ------------------
  |  Branch (1257:5): [True: 0, False: 60]
  ------------------
 1258|     60|        NodeId_clear(&eo->content.encoded.typeId, NULL);
 1259|     60|        String_clear(&eo->content.encoded.body, NULL);
 1260|     60|        break;
 1261|      0|    case UA_EXTENSIONOBJECT_DECODED:
  ------------------
  |  Branch (1261:5): [True: 0, False: 60]
  ------------------
 1262|      0|        if(eo->content.decoded.data)
  ------------------
  |  Branch (1262:12): [True: 0, False: 0]
  ------------------
 1263|      0|            UA_delete(eo->content.decoded.data, eo->content.decoded.type);
 1264|      0|        break;
 1265|      0|    default:
  ------------------
  |  Branch (1265:5): [True: 0, False: 60]
  ------------------
 1266|      0|        break;
 1267|     60|    }
 1268|     60|}
ua_types.c:DiagnosticInfo_clear:
 1877|     20|DiagnosticInfo_clear(void *p, const UA_DataType *_) {
 1878|     20|    UA_DiagnosticInfo *di = (UA_DiagnosticInfo *)p;
 1879|       |
 1880|     20|    String_clear(&di->additionalInfo, NULL);
 1881|     20|    if(di->hasInnerDiagnosticInfo && di->innerDiagnosticInfo) {
  ------------------
  |  Branch (1881:8): [True: 0, False: 20]
  |  Branch (1881:38): [True: 0, False: 0]
  ------------------
 1882|      0|        DiagnosticInfo_clear(di->innerDiagnosticInfo, NULL);
 1883|      0|        UA_free(di->innerDiagnosticInfo);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1884|      0|    }
 1885|     20|}
ua_types.c:clearStructure:
 2102|    320|clearStructure(void *p, const UA_DataType *type) {
 2103|    320|    uintptr_t ptr = (uintptr_t)p;
 2104|  2.24k|    for(size_t i = 0; i < type->membersSize; ++i) {
  ------------------
  |  Branch (2104:23): [True: 1.92k, False: 320]
  ------------------
 2105|  1.92k|        const UA_DataTypeMember *m = &type->members[i];
 2106|  1.92k|        const UA_DataType *mt = m->memberType;
 2107|  1.92k|        ptr += m->padding;
 2108|  1.92k|        if(!m->isOptional) {
  ------------------
  |  Branch (2108:12): [True: 1.92k, False: 0]
  ------------------
 2109|  1.92k|            if(!m->isArray) {
  ------------------
  |  Branch (2109:16): [True: 1.72k, False: 200]
  ------------------
 2110|  1.72k|                clearJumpTable[mt->typeKind]((void*)ptr, mt);
 2111|  1.72k|                ptr += mt->memSize;
 2112|  1.72k|            } else {
 2113|    200|                size_t length = *(size_t*)ptr;
 2114|    200|                ptr += sizeof(size_t);
 2115|    200|                UA_Array_delete(*(void**)ptr, length, mt);
 2116|    200|                ptr += sizeof(void*);
 2117|    200|            }
 2118|  1.92k|        } else { /* field is optional */
 2119|      0|            if(!m->isArray) {
  ------------------
  |  Branch (2119:16): [True: 0, False: 0]
  ------------------
 2120|       |                /* optional scalar field is contained */
 2121|      0|                if((*(void *const *)ptr != NULL))
  ------------------
  |  Branch (2121:20): [True: 0, False: 0]
  ------------------
 2122|      0|                    UA_Array_delete(*(void **)ptr, 1, mt);
 2123|      0|                ptr += sizeof(void *);
 2124|      0|            } else {
 2125|       |                /* optional array field is contained */
 2126|      0|                if((*(void *const *)(ptr + sizeof(size_t)) != NULL)) {
  ------------------
  |  Branch (2126:20): [True: 0, False: 0]
  ------------------
 2127|      0|                    size_t length = *(size_t *)ptr;
 2128|      0|                    ptr += sizeof(size_t);
 2129|      0|                    UA_Array_delete(*(void **)ptr, length, mt);
 2130|      0|                    ptr += sizeof(void *);
 2131|      0|                } else { /* optional array field not contained */
 2132|      0|                    ptr += sizeof(size_t);
 2133|      0|                    ptr += sizeof(void *);
 2134|      0|                }
 2135|      0|            }
 2136|      0|        }
 2137|  1.92k|    }
 2138|    320|}

UA_KeyValueMap_clear:
  546|     60|UA_KeyValueMap_clear(UA_KeyValueMap *map) {
  547|     60|    if(!map)
  ------------------
  |  Branch (547:8): [True: 0, False: 60]
  ------------------
  548|      0|        return;
  549|     60|    if(map->mapSize > 0) {
  ------------------
  |  Branch (549:8): [True: 0, False: 60]
  ------------------
  550|      0|        UA_Array_delete(map->map, map->mapSize, &UA_TYPES[UA_TYPES_KEYVALUEPAIR]);
  ------------------
  |  | 1247|      0|#define UA_TYPES_KEYVALUEPAIR 35
  ------------------
  551|      0|        map->mapSize = 0;
  552|      0|    }
  553|     60|}

LLVMFuzzerTestOneInput:
   13|     26|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   14|     26|    if(size < 10)
  ------------------
  |  Branch (14:8): [True: 6, False: 20]
  ------------------
   15|      6|        return 0;
   16|       |
   17|     20|    UA_Client *client = UA_Client_new();
   18|     20|    if(!client)
  ------------------
  |  Branch (18:8): [True: 0, False: 20]
  ------------------
   19|      0|        return 0;
   20|       |    
   21|     20|    UA_ClientConfig *config = UA_Client_getConfig(client);
   22|     20|    if(config->logging)
  ------------------
  |  Branch (22:8): [True: 20, False: 0]
  ------------------
   23|     20|        config->logging->log = NULL; // Disable logging
   24|       |
   25|       |    // Manually set some states to allow processing responses
   26|     20|    client->channel.state = UA_SECURECHANNELSTATE_OPEN;
   27|     20|    client->sessionState = UA_SESSIONSTATE_ACTIVATED;
   28|       |
   29|     20|    UA_MessageType messageType = (UA_MessageType)data[0];
   30|     20|    UA_UInt32 requestId = *(UA_UInt32*)&data[1];
   31|       |    
   32|     20|    UA_ByteString message;
   33|     20|    message.length = size - 5;
   34|     20|    message.data = (UA_Byte*)UA_malloc(message.length);
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
   35|     20|    memcpy(message.data, &data[5], message.length);
   36|       |
   37|       |    // We need at least one async call to match the requestId
   38|     20|    AsyncServiceCall *ac = (AsyncServiceCall*)UA_malloc(sizeof(AsyncServiceCall));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
   39|     20|    ac->requestId = requestId;
   40|     20|    ac->callback = NULL;
   41|     20|    ac->responseType = &UA_TYPES[UA_TYPES_READRESPONSE]; // Just some type
  ------------------
  |  |10546|     20|#define UA_TYPES_READRESPONSE 257
  ------------------
   42|     20|    ac->userdata = NULL;
   43|     20|    ac->syncResponse = NULL;
   44|     20|    LIST_INSERT_HEAD(&client->asyncServiceCalls, ac, pointers);
  ------------------
  |  |  221|     20|#define LIST_INSERT_HEAD(head, elm, field) do {				\
  |  |  222|     20|    if (((elm)->field.le_next = (head)->lh_first) != NULL)		\
  |  |  ------------------
  |  |  |  Branch (222:9): [True: 0, False: 20]
  |  |  ------------------
  |  |  223|     20|        (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
  |  |  224|     20|    (head)->lh_first = (elm);					\
  |  |  225|     20|    (elm)->field.le_prev = &(head)->lh_first;			\
  |  |  226|     20|} while (0)
  |  |  ------------------
  |  |  |  Branch (226:10): [Folded, False: 20]
  |  |  ------------------
  ------------------
   45|       |
   46|     20|    processServiceResponse(client, &client->channel, messageType, requestId, &message);
   47|       |
   48|       |    // Cleanup
   49|       |    // processServiceResponse might have removed 'ac' if it matched
   50|     20|    AsyncServiceCall *ac2, *tmp;
   51|     20|    LIST_FOREACH_SAFE(ac2, &client->asyncServiceCalls, pointers, tmp) {
  ------------------
  |  |  195|     20|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     20|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     40|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|     20|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 20, False: 20]
  |  |  |  Branch (196:18): [True: 20, False: 0]
  |  |  ------------------
  |  |  197|     20|        (var) = (tvar))
  ------------------
   52|     20|        LIST_REMOVE(ac2, pointers);
  ------------------
  |  |  228|     20|#define LIST_REMOVE(elm, field) do {					\
  |  |  229|     20|    if ((elm)->field.le_next != NULL)				\
  |  |  ------------------
  |  |  |  Branch (229:9): [True: 0, False: 20]
  |  |  ------------------
  |  |  230|     20|        (elm)->field.le_next->field.le_prev =			\
  |  |  231|      0|            (elm)->field.le_prev;				\
  |  |  232|     20|    *(elm)->field.le_prev = (elm)->field.le_next;			\
  |  |  233|     20|    _Q_INVALIDATE((elm)->field.le_prev);				\
  |  |  234|     20|    _Q_INVALIDATE((elm)->field.le_next);				\
  |  |  235|     20|} while (0)
  |  |  ------------------
  |  |  |  Branch (235:10): [Folded, False: 20]
  |  |  ------------------
  ------------------
   53|     20|        UA_free(ac2);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
   54|     20|    }
   55|       |
   56|     20|    UA_ByteString_clear(&message);
   57|     20|    UA_Client_delete(client);
   58|     20|    return 0;
   59|     20|}

fuzz_client.cc:_ZL19UA_ByteString_clearP9UA_String:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ByteString_clear:
  239|    120|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ChannelSecurityToken_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_String_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_INIT:
  486|     20|UA_LOCK_INIT(UA_Lock *lock) {
  487|     20|    pthread_mutexattr_t mattr;
  488|     20|    pthread_mutexattr_init(&mattr);
  489|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  490|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  491|     20|    pthread_mutexattr_destroy(&mattr);
  492|     20|    lock->count = 0;
  493|     20|}
ua_client.c:UA_ApplicationDescription_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_String_clear:
  239|    120|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ExtensionObject_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_EndpointDescription_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_UserTokenPolicy_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ByteString_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_DESTROY:
  496|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  497|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (497:5): [True: 20, False: 0]
  ------------------
  498|     20|    pthread_mutex_destroy(&lock->mutex);
  499|     20|}
ua_client.c:UA_LOCK_ASSERT:
  514|     40|UA_LOCK_ASSERT(UA_Lock *lock) {
  515|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  395|     40|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (515:5): [True: 40, False: 0]
  ------------------
  516|     40|}
ua_client.c:UA_LOCK:
  502|     60|UA_LOCK(UA_Lock *lock) {
  503|     60|    pthread_mutex_lock(&lock->mutex);
  504|     60|    lock->count++;
  505|     60|}
ua_client.c:UA_UNLOCK:
  508|     60|UA_UNLOCK(UA_Lock *lock) {
  509|     60|    lock->count--;
  510|     60|    pthread_mutex_unlock(&lock->mutex);
  511|     60|}
ua_client_connect.c:UA_String_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_ByteString_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_EndpointDescription_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_NodeId_clear:
  239|     80|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionResponse_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_init:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_certificategroup_none.c:UA_NodeId_copy:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securitypolicy_none.c:UA_ByteString_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
timer.c:UA_LOCK_INIT:
  486|     20|UA_LOCK_INIT(UA_Lock *lock) {
  487|     20|    pthread_mutexattr_t mattr;
  488|     20|    pthread_mutexattr_init(&mattr);
  489|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  490|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  491|     20|    pthread_mutexattr_destroy(&mattr);
  492|     20|    lock->count = 0;
  493|     20|}
timer.c:UA_LOCK:
  502|     40|UA_LOCK(UA_Lock *lock) {
  503|     40|    pthread_mutex_lock(&lock->mutex);
  504|     40|    lock->count++;
  505|     40|}
timer.c:UA_UNLOCK:
  508|     40|UA_UNLOCK(UA_Lock *lock) {
  509|     40|    lock->count--;
  510|     40|    pthread_mutex_unlock(&lock->mutex);
  511|     40|}
timer.c:UA_LOCK_DESTROY:
  496|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  497|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (497:5): [True: 20, False: 0]
  ------------------
  498|     20|    pthread_mutex_destroy(&lock->mutex);
  499|     20|}
eventloop_posix.c:UA_LOCK_INIT:
  486|     20|UA_LOCK_INIT(UA_Lock *lock) {
  487|     20|    pthread_mutexattr_t mattr;
  488|     20|    pthread_mutexattr_init(&mattr);
  489|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  490|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  491|     20|    pthread_mutexattr_destroy(&mattr);
  492|     20|    lock->count = 0;
  493|     20|}
eventloop_posix.c:UA_LOCK_ASSERT:
  514|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  515|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (515:5): [True: 20, False: 0]
  ------------------
  516|     20|}
eventloop_posix.c:UA_LOCK_DESTROY:
  496|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  497|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (497:5): [True: 20, False: 0]
  ------------------
  498|     20|    pthread_mutex_destroy(&lock->mutex);
  499|     20|}
eventloop_posix.c:UA_UNLOCK:
  508|    200|UA_UNLOCK(UA_Lock *lock) {
  509|    200|    lock->count--;
  510|    200|    pthread_mutex_unlock(&lock->mutex);
  511|    200|}
eventloop_posix.c:UA_LOCK:
  502|    200|UA_LOCK(UA_Lock *lock) {
  503|    200|    pthread_mutex_lock(&lock->mutex);
  504|    200|    lock->count++;
  505|    200|}
eventloop_posix_tcp.c:UA_String_copy:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_String_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_ByteString_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_copy:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_ByteString_clear:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_String_copy:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_LOCK_ASSERT:
  514|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  515|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  395|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (515:5): [True: 20, False: 0]
  ------------------
  516|     20|}
eventloop_posix_interrupt.c:UA_String_clear:
  239|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
securitypolicy_common.c:UA_ByteString_init:
  239|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl

