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_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|}
UA_EventLoopPOSIX_processDelayed:
  136|     20|UA_EventLoopPOSIX_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;
  ------------------
  |  |  314|     20|# define UA_atomic(T) T
  ------------------
  144|     20|    UA_atomic(UA_atomic(UA_DelayedCallback*)*) tail = NULL;
  ------------------
  |  |  314|     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);
  ------------------
  |  |  316|      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|}
UA_EventLoopPOSIX_registerEventSource:
  406|     60|                                      UA_EventSource *es) {
  407|     60|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
  408|     60|    UA_LOCK(&el->elMutex);
  409|       |
  410|       |    /* Already registered? */
  411|     60|    if(es->state != UA_EVENTSOURCESTATE_FRESH) {
  ------------------
  |  Branch (411:8): [True: 0, False: 60]
  ------------------
  412|      0|        UA_LOG_ERROR(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
  413|      0|                     "Cannot register the EventSource \"%.*s\": "
  414|      0|                     "already registered",
  415|      0|                     (int)es->name.length, (char*)es->name.data);
  416|      0|        UA_UNLOCK(&el->elMutex);
  417|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  418|      0|    }
  419|       |
  420|       |    /* Add to linked list */
  421|     60|    es->next = el->eventLoop.eventSources;
  422|     60|    el->eventLoop.eventSources = es;
  423|       |
  424|     60|    es->eventLoop = &el->eventLoop;
  425|     60|    es->state = UA_EVENTSOURCESTATE_STOPPED;
  426|       |
  427|       |    /* Start if the entire EventLoop is started */
  428|     60|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  429|     60|    if(el->eventLoop.state == UA_EVENTLOOPSTATE_STARTED)
  ------------------
  |  Branch (429:8): [True: 0, False: 60]
  ------------------
  430|      0|        res = es->start(es);
  431|       |
  432|     60|    UA_UNLOCK(&el->elMutex);
  433|     60|    return res;
  434|     60|}
UA_EventLoopPOSIX_deregisterEventSource:
  438|     60|                                        UA_EventSource *es) {
  439|     60|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
  440|     60|    UA_LOCK(&el->elMutex);
  441|       |
  442|     60|    if(es->state != UA_EVENTSOURCESTATE_STOPPED) {
  ------------------
  |  Branch (442:8): [True: 0, False: 60]
  ------------------
  443|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  444|      0|                       "Cannot deregister the EventSource %.*s: "
  445|      0|                       "Has to be stopped first",
  446|      0|                       (int)es->name.length, es->name.data);
  447|      0|        UA_UNLOCK(&el->elMutex);
  448|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  449|      0|    }
  450|       |
  451|       |    /* Remove from the linked list */
  452|     60|    UA_EventSource **s = &el->eventLoop.eventSources;
  453|     60|    while(*s) {
  ------------------
  |  Branch (453:11): [True: 60, False: 0]
  ------------------
  454|     60|        if(*s == es) {
  ------------------
  |  Branch (454:12): [True: 60, False: 0]
  ------------------
  455|     60|            *s = es->next;
  456|     60|            break;
  457|     60|        }
  458|      0|        s = &(*s)->next;
  459|      0|    }
  460|       |
  461|       |    /* Set the state to non-registered */
  462|     60|    es->state = UA_EVENTSOURCESTATE_FRESH;
  463|       |
  464|     60|    UA_UNLOCK(&el->elMutex);
  465|     60|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  466|     60|}
UA_EventLoopPOSIX_lock:
  542|     60|UA_EventLoopPOSIX_lock(UA_EventLoop *public_el) {
  543|     60|    UA_LOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  544|     60|}
UA_EventLoopPOSIX_unlock:
  546|     60|UA_EventLoopPOSIX_unlock(UA_EventLoop *public_el) {
  547|     60|    UA_UNLOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  548|     60|}
UA_EventLoop_new_POSIX:
  563|     20|UA_EventLoop_new_POSIX(const UA_Logger *logger) {
  564|       |
  565|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)
  566|     20|        UA_calloc(1, sizeof(UA_EventLoopPOSIX));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  567|     20|    if(!el)
  ------------------
  |  Branch (567:8): [True: 0, False: 20]
  ------------------
  568|      0|        return NULL;
  569|       |
  570|     20|    UA_LOCK_INIT(&el->elMutex);
  571|     20|    UA_Timer_init(&el->timer);
  572|       |
  573|       |    /* Initialize the queue */
  574|     20|    el->delayedTail = &el->delayedHead1;
  575|     20|    el->delayedHead2 = (UA_DelayedCallback*)0x01; /* sentinel value */
  576|       |
  577|       |    /* Set the public EventLoop content */
  578|     20|    el->eventLoop.logger = logger;
  579|       |
  580|       |    /* Initialize the clock source to the default */
  581|     20|    el->clockSource = CLOCK_REALTIME;
  582|     20|# ifdef CLOCK_MONOTONIC_RAW
  583|     20|    el->clockSourceMonotonic = CLOCK_MONOTONIC_RAW;
  584|       |# else
  585|       |    el->clockSourceMonotonic = CLOCK_MONOTONIC;
  586|       |# endif
  587|       |
  588|       |    /* Set the method pointers for the interface */
  589|     20|    el->eventLoop.start = UA_EventLoopPOSIX_start;
  590|     20|    el->eventLoop.stop = UA_EventLoopPOSIX_stop;
  591|     20|    el->eventLoop.free = UA_EventLoopPOSIX_free;
  592|     20|    el->eventLoop.run = UA_EventLoopPOSIX_run;
  593|     20|    el->eventLoop.cancel = UA_EventLoopPOSIX_cancel;
  594|       |
  595|     20|    el->eventLoop.dateTime_now = UA_EventLoopPOSIX_DateTime_now;
  596|     20|    el->eventLoop.dateTime_nowMonotonic =
  597|     20|        UA_EventLoopPOSIX_DateTime_nowMonotonic;
  598|     20|    el->eventLoop.dateTime_localTimeUtcOffset =
  599|     20|        UA_EventLoopPOSIX_DateTime_localTimeUtcOffset;
  600|       |
  601|     20|    el->eventLoop.nextTimer = UA_EventLoopPOSIX_nextTimer;
  602|     20|    el->eventLoop.addTimer = UA_EventLoopPOSIX_addTimer;
  603|     20|    el->eventLoop.modifyTimer = UA_EventLoopPOSIX_modifyTimer;
  604|     20|    el->eventLoop.removeTimer = UA_EventLoopPOSIX_removeTimer;
  605|     20|    el->eventLoop.addDelayedCallback = UA_EventLoopPOSIX_addDelayedCallback;
  606|     20|    el->eventLoop.removeDelayedCallback = UA_EventLoopPOSIX_removeDelayedCallback;
  607|       |
  608|     20|    el->eventLoop.registerEventSource = UA_EventLoopPOSIX_registerEventSource;
  609|     20|    el->eventLoop.deregisterEventSource = UA_EventLoopPOSIX_deregisterEventSource;
  610|       |
  611|     20|    el->eventLoop.lock = UA_EventLoopPOSIX_lock;
  612|     20|    el->eventLoop.unlock = UA_EventLoopPOSIX_unlock;
  613|       |
  614|       |    /* Select the FD polling backend */
  615|     20|#if defined(UA_HAVE_EPOLL)
  616|     20|    el->registerFD = registerFD_epoll;
  617|     20|    el->modifyFD = modifyFD_epoll;
  618|     20|    el->deregisterFD = deregisterFD_epoll;
  619|       |#else
  620|       |    el->registerFD = registerFD_select;
  621|       |    el->modifyFD = modifyFD_select;
  622|       |    el->deregisterFD = deregisterFD_select;
  623|       |#endif
  624|       |
  625|     20|    return &el->eventLoop;
  626|     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;
  ------------------
  |  |  314|      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;
  ------------------
  |  |  314|      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);
  ------------------
  |  |  318|      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);
  ------------------
  |  |  320|      0|    do {                                                                \
  |  |  321|      0|        *old = __atomic_exchange_n(addr, newval, __ATOMIC_SEQ_CST);     \
  |  |  322|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (322: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);
  ------------------
  |  |  320|      0|    do {                                                                \
  |  |  321|      0|        *old = __atomic_exchange_n(addr, newval, __ATOMIC_SEQ_CST);     \
  |  |  322|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (322:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  101|      0|}
eventloop_posix.c:UA_EventLoopPOSIX_free:
  505|     20|UA_EventLoopPOSIX_free(UA_EventLoop *public_el) {
  506|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
  507|     20|    UA_LOCK(&el->elMutex);
  508|       |
  509|       |    /* Check if the EventLoop can be deleted */
  510|     20|    if(el->eventLoop.state != UA_EVENTLOOPSTATE_STOPPED &&
  ------------------
  |  Branch (510:8): [True: 20, False: 0]
  ------------------
  511|     20|       el->eventLoop.state != UA_EVENTLOOPSTATE_FRESH) {
  ------------------
  |  Branch (511:8): [True: 0, False: 20]
  ------------------
  512|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  513|      0|                       "Cannot delete a running EventLoop");
  514|      0|        UA_UNLOCK(&el->elMutex);
  515|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  516|      0|    }
  517|       |
  518|       |    /* Deregister and delete all the EventSources */
  519|     80|    while(el->eventLoop.eventSources) {
  ------------------
  |  Branch (519:11): [True: 60, False: 20]
  ------------------
  520|     60|        UA_EventSource *es = el->eventLoop.eventSources;
  521|     60|        UA_EventLoopPOSIX_deregisterEventSource(public_el, es);
  522|     60|        es->free(es);
  523|     60|    }
  524|       |
  525|       |    /* Remove the repeated timed callbacks */
  526|     20|    UA_Timer_clear(&el->timer);
  527|       |
  528|       |    /* Process remaining delayed callbacks */
  529|     20|    UA_EventLoopPOSIX_processDelayed(el);
  530|       |
  531|       |
  532|     20|    UA_KeyValueMap_clear(&el->eventLoop.params);
  533|       |
  534|       |    /* Clean up */
  535|     20|    UA_UNLOCK(&el->elMutex);
  536|     20|    UA_LOCK_DESTROY(&el->elMutex);
  537|     20|    UA_free(el);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  538|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  539|     20|}

UA_InterruptManager_new_POSIX:
  563|     20|UA_InterruptManager_new_POSIX(const UA_String eventSourceName) {
  564|     20|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)
  565|     20|        UA_calloc(1, sizeof(UA_POSIXInterruptManager));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  566|     20|    if(!pim)
  ------------------
  |  Branch (566:8): [True: 0, False: 20]
  ------------------
  567|      0|        return NULL;
  568|       |
  569|       |    /* Initialize the FD as invalid before adding the interrupt manager to the
  570|       |     * global array */
  571|     20|    pim->readfd.fd = UA_INVALID_FD;
  ------------------
  |  |  189|     20|#define UA_INVALID_FD UA_INVALID_SOCKET
  |  |  ------------------
  |  |  |  |   68|     20|#define UA_INVALID_SOCKET -1
  |  |  ------------------
  ------------------
  572|     20|    pim->writefd = UA_INVALID_FD;
  ------------------
  |  |  189|     20|#define UA_INVALID_FD UA_INVALID_SOCKET
  |  |  ------------------
  |  |  |  |   68|     20|#define UA_INVALID_SOCKET -1
  |  |  ------------------
  ------------------
  573|     20|    pim->managerSlot = NULL;
  574|       |
  575|     20|    if(!registerInterruptManager(pim)) {
  ------------------
  |  Branch (575:8): [True: 0, False: 20]
  ------------------
  576|      0|        UA_free(pim);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  577|      0|        return NULL;
  578|      0|    }
  579|       |
  580|     20|    UA_InterruptManager *im = &pim->im;
  581|     20|    im->eventSource.eventSourceType = UA_EVENTSOURCETYPE_INTERRUPTMANAGER;
  582|     20|    UA_String_copy(&eventSourceName, &im->eventSource.name);
  583|     20|    im->eventSource.start = startPOSIXInterruptManager;
  584|     20|    im->eventSource.stop = stopPOSIXInterruptManager;
  585|     20|    im->eventSource.free = freePOSIXInterruptmanager;
  586|     20|    im->registerInterrupt = registerPOSIXInterrupt;
  587|     20|    im->deregisterInterrupt = deregisterPOSIXInterrupt;
  588|     20|    return im;
  589|     20|}
eventloop_posix_interrupt.c:registerInterruptManager:
   59|     20|registerInterruptManager(UA_POSIXInterruptManager *pim) {
   60|     20|    for(size_t i = 0; i < UA_MAX_INTERRUPT_MANAGERS; i++) {
  ------------------
  |  |   14|     20|#define UA_MAX_INTERRUPT_MANAGERS 8
  ------------------
  |  Branch (60:23): [True: 20, False: 0]
  ------------------
   61|     20|        UA_POSIXInterruptManager *prev = NULL;
   62|     20|        UA_atomic_cmpxchg(&interruptManagers[i], &prev, pim);
  ------------------
  |  |  324|     20|    __atomic_compare_exchange_n(addr, expected, newval, false,          \
  |  |  325|     20|                                __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
  ------------------
   63|     20|        if(prev == NULL) {
  ------------------
  |  Branch (63:12): [True: 20, False: 0]
  ------------------
   64|     20|            pim->managerSlot = &interruptManagers[i];
   65|     20|            return true;
   66|     20|        }
   67|     20|    }
   68|      0|    return false;
   69|     20|}
eventloop_posix_interrupt.c:freePOSIXInterruptmanager:
  534|     20|freePOSIXInterruptmanager(UA_EventSource *es) {
  535|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)es->eventLoop;
  536|     20|    (void)el;
  537|     20|    UA_LOCK_ASSERT(&el->elMutex);
  538|       |
  539|     20|    if(es->state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (539:8): [True: 0, False: 20]
  ------------------
  540|      0|        UA_LOG_ERROR(es->eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
  541|      0|                     "Interrupt\t| The EventSource must be stopped "
  542|      0|                     "before it can be deleted");
  543|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  544|      0|    }
  545|       |
  546|       |    /* Deactivate and remove all registered signals */
  547|     20|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)es;
  548|     20|    UA_RegisteredSignal *rs, *rs_tmp;
  549|     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))
  ------------------
  550|      0|        deactivateSignal(rs);
  551|      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]
  |  |  ------------------
  ------------------
  552|      0|        UA_free(rs);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  553|      0|    }
  554|       |
  555|     20|    UA_String_clear(&es->name);
  556|     20|    unregisterInterruptManager(pim);
  557|     20|    UA_free(es);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  558|       |
  559|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  560|     20|}
eventloop_posix_interrupt.c:unregisterInterruptManager:
   72|     20|unregisterInterruptManager(UA_POSIXInterruptManager *pim) {
   73|     20|    UA_assert(*pim->managerSlot == pim);
  ------------------
  |  |  399|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (73:5): [True: 20, False: 0]
  ------------------
   74|     20|    UA_atomic_store(pim->managerSlot, NULL);
  ------------------
  |  |  318|     20|    __atomic_store_n(addr, newval, __ATOMIC_SEQ_CST)
  ------------------
   75|       |    pim->managerSlot = NULL;
   76|     20|}

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

UA_ConnectionManager_new_POSIX_UDP:
 1342|     20|UA_ConnectionManager_new_POSIX_UDP(const UA_String eventSourceName) {
 1343|     20|    UA_POSIXConnectionManager *cm = (UA_POSIXConnectionManager*)
 1344|     20|        UA_calloc(1, sizeof(UA_POSIXConnectionManager));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 1345|     20|    if(!cm)
  ------------------
  |  Branch (1345:8): [True: 0, False: 20]
  ------------------
 1346|      0|        return NULL;
 1347|       |
 1348|     20|    cm->cm.eventSource.eventSourceType = UA_EVENTSOURCETYPE_CONNECTIONMANAGER;
 1349|     20|    UA_String_copy(&eventSourceName, &cm->cm.eventSource.name);
 1350|     20|    cm->cm.eventSource.start = UDP_eventSourceStart;
 1351|     20|    cm->cm.eventSource.stop = UDP_eventSourceStop;
 1352|     20|    cm->cm.eventSource.free = UDP_eventSourceDelete;
 1353|     20|    cm->cm.protocol = UA_STRING((char*)(uintptr_t)udpName);
 1354|     20|    cm->cm.openConnection = UDP_openConnection;
 1355|     20|    cm->cm.allocNetworkBuffer = UA_EventLoopPOSIX_allocNetworkBuffer;
 1356|     20|    cm->cm.freeNetworkBuffer = UA_EventLoopPOSIX_freeNetworkBuffer;
 1357|     20|    cm->cm.sendWithConnection = UDP_sendWithConnection;
 1358|     20|    cm->cm.closeConnection = UDP_shutdownConnection;
 1359|     20|    return &cm->cm;
 1360|     20|}
eventloop_posix_udp.c:UDP_eventSourceDelete:
 1320|     20|UDP_eventSourceDelete(UA_EventSource *es) {
 1321|       |    /* The event source is a UA_ConnectionManager. */
 1322|     20|    UA_ConnectionManager *cm = (UA_ConnectionManager*)es;
 1323|     20|    UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
 1324|     20|    if(cm->eventSource.state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (1324:8): [True: 0, False: 20]
  ------------------
 1325|      0|        UA_LOG_ERROR(cm->eventSource.eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
 1326|      0|                     "UDP\t| The EventSource must be stopped before it can be deleted");
 1327|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 1328|      0|    }
 1329|       |
 1330|     20|    UA_ByteString_clear(&pcm->rxBuffer);
 1331|     20|    UA_ByteString_clear(&pcm->txBuffer);
 1332|     20|    UA_KeyValueMap_clear(&cm->eventSource.params);
 1333|     20|    UA_String_clear(&cm->eventSource.name);
 1334|     20|    UA_free(cm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1335|       |
 1336|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 1337|     20|}

timer.c:UA_TimerIdTree_ZIP_FIND:
  122|     20|name##_ZIP_FIND(struct name *head, const keytype *key) {                \
  123|     20|    struct type *cur = ZIP_ROOT(head);                                  \
  ------------------
  |  |   69|     20|#define ZIP_ROOT(head) (head)->root
  ------------------
  124|     20|    while(cur) {                                                        \
  ------------------
  |  Branch (124:11): [True: 0, False: 20]
  ------------------
  125|      0|        enum ZIP_CMP eq = cmp(key, &cur->keyfield);                     \
  126|      0|        if(eq == ZIP_CMP_EQ)                                            \
  ------------------
  |  Branch (126:12): [True: 0, False: 0]
  ------------------
  127|      0|            break;                                                      \
  128|      0|        if(eq == ZIP_CMP_LESS)                                          \
  ------------------
  |  Branch (128:12): [True: 0, False: 0]
  ------------------
  129|      0|            cur = ZIP_LEFT(cur, field);                                 \
  ------------------
  |  |   70|      0|#define ZIP_LEFT(elm, field) (elm)->field.left
  ------------------
  130|      0|        else                                                            \
  131|      0|            cur = ZIP_RIGHT(cur, field);                                \
  ------------------
  |  |   71|      0|#define ZIP_RIGHT(elm, field) (elm)->field.right
  ------------------
  132|      0|    }                                                                   \
  133|     20|    return cur;                                                         \
  134|     20|}                                                                       \
timer.c:UA_TimerIdTree_ZIP_ITER:
  206|     20|name##_ZIP_ITER(struct name *head, name##_cb cb, void *context) {       \
  207|     20|    return name##_ZIP_ITER_INNER(ZIP_ROOT(head), cb, context);          \
  ------------------
  |  |   69|     20|#define ZIP_ROOT(head) (head)->root
  ------------------
  208|     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_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:
  180|     40|                       const UA_Logger *logger) {
  181|       |
  182|     40|    memset(sp, 0, sizeof(UA_SecurityPolicy));
  183|     40|    sp->logger = logger;
  184|     40|    sp->policyUri = UA_STRING("http://opcfoundation.org/UA/SecurityPolicy#None");
  185|     40|    sp->certificateGroupId = UA_NODEID_NULL;
  186|     40|    sp->certificateTypeId = UA_NODEID_NULL;
  187|     40|    sp->securityLevel = 0;
  188|     40|    sp->policyType = UA_SECURITYPOLICYTYPE_NONE;
  189|       |
  190|       |    /* Symmetric Signature */
  191|     40|    UA_SecurityPolicySignatureAlgorithm *symSig = &sp->symSignatureAlgorithm;
  192|     40|    symSig->uri = UA_STRING_NULL;
  193|     40|    symSig->verify = verify_none;
  194|     40|    symSig->sign = sign_none;
  195|     40|    symSig->getLocalSignatureSize = length_none;
  196|     40|    symSig->getRemoteSignatureSize = length_none;
  197|     40|    symSig->getLocalKeyLength = length_none;
  198|     40|    symSig->getRemoteKeyLength = length_none;
  199|       |
  200|       |    /* Symmetric Encryption */
  201|     40|    UA_SecurityPolicyEncryptionAlgorithm *symEnc = &sp->symEncryptionAlgorithm;
  202|     40|    symEnc->uri = UA_STRING_NULL;
  203|     40|    symEnc->encrypt = encrypt_none;
  204|     40|    symEnc->decrypt = decrypt_none;
  205|     40|    symEnc->getLocalKeyLength = length_none;
  206|     40|    symEnc->getRemoteKeyLength = length_none;
  207|     40|    symEnc->getRemoteBlockSize = length_none;
  208|     40|    symEnc->getRemotePlainTextBlockSize = length_none;
  209|       |
  210|       |    /* This only works for none since symmetric and asymmetric crypto modules do
  211|       |     * the same i.e. nothing */
  212|     40|    sp->asymSignatureAlgorithm = sp->symSignatureAlgorithm;
  213|     40|    sp->asymEncryptionAlgorithm = sp->symEncryptionAlgorithm;
  214|       |
  215|       |    /* Use the same signing algorithm as for asymmetric signing */
  216|     40|    sp->certSignatureAlgorithm = sp->asymSignatureAlgorithm;
  217|       |
  218|       |    /* Direct Method Pointers */
  219|     40|    sp->newChannelContext = newContext_none;
  220|     40|    sp->deleteChannelContext = deleteContext_none;
  221|     40|    sp->setLocalSymEncryptingKey = setContextValue_none;
  222|     40|    sp->setLocalSymSigningKey = setContextValue_none;
  223|     40|    sp->setLocalSymIv = setContextValue_none;
  224|     40|    sp->setRemoteSymEncryptingKey = setContextValue_none;
  225|     40|    sp->setRemoteSymSigningKey = setContextValue_none;
  226|     40|    sp->setRemoteSymIv = setContextValue_none;
  227|     40|    sp->compareCertificate = compareCertificate_none;
  228|     40|    sp->generateKey = generateKey_none;
  229|     40|    sp->generateNonce = generateNonce_none;
  230|     40|    sp->nonceLength = 0;
  231|     40|    sp->makeCertThumbprint = makeThumbprint_none;
  232|     40|    sp->compareCertThumbprint = compareThumbprint_none;
  233|     40|    sp->updateCertificate = updateCertificate_none;
  234|     40|    sp->createSigningRequest = NULL;
  235|     40|    sp->clear = policy_clear_none;
  236|       |
  237|     40|    return setLocalCertificate_none(sp, localCertificate);
  238|     40|}
ua_securitypolicy_none.c:policy_clear_none:
  174|     40|policy_clear_none(UA_SecurityPolicy *policy) {
  175|     40|    UA_ByteString_clear(&policy->localCertificate);
  176|     40|}
ua_securitypolicy_none.c:setLocalCertificate_none:
  137|     40|                         const UA_ByteString certificate) {
  138|     40|    UA_ByteString_clear(&policy->localCertificate);
  139|       |    /* #None does no crypto, so an empty certificate is valid and a no-op. */
  140|     40|    if(certificate.length == 0)
  ------------------
  |  Branch (140:8): [True: 40, False: 0]
  ------------------
  141|     40|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  142|       |
  143|      0|#if defined(UA_ENABLE_ENCRYPTION_MBEDTLS) || defined(UA_ENABLE_ENCRYPTION_OPENSSL) || \
  144|      0|    defined(UA_ENABLE_ENCRYPTION_LIBRESSL)
  145|       |    /* Use the crypto backend to convert the certificate to DER for the wire */
  146|       |#ifdef UA_ENABLE_ENCRYPTION_MBEDTLS
  147|       |    UA_StatusCode retval =
  148|       |        UA_mbedTLS_LoadLocalCertificate(&certificate, &policy->localCertificate);
  149|       |#else
  150|      0|    UA_StatusCode retval =
  151|      0|        UA_OpenSSL_LoadLocalCertificate(&certificate, &policy->localCertificate,
  152|      0|                                        EVP_PKEY_NONE);
  153|      0|#endif
  154|      0|    if(retval == UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (154:8): [True: 0, False: 0]
  ------------------
  155|      0|        return retval;
  156|       |    /* #None never uses the certificate cryptographically. Store a certificate
  157|       |     * the backend cannot parse (e.g. EdDSA) verbatim instead of failing. */
  158|      0|    UA_LOG_WARNING(policy->logger, UA_LOGCATEGORY_SECURITYPOLICY,
  159|      0|                   "SecurityPolicy#None: The local certificate could not be "
  160|      0|                   "parsed by the crypto backend. Storing it unmodified.");
  161|      0|#endif
  162|      0|    return UA_ByteString_copy(&certificate, &policy->localCertificate);
  163|      0|}

UA_ClientConfig_setDefault:
 2072|     20|UA_ClientConfig_setDefault(UA_ClientConfig *config) {
 2073|       |    /* The following fields are untouched and OK to leave as NULL or 0:
 2074|       |     *  clientContext
 2075|       |     *  userIdentityToken
 2076|       |     *  securityMode
 2077|       |     *  securityPolicyUri
 2078|       |     *  endpoint
 2079|       |     *  userTokenPolicy
 2080|       |     *  customDataTypes
 2081|       |     *  connectivityCheckInterval
 2082|       |     *  stateCallback
 2083|       |     *  inactivityCallback
 2084|       |     *  outStandingPublishRequests
 2085|       |     *  subscriptionInactivityCallback
 2086|       |     *  sessionLocaleIds
 2087|       |     *  sessionLocaleIdsSize */
 2088|       |
 2089|     20|    if(config->timeout == 0)
  ------------------
  |  Branch (2089:8): [True: 20, False: 0]
  ------------------
 2090|     20|        config->timeout = 5 * 1000; /* 5 seconds */
 2091|     20|    if(config->secureChannelLifeTime == 0)
  ------------------
  |  Branch (2091:8): [True: 20, False: 0]
  ------------------
 2092|     20|        config->secureChannelLifeTime = 10 * 60 * 1000; /* 10 minutes */
 2093|     20|    if(config->maxAsyncServiceCalls == 0)
  ------------------
  |  Branch (2093:8): [True: 20, False: 0]
  ------------------
 2094|     20|        config->maxAsyncServiceCalls = 32;
 2095|       |
 2096|     20|    if(config->logging == NULL)
  ------------------
  |  Branch (2096:8): [True: 0, False: 20]
  ------------------
 2097|      0|        config->logging = UA_Log_Stdout_new(UA_LOGLEVEL_INFO);
 2098|       |
 2099|       |    /* EventLoop */
 2100|     20|    if(config->eventLoop == NULL) {
  ------------------
  |  Branch (2100:8): [True: 20, False: 0]
  ------------------
 2101|       |#if defined(UA_ARCHITECTURE_ZEPHYR)
 2102|       |        config->eventLoop = UA_EventLoop_new_Zephyr(config->logging);
 2103|       |#elif defined(UA_ARCHITECTURE_LWIP)
 2104|       |        config->eventLoop = UA_EventLoop_new_LWIP(config->logging, NULL);
 2105|       |#elif defined(UA_ARCHITECTURE_WIN32)
 2106|       |        config->eventLoop = UA_EventLoop_new_WIN32(config->logging);
 2107|       |#else
 2108|     20|        config->eventLoop = UA_EventLoop_new_POSIX(config->logging);
 2109|     20|#endif
 2110|     20|        config->externalEventLoop = false;
 2111|       |
 2112|       |        /* Add the TCP connection manager */
 2113|       |#if defined(UA_ARCHITECTURE_ZEPHYR)
 2114|       |        UA_ConnectionManager *tcpCM =
 2115|       |            UA_ConnectionManager_new_Zephyr_TCP(UA_STRING("tcp connection manager"));
 2116|       |#elif defined(UA_ARCHITECTURE_LWIP)
 2117|       |        UA_ConnectionManager *tcpCM =
 2118|       |            UA_ConnectionManager_new_LWIP_TCP(UA_STRING("tcp connection manager"));
 2119|       |#elif defined(UA_ARCHITECTURE_WIN32)
 2120|       |        UA_ConnectionManager *tcpCM =
 2121|       |            UA_ConnectionManager_new_WIN32_TCP(UA_STRING("tcp connection manager"));
 2122|       |#else
 2123|     20|        UA_ConnectionManager *tcpCM =
 2124|     20|            UA_ConnectionManager_new_POSIX_TCP(UA_STRING("tcp connection manager"));
 2125|     20|#endif
 2126|     20|        config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)tcpCM);
 2127|       |
 2128|       |#ifdef UA_ENABLE_LWS
 2129|       |        /* Add the WebSocket connection manager. The client selects it
 2130|       |         * automatically for opc.wss EndpointUrls. */
 2131|       |        UA_ConnectionManager *wsCM =
 2132|       |            UA_ConnectionManager_new_LWS_WebSocket(
 2133|       |                UA_STRING("websocket connection manager"));
 2134|       |        if(wsCM)
 2135|       |            config->eventLoop->registerEventSource(config->eventLoop,
 2136|       |                                                    (UA_EventSource*)wsCM);
 2137|       |#endif
 2138|       |
 2139|       |#if defined(UA_ARCHITECTURE_LWIP)
 2140|       |        UA_ConnectionManager *udpCM =
 2141|       |            UA_ConnectionManager_new_LWIP_UDP(UA_STRING("udp connection manager"));
 2142|       |#elif defined(UA_ARCHITECTURE_WIN32)
 2143|       |        UA_ConnectionManager *udpCM =
 2144|       |            UA_ConnectionManager_new_WIN32_UDP(UA_STRING("udp connection manager"));
 2145|       |#elif !defined(UA_ARCHITECTURE_ZEPHYR)
 2146|       |        UA_ConnectionManager *udpCM =
 2147|     20|            UA_ConnectionManager_new_POSIX_UDP(UA_STRING("udp connection manager"));
 2148|     20|#endif
 2149|     20|#if !defined(UA_ARCHITECTURE_ZEPHYR)
 2150|     20|        if(udpCM)
  ------------------
  |  Branch (2150:12): [True: 20, False: 0]
  ------------------
 2151|     20|            config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)udpCM);
 2152|     20|#endif
 2153|       |
 2154|     20|#if !defined(UA_ARCHITECTURE_ZEPHYR) && !defined(UA_ARCHITECTURE_LWIP)
 2155|       |        /* Add the interrupt manager */
 2156|     20|        UA_InterruptManager *im =
 2157|       |#ifdef UA_ARCHITECTURE_WIN32
 2158|       |            UA_InterruptManager_new_WIN32(UA_STRING("interrupt manager"));
 2159|       |#else
 2160|     20|            UA_InterruptManager_new_POSIX(UA_STRING("interrupt manager"));
 2161|     20|#endif
 2162|     20|        if(im) {
  ------------------
  |  Branch (2162:12): [True: 20, False: 0]
  ------------------
 2163|     20|            config->eventLoop->registerEventSource(config->eventLoop, &im->eventSource);
 2164|     20|        } else {
 2165|      0|            UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_APPLICATION,
 2166|      0|                         "Cannot create the Interrupt Manager (only relevant if used)");
 2167|      0|        }
 2168|     20|#endif
 2169|     20|    }
 2170|       |
 2171|     20|    if(config->localConnectionConfig.recvBufferSize == 0)
  ------------------
  |  Branch (2171:8): [True: 20, False: 0]
  ------------------
 2172|     20|        config->localConnectionConfig = UA_ConnectionConfig_default;
 2173|       |
 2174|       |#ifdef UA_ENABLE_LWS
 2175|       |    if(config->webSocketMaxQueueSize == 0) {
 2176|       |        UA_UInt32 sendBufferSize = config->localConnectionConfig.sendBufferSize;
 2177|       |        config->webSocketMaxQueueSize = sendBufferSize > UINT32_MAX / 16 ?
 2178|       |            UINT32_MAX : sendBufferSize * 16;
 2179|       |    }
 2180|       |#endif
 2181|       |
 2182|     20|    if(!config->certificateVerification.logging) {
  ------------------
  |  Branch (2182:8): [True: 20, False: 0]
  ------------------
 2183|     20|        config->certificateVerification.logging = config->logging;
 2184|     20|    }
 2185|       |
 2186|     20|#ifdef UA_ENABLE_ENCRYPTION
 2187|       |    /* Limits for TrustList */
 2188|     20|    config->maxTrustListSize = 0;
 2189|     20|    config->maxRejectedListSize = 0;
 2190|     20|#endif
 2191|       |
 2192|     20|    if(!config->certificateVerification.verifyCertificate) {
  ------------------
  |  Branch (2192:8): [True: 20, False: 0]
  ------------------
 2193|       |        /* Certificate Verification that accepts every certificate. Can be
 2194|       |         * overwritten when the policy is specialized. */
 2195|     20|        UA_CertificateGroup_AcceptAll(&config->certificateVerification);
 2196|     20|    }
 2197|       |
 2198|       |    /* With encryption enabled, the applicationUri needs to match the URI from
 2199|       |     * the certificate */
 2200|     20|    if(!config->clientDescription.applicationUri.data)
  ------------------
  |  Branch (2200:8): [True: 20, False: 0]
  ------------------
 2201|     20|        config->clientDescription.applicationUri = UA_STRING_ALLOC(APPLICATION_URI);
  ------------------
  |  |  220|     20|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
 2202|     20|    if(config->clientDescription.applicationType == 0)
  ------------------
  |  Branch (2202:8): [True: 20, False: 0]
  ------------------
 2203|     20|        config->clientDescription.applicationType = UA_APPLICATIONTYPE_CLIENT;
 2204|       |
 2205|     20|    if(config->securityPoliciesSize == 0) {
  ------------------
  |  Branch (2205:8): [True: 20, False: 0]
  ------------------
 2206|     20|        config->securityPolicies = (UA_SecurityPolicy*)UA_malloc(sizeof(UA_SecurityPolicy));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
 2207|     20|        if(!config->securityPolicies)
  ------------------
  |  Branch (2207:12): [True: 0, False: 20]
  ------------------
 2208|      0|            return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   32|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2209|     20|        UA_StatusCode retval = UA_SecurityPolicy_None(config->securityPolicies,
 2210|     20|                                                      UA_BYTESTRING_NULL, config->logging);
 2211|     20|        if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2211:12): [True: 0, False: 20]
  ------------------
 2212|      0|            UA_free(config->securityPolicies);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2213|      0|            config->securityPolicies = NULL;
 2214|      0|            return retval;
 2215|      0|        }
 2216|     20|        config->securityPoliciesSize = 1;
 2217|     20|    }
 2218|       |
 2219|       |    /* Initialize authSecurityPolicies with the None policy as a fallback.
 2220|       |     * This is needed so that non-X509 token types (e.g. username/password,
 2221|       |     * anonymous) can look up a matching SecurityPolicy for authentication.
 2222|       |     * When UA_ClientConfig_setAuthenticationCert is called later, this gets
 2223|       |     * replaced with the full set of authentication SecurityPolicies. */
 2224|     20|    if(config->authSecurityPoliciesSize == 0) {
  ------------------
  |  Branch (2224:8): [True: 20, False: 0]
  ------------------
 2225|     20|        config->authSecurityPolicies =
 2226|     20|            (UA_SecurityPolicy*)UA_malloc(sizeof(UA_SecurityPolicy));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
 2227|     20|        if(!config->authSecurityPolicies)
  ------------------
  |  Branch (2227:12): [True: 0, False: 20]
  ------------------
 2228|      0|            return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   32|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2229|     20|        UA_StatusCode retval =
 2230|     20|            UA_SecurityPolicy_None(config->authSecurityPolicies,
 2231|     20|                                   UA_BYTESTRING_NULL, config->logging);
 2232|     20|        if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2232:12): [True: 0, False: 20]
  ------------------
 2233|      0|            UA_free(config->authSecurityPolicies);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2234|      0|            config->authSecurityPolicies = NULL;
 2235|      0|            return retval;
 2236|      0|        }
 2237|     20|        config->authSecurityPoliciesSize = 1;
 2238|     20|    }
 2239|       |
 2240|     20|    if(config->requestedSessionTimeout == 0)
  ------------------
  |  Branch (2240:8): [True: 20, False: 0]
  ------------------
 2241|     20|        config->requestedSessionTimeout = 1200000;
 2242|       |
 2243|     20|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2244|     20|    if(config->outStandingPublishRequests == 0)
  ------------------
  |  Branch (2244:8): [True: 20, False: 0]
  ------------------
 2245|     20|        config->outStandingPublishRequests = 10;
 2246|     20|#endif
 2247|       |
 2248|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2249|     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:
  118|     20|UA_Client_newWithConfig(const UA_ClientConfig *config) {
  119|     20|    if(!config)
  ------------------
  |  Branch (119:8): [True: 0, False: 20]
  ------------------
  120|      0|        return NULL;
  121|     20|    UA_Client *client = (UA_Client*)UA_malloc(sizeof(UA_Client));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  122|     20|    if(!client)
  ------------------
  |  Branch (122:8): [True: 0, False: 20]
  ------------------
  123|      0|        return NULL;
  124|     20|    memset(client, 0, sizeof(UA_Client));
  125|     20|    client->config = *config;
  126|       |
  127|     20|    UA_SecureChannel_init(&client->channel);
  128|     20|    client->channel.config = client->config.localConnectionConfig;
  129|     20|    client->connectStatus = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  130|       |
  131|     20|#if UA_MULTITHREADING >= 100
  132|     20|    UA_LOCK_INIT(&client->clientMutex);
  133|     20|#endif
  134|       |
  135|       |    /* Initialize the namespace mapping */
  136|     20|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  137|     20|    size_t initialNs = 2 + config->namespacesSize;
  138|     20|    client->namespaces = (UA_String*)UA_calloc(initialNs, sizeof(UA_String));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  139|     20|    if(!client->namespaces)
  ------------------
  |  Branch (139:8): [True: 0, False: 20]
  ------------------
  140|      0|        goto error;
  141|       |
  142|     20|    client->namespacesSize = initialNs;
  143|     20|    client->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
  ------------------
  |  |  220|     20|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
  144|     20|    client->namespaces[1] = UA_STRING_NULL; /* Gets set when we connect to the server */
  145|     20|    for(size_t i = 0; i < config->namespacesSize; i++) {
  ------------------
  |  Branch (145:23): [True: 0, False: 20]
  ------------------
  146|      0|        res |= UA_String_copy(&client->namespaces[i+2], &config->namespaces[i]);
  147|      0|    }
  148|     20|    if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (148:8): [True: 0, False: 20]
  ------------------
  149|      0|        goto error;
  150|       |
  151|     20|    return client;
  152|       |
  153|      0|error:
  154|      0|    memset(&client->config, 0, sizeof(UA_ClientConfig));
  155|      0|    UA_Client_delete(client);
  156|       |    return NULL;
  157|     20|}
UA_ClientConfig_clear:
  160|     20|UA_ClientConfig_clear(UA_ClientConfig *config) {
  161|     20|    UA_ApplicationDescription_clear(&config->clientDescription);
  162|     20|    UA_String_clear(&config->endpointUrl);
  163|     20|    UA_ExtensionObject_clear(&config->userIdentityToken);
  164|       |
  165|       |    /* Delete the SecurityPolicies for Authentication */
  166|     20|    if(config->authSecurityPolicies != 0) {
  ------------------
  |  Branch (166:8): [True: 20, False: 0]
  ------------------
  167|     40|        for(size_t i = 0; i < config->authSecurityPoliciesSize; i++)
  ------------------
  |  Branch (167:27): [True: 20, False: 20]
  ------------------
  168|     20|            config->authSecurityPolicies[i].clear(&config->authSecurityPolicies[i]);
  169|     20|        UA_free(config->authSecurityPolicies);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  170|     20|        config->authSecurityPolicies = 0;
  171|     20|    }
  172|     20|    UA_String_clear(&config->securityPolicyUri);
  173|     20|    UA_String_clear(&config->authSecurityPolicyUri);
  174|       |
  175|     20|    UA_EndpointDescription_clear(&config->endpoint);
  176|     20|    UA_UserTokenPolicy_clear(&config->userTokenPolicy);
  177|       |
  178|     20|    UA_String_clear(&config->applicationUri);
  179|       |#ifdef UA_ENABLE_LWS
  180|       |    UA_ByteString_clear(&config->webSocketCaCertificate);
  181|       |#endif
  182|       |
  183|     20|    if(config->certificateVerification.clear)
  ------------------
  |  Branch (183:8): [True: 20, False: 0]
  ------------------
  184|     20|        config->certificateVerification.clear(&config->certificateVerification);
  185|       |
  186|       |    /* Delete the SecurityPolicies */
  187|     20|    if(config->securityPolicies != 0) {
  ------------------
  |  Branch (187:8): [True: 20, False: 0]
  ------------------
  188|     40|        for(size_t i = 0; i < config->securityPoliciesSize; i++)
  ------------------
  |  Branch (188:27): [True: 20, False: 20]
  ------------------
  189|     20|            config->securityPolicies[i].clear(&config->securityPolicies[i]);
  190|     20|        UA_free(config->securityPolicies);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  191|     20|        config->securityPolicies = 0;
  192|     20|    }
  193|       |
  194|       |    /* Stop and delete the EventLoop */
  195|     20|    UA_EventLoop *el = config->eventLoop;
  196|     20|    if(el && !config->externalEventLoop) {
  ------------------
  |  Branch (196:8): [True: 20, False: 0]
  |  Branch (196:14): [True: 20, False: 0]
  ------------------
  197|     20|        if(el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (197:12): [True: 0, False: 20]
  ------------------
  198|      0|           el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (198:12): [True: 0, False: 0]
  ------------------
  199|      0|            el->stop(el);
  200|      0|            while(el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (200:19): [True: 0, False: 0]
  ------------------
  201|      0|                el->run(el, 100);
  202|      0|            }
  203|      0|        }
  204|     20|        el->free(el);
  205|     20|        config->eventLoop = NULL;
  206|     20|    }
  207|       |
  208|       |    /* Logging */
  209|     20|    if(config->logging != NULL && config->logging->clear != NULL)
  ------------------
  |  Branch (209:8): [True: 20, False: 0]
  |  Branch (209:35): [True: 20, False: 0]
  ------------------
  210|     20|        config->logging->clear(config->logging);
  211|     20|    config->logging = NULL;
  212|       |
  213|     20|    UA_String_clear(&config->sessionName);
  214|     20|    if(config->sessionLocaleIdsSize > 0 && config->sessionLocaleIds) {
  ------------------
  |  Branch (214:8): [True: 0, False: 20]
  |  Branch (214:44): [True: 0, False: 0]
  ------------------
  215|      0|        UA_Array_delete(config->sessionLocaleIds,
  216|      0|                        config->sessionLocaleIdsSize, &UA_TYPES[UA_TYPES_LOCALEID]);
  ------------------
  |  | 5276|      0|#define UA_TYPES_LOCALEID 131
  ------------------
  217|      0|    }
  218|     20|    config->sessionLocaleIds = NULL;
  219|     20|    config->sessionLocaleIdsSize = 0;
  220|       |
  221|       |    /* Custom Data Types */
  222|     20|    UA_cleanupDataTypeWithCustom(config->customDataTypes);
  223|       |
  224|     20|#ifdef UA_ENABLE_ENCRYPTION
  225|       |    config->privateKeyPasswordCallback = NULL;
  226|     20|#endif
  227|     20|}
UA_Client_delete:
  293|     20|UA_Client_delete(UA_Client* client) {
  294|     20|    UA_Client_disconnect(client);
  295|     20|    UA_Client_clear(client);
  296|     20|    UA_ClientConfig_clear(&client->config);
  297|     20|    UA_free(client);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  298|     20|}
UA_Client_getConfig:
  314|     40|UA_Client_getConfig(UA_Client *client) {
  315|     40|    if(!client)
  ------------------
  |  Branch (315:8): [True: 0, False: 40]
  ------------------
  316|      0|        return NULL;
  317|     40|    return &client->config;
  318|     40|}
notifyClientState:
  341|     40|notifyClientState(UA_Client *client) {
  342|     40|    UA_LOCK_ASSERT(&client->clientMutex);
  343|       |
  344|     40|    if(client->connectStatus == client->oldConnectStatus &&
  ------------------
  |  Branch (344:8): [True: 20, False: 20]
  ------------------
  345|     20|       client->channel.state == client->oldChannelState &&
  ------------------
  |  Branch (345:8): [True: 20, False: 0]
  ------------------
  346|     20|       client->sessionState == client->oldSessionState)
  ------------------
  |  Branch (346:8): [True: 20, False: 0]
  ------------------
  347|     20|        return;
  348|       |
  349|       |#if UA_LOGLEVEL <= 300
  350|       |    UA_Boolean info = (client->connectStatus != UA_STATUSCODE_GOOD);
  351|       |    if(client->oldChannelState != client->channel.state)
  352|       |        info |= (client->channel.state == UA_SECURECHANNELSTATE_OPEN ||
  353|       |                 client->channel.state == UA_SECURECHANNELSTATE_CLOSED);
  354|       |    if(client->oldSessionState != client->sessionState)
  355|       |        info |= (client->sessionState == UA_SESSIONSTATE_CREATED ||
  356|       |                 client->sessionState == UA_SESSIONSTATE_ACTIVATED ||
  357|       |                 client->sessionState == UA_SESSIONSTATE_CLOSED);
  358|       |
  359|       |    const char *channelStateText = channelStateTexts[client->channel.state];
  360|       |    const char *sessionStateText = sessionStateTexts[client->sessionState];
  361|       |    const char *connectStatusText = UA_StatusCode_name(client->connectStatus);
  362|       |
  363|       |    if(info)
  364|       |        UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
  365|       |                    "Client Status: ChannelState: %s, SessionState: %s, ConnectStatus: %s",
  366|       |                    channelStateText, sessionStateText, connectStatusText);
  367|       |    else
  368|       |        UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
  369|       |                     "Client Status: ChannelState: %s, SessionState: %s, ConnectStatus: %s",
  370|       |                     channelStateText, sessionStateText, connectStatusText);
  371|       |#endif
  372|       |
  373|     20|    client->oldConnectStatus = client->connectStatus;
  374|     20|    client->oldChannelState = client->channel.state;
  375|     20|    client->oldSessionState = client->sessionState;
  376|       |
  377|     20|    if(client->config.stateCallback)
  ------------------
  |  Branch (377:8): [True: 0, False: 20]
  ------------------
  378|      0|        client->config.stateCallback(client, client->channel.state,
  379|      0|                                     client->sessionState, client->connectStatus);
  380|     20|}
processServiceResponse:
  640|     20|                       UA_ByteString *message) {
  641|     20|    if(!UA_SecureChannel_isConnected(channel)) {
  ------------------
  |  Branch (641:8): [True: 0, False: 20]
  ------------------
  642|      0|        if(messageType == UA_MESSAGETYPE_MSG) {
  ------------------
  |  Branch (642:12): [True: 0, False: 0]
  ------------------
  643|      0|            UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Discard MSG message "
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  644|      0|                                 "with RequestId %u as the SecureChannel is not connected",
  645|      0|                                 requestId);
  646|      0|        } else {
  647|      0|            UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Discard message "
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  648|      0|                                 "as the SecureChannel is not connected");
  649|      0|        }
  650|      0|        return UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  740|      0|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
  651|      0|    }
  652|       |
  653|     20|    switch(messageType) {
  654|      0|    case UA_MESSAGETYPE_RHE:
  ------------------
  |  Branch (654:5): [True: 0, False: 20]
  ------------------
  655|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process RHE message");
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  656|      0|        processRHEMessage(client, message);
  657|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  658|      0|    case UA_MESSAGETYPE_ACK:
  ------------------
  |  Branch (658:5): [True: 0, False: 20]
  ------------------
  659|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process ACK message");
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  660|      0|        processACKResponse(client, message);
  661|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  662|      0|    case UA_MESSAGETYPE_OPN:
  ------------------
  |  Branch (662:5): [True: 0, False: 20]
  ------------------
  663|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process OPN message");
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  664|      0|        processOPNResponse(client, message);
  665|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  666|      0|    case UA_MESSAGETYPE_ERR:
  ------------------
  |  Branch (666:5): [True: 0, False: 20]
  ------------------
  667|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process ERR message");
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  668|      0|        processERRResponse(client, message);
  669|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  670|      0|    case UA_MESSAGETYPE_MSG:
  ------------------
  |  Branch (670:5): [True: 0, False: 20]
  ------------------
  671|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process MSG message "
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  672|      0|                             "with RequestId %u", requestId);
  673|      0|        return processMSGResponse(client, requestId, message);
  674|     20|    default:
  ------------------
  |  Branch (674:5): [True: 20, False: 0]
  ------------------
  675|     20|        UA_LOG_TRACE_CHANNEL(client->config.logging, channel,
  ------------------
  |  |  491|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  676|     20|                             "Invalid message type");
  677|     20|        channel->state = UA_SECURECHANNELSTATE_CLOSING;
  678|     20|        return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID;
  ------------------
  |  |  485|     20|#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID ((UA_StatusCode) 0x807E0000)
  ------------------
  679|     20|    }
  680|     20|}
__Client_Service:
  685|     20|                 const UA_DataType *responseType) {
  686|     20|    UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
  687|       |
  688|       |    /* Initialize. Response is valied in case of aborting. */
  689|     20|    UA_init(response, responseType);
  690|       |
  691|       |    /* Verify that the EventLoop is running */
  692|     20|    UA_EventLoop *el = client->config.eventLoop;
  693|     20|    if(!el || el->state != UA_EVENTLOOPSTATE_STARTED) {
  ------------------
  |  Branch (693:8): [True: 0, False: 20]
  |  Branch (693:15): [True: 20, False: 0]
  ------------------
  694|     20|        respHeader->serviceResult = UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|     20|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  695|     20|        return;
  696|     20|    }
  697|       |
  698|       |    /* Check that the SecureChannel is open and also a Session active (if we
  699|       |     * want a Session). Otherwise reopen. */
  700|      0|    if(!isFullyConnected(client)) {
  ------------------
  |  Branch (700:8): [True: 0, False: 0]
  ------------------
  701|      0|        UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
  702|      0|                    "Re-establish the connection for the synchronous service call");
  703|      0|        connectSync(client);
  704|      0|        if(client->connectStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (704:12): [True: 0, False: 0]
  ------------------
  705|      0|            respHeader->serviceResult = client->connectStatus;
  706|      0|            return;
  707|      0|        }
  708|      0|    }
  709|       |
  710|       |    /* Store the channelId to detect if the channel was changed by a
  711|       |     * reconnection within the EventLoop run method. */
  712|      0|    UA_UInt32 channelId = client->channel.securityToken.channelId;
  713|       |
  714|       |    /* Send the request */
  715|      0|    UA_UInt32 requestId = 0;
  716|      0|    UA_StatusCode retval = sendRequest(client, request, requestType, &requestId);
  717|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (717:8): [True: 0, False: 0]
  ------------------
  718|       |        /* If sending failed, the status is set to closing. The SecureChannel is
  719|       |         * the actually closed in the next iteration of the EventLoop. */
  720|      0|        UA_assert(client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  ------------------
  |  |  399|      0|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (720:9): [True: 0, False: 0]
  |  Branch (720:9): [True: 0, False: 0]
  ------------------
  721|      0|                  client->channel.state == UA_SECURECHANNELSTATE_CLOSED);
  722|      0|        UA_LOG_WARNING(client->config.logging, UA_LOGCATEGORY_CLIENT,
  723|      0|                       "Sending the request failed with status %s",
  724|      0|                       UA_StatusCode_name(retval));
  725|      0|        notifyClientState(client);
  726|      0|        respHeader->serviceResult = retval;
  727|      0|        return;
  728|      0|    }
  729|       |
  730|       |    /* Temporarily insert an AsyncServiceCall */
  731|      0|    const UA_RequestHeader *rh = (const UA_RequestHeader*)request;
  732|      0|    AsyncServiceCall ac;
  733|      0|    ac.callback = NULL;
  734|      0|    ac.userdata = NULL;
  735|      0|    ac.responseType = responseType;
  736|      0|    ac.syncResponse = (UA_Response*)response;
  737|      0|    ac.requestId = requestId;
  738|      0|    ac.start = el->dateTime_nowMonotonic(el); /* Start timeout after sending */
  739|      0|    ac.timeout = rh->timeoutHint;
  740|      0|    ac.applicationCall = false;
  741|      0|    ac.requestHandle = rh->requestHandle;
  742|      0|    if(ac.timeout == 0)
  ------------------
  |  Branch (742:8): [True: 0, False: 0]
  ------------------
  743|      0|        ac.timeout = UA_UINT32_MAX; /* 0 -> unlimited */
  ------------------
  |  |  109|      0|#define UA_UINT32_MAX 4294967295UL
  ------------------
  744|       |
  745|      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]
  |  |  ------------------
  ------------------
  746|       |
  747|       |    /* Time until which the request has to be answered */
  748|      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
  |  |  ------------------
  ------------------
  749|       |
  750|       |    /* Run the EventLoop until the request was processed, the request has timed
  751|       |     * out or the client connection fails */
  752|      0|    UA_UInt32 timeout_remaining = ac.timeout;
  753|      0|    while(true) {
  ------------------
  |  Branch (753:11): [True: 0, Folded]
  ------------------
  754|       |        /* Unlock before dropping into the EventLoop. The client lock is
  755|       |         * re-taken in the network callback if an event occurs. */
  756|      0|        retval = el->run(el, timeout_remaining);
  757|       |
  758|       |        /* Was the response received? In that case we can directly return. The
  759|       |         * ac was already removed from the internal linked list. */
  760|      0|        if(ac.syncResponse == NULL)
  ------------------
  |  Branch (760:12): [True: 0, False: 0]
  ------------------
  761|      0|            return;
  762|       |
  763|       |        /* Check the status. Do not try to resend if the connection breaks.
  764|       |         * Leave this to the application-level user. For example, we do not want
  765|       |         * to call a method twice is the connection broke after sending the
  766|       |         * request. */
  767|      0|        if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (767:12): [True: 0, False: 0]
  ------------------
  768|      0|            break;
  769|       |
  770|       |        /* The connection was lost */
  771|      0|        retval = client->connectStatus;
  772|      0|        if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (772:12): [True: 0, False: 0]
  ------------------
  773|      0|            break;
  774|       |
  775|       |        /* The channel is no longer the same or was closed */
  776|      0|        if(channelId != client->channel.securityToken.channelId) {
  ------------------
  |  Branch (776:12): [True: 0, False: 0]
  ------------------
  777|      0|            retval = UA_STATUSCODE_BADSECURECHANNELCLOSED;
  ------------------
  |  |  509|      0|#define UA_STATUSCODE_BADSECURECHANNELCLOSED ((UA_StatusCode) 0x80860000)
  ------------------
  778|      0|            break;
  779|      0|        }
  780|       |
  781|       |        /* Update the remaining timeout or break */
  782|      0|        UA_DateTime now = ac.start = el->dateTime_nowMonotonic(el);
  783|      0|        if(now > maxDate) {
  ------------------
  |  Branch (783:12): [True: 0, False: 0]
  ------------------
  784|      0|            retval = UA_STATUSCODE_BADTIMEOUT;
  ------------------
  |  |   59|      0|#define UA_STATUSCODE_BADTIMEOUT ((UA_StatusCode) 0x800A0000)
  ------------------
  785|      0|            break;
  786|      0|        }
  787|      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
  |  |  ------------------
  ------------------
  788|      0|    }
  789|       |
  790|       |    /* Detach from the internal async service list */
  791|      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]
  |  |  ------------------
  ------------------
  792|       |
  793|       |    /* Return the status code */
  794|      0|    respHeader->serviceResult = retval;
  795|      0|}
__Client_AsyncService_removeAll:
  827|     60|__Client_AsyncService_removeAll(UA_Client *client, UA_StatusCode statusCode) {
  828|       |    /* Make this function reentrant. One of the async callbacks could indirectly
  829|       |     * operate on the list. Moving all elements to a local list before iterating
  830|       |     * that. */
  831|     60|    UA_AsyncServiceList asyncServiceCalls = client->asyncServiceCalls;
  832|     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]
  |  |  ------------------
  ------------------
  833|     60|    client->outstandingAsyncServiceCalls = 0;
  834|     60|    if(asyncServiceCalls.lh_first)
  ------------------
  |  Branch (834:8): [True: 0, False: 60]
  ------------------
  835|      0|        asyncServiceCalls.lh_first->pointers.le_prev = &asyncServiceCalls.lh_first;
  836|       |
  837|       |    /* Cancel and remove the elements from the local list */
  838|     60|    AsyncServiceCall *ac, *ac_tmp;
  839|     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))
  ------------------
  840|       |        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]
  |  |  ------------------
  ------------------
  841|      0|        __Client_AsyncService_cancel(client, ac, statusCode);
  842|      0|    }
  843|     60|}
UA_Client_removeCallback:
 1106|     20|UA_Client_removeCallback(UA_Client *client, UA_UInt64 callbackId) {
 1107|     20|    if(!client->config.eventLoop)
  ------------------
  |  Branch (1107:8): [True: 0, False: 20]
  ------------------
 1108|      0|        return;
 1109|     20|    lockClient(client);
 1110|     20|    client->config.eventLoop->removeTimer(client->config.eventLoop, callbackId);
 1111|     20|    unlockClient(client);
 1112|     20|}
lockClient:
 1424|     60|void lockClient(UA_Client *client) {
 1425|     60|    if(UA_LIKELY(client->config.eventLoop && client->config.eventLoop->lock))
  ------------------
  |  |  578|    120|# define UA_LIKELY(x) __builtin_expect((x), 1)
  |  |  ------------------
  |  |  |  Branch (578:23): [True: 60, False: 0]
  |  |  |  Branch (578:41): [True: 60, False: 0]
  |  |  |  Branch (578:41): [True: 60, False: 0]
  |  |  ------------------
  ------------------
 1426|     60|        client->config.eventLoop->lock(client->config.eventLoop);
 1427|     60|    UA_LOCK(&client->clientMutex);
 1428|     60|}
unlockClient:
 1430|     60|void unlockClient(UA_Client *client) {
 1431|     60|    if(UA_LIKELY(client->config.eventLoop && client->config.eventLoop->unlock))
  ------------------
  |  |  578|    120|# define UA_LIKELY(x) __builtin_expect((x), 1)
  |  |  ------------------
  |  |  |  Branch (578:23): [True: 60, False: 0]
  |  |  |  Branch (578:41): [True: 60, False: 0]
  |  |  |  Branch (578:41): [True: 60, False: 0]
  |  |  ------------------
  ------------------
 1432|     60|        client->config.eventLoop->unlock(client->config.eventLoop);
 1433|     60|    UA_UNLOCK(&client->clientMutex);
 1434|     60|}
ua_client.c:UA_Client_clear:
  237|     20|UA_Client_clear(UA_Client *client) {
  238|       |    /* Prevent new async service calls in UA_Client_AsyncService_removeAll */
  239|     20|    UA_SessionState oldState = client->sessionState;
  240|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
  241|       |
  242|       |    /* Delete the async service calls with BADHSUTDOWN */
  243|     20|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSHUTDOWN);
  ------------------
  |  |   65|     20|#define UA_STATUSCODE_BADSHUTDOWN ((UA_StatusCode) 0x800C0000)
  ------------------
  244|       |
  245|       |    /* Reset to the old state to properly close the session */
  246|     20|    client->sessionState = oldState;
  247|       |
  248|     20|    UA_Client_disconnect(client);
  249|       |
  250|       |    /* Prevent reconnection attempts during the EventLoop teardown
  251|       |     * in UA_ClientConfig_clear */
  252|     20|    client->connectStatus = UA_STATUSCODE_BADSHUTDOWN;
  ------------------
  |  |   65|     20|#define UA_STATUSCODE_BADSHUTDOWN ((UA_StatusCode) 0x800C0000)
  ------------------
  253|       |
  254|     20|    UA_String_clear(&client->discoveryUrl);
  255|     20|    UA_EndpointDescription_clear(&client->endpoint);
  256|       |
  257|     20|    UA_ByteString_clear(&client->serverSessionNonce);
  258|     20|    UA_ByteString_clear(&client->clientSessionNonce);
  259|       |
  260|       |    /* Delete the subscriptions */
  261|     20|#ifdef UA_ENABLE_SUBSCRIPTIONS
  262|     20|    __Client_Subscriptions_clear(client);
  263|     20|#endif
  264|       |
  265|       |    /* Remove the internal regular callback */
  266|     20|    UA_Client_removeCallback(client, client->houseKeepingCallbackId);
  267|     20|    client->houseKeepingCallbackId = 0;
  268|       |
  269|       |    /* Clean up the SecureChannel */
  270|     20|    UA_SecureChannel_clear(&client->channel);
  271|       |
  272|       |    /* Free the namespace mapping */
  273|     20|    UA_Array_delete(client->namespaces, client->namespacesSize,
  274|     20|                    &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|     20|#define UA_TYPES_STRING 11
  ------------------
  275|     20|    client->namespaces = NULL;
  276|     20|    client->namespacesSize = 0;
  277|       |
  278|       |    /* Call the application notification callback */
  279|     20|    UA_ClientConfig *config = &client->config;
  280|     20|    if(config->lifecycleNotificationCallback)
  ------------------
  |  Branch (280:8): [True: 0, False: 20]
  ------------------
  281|      0|        config->lifecycleNotificationCallback(client, UA_APPLICATIONNOTIFICATIONTYPE_LIFECYCLE_STOPPED,
  ------------------
  |  |  217|      0|    ((0x01ULL << 32) | 0x04)
  ------------------
  282|      0|                                              UA_KEYVALUEMAP_NULL);
  283|     20|    if(config->globalNotificationCallback)
  ------------------
  |  Branch (283:8): [True: 20, False: 0]
  ------------------
  284|     20|        config->globalNotificationCallback(client, UA_APPLICATIONNOTIFICATIONTYPE_LIFECYCLE_STOPPED,
  ------------------
  |  |  217|     20|    ((0x01ULL << 32) | 0x04)
  ------------------
  285|     20|                                           UA_KEYVALUEMAP_NULL);
  286|       |
  287|     20|#if UA_MULTITHREADING >= 100
  288|     20|    UA_LOCK_DESTROY(&client->clientMutex);
  289|     20|#endif
  290|     20|}

closeSecureChannel:
 2925|     40|closeSecureChannel(UA_Client *client) {
 2926|       |    /* If we close SecureChannel when the Session is still active, set to
 2927|       |     * created. Otherwise the Session would remain active until the connection
 2928|       |     * callback is called for the closing connection. */
 2929|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (2929:8): [True: 0, False: 40]
  ------------------
 2930|      0|        client->sessionState = UA_SESSIONSTATE_CREATED;
 2931|       |
 2932|       |    /* Prevent recursion */
 2933|     40|    if(client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  ------------------
  |  Branch (2933:8): [True: 40, False: 0]
  ------------------
 2934|      0|       client->channel.state == UA_SECURECHANNELSTATE_CLOSED)
  ------------------
  |  Branch (2934:8): [True: 0, False: 0]
  ------------------
 2935|     40|        return;
 2936|       |
 2937|      0|    UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2938|      0|                         "Closing the channel");
 2939|       |
 2940|      0|    disconnectListenSockets(client);
 2941|       |
 2942|       |    /* Send CLO if the SecureChannel is open */
 2943|      0|    if(client->channel.state == UA_SECURECHANNELSTATE_OPEN) {
  ------------------
  |  Branch (2943:8): [True: 0, False: 0]
  ------------------
 2944|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  493|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2945|      0|                             "Sending the CLO message");
 2946|       |
 2947|      0|        UA_EventLoop *el = client->config.eventLoop;
 2948|       |
 2949|       |        /* Manually set up the header (otherwise done in sendRequest) */
 2950|      0|        UA_CloseSecureChannelRequest request;
 2951|      0|        UA_CloseSecureChannelRequest_init(&request);
 2952|      0|        request.requestHeader.requestHandle = ++client->requestHandle;
 2953|      0|        request.requestHeader.timestamp = el->dateTime_now(el);
 2954|      0|        request.requestHeader.timeoutHint = client->config.timeout;
 2955|      0|        request.requestHeader.authenticationToken = client->authenticationToken;
 2956|      0|        UA_SecureChannel_sendCLO(&client->channel, ++client->requestId, &request);
 2957|      0|    }
 2958|       |
 2959|       |    /* The connection is eventually closed in the next callback from the
 2960|       |     * ConnectionManager with the appropriate status code. Don't set the
 2961|       |     * connection closed right away! */
 2962|      0|    UA_SecureChannel_shutdown(&client->channel, UA_SHUTDOWNREASON_CLOSE);
 2963|      0|}
cleanupSession:
 2982|     40|cleanupSession(UA_Client *client) {
 2983|     40|    UA_NodeId_clear(&client->sessionId);
 2984|     40|    UA_NodeId_clear(&client->authenticationToken);
 2985|     40|    client->requestHandle = 0;
 2986|       |
 2987|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2988|       |    /* We need to clean up the subscriptions */
 2989|     40|    __Client_Subscriptions_clear(client);
 2990|     40|#endif
 2991|       |
 2992|       |    /* Delete outstanding async services */
 2993|     40|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSESSIONCLOSED);
  ------------------
  |  |  152|     40|#define UA_STATUSCODE_BADSESSIONCLOSED ((UA_StatusCode) 0x80260000)
  ------------------
 2994|       |
 2995|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2996|     40|    client->currentlyOutStandingPublishRequests = 0;
 2997|     40|#endif
 2998|       |
 2999|     40|    client->sessionState = UA_SESSIONSTATE_CLOSED;
 3000|       |
 3001|       |    /* Clean the latest server's ephemeral public key */
 3002|     40|    UA_ByteString_clear(&client->serverEphemeralPubKey);
 3003|     40|    if(client->utpSp && client->utpSpContext) {
  ------------------
  |  Branch (3003:8): [True: 0, False: 40]
  |  Branch (3003:25): [True: 0, False: 0]
  ------------------
 3004|      0|        client->utpSp->deleteChannelContext(client->utpSp, client->utpSpContext);
 3005|      0|        client->utpSp = NULL;
 3006|       |        client->utpSpContext = NULL;
 3007|      0|    }
 3008|     40|}
UA_Client_disconnect:
 3062|     40|UA_Client_disconnect(UA_Client *client) {
 3063|     40|    lockClient(client);
 3064|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (3064:8): [True: 20, False: 20]
  ------------------
 3065|     20|        sendCloseSession(client);
 3066|     40|    cleanupSession(client);
 3067|     40|    disconnectSecureChannel(client, true);
 3068|     40|    unlockClient(client);
 3069|     40|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 3070|     40|}
ua_client_connect.c:disconnectSecureChannel:
 3011|     40|disconnectSecureChannel(UA_Client *client, UA_Boolean sync) {
 3012|       |    /* Clean the DiscoveryUrl and endpoint description when the connection is
 3013|       |     * explicitly closed */
 3014|     40|    UA_String_clear(&client->discoveryUrl);
 3015|     40|    UA_EndpointDescription_clear(&client->endpoint);
 3016|       |
 3017|       |    /* Manually set the status to closed to prevent an automatic reconnection.
 3018|       |     * Do this before closing because some ConnectionManagers report the close
 3019|       |     * synchronously. Notify the client at the end. */
 3020|     40|    if(client->connectStatus == UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (3020:8): [True: 20, False: 20]
  ------------------
 3021|     20|        client->connectStatus = UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  740|     20|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
 3022|       |
 3023|       |    /* Close the SecureChannel */
 3024|     40|    closeSecureChannel(client);
 3025|       |
 3026|       |    /* In the synchronous case, loop until the client has actually closed. */
 3027|     40|    UA_EventLoop *el = client->config.eventLoop;
 3028|     40|    if(sync && el &&
  ------------------
  |  Branch (3028:8): [True: 40, False: 0]
  |  Branch (3028:16): [True: 40, False: 0]
  ------------------
 3029|     40|       el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (3029:8): [True: 0, False: 40]
  ------------------
 3030|      0|       el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (3030:8): [True: 0, False: 0]
  ------------------
 3031|      0|        while(client->channel.state != UA_SECURECHANNELSTATE_CLOSED) {
  ------------------
  |  Branch (3031:15): [True: 0, False: 0]
  ------------------
 3032|      0|            UA_StatusCode runStatus = el->run(el, 100);
 3033|      0|            if(runStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (3033:16): [True: 0, False: 0]
  ------------------
 3034|      0|                UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
 3035|      0|                             "EventLoop run returned %s during synchronous disconnect, "
 3036|      0|                             "stopping wait loop", UA_StatusCode_name(runStatus));
 3037|      0|                break;
 3038|      0|            }
 3039|      0|        }
 3040|      0|    }
 3041|       |
 3042|     40|    notifyClientState(client);
 3043|     40|}
ua_client_connect.c:sendCloseSession:
 2966|     20|sendCloseSession(UA_Client *client) {
 2967|     20|    UA_CloseSessionRequest request;
 2968|     20|    UA_CloseSessionRequest_init(&request);
 2969|     20|    request.deleteSubscriptions = true;
 2970|     20|    UA_CloseSessionResponse response;
 2971|     20|    __Client_Service(client, &request, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST],
  ------------------
  |  | 7322|     20|#define UA_TYPES_CLOSESESSIONREQUEST 181
  ------------------
 2972|     20|                        &response, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
  ------------------
  |  | 7360|     20|#define UA_TYPES_CLOSESESSIONRESPONSE 182
  ------------------
 2973|     20|    UA_CloseSessionRequest_clear(&request);
 2974|     20|    UA_CloseSessionResponse_clear(&response);
 2975|       |
 2976|       |    /* Set after sending the message to prevent immediate reoping during the
 2977|       |     * service call */
 2978|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
 2979|     20|}

__Client_Subscriptions_clear:
 1775|     60|__Client_Subscriptions_clear(UA_Client *client) {
 1776|     60|    UA_Client_NotificationsAckNumber *n;
 1777|     60|    UA_Client_NotificationsAckNumber *tmp;
 1778|     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))
  ------------------
 1779|      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]
  |  |  ------------------
  ------------------
 1780|      0|        UA_free(n);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1781|      0|    }
 1782|       |
 1783|     60|    UA_Client_Subscription *sub;
 1784|     60|    UA_Client_Subscription *tmps;
 1785|     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))
  ------------------
 1786|      0|        __Client_Subscription_deleteInternal(client, sub); /* force local removal */
 1787|       |
 1788|     60|    client->monitoredItemHandles = 0;
 1789|     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);
  ------------------
  |  |  399|     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:
  179|     20|UA_cleanupDataTypeWithCustom(UA_DataTypeArray *customTypes) {
  180|     20|    while(customTypes) {
  ------------------
  |  Branch (180:11): [True: 0, False: 20]
  ------------------
  181|      0|        UA_DataTypeArray *next = customTypes->next;
  182|      0|        if(customTypes->cleanup) {
  ------------------
  |  Branch (182:12): [True: 0, False: 0]
  ------------------
  183|      0|            for(size_t i = 0; i < customTypes->typesSize; ++i) {
  ------------------
  |  Branch (183:31): [True: 0, False: 0]
  ------------------
  184|      0|                UA_DataType *type = &customTypes->types[i];
  185|      0|                UA_DataType_clear(type);
  186|      0|            }
  187|      0|            UA_free(customTypes->types);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  188|      0|            UA_free(customTypes);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  189|      0|        }
  190|      0|        customTypes = next;
  191|      0|    }
  192|     20|}
UA_STRING:
  219|    140|UA_STRING(char *chars) {
  220|    140|    UA_String s = {0, NULL};
  221|    140|    if(!chars)
  ------------------
  |  Branch (221:8): [True: 0, False: 140]
  ------------------
  222|      0|        return s;
  223|    140|    s.length = strlen(chars);
  224|    140|    s.data = (UA_Byte*)chars;
  225|    140|    return s;
  226|    140|}
UA_String_fromChars:
  229|     40|UA_String_fromChars(const char *src) {
  230|     40|    UA_String s; s.length = 0; s.data = NULL;
  231|     40|    if(!src)
  ------------------
  |  Branch (231:8): [True: 0, False: 40]
  ------------------
  232|      0|        return s;
  233|     40|    s.length = strlen(src);
  234|     40|    if(s.length > 0) {
  ------------------
  |  Branch (234:8): [True: 40, False: 0]
  ------------------
  235|     40|        s.data = (u8*)UA_malloc(s.length);
  ------------------
  |  |   18|     40|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  236|     40|        if(UA_UNLIKELY(!s.data)) {
  ------------------
  |  |  579|     40|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (579:25): [True: 0, False: 40]
  |  |  ------------------
  ------------------
  237|      0|            s.length = 0;
  238|      0|            return s;
  239|      0|        }
  240|     40|        memcpy(s.data, src, s.length);
  241|     40|    } else {
  242|      0|        s.data = (u8*)UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  755|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
  243|      0|    }
  244|     40|    return s;
  245|     40|}
UA_init:
 1923|     20|void UA_init(void *p, const UA_DataType *type) {
 1924|     20|    memset(p, 0, type->memSize);
 1925|     20|}
UA_copy:
 2094|     80|UA_copy(const void *src, void *dst, const UA_DataType *type) {
 2095|     80|    memset(dst, 0, type->memSize); /* init */
 2096|     80|    UA_StatusCode retval = copyJumpTable[type->typeKind](src, dst, type);
 2097|     80|    if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     80|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2097:8): [True: 0, False: 80]
  ------------------
 2098|      0|        UA_clear(dst, type);
 2099|     80|    return retval;
 2100|     80|}
UA_clear:
 2197|    980|UA_clear(void *p, const UA_DataType *type) {
 2198|    980|    clearJumpTable[type->typeKind](p, type);
 2199|    980|    memset(p, 0, type->memSize); /* init */
 2200|    980|}
UA_Array_copy:
 2694|     60|              void **dst, const UA_DataType *type) {
 2695|     60|    if(size == 0) {
  ------------------
  |  Branch (2695:8): [True: 0, False: 60]
  ------------------
 2696|      0|        if(src == NULL)
  ------------------
  |  Branch (2696:12): [True: 0, False: 0]
  ------------------
 2697|      0|            *dst = NULL;
 2698|      0|        else
 2699|      0|            *dst= UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  755|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
 2700|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2701|      0|    }
 2702|       |
 2703|       |    /* Check the array consistency -- defensive programming in case the user
 2704|       |     * manually created an inconsistent array */
 2705|     60|    if(UA_UNLIKELY(!type || !src))
  ------------------
  |  |  579|    120|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (579:25): [True: 0, False: 60]
  |  |  |  Branch (579:43): [True: 0, False: 60]
  |  |  |  Branch (579:43): [True: 0, False: 60]
  |  |  ------------------
  ------------------
 2706|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 2707|       |
 2708|       |    /* calloc, so we don't have to check retval in every iteration of copying */
 2709|     60|    *dst = UA_calloc(size, type->memSize);
  ------------------
  |  |   20|     60|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 2710|     60|    if(!*dst)
  ------------------
  |  Branch (2710:8): [True: 0, False: 60]
  ------------------
 2711|      0|        return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   32|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2712|       |
 2713|     60|    if(type->pointerFree) {
  ------------------
  |  Branch (2713:8): [True: 60, False: 0]
  ------------------
 2714|     60|        memcpy(*dst, src, type->memSize * size);
 2715|     60|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2716|     60|    }
 2717|       |
 2718|      0|    uintptr_t ptrs = (uintptr_t)src;
 2719|      0|    uintptr_t ptrd = (uintptr_t)*dst;
 2720|      0|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2721|      0|    for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2721:23): [True: 0, False: 0]
  ------------------
 2722|      0|        retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
 2723|      0|        ptrs += type->memSize;
 2724|      0|        ptrd += type->memSize;
 2725|      0|    }
 2726|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2726:8): [True: 0, False: 0]
  ------------------
 2727|      0|        UA_Array_delete(*dst, size, type);
 2728|       |        *dst = NULL;
 2729|      0|    }
 2730|      0|    return retval;
 2731|     60|}
UA_Array_delete:
 2822|  2.00k|UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
 2823|  2.00k|    if(!type->pointerFree) {
  ------------------
  |  Branch (2823:8): [True: 220, False: 1.78k]
  ------------------
 2824|    220|        uintptr_t ptr = (uintptr_t)p;
 2825|    260|        for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2825:27): [True: 40, False: 220]
  ------------------
 2826|     40|            UA_clear((void*)ptr, type);
 2827|     40|            ptr += type->memSize;
 2828|     40|        }
 2829|    220|    }
 2830|  2.00k|    UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
  ------------------
  |  |   19|  2.00k|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2831|  2.00k|}
UA_NamespaceMapping_clear:
 3026|     20|UA_NamespaceMapping_clear(UA_NamespaceMapping *nm) {
 3027|     20|    if(!nm)
  ------------------
  |  Branch (3027:8): [True: 20, False: 0]
  ------------------
 3028|     20|        return;
 3029|      0|    UA_Array_delete(nm->namespaceUris, nm->namespaceUrisSize, &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|      0|#define UA_TYPES_STRING 11
  ------------------
 3030|      0|    UA_Array_delete(nm->local2remote, nm->local2remoteSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 3031|      0|    UA_Array_delete(nm->remote2local, nm->remote2localSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 3032|      0|    nm->namespaceUris = NULL;
 3033|      0|    nm->local2remote = NULL;
 3034|       |    nm->remote2local = NULL;
 3035|      0|    nm->namespaceUrisSize = 0;
 3036|      0|    nm->local2remoteSize = 0;
 3037|      0|    nm->remote2localSize = 0;
 3038|      0|}
UA_NamespaceMapping_delete:
 3041|     20|UA_NamespaceMapping_delete(UA_NamespaceMapping *nm) {
 3042|     20|    UA_NamespaceMapping_clear(nm);
 3043|     20|    UA_free(nm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 3044|     20|}
ua_types.c:String_copy:
  280|     60|String_copy(const void *src, void *dst, const UA_DataType *_) {
  281|     60|    const UA_String *srcS = (const UA_String*)src;
  282|     60|    UA_String *dstS = (UA_String *)dst;
  283|     60|    UA_StatusCode res =
  284|     60|        UA_Array_copy(srcS->data, srcS->length, (void**)&dstS->data,
  285|     60|                      &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|     60|#define UA_TYPES_BYTE 2
  ------------------
  286|     60|    if(res == UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (286:8): [True: 60, False: 0]
  ------------------
  287|     60|        dstS->length = srcS->length;
  288|     60|    return res;
  289|     60|}
ua_types.c:NodeId_copy:
  783|     20|NodeId_copy(const void *src, void *dst, const UA_DataType *_) {
  784|     20|    const UA_NodeId *srcN = (const UA_NodeId*)src;
  785|     20|    UA_NodeId *dstN = (UA_NodeId *)dst;
  786|     20|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  787|     20|    switch(srcN->identifierType) {
  788|     20|    case UA_NODEIDTYPE_NUMERIC:
  ------------------
  |  Branch (788:5): [True: 20, False: 0]
  ------------------
  789|     20|        *dstN = *srcN;
  790|     20|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  791|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (791:5): [True: 0, False: 20]
  ------------------
  792|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (792:5): [True: 0, False: 20]
  ------------------
  793|      0|        retval |= String_copy(&srcN->identifier.string,
  794|      0|                              &dstN->identifier.string, NULL);
  795|      0|        break;
  796|      0|    case UA_NODEIDTYPE_GUID:
  ------------------
  |  Branch (796:5): [True: 0, False: 20]
  ------------------
  797|      0|        dstN->identifier.guid = srcN->identifier.guid;
  798|      0|        break;
  799|      0|    default:
  ------------------
  |  Branch (799:5): [True: 0, False: 20]
  ------------------
  800|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  801|     20|    }
  802|      0|    dstN->namespaceIndex = srcN->namespaceIndex;
  803|      0|    dstN->identifierType = srcN->identifierType;
  804|      0|    return retval;
  805|     20|}
ua_types.c:nopClear:
 2159|    600|static void nopClear(void *p, const UA_DataType *type) { }
ua_types.c:String_clear:
  292|  1.78k|String_clear(void *p, const UA_DataType *_) {
  293|  1.78k|    UA_String *s = (UA_String*)p;
  294|  1.78k|    UA_Array_delete(s->data, s->length, &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|  1.78k|#define UA_TYPES_BYTE 2
  ------------------
  295|  1.78k|}
ua_types.c:NodeId_clear:
  771|    160|NodeId_clear(void *p, const UA_DataType *_) {
  772|    160|    UA_NodeId *id = (UA_NodeId*)p;
  773|    160|    switch(id->identifierType) {
  774|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (774:5): [True: 0, False: 160]
  ------------------
  775|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (775:5): [True: 0, False: 160]
  ------------------
  776|      0|        String_clear(&id->identifier.string, NULL);
  777|      0|        break;
  778|    160|    default: break;
  ------------------
  |  Branch (778:5): [True: 160, False: 0]
  ------------------
  779|    160|    }
  780|    160|}
ua_types.c:LocalizedText_clear:
 1831|    100|LocalizedText_clear(void *p, const UA_DataType *_) {
 1832|    100|    UA_LocalizedText *lt = (UA_LocalizedText *)p;
 1833|    100|    String_clear(&lt->locale, NULL);
 1834|       |    String_clear(&lt->text, NULL);
 1835|    100|}
ua_types.c:ExtensionObject_clear:
 1245|     60|ExtensionObject_clear(void *p, const UA_DataType *_) {
 1246|     60|    UA_ExtensionObject *eo = (UA_ExtensionObject *)p;
 1247|     60|    switch(eo->encoding) {
 1248|     60|    case UA_EXTENSIONOBJECT_ENCODED_NOBODY:
  ------------------
  |  Branch (1248:5): [True: 60, False: 0]
  ------------------
 1249|     60|    case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING:
  ------------------
  |  Branch (1249:5): [True: 0, False: 60]
  ------------------
 1250|     60|    case UA_EXTENSIONOBJECT_ENCODED_XML:
  ------------------
  |  Branch (1250:5): [True: 0, False: 60]
  ------------------
 1251|     60|        NodeId_clear(&eo->content.encoded.typeId, NULL);
 1252|     60|        String_clear(&eo->content.encoded.body, NULL);
 1253|     60|        break;
 1254|      0|    case UA_EXTENSIONOBJECT_DECODED:
  ------------------
  |  Branch (1254:5): [True: 0, False: 60]
  ------------------
 1255|      0|        if(eo->content.decoded.data)
  ------------------
  |  Branch (1255:12): [True: 0, False: 0]
  ------------------
 1256|      0|            UA_delete(eo->content.decoded.data, eo->content.decoded.type);
 1257|      0|        break;
 1258|      0|    default:
  ------------------
  |  Branch (1258:5): [True: 0, False: 60]
  ------------------
 1259|      0|        break;
 1260|     60|    }
 1261|     60|}
ua_types.c:DiagnosticInfo_clear:
 1878|     20|DiagnosticInfo_clear(void *p, const UA_DataType *_) {
 1879|     20|    UA_DiagnosticInfo *di = (UA_DiagnosticInfo *)p;
 1880|       |
 1881|     20|    String_clear(&di->additionalInfo, NULL);
 1882|     20|    if(di->hasInnerDiagnosticInfo && di->innerDiagnosticInfo) {
  ------------------
  |  Branch (1882:8): [True: 0, False: 20]
  |  Branch (1882:38): [True: 0, False: 0]
  ------------------
 1883|      0|        DiagnosticInfo_clear(di->innerDiagnosticInfo, NULL);
 1884|      0|        UA_free(di->innerDiagnosticInfo);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1885|      0|    }
 1886|     20|}
ua_types.c:clearStructure:
 2103|    320|clearStructure(void *p, const UA_DataType *type) {
 2104|    320|    uintptr_t ptr = (uintptr_t)p;
 2105|  2.24k|    for(size_t i = 0; i < type->membersSize; ++i) {
  ------------------
  |  Branch (2105:23): [True: 1.92k, False: 320]
  ------------------
 2106|  1.92k|        const UA_DataTypeMember *m = &type->members[i];
 2107|  1.92k|        const UA_DataType *mt = m->memberType;
 2108|  1.92k|        ptr += m->padding;
 2109|  1.92k|        if(!m->isOptional) {
  ------------------
  |  Branch (2109:12): [True: 1.92k, False: 0]
  ------------------
 2110|  1.92k|            if(!m->isArray) {
  ------------------
  |  Branch (2110:16): [True: 1.72k, False: 200]
  ------------------
 2111|  1.72k|                clearJumpTable[mt->typeKind]((void*)ptr, mt);
 2112|  1.72k|                ptr += mt->memSize;
 2113|  1.72k|            } else {
 2114|    200|                size_t length = *(size_t*)ptr;
 2115|    200|                ptr += sizeof(size_t);
 2116|    200|                UA_Array_delete(*(void**)ptr, length, mt);
 2117|    200|                ptr += sizeof(void*);
 2118|    200|            }
 2119|  1.92k|        } else { /* field is optional */
 2120|      0|            if(!m->isArray) {
  ------------------
  |  Branch (2120:16): [True: 0, False: 0]
  ------------------
 2121|       |                /* optional scalar field is contained */
 2122|      0|                if((*(void *const *)ptr != NULL))
  ------------------
  |  Branch (2122:20): [True: 0, False: 0]
  ------------------
 2123|      0|                    UA_Array_delete(*(void **)ptr, 1, mt);
 2124|      0|                ptr += sizeof(void *);
 2125|      0|            } else {
 2126|       |                /* optional array field is contained */
 2127|      0|                if((*(void *const *)(ptr + sizeof(size_t)) != NULL)) {
  ------------------
  |  Branch (2127:20): [True: 0, False: 0]
  ------------------
 2128|      0|                    size_t length = *(size_t *)ptr;
 2129|      0|                    ptr += sizeof(size_t);
 2130|      0|                    UA_Array_delete(*(void **)ptr, length, mt);
 2131|      0|                    ptr += sizeof(void *);
 2132|      0|                } else { /* optional array field not contained */
 2133|      0|                    ptr += sizeof(size_t);
 2134|      0|                    ptr += sizeof(void *);
 2135|      0|                }
 2136|      0|            }
 2137|      0|        }
 2138|  1.92k|    }
 2139|    320|}

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

LLVMFuzzerTestOneInput:
   14|     26|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   15|     26|    if(size < 10)
  ------------------
  |  Branch (15:8): [True: 6, False: 20]
  ------------------
   16|      6|        return 0;
   17|       |
   18|     20|    UA_Client *client = UA_Client_newForUnitTest();
   19|     20|    if(!client)
  ------------------
  |  Branch (19:8): [True: 0, False: 20]
  ------------------
   20|      0|        return 0;
   21|       |    
   22|     20|    UA_ClientConfig *config = UA_Client_getConfig(client);
   23|     20|    if(config->logging)
  ------------------
  |  Branch (23:8): [True: 20, False: 0]
  ------------------
   24|     20|        config->logging->log = NULL; // Disable logging
   25|       |
   26|       |    // Manually set some states to allow processing responses
   27|     20|    client->channel.state = UA_SECURECHANNELSTATE_OPEN;
   28|     20|    client->sessionState = UA_SESSIONSTATE_ACTIVATED;
   29|       |
   30|     20|    UA_MessageType messageType = (UA_MessageType)data[0];
   31|     20|    UA_UInt32 requestId = *(UA_UInt32*)&data[1];
   32|       |    
   33|     20|    UA_ByteString message;
   34|     20|    message.length = size - 5;
   35|     20|    message.data = (UA_Byte*)UA_malloc(message.length);
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
   36|     20|    memcpy(message.data, &data[5], message.length);
   37|       |
   38|       |    // We need at least one async call to match the requestId
   39|     20|    AsyncServiceCall *ac = (AsyncServiceCall*)UA_malloc(sizeof(AsyncServiceCall));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
   40|     20|    ac->requestId = requestId;
   41|     20|    ac->callback = NULL;
   42|     20|    ac->responseType = &UA_TYPES[UA_TYPES_READRESPONSE]; // Just some type
  ------------------
  |  |10546|     20|#define UA_TYPES_READRESPONSE 257
  ------------------
   43|     20|    ac->userdata = NULL;
   44|     20|    ac->syncResponse = NULL;
   45|     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]
  |  |  ------------------
  ------------------
   46|       |
   47|     20|    processServiceResponse(client, &client->channel, messageType, requestId, &message);
   48|       |
   49|       |    // Cleanup
   50|       |    // processServiceResponse might have removed 'ac' if it matched
   51|     20|    AsyncServiceCall *ac2, *tmp;
   52|     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))
  ------------------
   53|     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]
  |  |  ------------------
  ------------------
   54|     20|        UA_free(ac2);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
   55|     20|    }
   56|       |
   57|     20|    UA_ByteString_clear(&message);
   58|     20|    UA_Client_delete(client);
   59|     20|    return 0;
   60|     20|}

UA_Client_newForUnitTest:
   91|     20|UA_Client_newForUnitTest(void) {
   92|     20|    UA_ClientConfig cc;
   93|     20|    memset(&cc, 0, sizeof(UA_ClientConfig));
   94|     20|    cc.logging = UA_Log_Stdout_new(TESTING_LOGLEVEL);
  ------------------
  |  |   12|     20|#define TESTING_LOGLEVEL UA_LOGLEVEL_INFO
  ------------------
   95|     20|    UA_ClientConfig_setDefault(&cc);
   96|     20|    UA_Client *client = UA_Client_newWithConfig(&cc);
   97|     20|    if(!client)
  ------------------
  |  Branch (97:8): [True: 0, False: 20]
  ------------------
   98|      0|        return NULL;
   99|     20|    UA_ClientConfig *config = UA_Client_getConfig(client);
  100|       |    /* Manually set the eventloop clock to the fake clock */
  101|     20|    config->eventLoop->dateTime_now = UA_DateTime_now_fake;
  102|     20|    config->eventLoop->dateTime_nowMonotonic = UA_DateTime_now_fake;
  103|     20|    config->tcpReuseAddr = true;
  104|       |
  105|       |    /* Allow username/pw w/o encryption */
  106|     20|    config->allowNonePolicyPassword = true;
  107|       |
  108|       |    /* Increase the timeouts (needed for valgrind CI tests) */
  109|     20|    config->timeout = 10 * 60 * 1000;
  110|       |
  111|     20|    config->globalNotificationCallback = testClientNotificationCallback;
  112|       |
  113|     20|    return client;
  114|     20|}
test_helpers.c:testClientNotificationCallback:
   87|     20|                               const UA_KeyValueMap payload) {
   88|     20|}

fuzz_client.cc:_ZL19UA_ByteString_clearP9UA_String:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ByteString_clear:
  243|    120|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ChannelSecurityToken_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_String_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_INIT:
  490|     20|UA_LOCK_INIT(UA_Lock *lock) {
  491|     20|    pthread_mutexattr_t mattr;
  492|     20|    pthread_mutexattr_init(&mattr);
  493|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  494|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  495|     20|    pthread_mutexattr_destroy(&mattr);
  496|     20|    lock->count = 0;
  497|     20|}
ua_client.c:UA_ApplicationDescription_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_String_clear:
  243|    120|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ExtensionObject_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_EndpointDescription_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_UserTokenPolicy_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ByteString_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_DESTROY:
  500|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  501|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  399|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (501:5): [True: 20, False: 0]
  ------------------
  502|     20|    pthread_mutex_destroy(&lock->mutex);
  503|     20|}
ua_client.c:UA_LOCK_ASSERT:
  518|     40|UA_LOCK_ASSERT(UA_Lock *lock) {
  519|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  399|     40|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (519:5): [True: 40, False: 0]
  ------------------
  520|     40|}
ua_client.c:UA_LOCK:
  506|     60|UA_LOCK(UA_Lock *lock) {
  507|     60|    pthread_mutex_lock(&lock->mutex);
  508|     60|    lock->count++;
  509|     60|}
ua_client.c:UA_UNLOCK:
  512|     60|UA_UNLOCK(UA_Lock *lock) {
  513|     60|    lock->count--;
  514|     60|    pthread_mutex_unlock(&lock->mutex);
  515|     60|}
ua_client_connect.c:UA_String_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_ByteString_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_EndpointDescription_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_NodeId_clear:
  243|     80|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionResponse_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_init:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_certificategroup_none.c:UA_NodeId_copy:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securitypolicy_none.c:UA_ByteString_clear:
  243|     80|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
timer.c:UA_LOCK_INIT:
  490|     20|UA_LOCK_INIT(UA_Lock *lock) {
  491|     20|    pthread_mutexattr_t mattr;
  492|     20|    pthread_mutexattr_init(&mattr);
  493|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  494|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  495|     20|    pthread_mutexattr_destroy(&mattr);
  496|     20|    lock->count = 0;
  497|     20|}
timer.c:UA_LOCK:
  506|     40|UA_LOCK(UA_Lock *lock) {
  507|     40|    pthread_mutex_lock(&lock->mutex);
  508|     40|    lock->count++;
  509|     40|}
timer.c:UA_UNLOCK:
  512|     40|UA_UNLOCK(UA_Lock *lock) {
  513|     40|    lock->count--;
  514|     40|    pthread_mutex_unlock(&lock->mutex);
  515|     40|}
timer.c:UA_LOCK_DESTROY:
  500|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  501|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  399|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (501:5): [True: 20, False: 0]
  ------------------
  502|     20|    pthread_mutex_destroy(&lock->mutex);
  503|     20|}
eventloop_posix.c:UA_LOCK:
  506|    200|UA_LOCK(UA_Lock *lock) {
  507|    200|    pthread_mutex_lock(&lock->mutex);
  508|    200|    lock->count++;
  509|    200|}
eventloop_posix.c:UA_UNLOCK:
  512|    200|UA_UNLOCK(UA_Lock *lock) {
  513|    200|    lock->count--;
  514|    200|    pthread_mutex_unlock(&lock->mutex);
  515|    200|}
eventloop_posix.c:UA_LOCK_ASSERT:
  518|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  519|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  399|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (519:5): [True: 20, False: 0]
  ------------------
  520|     20|}
eventloop_posix.c:UA_LOCK_INIT:
  490|     20|UA_LOCK_INIT(UA_Lock *lock) {
  491|     20|    pthread_mutexattr_t mattr;
  492|     20|    pthread_mutexattr_init(&mattr);
  493|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  494|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  495|     20|    pthread_mutexattr_destroy(&mattr);
  496|     20|    lock->count = 0;
  497|     20|}
eventloop_posix.c:UA_LOCK_DESTROY:
  500|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  501|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  399|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (501:5): [True: 20, False: 0]
  ------------------
  502|     20|    pthread_mutex_destroy(&lock->mutex);
  503|     20|}
eventloop_posix_tcp.c:UA_String_copy:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_String_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_ByteString_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_copy:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_ByteString_clear:
  243|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_String_copy:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_LOCK_ASSERT:
  518|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  519|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  399|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (519:5): [True: 20, False: 0]
  ------------------
  520|     20|}
eventloop_posix_interrupt.c:UA_String_clear:
  243|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl

