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:
   53|     20|                              UA_UInt64 callbackId) {
   54|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
   55|     20|    UA_Timer_remove(&el->timer, callbackId);
   56|     20|}
UA_EventLoopPOSIX_processDelayed:
  137|     20|UA_EventLoopPOSIX_processDelayed(UA_EventLoopPOSIX *el) {
  138|     20|    UA_LOG_TRACE(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  139|     20|                 "Process delayed callbacks");
  140|       |
  141|     20|    UA_LOCK_ASSERT(&el->elMutex);
  142|       |
  143|       |    /* Reset and get the old head and tail */
  144|     20|    UA_atomic(UA_DelayedCallback *) dc = NULL;
  ------------------
  |  |  315|     20|# define UA_atomic(T) T
  ------------------
  145|     20|    UA_atomic(UA_atomic(UA_DelayedCallback*)*) tail = NULL;
  ------------------
  |  |  315|     20|# define UA_atomic(T) T
  ------------------
  146|     20|    resetDelayedQueue(el, &dc, &tail);
  147|       |
  148|       |    /* tail points to the location where the next element shall be inserted: The
  149|       |     * next-pointer of the last element. Since the next-pointer is the first
  150|       |     * struct member, we can directly cast to the last element. */
  151|     20|    UA_DelayedCallback *last = (UA_DelayedCallback*)(uintptr_t)tail;
  152|       |
  153|       |    /* Loop until we reach the tail (or head and tail are both NULL) */
  154|     20|    UA_DelayedCallback *next;
  155|     20|    for(; dc; dc = next) {
  ------------------
  |  Branch (155:11): [True: 0, False: 20]
  ------------------
  156|      0|        next = dc->next;
  157|      0|        while(!next && dc != last)
  ------------------
  |  Branch (157:15): [True: 0, False: 0]
  |  Branch (157:24): [True: 0, False: 0]
  ------------------
  158|      0|            next = UA_atomic_load(&dc->next);
  ------------------
  |  |  317|      0|    __atomic_load_n(addr, __ATOMIC_SEQ_CST)
  ------------------
  159|      0|        if(!dc->callback)
  ------------------
  |  Branch (159:12): [True: 0, False: 0]
  ------------------
  160|      0|            continue;
  161|      0|        dc->callback(dc->application, dc->context);
  162|      0|    }
  163|     20|}
UA_EventLoopPOSIX_registerEventSource:
  407|     60|                                      UA_EventSource *es) {
  408|     60|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
  409|     60|    UA_LOCK(&el->elMutex);
  410|       |
  411|       |    /* Already registered? */
  412|     60|    if(es->state != UA_EVENTSOURCESTATE_FRESH) {
  ------------------
  |  Branch (412:8): [True: 0, False: 60]
  ------------------
  413|      0|        UA_LOG_ERROR(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
  414|      0|                     "Cannot register the EventSource \"%.*s\": "
  415|      0|                     "already registered",
  416|      0|                     (int)es->name.length, (char*)es->name.data);
  417|      0|        UA_UNLOCK(&el->elMutex);
  418|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  419|      0|    }
  420|       |
  421|       |    /* Add to linked list */
  422|     60|    es->next = el->eventLoop.eventSources;
  423|     60|    el->eventLoop.eventSources = es;
  424|       |
  425|     60|    es->eventLoop = &el->eventLoop;
  426|     60|    es->state = UA_EVENTSOURCESTATE_STOPPED;
  427|       |
  428|       |    /* Start if the entire EventLoop is started */
  429|     60|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  430|     60|    if(el->eventLoop.state == UA_EVENTLOOPSTATE_STARTED)
  ------------------
  |  Branch (430:8): [True: 0, False: 60]
  ------------------
  431|      0|        res = es->start(es);
  432|       |
  433|     60|    UA_UNLOCK(&el->elMutex);
  434|     60|    return res;
  435|     60|}
UA_EventLoopPOSIX_deregisterEventSource:
  439|     60|                                        UA_EventSource *es) {
  440|     60|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
  441|     60|    UA_LOCK(&el->elMutex);
  442|       |
  443|     60|    if(es->state != UA_EVENTSOURCESTATE_STOPPED) {
  ------------------
  |  Branch (443:8): [True: 0, False: 60]
  ------------------
  444|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  445|      0|                       "Cannot deregister the EventSource %.*s: "
  446|      0|                       "Has to be stopped first",
  447|      0|                       (int)es->name.length, es->name.data);
  448|      0|        UA_UNLOCK(&el->elMutex);
  449|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  450|      0|    }
  451|       |
  452|       |    /* Remove from the linked list */
  453|     60|    UA_EventSource **s = &el->eventLoop.eventSources;
  454|     60|    while(*s) {
  ------------------
  |  Branch (454:11): [True: 60, False: 0]
  ------------------
  455|     60|        if(*s == es) {
  ------------------
  |  Branch (455:12): [True: 60, False: 0]
  ------------------
  456|     60|            *s = es->next;
  457|     60|            break;
  458|     60|        }
  459|      0|        s = &(*s)->next;
  460|      0|    }
  461|       |
  462|       |    /* Set the state to non-registered */
  463|     60|    es->state = UA_EVENTSOURCESTATE_FRESH;
  464|       |
  465|     60|    UA_UNLOCK(&el->elMutex);
  466|     60|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  467|     60|}
UA_EventLoopPOSIX_lock:
  549|     60|UA_EventLoopPOSIX_lock(UA_EventLoop *public_el) {
  550|     60|    UA_LOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  551|     60|}
UA_EventLoopPOSIX_unlock:
  553|     60|UA_EventLoopPOSIX_unlock(UA_EventLoop *public_el) {
  554|     60|    UA_UNLOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  555|     60|}
UA_EventLoop_new_POSIX:
  570|     20|UA_EventLoop_new_POSIX(const UA_Logger *logger) {
  571|       |
  572|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)
  573|     20|        UA_calloc(1, sizeof(UA_EventLoopPOSIX));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  574|     20|    if(!el)
  ------------------
  |  Branch (574:8): [True: 0, False: 20]
  ------------------
  575|      0|        return NULL;
  576|       |
  577|     20|    UA_LOCK_INIT(&el->elMutex);
  578|     20|    UA_Timer_init(&el->timer);
  579|       |
  580|       |    /* Initialize the queue */
  581|     20|    el->delayedTail = &el->delayedHead1;
  582|     20|    el->delayedHead2 = (UA_DelayedCallback*)0x01; /* sentinel value */
  583|       |
  584|       |    /* Set the public EventLoop content */
  585|     20|    el->eventLoop.logger = logger;
  586|       |
  587|       |    /* Initialize the clock source to the default */
  588|     20|    el->clockSource = CLOCK_REALTIME;
  589|     20|# ifdef CLOCK_MONOTONIC_RAW
  590|     20|    el->clockSourceMonotonic = CLOCK_MONOTONIC_RAW;
  591|       |# else
  592|       |    el->clockSourceMonotonic = CLOCK_MONOTONIC;
  593|       |# endif
  594|       |
  595|       |    /* Set the method pointers for the interface */
  596|     20|    el->eventLoop.start = UA_EventLoopPOSIX_start;
  597|     20|    el->eventLoop.stop = UA_EventLoopPOSIX_stop;
  598|     20|    el->eventLoop.free = UA_EventLoopPOSIX_free;
  599|     20|    el->eventLoop.run = UA_EventLoopPOSIX_run;
  600|     20|    el->eventLoop.cancel = UA_EventLoopPOSIX_cancel;
  601|       |
  602|     20|    el->eventLoop.dateTime_now = UA_EventLoopPOSIX_DateTime_now;
  603|     20|    el->eventLoop.dateTime_nowMonotonic =
  604|     20|        UA_EventLoopPOSIX_DateTime_nowMonotonic;
  605|     20|    el->eventLoop.dateTime_localTimeUtcOffset =
  606|     20|        UA_EventLoopPOSIX_DateTime_localTimeUtcOffset;
  607|       |
  608|     20|    el->eventLoop.nextTimer = UA_EventLoopPOSIX_nextTimer;
  609|     20|    el->eventLoop.addTimer = UA_EventLoopPOSIX_addTimer;
  610|     20|    el->eventLoop.modifyTimer = UA_EventLoopPOSIX_modifyTimer;
  611|     20|    el->eventLoop.removeTimer = UA_EventLoopPOSIX_removeTimer;
  612|     20|    el->eventLoop.addDelayedCallback = UA_EventLoopPOSIX_addDelayedCallback;
  613|     20|    el->eventLoop.removeDelayedCallback = UA_EventLoopPOSIX_removeDelayedCallback;
  614|       |
  615|     20|    el->eventLoop.registerEventSource = UA_EventLoopPOSIX_registerEventSource;
  616|     20|    el->eventLoop.deregisterEventSource = UA_EventLoopPOSIX_deregisterEventSource;
  617|       |
  618|     20|    el->eventLoop.lock = UA_EventLoopPOSIX_lock;
  619|     20|    el->eventLoop.unlock = UA_EventLoopPOSIX_unlock;
  620|       |
  621|       |    /* Select the FD polling backend */
  622|     20|#if defined(UA_HAVE_EPOLL)
  623|     20|    el->registerFD = registerFD_epoll;
  624|     20|    el->modifyFD = modifyFD_epoll;
  625|     20|    el->deregisterFD = deregisterFD_epoll;
  626|       |#else
  627|       |    el->registerFD = registerFD_select;
  628|       |    el->modifyFD = modifyFD_select;
  629|       |    el->deregisterFD = deregisterFD_select;
  630|       |#endif
  631|       |
  632|     20|    return &el->eventLoop;
  633|     20|}
eventloop_posix.c:resetDelayedQueue:
   80|     20|                  UA_atomic(UA_atomic(UA_DelayedCallback*)*)* oldTail) {
   81|     20|    if(el->delayedHead1 <= (UA_DelayedCallback *)0x01 &&
  ------------------
  |  Branch (81:8): [True: 20, False: 0]
  ------------------
   82|     20|       el->delayedHead2 <= (UA_DelayedCallback *)0x01)
  ------------------
  |  Branch (82:8): [True: 20, False: 0]
  ------------------
   83|     20|        return; /* The queue is empty */
   84|       |
   85|       |    /* Get the location of the active and the inactive head */
   86|      0|    UA_Boolean active1 = (el->delayedHead1 != (UA_DelayedCallback*)0x01);
   87|      0|    UA_atomic(UA_DelayedCallback*)* activeHead = (active1) ? &el->delayedHead1 : &el->delayedHead2;
  ------------------
  |  |  315|      0|# define UA_atomic(T) T
  ------------------
  |  Branch (87:50): [True: 0, False: 0]
  ------------------
   88|      0|    UA_atomic(UA_DelayedCallback*)* inactiveHead = (active1) ? &el->delayedHead2 : &el->delayedHead1;
  ------------------
  |  |  315|      0|# define UA_atomic(T) T
  ------------------
  |  Branch (88:52): [True: 0, False: 0]
  ------------------
   89|       |
   90|       |    /* Set NULL to the inactive head. This indicates it is now active. */
   91|      0|    UA_atomic_store(inactiveHead, NULL);
  ------------------
  |  |  319|      0|    __atomic_store_n(addr, newval, __ATOMIC_SEQ_CST)
  ------------------
   92|       |
   93|       |    /* Set a sentinel value to "inactivate" the active head. Return the old
   94|       |     * active head. Parallel threads may continue to add elements below the old
   95|       |     * "activeHead" if they already have a pointer. */
   96|      0|    UA_atomic_xchg(activeHead, (UA_DelayedCallback*)0x01, oldHead);
  ------------------
  |  |  321|      0|    do {                                                                \
  |  |  322|      0|        *old = __atomic_exchange_n(addr, newval, __ATOMIC_SEQ_CST);     \
  |  |  323|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (323:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
   97|       |
   98|       |    /* Make the inactiveHead the new "active" by pointing to it from the tail.
   99|       |     * Also return the old tail. From the consumer-thread we can then iterate
  100|       |     * the linked-list until we find the old tail as the last element. */
  101|      0|    UA_atomic_xchg(&el->delayedTail, inactiveHead, oldTail);
  ------------------
  |  |  321|      0|    do {                                                                \
  |  |  322|      0|        *old = __atomic_exchange_n(addr, newval, __ATOMIC_SEQ_CST);     \
  |  |  323|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (323:13): [Folded, False: 0]
  |  |  ------------------
  ------------------
  102|      0|}
eventloop_posix.c:UA_EventLoopPOSIX_free:
  506|     20|UA_EventLoopPOSIX_free(UA_EventLoop *public_el) {
  507|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
  508|     20|    UA_LOCK(&el->elMutex);
  509|       |
  510|       |    /* Check if the EventLoop can be deleted */
  511|     20|    if(el->eventLoop.state != UA_EVENTLOOPSTATE_STOPPED &&
  ------------------
  |  Branch (511:8): [True: 20, False: 0]
  ------------------
  512|     20|       el->eventLoop.state != UA_EVENTLOOPSTATE_FRESH) {
  ------------------
  |  Branch (512:8): [True: 0, False: 20]
  ------------------
  513|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  514|      0|                       "Cannot delete a running EventLoop");
  515|      0|        UA_UNLOCK(&el->elMutex);
  516|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  517|      0|    }
  518|       |
  519|       |    /* Deregister and delete all the EventSources */
  520|     80|    while(el->eventLoop.eventSources) {
  ------------------
  |  Branch (520:11): [True: 60, False: 20]
  ------------------
  521|     60|        UA_EventSource *es = el->eventLoop.eventSources;
  522|     60|        UA_EventLoopPOSIX_deregisterEventSource(public_el, es);
  523|     60|        es->free(es);
  524|     60|    }
  525|       |
  526|       |    /* Remove the repeated timed callbacks */
  527|     20|    UA_Timer_clear(&el->timer);
  528|       |
  529|       |#ifdef UA_ENABLE_LWS
  530|       |    /* The LWS context can only be destroyed synchronously outside an LWS
  531|       |     * service callback. All EventSources have released it at this point. */
  532|       |    UA_LWS_destroyContext(public_el);
  533|       |#endif
  534|       |
  535|       |    /* Process remaining delayed callbacks */
  536|     20|    UA_EventLoopPOSIX_processDelayed(el);
  537|       |
  538|       |
  539|     20|    UA_KeyValueMap_clear(&el->eventLoop.params);
  540|       |
  541|       |    /* Clean up */
  542|     20|    UA_UNLOCK(&el->elMutex);
  543|     20|    UA_LOCK_DESTROY(&el->elMutex);
  544|     20|    UA_free(el);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  545|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  546|     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;
  ------------------
  |  |  190|     20|#define UA_INVALID_FD UA_INVALID_SOCKET
  |  |  ------------------
  |  |  |  |   69|     20|#define UA_INVALID_SOCKET -1
  |  |  ------------------
  ------------------
  572|     20|    pim->writefd = UA_INVALID_FD;
  ------------------
  |  |  190|     20|#define UA_INVALID_FD UA_INVALID_SOCKET
  |  |  ------------------
  |  |  |  |   69|     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);
  ------------------
  |  |  325|     20|    __atomic_compare_exchange_n(addr, expected, newval, false,          \
  |  |  326|     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);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (73:5): [True: 20, False: 0]
  ------------------
   74|     20|    UA_atomic_store(pim->managerSlot, NULL);
  ------------------
  |  |  319|     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:
 2084|     20|UA_ClientConfig_setDefault(UA_ClientConfig *config) {
 2085|       |    /* The following fields are untouched and OK to leave as NULL or 0:
 2086|       |     *  clientContext
 2087|       |     *  userIdentityToken
 2088|       |     *  securityMode
 2089|       |     *  securityPolicyUri
 2090|       |     *  endpoint
 2091|       |     *  userTokenPolicy
 2092|       |     *  customDataTypes
 2093|       |     *  connectivityCheckInterval
 2094|       |     *  stateCallback
 2095|       |     *  inactivityCallback
 2096|       |     *  outStandingPublishRequests
 2097|       |     *  subscriptionInactivityCallback
 2098|       |     *  sessionLocaleIds
 2099|       |     *  sessionLocaleIdsSize */
 2100|       |
 2101|     20|    if(config->timeout == 0)
  ------------------
  |  Branch (2101:8): [True: 20, False: 0]
  ------------------
 2102|     20|        config->timeout = 5 * 1000; /* 5 seconds */
 2103|     20|    if(config->secureChannelLifeTime == 0)
  ------------------
  |  Branch (2103:8): [True: 20, False: 0]
  ------------------
 2104|     20|        config->secureChannelLifeTime = 10 * 60 * 1000; /* 10 minutes */
 2105|     20|    if(config->maxAsyncServiceCalls == 0)
  ------------------
  |  Branch (2105:8): [True: 20, False: 0]
  ------------------
 2106|     20|        config->maxAsyncServiceCalls = 32;
 2107|       |
 2108|     20|    if(config->logging == NULL)
  ------------------
  |  Branch (2108:8): [True: 0, False: 20]
  ------------------
 2109|      0|        config->logging = UA_Log_Stdout_new(UA_LOGLEVEL_INFO);
 2110|       |
 2111|       |    /* EventLoop */
 2112|     20|    if(config->eventLoop == NULL) {
  ------------------
  |  Branch (2112:8): [True: 20, False: 0]
  ------------------
 2113|       |#if defined(UA_ARCHITECTURE_ZEPHYR)
 2114|       |        config->eventLoop = UA_EventLoop_new_Zephyr(config->logging);
 2115|       |#elif defined(UA_ARCHITECTURE_LWIP)
 2116|       |        config->eventLoop = UA_EventLoop_new_LWIP(config->logging, NULL);
 2117|       |#elif defined(UA_ARCHITECTURE_WIN32)
 2118|       |        config->eventLoop = UA_EventLoop_new_WIN32(config->logging);
 2119|       |#else
 2120|     20|        config->eventLoop = UA_EventLoop_new_POSIX(config->logging);
 2121|     20|#endif
 2122|     20|        config->externalEventLoop = false;
 2123|       |
 2124|       |        /* Add the TCP connection manager */
 2125|       |#if defined(UA_ARCHITECTURE_ZEPHYR)
 2126|       |        UA_ConnectionManager *tcpCM =
 2127|       |            UA_ConnectionManager_new_Zephyr_TCP(UA_STRING("tcp connection manager"));
 2128|       |#elif defined(UA_ARCHITECTURE_LWIP)
 2129|       |        UA_ConnectionManager *tcpCM =
 2130|       |            UA_ConnectionManager_new_LWIP_TCP(UA_STRING("tcp connection manager"));
 2131|       |#elif defined(UA_ARCHITECTURE_WIN32)
 2132|       |        UA_ConnectionManager *tcpCM =
 2133|       |            UA_ConnectionManager_new_WIN32_TCP(UA_STRING("tcp connection manager"));
 2134|       |#else
 2135|     20|        UA_ConnectionManager *tcpCM =
 2136|     20|            UA_ConnectionManager_new_POSIX_TCP(UA_STRING("tcp connection manager"));
 2137|     20|#endif
 2138|     20|        config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)tcpCM);
 2139|       |
 2140|       |#ifdef UA_ENABLE_LWS
 2141|       |        /* Add the WebSocket connection manager. The client selects it
 2142|       |         * automatically for opc.wss EndpointUrls. */
 2143|       |        UA_ConnectionManager *wsCM =
 2144|       |            UA_ConnectionManager_new_LWS_WebSocket(
 2145|       |                UA_STRING("websocket connection manager"));
 2146|       |        if(wsCM)
 2147|       |            config->eventLoop->registerEventSource(config->eventLoop,
 2148|       |                                                    (UA_EventSource*)wsCM);
 2149|       |        UA_ConnectionManager *httpCM =
 2150|       |            UA_ConnectionManager_new_HTTP(UA_STRING("http connection manager"));
 2151|       |        if(httpCM)
 2152|       |            config->eventLoop->registerEventSource(config->eventLoop,
 2153|       |                                                    (UA_EventSource*)httpCM);
 2154|       |#endif
 2155|       |
 2156|       |#if defined(UA_ARCHITECTURE_LWIP)
 2157|       |        UA_ConnectionManager *udpCM =
 2158|       |            UA_ConnectionManager_new_LWIP_UDP(UA_STRING("udp connection manager"));
 2159|       |#elif defined(UA_ARCHITECTURE_WIN32)
 2160|       |        UA_ConnectionManager *udpCM =
 2161|       |            UA_ConnectionManager_new_WIN32_UDP(UA_STRING("udp connection manager"));
 2162|       |#elif !defined(UA_ARCHITECTURE_ZEPHYR)
 2163|       |        UA_ConnectionManager *udpCM =
 2164|     20|            UA_ConnectionManager_new_POSIX_UDP(UA_STRING("udp connection manager"));
 2165|     20|#endif
 2166|     20|#if !defined(UA_ARCHITECTURE_ZEPHYR)
 2167|     20|        if(udpCM)
  ------------------
  |  Branch (2167:12): [True: 20, False: 0]
  ------------------
 2168|     20|            config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)udpCM);
 2169|     20|#endif
 2170|       |
 2171|     20|#if !defined(UA_ARCHITECTURE_ZEPHYR) && !defined(UA_ARCHITECTURE_LWIP)
 2172|       |        /* Add the interrupt manager */
 2173|     20|        UA_InterruptManager *im =
 2174|       |#ifdef UA_ARCHITECTURE_WIN32
 2175|       |            UA_InterruptManager_new_WIN32(UA_STRING("interrupt manager"));
 2176|       |#else
 2177|     20|            UA_InterruptManager_new_POSIX(UA_STRING("interrupt manager"));
 2178|     20|#endif
 2179|     20|        if(im) {
  ------------------
  |  Branch (2179:12): [True: 20, False: 0]
  ------------------
 2180|     20|            config->eventLoop->registerEventSource(config->eventLoop, &im->eventSource);
 2181|     20|        } else {
 2182|      0|            UA_LOG_ERROR(config->logging, UA_LOGCATEGORY_APPLICATION,
 2183|      0|                         "Cannot create the Interrupt Manager (only relevant if used)");
 2184|      0|        }
 2185|     20|#endif
 2186|     20|    }
 2187|       |
 2188|     20|    if(config->localConnectionConfig.recvBufferSize == 0)
  ------------------
  |  Branch (2188:8): [True: 20, False: 0]
  ------------------
 2189|     20|        config->localConnectionConfig = UA_ConnectionConfig_default;
 2190|       |
 2191|       |#ifdef UA_ENABLE_LWS
 2192|       |    if(config->webSocketMaxQueueSize == 0) {
 2193|       |        UA_UInt32 sendBufferSize = config->localConnectionConfig.sendBufferSize;
 2194|       |        config->webSocketMaxQueueSize = sendBufferSize > UINT32_MAX / 16 ?
 2195|       |            UINT32_MAX : sendBufferSize * 16;
 2196|       |    }
 2197|       |#endif
 2198|     20|    if(config->httpTimeout == 0)
  ------------------
  |  Branch (2198:8): [True: 20, False: 0]
  ------------------
 2199|     20|        config->httpTimeout = 60;
 2200|     20|    if(config->httpMaxMsgSize == 0)
  ------------------
  |  Branch (2200:8): [True: 20, False: 0]
  ------------------
 2201|     20|        config->httpMaxMsgSize =
 2202|     20|            config->localConnectionConfig.localMaxMessageSize;
 2203|     20|    if(config->httpMaxDecompressedMsgSize == 0)
  ------------------
  |  Branch (2203:8): [True: 20, False: 0]
  ------------------
 2204|     20|        config->httpMaxDecompressedMsgSize = config->httpMaxMsgSize;
 2205|       |
 2206|     20|    if(!config->certificateVerification.logging) {
  ------------------
  |  Branch (2206:8): [True: 20, False: 0]
  ------------------
 2207|     20|        config->certificateVerification.logging = config->logging;
 2208|     20|    }
 2209|       |
 2210|     20|#ifdef UA_ENABLE_ENCRYPTION
 2211|       |    /* Limits for TrustList */
 2212|     20|    config->maxTrustListSize = 0;
 2213|     20|    config->maxRejectedListSize = 0;
 2214|     20|#endif
 2215|       |
 2216|     20|    if(!config->certificateVerification.verifyCertificate) {
  ------------------
  |  Branch (2216:8): [True: 20, False: 0]
  ------------------
 2217|       |        /* Certificate Verification that accepts every certificate. Can be
 2218|       |         * overwritten when the policy is specialized. */
 2219|     20|        UA_CertificateGroup_AcceptAll(&config->certificateVerification);
 2220|     20|    }
 2221|       |
 2222|       |    /* With encryption enabled, the applicationUri needs to match the URI from
 2223|       |     * the certificate */
 2224|     20|    if(!config->clientDescription.applicationUri.data)
  ------------------
  |  Branch (2224:8): [True: 20, False: 0]
  ------------------
 2225|     20|        config->clientDescription.applicationUri = UA_STRING_ALLOC(APPLICATION_URI);
  ------------------
  |  |  221|     20|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
 2226|     20|    if(config->clientDescription.applicationType == 0)
  ------------------
  |  Branch (2226:8): [True: 20, False: 0]
  ------------------
 2227|     20|        config->clientDescription.applicationType = UA_APPLICATIONTYPE_CLIENT;
 2228|       |
 2229|     20|    if(config->securityPoliciesSize == 0) {
  ------------------
  |  Branch (2229:8): [True: 20, False: 0]
  ------------------
 2230|     20|        config->securityPolicies = (UA_SecurityPolicy*)UA_malloc(sizeof(UA_SecurityPolicy));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
 2231|     20|        if(!config->securityPolicies)
  ------------------
  |  Branch (2231:12): [True: 0, False: 20]
  ------------------
 2232|      0|            return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   32|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2233|     20|        UA_StatusCode retval = UA_SecurityPolicy_None(config->securityPolicies,
 2234|     20|                                                      UA_BYTESTRING_NULL, config->logging);
 2235|     20|        if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2235:12): [True: 0, False: 20]
  ------------------
 2236|      0|            UA_free(config->securityPolicies);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2237|      0|            config->securityPolicies = NULL;
 2238|      0|            return retval;
 2239|      0|        }
 2240|     20|        config->securityPoliciesSize = 1;
 2241|     20|    }
 2242|       |
 2243|       |    /* Initialize authSecurityPolicies with the None policy as a fallback.
 2244|       |     * This is needed so that non-X509 token types (e.g. username/password,
 2245|       |     * anonymous) can look up a matching SecurityPolicy for authentication.
 2246|       |     * When UA_ClientConfig_setAuthenticationCert is called later, this gets
 2247|       |     * replaced with the full set of authentication SecurityPolicies. */
 2248|     20|    if(config->authSecurityPoliciesSize == 0) {
  ------------------
  |  Branch (2248:8): [True: 20, False: 0]
  ------------------
 2249|     20|        config->authSecurityPolicies =
 2250|     20|            (UA_SecurityPolicy*)UA_malloc(sizeof(UA_SecurityPolicy));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
 2251|     20|        if(!config->authSecurityPolicies)
  ------------------
  |  Branch (2251:12): [True: 0, False: 20]
  ------------------
 2252|      0|            return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   32|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2253|     20|        UA_StatusCode retval =
 2254|     20|            UA_SecurityPolicy_None(config->authSecurityPolicies,
 2255|     20|                                   UA_BYTESTRING_NULL, config->logging);
 2256|     20|        if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2256:12): [True: 0, False: 20]
  ------------------
 2257|      0|            UA_free(config->authSecurityPolicies);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2258|      0|            config->authSecurityPolicies = NULL;
 2259|      0|            return retval;
 2260|      0|        }
 2261|     20|        config->authSecurityPoliciesSize = 1;
 2262|     20|    }
 2263|       |
 2264|     20|    if(config->requestedSessionTimeout == 0)
  ------------------
  |  Branch (2264:8): [True: 20, False: 0]
  ------------------
 2265|     20|        config->requestedSessionTimeout = 1200000;
 2266|       |
 2267|     20|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2268|     20|    if(config->outStandingPublishRequests == 0)
  ------------------
  |  Branch (2268:8): [True: 20, False: 0]
  ------------------
 2269|     20|        config->outStandingPublishRequests = 10;
 2270|     20|#endif
 2271|       |
 2272|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2273|     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:
  142|     20|UA_Client_newWithConfig(const UA_ClientConfig *config) {
  143|     20|    if(!config)
  ------------------
  |  Branch (143:8): [True: 0, False: 20]
  ------------------
  144|      0|        return NULL;
  145|     20|    UA_Client *client = (UA_Client*)UA_malloc(sizeof(UA_Client));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  146|     20|    if(!client)
  ------------------
  |  Branch (146:8): [True: 0, False: 20]
  ------------------
  147|      0|        return NULL;
  148|     20|    memset(client, 0, sizeof(UA_Client));
  149|     20|    client->config = *config;
  150|       |
  151|     20|    UA_SecureChannel_init(&client->channel);
  152|     20|    client->channel.config = client->config.localConnectionConfig;
  153|     20|    client->connectStatus = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  154|       |
  155|     20|#if UA_MULTITHREADING >= 100
  156|     20|    UA_LOCK_INIT(&client->clientMutex);
  157|     20|#endif
  158|       |
  159|       |    /* Initialize the namespace mapping */
  160|     20|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  161|     20|    size_t initialNs = 2 + config->namespacesSize;
  162|     20|    client->namespaces = (UA_String*)UA_calloc(initialNs, sizeof(UA_String));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  163|     20|    if(!client->namespaces)
  ------------------
  |  Branch (163:8): [True: 0, False: 20]
  ------------------
  164|      0|        goto error;
  165|       |
  166|     20|    client->namespacesSize = initialNs;
  167|     20|    client->namespaces[0] = UA_STRING_ALLOC("http://opcfoundation.org/UA/");
  ------------------
  |  |  221|     20|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
  168|     20|    client->namespaces[1] = UA_STRING_NULL; /* Gets set when we connect to the server */
  169|     20|    for(size_t i = 0; i < config->namespacesSize; i++) {
  ------------------
  |  Branch (169:23): [True: 0, False: 20]
  ------------------
  170|      0|        res |= UA_String_copy(&client->namespaces[i+2], &config->namespaces[i]);
  171|      0|    }
  172|     20|    if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (172:8): [True: 0, False: 20]
  ------------------
  173|      0|        goto error;
  174|       |
  175|     20|    return client;
  176|       |
  177|      0|error:
  178|      0|    memset(&client->config, 0, sizeof(UA_ClientConfig));
  179|      0|    UA_Client_delete(client);
  180|       |    return NULL;
  181|     20|}
UA_ClientConfig_clear:
  184|     20|UA_ClientConfig_clear(UA_ClientConfig *config) {
  185|     20|    UA_ApplicationDescription_clear(&config->clientDescription);
  186|     20|    UA_String_clear(&config->endpointUrl);
  187|     20|    UA_ExtensionObject_clear(&config->userIdentityToken);
  188|       |
  189|       |    /* Delete the SecurityPolicies for Authentication */
  190|     20|    if(config->authSecurityPolicies != 0) {
  ------------------
  |  Branch (190:8): [True: 20, False: 0]
  ------------------
  191|     40|        for(size_t i = 0; i < config->authSecurityPoliciesSize; i++)
  ------------------
  |  Branch (191:27): [True: 20, False: 20]
  ------------------
  192|     20|            config->authSecurityPolicies[i].clear(&config->authSecurityPolicies[i]);
  193|     20|        UA_free(config->authSecurityPolicies);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  194|     20|        config->authSecurityPolicies = 0;
  195|     20|    }
  196|     20|    UA_String_clear(&config->securityPolicyUri);
  197|     20|    UA_String_clear(&config->authSecurityPolicyUri);
  198|       |
  199|     20|    UA_EndpointDescription_clear(&config->endpoint);
  200|     20|    UA_UserTokenPolicy_clear(&config->userTokenPolicy);
  201|       |
  202|     20|    UA_String_clear(&config->applicationUri);
  203|       |#ifdef UA_ENABLE_LWS
  204|       |    UA_ByteString_clear(&config->webSocketCaCertificate);
  205|       |#endif
  206|     20|    UA_ByteString_clear(&config->httpCaCertificate);
  207|     20|    UA_ByteString_clear(&config->httpClientCertificate);
  208|     20|    UA_ByteString_clear(&config->httpClientPrivateKey);
  209|     20|    UA_String_clear(&config->httpClientPrivateKeyPassword);
  210|       |
  211|     20|    if(config->certificateVerification.clear)
  ------------------
  |  Branch (211:8): [True: 20, False: 0]
  ------------------
  212|     20|        config->certificateVerification.clear(&config->certificateVerification);
  213|       |
  214|       |    /* Delete the SecurityPolicies */
  215|     20|    if(config->securityPolicies != 0) {
  ------------------
  |  Branch (215:8): [True: 20, False: 0]
  ------------------
  216|     40|        for(size_t i = 0; i < config->securityPoliciesSize; i++)
  ------------------
  |  Branch (216:27): [True: 20, False: 20]
  ------------------
  217|     20|            config->securityPolicies[i].clear(&config->securityPolicies[i]);
  218|     20|        UA_free(config->securityPolicies);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  219|     20|        config->securityPolicies = 0;
  220|     20|    }
  221|       |
  222|       |    /* Stop and delete the EventLoop */
  223|     20|    UA_EventLoop *el = config->eventLoop;
  224|     20|    if(el && !config->externalEventLoop) {
  ------------------
  |  Branch (224:8): [True: 20, False: 0]
  |  Branch (224:14): [True: 20, False: 0]
  ------------------
  225|     20|        if(el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (225:12): [True: 0, False: 20]
  ------------------
  226|      0|           el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (226:12): [True: 0, False: 0]
  ------------------
  227|      0|            el->stop(el);
  228|      0|            while(el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (228:19): [True: 0, False: 0]
  ------------------
  229|      0|                el->run(el, 100);
  230|      0|            }
  231|      0|        }
  232|     20|        el->free(el);
  233|     20|        config->eventLoop = NULL;
  234|     20|    }
  235|       |
  236|       |    /* Logging */
  237|     20|    if(config->logging != NULL && config->logging->clear != NULL)
  ------------------
  |  Branch (237:8): [True: 20, False: 0]
  |  Branch (237:35): [True: 20, False: 0]
  ------------------
  238|     20|        config->logging->clear(config->logging);
  239|     20|    config->logging = NULL;
  240|       |
  241|     20|    UA_String_clear(&config->sessionName);
  242|     20|    if(config->sessionLocaleIdsSize > 0 && config->sessionLocaleIds) {
  ------------------
  |  Branch (242:8): [True: 0, False: 20]
  |  Branch (242:44): [True: 0, False: 0]
  ------------------
  243|      0|        UA_Array_delete(config->sessionLocaleIds,
  244|      0|                        config->sessionLocaleIdsSize, &UA_TYPES[UA_TYPES_LOCALEID]);
  ------------------
  |  | 5276|      0|#define UA_TYPES_LOCALEID 131
  ------------------
  245|      0|    }
  246|     20|    config->sessionLocaleIds = NULL;
  247|     20|    config->sessionLocaleIdsSize = 0;
  248|       |
  249|       |    /* Custom Data Types */
  250|     20|    UA_cleanupDataTypeWithCustom(config->customDataTypes);
  251|       |
  252|     20|#ifdef UA_ENABLE_ENCRYPTION
  253|       |    config->privateKeyPasswordCallback = NULL;
  254|     20|#endif
  255|     20|}
UA_Client_delete:
  320|     20|UA_Client_delete(UA_Client* client) {
  321|     20|    UA_Client_disconnect(client);
  322|     20|    UA_Client_clear(client);
  323|     20|    UA_ClientConfig_clear(&client->config);
  324|     20|    UA_free(client);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  325|     20|}
UA_Client_getConfig:
  341|     40|UA_Client_getConfig(UA_Client *client) {
  342|     40|    if(!client)
  ------------------
  |  Branch (342:8): [True: 0, False: 40]
  ------------------
  343|      0|        return NULL;
  344|     40|    return &client->config;
  345|     40|}
notifyClientState:
  368|     40|notifyClientState(UA_Client *client) {
  369|     40|    UA_LOCK_ASSERT(&client->clientMutex);
  370|       |
  371|     40|    if(client->connectStatus == client->oldConnectStatus &&
  ------------------
  |  Branch (371:8): [True: 20, False: 20]
  ------------------
  372|     20|       client->channel.state == client->oldChannelState &&
  ------------------
  |  Branch (372:8): [True: 20, False: 0]
  ------------------
  373|     20|       client->sessionState == client->oldSessionState)
  ------------------
  |  Branch (373:8): [True: 20, False: 0]
  ------------------
  374|     20|        return;
  375|       |
  376|       |#if UA_LOGLEVEL <= 300
  377|       |    UA_Boolean info = (client->connectStatus != UA_STATUSCODE_GOOD);
  378|       |    if(client->oldChannelState != client->channel.state)
  379|       |        info |= (client->channel.state == UA_SECURECHANNELSTATE_OPEN ||
  380|       |                 client->channel.state == UA_SECURECHANNELSTATE_CLOSED);
  381|       |    if(client->oldSessionState != client->sessionState)
  382|       |        info |= (client->sessionState == UA_SESSIONSTATE_CREATED ||
  383|       |                 client->sessionState == UA_SESSIONSTATE_ACTIVATED ||
  384|       |                 client->sessionState == UA_SESSIONSTATE_CLOSED);
  385|       |
  386|       |    const char *channelStateText = channelStateTexts[client->channel.state];
  387|       |    const char *sessionStateText = sessionStateTexts[client->sessionState];
  388|       |    const char *connectStatusText = UA_StatusCode_name(client->connectStatus);
  389|       |
  390|       |    if(info)
  391|       |        UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
  392|       |                    "Client Status: ChannelState: %s, SessionState: %s, ConnectStatus: %s",
  393|       |                    channelStateText, sessionStateText, connectStatusText);
  394|       |    else
  395|       |        UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
  396|       |                     "Client Status: ChannelState: %s, SessionState: %s, ConnectStatus: %s",
  397|       |                     channelStateText, sessionStateText, connectStatusText);
  398|       |#endif
  399|       |
  400|     20|    client->oldConnectStatus = client->connectStatus;
  401|     20|    client->oldChannelState = client->channel.state;
  402|     20|    client->oldSessionState = client->sessionState;
  403|       |
  404|     20|    if(client->config.stateCallback)
  ------------------
  |  Branch (404:8): [True: 0, False: 20]
  ------------------
  405|      0|        client->config.stateCallback(client, client->channel.state,
  406|      0|                                     client->sessionState, client->connectStatus);
  407|     20|}
processServiceResponse:
  776|     20|                       UA_ByteString *message) {
  777|     20|    if(!UA_SecureChannel_isConnected(channel)) {
  ------------------
  |  Branch (777:8): [True: 0, False: 20]
  ------------------
  778|      0|        if(messageType == UA_MESSAGETYPE_MSG) {
  ------------------
  |  Branch (778:12): [True: 0, False: 0]
  ------------------
  779|      0|            UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Discard MSG message "
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  780|      0|                                 "with RequestId %u as the SecureChannel is not connected",
  781|      0|                                 requestId);
  782|      0|        } else {
  783|      0|            UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Discard message "
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  784|      0|                                 "as the SecureChannel is not connected");
  785|      0|        }
  786|      0|        return UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  740|      0|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
  787|      0|    }
  788|       |
  789|     20|    switch(messageType) {
  790|      0|    case UA_MESSAGETYPE_RHE:
  ------------------
  |  Branch (790:5): [True: 0, False: 20]
  ------------------
  791|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process RHE message");
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  792|      0|        processRHEMessage(client, message);
  793|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  794|      0|    case UA_MESSAGETYPE_ACK:
  ------------------
  |  Branch (794:5): [True: 0, False: 20]
  ------------------
  795|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process ACK message");
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  796|      0|        processACKResponse(client, message);
  797|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  798|      0|    case UA_MESSAGETYPE_OPN:
  ------------------
  |  Branch (798:5): [True: 0, False: 20]
  ------------------
  799|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process OPN message");
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  800|      0|        processOPNResponse(client, message);
  801|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  802|      0|    case UA_MESSAGETYPE_ERR:
  ------------------
  |  Branch (802:5): [True: 0, False: 20]
  ------------------
  803|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process ERR message");
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  804|      0|        processERRResponse(client, message);
  805|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  806|      0|    case UA_MESSAGETYPE_MSG:
  ------------------
  |  Branch (806:5): [True: 0, False: 20]
  ------------------
  807|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, channel, "Process MSG message "
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  808|      0|                             "with RequestId %u", requestId);
  809|      0|        return __Client_processServiceResponsePayload(
  810|      0|            client, requestId, message, UA_SECURECHANNEL_ENCODING_BINARY);
  811|     20|    default:
  ------------------
  |  Branch (811:5): [True: 20, False: 0]
  ------------------
  812|     20|        UA_LOG_TRACE_CHANNEL(client->config.logging, channel,
  ------------------
  |  |  576|     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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  813|     20|                             "Invalid message type");
  814|     20|        channel->state = UA_SECURECHANNELSTATE_CLOSING;
  815|     20|        return UA_STATUSCODE_BADTCPMESSAGETYPEINVALID;
  ------------------
  |  |  485|     20|#define UA_STATUSCODE_BADTCPMESSAGETYPEINVALID ((UA_StatusCode) 0x807E0000)
  ------------------
  816|     20|    }
  817|     20|}
__Client_Service:
  822|     20|                 const UA_DataType *responseType) {
  823|     20|    UA_ResponseHeader *respHeader = (UA_ResponseHeader*)response;
  824|       |
  825|       |    /* Initialize. Response is valied in case of aborting. */
  826|     20|    UA_init(response, responseType);
  827|       |
  828|       |    /* Verify that the EventLoop is running */
  829|     20|    UA_EventLoop *el = client->config.eventLoop;
  830|     20|    if(!el || el->state != UA_EVENTLOOPSTATE_STARTED) {
  ------------------
  |  Branch (830:8): [True: 0, False: 20]
  |  Branch (830:15): [True: 20, False: 0]
  ------------------
  831|     20|        respHeader->serviceResult = UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|     20|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  832|     20|        return;
  833|     20|    }
  834|       |
  835|       |    /* Check that the SecureChannel is open and also a Session active (if we
  836|       |     * want a Session). Otherwise reopen. */
  837|      0|    if(!isFullyConnected(client)) {
  ------------------
  |  Branch (837:8): [True: 0, False: 0]
  ------------------
  838|      0|        UA_LOG_INFO(client->config.logging, UA_LOGCATEGORY_CLIENT,
  839|      0|                    "Re-establish the connection for the synchronous service call");
  840|      0|        connectSync(client);
  841|      0|        if(client->connectStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (841:12): [True: 0, False: 0]
  ------------------
  842|      0|            respHeader->serviceResult = client->connectStatus;
  843|      0|            return;
  844|      0|        }
  845|      0|    }
  846|       |
  847|       |    /* Store the channelId to detect if the channel was changed by a
  848|       |     * reconnection within the EventLoop run method. */
  849|      0|    UA_UInt32 channelId = client->channel.securityToken.channelId;
  850|       |
  851|       |    /* Set up and register the synchronous service call before sending. */
  852|      0|    AsyncServiceCall ac;
  853|      0|    memset(&ac, 0, sizeof(ac));
  854|      0|    ac.responseType = responseType;
  855|      0|    ac.syncResponse = (UA_Response*)response;
  856|      0|    ac.applicationCall = false;
  857|      0|    UA_StatusCode retval = sendRequest(client, request, requestType, &ac);
  858|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (858:8): [True: 0, False: 0]
  ------------------
  859|       |        /* If sending failed, the status is set to closing. The SecureChannel is
  860|       |         * the actually closed in the next iteration of the EventLoop. */
  861|      0|        UA_assert(client->channel.transport == UA_SECURECHANNEL_TRANSPORT_HTTP ||
  ------------------
  |  |  400|      0|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (861:9): [True: 0, False: 0]
  |  Branch (861:9): [True: 0, False: 0]
  |  Branch (861:9): [True: 0, False: 0]
  ------------------
  862|      0|                  client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  863|      0|                  client->channel.state == UA_SECURECHANNELSTATE_CLOSED);
  864|      0|        UA_LOG_WARNING(client->config.logging, UA_LOGCATEGORY_CLIENT,
  865|      0|                       "Sending the request failed with status %s",
  866|      0|                       UA_StatusCode_name(retval));
  867|      0|        notifyClientState(client);
  868|      0|        respHeader->serviceResult = retval;
  869|      0|        return;
  870|      0|    }
  871|       |
  872|       |    /* Time until which the request has to be answered */
  873|      0|    UA_DateTime maxDate = ac.start + ((UA_DateTime)ac.timeout * UA_DATETIME_MSEC);
  ------------------
  |  |  285|      0|#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
  |  |  ------------------
  |  |  |  |  284|      0|#define UA_DATETIME_USEC 10LL
  |  |  ------------------
  ------------------
  874|       |
  875|       |    /* Run the EventLoop until the request was processed, the request has timed
  876|       |     * out or the client connection fails */
  877|      0|    UA_UInt32 timeout_remaining = ac.timeout;
  878|      0|    while(true) {
  ------------------
  |  Branch (878:11): [True: 0, Folded]
  ------------------
  879|       |        /* Unlock before dropping into the EventLoop. The client lock is
  880|       |         * re-taken in the network callback if an event occurs. */
  881|      0|        retval = el->run(el, timeout_remaining);
  882|       |
  883|       |        /* Was the response received? In that case we can directly return. The
  884|       |         * ac was already removed from the internal linked list. */
  885|      0|        if(ac.syncResponse == NULL)
  ------------------
  |  Branch (885:12): [True: 0, False: 0]
  ------------------
  886|      0|            return;
  887|       |
  888|       |        /* Check the status. Do not try to resend if the connection breaks.
  889|       |         * Leave this to the application-level user. For example, we do not want
  890|       |         * to call a method twice is the connection broke after sending the
  891|       |         * request. */
  892|      0|        if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (892:12): [True: 0, False: 0]
  ------------------
  893|      0|            break;
  894|       |
  895|       |        /* The connection was lost */
  896|      0|        retval = client->connectStatus;
  897|      0|        if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (897:12): [True: 0, False: 0]
  ------------------
  898|      0|            break;
  899|       |
  900|       |        /* The channel is no longer the same or was closed */
  901|      0|        if(channelId != client->channel.securityToken.channelId) {
  ------------------
  |  Branch (901:12): [True: 0, False: 0]
  ------------------
  902|      0|            retval = UA_STATUSCODE_BADSECURECHANNELCLOSED;
  ------------------
  |  |  509|      0|#define UA_STATUSCODE_BADSECURECHANNELCLOSED ((UA_StatusCode) 0x80860000)
  ------------------
  903|      0|            break;
  904|      0|        }
  905|       |
  906|       |        /* Update the remaining timeout or break */
  907|      0|        UA_DateTime now = ac.start = el->dateTime_nowMonotonic(el);
  908|      0|        if(now > maxDate) {
  ------------------
  |  Branch (908:12): [True: 0, False: 0]
  ------------------
  909|      0|            retval = UA_STATUSCODE_BADTIMEOUT;
  ------------------
  |  |   59|      0|#define UA_STATUSCODE_BADTIMEOUT ((UA_StatusCode) 0x800A0000)
  ------------------
  910|      0|            break;
  911|      0|        }
  912|      0|        timeout_remaining = (UA_UInt32)((maxDate - now) / UA_DATETIME_MSEC);
  ------------------
  |  |  285|      0|#define UA_DATETIME_MSEC (UA_DATETIME_USEC * 1000LL)
  |  |  ------------------
  |  |  |  |  284|      0|#define UA_DATETIME_USEC 10LL
  |  |  ------------------
  ------------------
  913|      0|    }
  914|       |
  915|       |    /* Detach from the internal async service list */
  916|      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]
  |  |  ------------------
  ------------------
  917|      0|    UA_ByteString_clear(&ac.httpResponseBody);
  918|       |
  919|       |    /* Return the status code */
  920|      0|    respHeader->serviceResult = retval;
  921|      0|}
__Client_AsyncService_removeAll:
  968|     60|__Client_AsyncService_removeAll(UA_Client *client, UA_StatusCode statusCode) {
  969|       |    /* Make this function reentrant. One of the async callbacks could indirectly
  970|       |     * operate on the list. Moving all elements to a local list before iterating
  971|       |     * that. */
  972|     60|    UA_AsyncServiceList asyncServiceCalls = client->asyncServiceCalls;
  973|     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]
  |  |  ------------------
  ------------------
  974|     60|    client->outstandingAsyncServiceCalls = 0;
  975|     60|    if(asyncServiceCalls.lh_first)
  ------------------
  |  Branch (975:8): [True: 0, False: 60]
  ------------------
  976|      0|        asyncServiceCalls.lh_first->pointers.le_prev = &asyncServiceCalls.lh_first;
  977|       |
  978|       |    /* Cancel and remove the elements from the local list */
  979|     60|    AsyncServiceCall *ac, *ac_tmp;
  980|     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))
  ------------------
  981|       |        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]
  |  |  ------------------
  ------------------
  982|      0|        __Client_AsyncService_cancel(client, ac, statusCode);
  983|      0|    }
  984|     60|}
UA_Client_removeCallback:
 1235|     20|UA_Client_removeCallback(UA_Client *client, UA_UInt64 callbackId) {
 1236|     20|    if(!client->config.eventLoop)
  ------------------
  |  Branch (1236:8): [True: 0, False: 20]
  ------------------
 1237|      0|        return;
 1238|     20|    lockClient(client);
 1239|     20|    client->config.eventLoop->removeTimer(client->config.eventLoop, callbackId);
 1240|     20|    unlockClient(client);
 1241|     20|}
lockClient:
 1553|     60|void lockClient(UA_Client *client) {
 1554|     60|    if(UA_LIKELY(client->config.eventLoop && client->config.eventLoop->lock))
  ------------------
  |  |  579|    120|# define UA_LIKELY(x) __builtin_expect((x), 1)
  |  |  ------------------
  |  |  |  Branch (579:23): [True: 60, False: 0]
  |  |  |  Branch (579:41): [True: 60, False: 0]
  |  |  |  Branch (579:41): [True: 60, False: 0]
  |  |  ------------------
  ------------------
 1555|     60|        client->config.eventLoop->lock(client->config.eventLoop);
 1556|     60|    UA_LOCK(&client->clientMutex);
 1557|     60|}
unlockClient:
 1559|     60|void unlockClient(UA_Client *client) {
 1560|     60|    if(UA_LIKELY(client->config.eventLoop && client->config.eventLoop->unlock))
  ------------------
  |  |  579|    120|# define UA_LIKELY(x) __builtin_expect((x), 1)
  |  |  ------------------
  |  |  |  Branch (579:23): [True: 60, False: 0]
  |  |  |  Branch (579:41): [True: 60, False: 0]
  |  |  |  Branch (579:41): [True: 60, False: 0]
  |  |  ------------------
  ------------------
 1561|     60|        client->config.eventLoop->unlock(client->config.eventLoop);
 1562|     60|    UA_UNLOCK(&client->clientMutex);
 1563|     60|}
ua_client.c:UA_Client_clear:
  265|     20|UA_Client_clear(UA_Client *client) {
  266|       |    /* Prevent new async service calls in UA_Client_AsyncService_removeAll */
  267|     20|    UA_SessionState oldState = client->sessionState;
  268|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
  269|       |
  270|       |    /* Delete the async service calls with BADHSUTDOWN */
  271|     20|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSHUTDOWN);
  ------------------
  |  |   65|     20|#define UA_STATUSCODE_BADSHUTDOWN ((UA_StatusCode) 0x800C0000)
  ------------------
  272|       |
  273|       |    /* Reset to the old state to properly close the session */
  274|     20|    client->sessionState = oldState;
  275|       |
  276|     20|    UA_Client_disconnect(client);
  277|       |
  278|       |    /* Prevent reconnection attempts during the EventLoop teardown
  279|       |     * in UA_ClientConfig_clear */
  280|     20|    client->connectStatus = UA_STATUSCODE_BADSHUTDOWN;
  ------------------
  |  |   65|     20|#define UA_STATUSCODE_BADSHUTDOWN ((UA_StatusCode) 0x800C0000)
  ------------------
  281|       |
  282|     20|    UA_String_clear(&client->discoveryUrl);
  283|     20|    UA_EndpointDescription_clear(&client->endpoint);
  284|       |
  285|     20|    UA_ByteString_clear(&client->serverSessionNonce);
  286|     20|    UA_ByteString_clear(&client->clientSessionNonce);
  287|       |    /* Delete the subscriptions */
  288|     20|#ifdef UA_ENABLE_SUBSCRIPTIONS
  289|     20|    __Client_Subscriptions_clear(client);
  290|     20|#endif
  291|       |
  292|       |    /* Remove the internal regular callback */
  293|     20|    UA_Client_removeCallback(client, client->houseKeepingCallbackId);
  294|     20|    client->houseKeepingCallbackId = 0;
  295|       |
  296|       |    /* Clean up the SecureChannel */
  297|     20|    UA_SecureChannel_clear(&client->channel);
  298|       |
  299|       |    /* Free the namespace mapping */
  300|     20|    UA_Array_delete(client->namespaces, client->namespacesSize,
  301|     20|                    &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|     20|#define UA_TYPES_STRING 11
  ------------------
  302|     20|    client->namespaces = NULL;
  303|     20|    client->namespacesSize = 0;
  304|       |
  305|       |    /* Call the application notification callback */
  306|     20|    UA_ClientConfig *config = &client->config;
  307|     20|    if(config->lifecycleNotificationCallback)
  ------------------
  |  Branch (307:8): [True: 0, False: 20]
  ------------------
  308|      0|        config->lifecycleNotificationCallback(client, UA_APPLICATIONNOTIFICATIONTYPE_LIFECYCLE_STOPPED,
  ------------------
  |  |  218|      0|    ((0x01ULL << 32) | 0x04)
  ------------------
  309|      0|                                              UA_KEYVALUEMAP_NULL);
  310|     20|    if(config->globalNotificationCallback)
  ------------------
  |  Branch (310:8): [True: 20, False: 0]
  ------------------
  311|     20|        config->globalNotificationCallback(client, UA_APPLICATIONNOTIFICATIONTYPE_LIFECYCLE_STOPPED,
  ------------------
  |  |  218|     20|    ((0x01ULL << 32) | 0x04)
  ------------------
  312|     20|                                           UA_KEYVALUEMAP_NULL);
  313|       |
  314|     20|#if UA_MULTITHREADING >= 100
  315|     20|    UA_LOCK_DESTROY(&client->clientMutex);
  316|     20|#endif
  317|     20|}

closeSecureChannel:
 3079|     40|closeSecureChannel(UA_Client *client) {
 3080|       |    /* If we close SecureChannel when the Session is still active, set to
 3081|       |     * created. Otherwise the Session would remain active until the connection
 3082|       |     * callback is called for the closing connection. */
 3083|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (3083:8): [True: 0, False: 40]
  ------------------
 3084|      0|        client->sessionState = UA_SESSIONSTATE_CREATED;
 3085|       |
 3086|       |    /* Prevent recursion */
 3087|     40|    if(client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  ------------------
  |  Branch (3087:8): [True: 40, False: 0]
  ------------------
 3088|      0|       client->channel.state == UA_SECURECHANNELSTATE_CLOSED)
  ------------------
  |  Branch (3088:8): [True: 0, False: 0]
  ------------------
 3089|     40|        return;
 3090|       |
 3091|      0|    UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3092|      0|                         "Closing the channel");
 3093|       |
 3094|      0|    disconnectListenSockets(client);
 3095|       |
 3096|       |    /* Only UACP has a CloseSecureChannel message. Direct HTTP proceeds
 3097|       |     * immediately to transport shutdown. */
 3098|      0|    if(client->channel.state == UA_SECURECHANNELSTATE_OPEN &&
  ------------------
  |  Branch (3098:8): [True: 0, False: 0]
  ------------------
 3099|      0|       client->channel.transport == UA_SECURECHANNEL_TRANSPORT_UACP) {
  ------------------
  |  Branch (3099:8): [True: 0, False: 0]
  ------------------
 3100|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  578|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3101|      0|                             "Sending the CLO message");
 3102|       |
 3103|      0|        UA_EventLoop *el = client->config.eventLoop;
 3104|       |
 3105|       |        /* Manually set up the header (otherwise done in sendRequest) */
 3106|      0|        UA_CloseSecureChannelRequest request;
 3107|      0|        UA_CloseSecureChannelRequest_init(&request);
 3108|      0|        request.requestHeader.requestHandle = ++client->requestHandle;
 3109|      0|        request.requestHeader.timestamp = el->dateTime_now(el);
 3110|      0|        request.requestHeader.timeoutHint = client->config.timeout;
 3111|      0|        request.requestHeader.authenticationToken = client->authenticationToken;
 3112|      0|        UA_SecureChannel_sendCLO(&client->channel,
 3113|      0|                                 __Client_nextRequestId(client), &request);
 3114|      0|    }
 3115|       |
 3116|       |    /* The connection is eventually closed in the next callback from the
 3117|       |     * ConnectionManager with the appropriate status code. Don't set the
 3118|       |     * connection closed right away! */
 3119|      0|    UA_SecureChannel_shutdown(&client->channel, UA_SHUTDOWNREASON_CLOSE);
 3120|      0|}
cleanupSession:
 3139|     40|cleanupSession(UA_Client *client) {
 3140|     40|    UA_NodeId_clear(&client->sessionId);
 3141|     40|    UA_NodeId_clear(&client->authenticationToken);
 3142|     40|    client->requestHandle = 0;
 3143|       |
 3144|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 3145|       |    /* We need to clean up the subscriptions */
 3146|     40|    __Client_Subscriptions_clear(client);
 3147|     40|#endif
 3148|       |
 3149|       |    /* Delete outstanding async services */
 3150|     40|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSESSIONCLOSED);
  ------------------
  |  |  152|     40|#define UA_STATUSCODE_BADSESSIONCLOSED ((UA_StatusCode) 0x80260000)
  ------------------
 3151|       |
 3152|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 3153|     40|    client->currentlyOutStandingPublishRequests = 0;
 3154|     40|#endif
 3155|       |
 3156|     40|    client->sessionState = UA_SESSIONSTATE_CLOSED;
 3157|       |
 3158|       |    /* Clean the latest server's ephemeral public key */
 3159|     40|    UA_ByteString_clear(&client->serverEphemeralPubKey);
 3160|     40|    if(client->utpSp && client->utpSpContext) {
  ------------------
  |  Branch (3160:8): [True: 0, False: 40]
  |  Branch (3160:25): [True: 0, False: 0]
  ------------------
 3161|      0|        client->utpSp->deleteChannelContext(client->utpSp, client->utpSpContext);
 3162|      0|        client->utpSp = NULL;
 3163|       |        client->utpSpContext = NULL;
 3164|      0|    }
 3165|     40|}
UA_Client_disconnect:
 3219|     40|UA_Client_disconnect(UA_Client *client) {
 3220|     40|    lockClient(client);
 3221|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (3221:8): [True: 20, False: 20]
  ------------------
 3222|     20|        sendCloseSession(client);
 3223|     40|    cleanupSession(client);
 3224|     40|    disconnectSecureChannel(client, true);
 3225|     40|    unlockClient(client);
 3226|     40|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 3227|     40|}
ua_client_connect.c:disconnectSecureChannel:
 3168|     40|disconnectSecureChannel(UA_Client *client, UA_Boolean sync) {
 3169|       |    /* Clean the DiscoveryUrl and endpoint description when the connection is
 3170|       |     * explicitly closed */
 3171|     40|    UA_String_clear(&client->discoveryUrl);
 3172|     40|    UA_EndpointDescription_clear(&client->endpoint);
 3173|       |
 3174|       |    /* Manually set the status to closed to prevent an automatic reconnection.
 3175|       |     * Do this before closing because some ConnectionManagers report the close
 3176|       |     * synchronously. Notify the client at the end. */
 3177|     40|    if(client->connectStatus == UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (3177:8): [True: 20, False: 20]
  ------------------
 3178|     20|        client->connectStatus = UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  740|     20|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
 3179|       |
 3180|       |    /* Close the SecureChannel */
 3181|     40|    closeSecureChannel(client);
 3182|       |
 3183|       |    /* In the synchronous case, loop until the client has actually closed. */
 3184|     40|    UA_EventLoop *el = client->config.eventLoop;
 3185|     40|    if(sync && el &&
  ------------------
  |  Branch (3185:8): [True: 40, False: 0]
  |  Branch (3185:16): [True: 40, False: 0]
  ------------------
 3186|     40|       el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (3186:8): [True: 0, False: 40]
  ------------------
 3187|      0|       el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (3187:8): [True: 0, False: 0]
  ------------------
 3188|      0|        while(client->channel.state != UA_SECURECHANNELSTATE_CLOSED) {
  ------------------
  |  Branch (3188:15): [True: 0, False: 0]
  ------------------
 3189|      0|            UA_StatusCode runStatus = el->run(el, 100);
 3190|      0|            if(runStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (3190:16): [True: 0, False: 0]
  ------------------
 3191|      0|                UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
 3192|      0|                             "EventLoop run returned %s during synchronous disconnect, "
 3193|      0|                             "stopping wait loop", UA_StatusCode_name(runStatus));
 3194|      0|                break;
 3195|      0|            }
 3196|      0|        }
 3197|      0|    }
 3198|       |
 3199|     40|    notifyClientState(client);
 3200|     40|}
ua_client_connect.c:sendCloseSession:
 3123|     20|sendCloseSession(UA_Client *client) {
 3124|     20|    UA_CloseSessionRequest request;
 3125|     20|    UA_CloseSessionRequest_init(&request);
 3126|     20|    request.deleteSubscriptions = true;
 3127|     20|    UA_CloseSessionResponse response;
 3128|     20|    __Client_Service(client, &request, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST],
  ------------------
  |  | 7322|     20|#define UA_TYPES_CLOSESESSIONREQUEST 181
  ------------------
 3129|     20|                        &response, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
  ------------------
  |  | 7360|     20|#define UA_TYPES_CLOSESESSIONRESPONSE 182
  ------------------
 3130|     20|    UA_CloseSessionRequest_clear(&request);
 3131|     20|    UA_CloseSessionResponse_clear(&response);
 3132|       |
 3133|       |    /* Set after sending the message to prevent immediate reoping during the
 3134|       |     * service call */
 3135|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
 3136|     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:
   31|     20|UA_SecureChannel_init(UA_SecureChannel *channel) {
   32|       |    /* Normal linked lists are initialized by zeroing out */
   33|     20|    memset(channel, 0, sizeof(UA_SecureChannel));
   34|     20|    channel->transport = UA_SECURECHANNEL_TRANSPORT_UACP;
   35|     20|    channel->encoding = UA_SECURECHANNEL_ENCODING_BINARY;
   36|       |    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]
  |  |  ------------------
  ------------------
   37|     20|}
UA_SecureChannel_isConnected:
  153|     20|UA_SecureChannel_isConnected(UA_SecureChannel *channel) {
  154|     20|    return (channel->state > UA_SECURECHANNELSTATE_CLOSED &&
  ------------------
  |  Branch (154:13): [True: 20, False: 0]
  ------------------
  155|     20|            channel->state < UA_SECURECHANNELSTATE_CLOSING);
  ------------------
  |  Branch (155:13): [True: 20, False: 0]
  ------------------
  156|     20|}
UA_SecureChannel_deleteBuffered:
  214|     20|UA_SecureChannel_deleteBuffered(UA_SecureChannel *channel) {
  215|     20|    deleteChunks(channel);
  216|     20|    if(channel->unprocessedCopied)
  ------------------
  |  Branch (216:8): [True: 0, False: 20]
  ------------------
  217|      0|        UA_ByteString_clear(&channel->unprocessed);
  218|     20|}
UA_SecureChannel_clear:
  243|     20|UA_SecureChannel_clear(UA_SecureChannel *channel) {
  244|       |    /* No sessions must be attached to this any longer */
  245|     20|    UA_assert(channel->sessions == NULL);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (245:5): [True: 20, False: 0]
  ------------------
  246|       |
  247|       |    /* Delete the channel context for the security policy */
  248|     20|    UA_SecurityPolicy *sp = channel->securityPolicy;
  249|     20|    if(sp) {
  ------------------
  |  Branch (249:8): [True: 0, False: 20]
  ------------------
  250|      0|        if(channel->channelContext)
  ------------------
  |  Branch (250:12): [True: 0, False: 0]
  ------------------
  251|      0|            sp->deleteChannelContext(sp, channel->channelContext);
  252|      0|        channel->securityPolicy = NULL;
  253|      0|        channel->channelContext = NULL;
  254|      0|        channel->enhancedSecurity = false;     /* No policy => not enhanced */
  255|      0|        channel->legacySequenceNumbers = true; /* No policy => legacy */
  256|      0|    }
  257|       |
  258|       |    /* Remove remaining delayed callback */
  259|     20|    if(channel->connectionManager &&
  ------------------
  |  Branch (259:8): [True: 0, False: 20]
  ------------------
  260|      0|       channel->connectionManager->eventSource.eventLoop) {
  ------------------
  |  Branch (260:8): [True: 0, False: 0]
  ------------------
  261|      0|        UA_EventLoop *el = channel->connectionManager->eventSource.eventLoop;
  262|      0|        el->removeDelayedCallback(el, &channel->unprocessedDelayed);
  263|      0|    }
  264|       |
  265|       |    /* The EventLoop connection is no longer valid */
  266|     20|    channel->connectionId = 0;
  267|     20|    channel->connectionManager = NULL;
  268|       |
  269|       |    /* Clean up the SecurityToken */
  270|     20|    UA_ChannelSecurityToken_clear(&channel->securityToken);
  271|     20|    UA_ChannelSecurityToken_clear(&channel->altSecurityToken);
  272|       |
  273|       |    /* Clean up certificate and nonces */
  274|     20|    UA_ByteString_clear(&channel->remoteCertificate);
  275|     20|    UA_ByteString_clear(&channel->localNonce);
  276|     20|    UA_ByteString_clear(&channel->remoteNonce);
  277|       |
  278|       |    /* Clean up the v1.05.07 SecureChannel elements */
  279|     20|    UA_ByteString_clear(&channel->firstRequestSignature);
  280|     20|    UA_ByteString_clear(&channel->currentIKM);
  281|     20|    UA_ByteString_clear(&channel->channelThumbprint);
  282|       |
  283|       |    /* Clean up endpointUrl and remoteAddress */
  284|     20|    UA_String_clear(&channel->endpointUrl);
  285|     20|    UA_String_clear(&channel->remoteAddress);
  286|       |
  287|       |    /* Delete remaining chunks */
  288|     20|    UA_SecureChannel_deleteBuffered(channel);
  289|       |
  290|       |    /* Clean up namespace mapping */
  291|     20|    UA_NamespaceMapping_delete(channel->namespaceMapping);
  292|     20|    channel->namespaceMapping = NULL;
  293|       |
  294|       |    /* Reset the SecureChannel for reuse (in the client) */
  295|     20|    channel->securityMode = UA_MESSAGESECURITYMODE_INVALID;
  296|     20|    channel->shutdownReason = UA_SHUTDOWNREASON_CLOSE;
  297|     20|    memset(&channel->config, 0, sizeof(UA_ConnectionConfig));
  298|     20|    channel->receiveSequenceNumber = 0;
  299|     20|    channel->sendSequenceNumber = 0;
  300|       |
  301|       |    /* Set the state to closed */
  302|     20|    channel->state = UA_SECURECHANNELSTATE_CLOSED;
  303|     20|    channel->renewState = UA_SECURECHANNELRENEWSTATE_NORMAL;
  304|     20|    channel->transport = UA_SECURECHANNEL_TRANSPORT_UACP;
  305|     20|    channel->encoding = UA_SECURECHANNEL_ENCODING_BINARY;
  306|     20|}
ua_securechannel.c:deleteChunks:
  203|     20|deleteChunks(UA_SecureChannel *channel) {
  204|     20|    UA_Chunk *chunk, *chunk_tmp;
  205|     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))
  ------------------
  206|       |        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]
  |  |  ------------------
  ------------------
  207|      0|        UA_Chunk_delete(chunk);
  208|      0|    }
  209|     20|    channel->chunksCount = 0;
  210|     20|    channel->chunksLength = 0;
  211|     20|}

UA_cleanupDataTypeWithCustom:
  180|     20|UA_cleanupDataTypeWithCustom(UA_DataTypeArray *customTypes) {
  181|     20|    while(customTypes) {
  ------------------
  |  Branch (181:11): [True: 0, False: 20]
  ------------------
  182|      0|        UA_DataTypeArray *next = customTypes->next;
  183|      0|        if(customTypes->cleanup) {
  ------------------
  |  Branch (183:12): [True: 0, False: 0]
  ------------------
  184|      0|            for(size_t i = 0; i < customTypes->typesSize; ++i) {
  ------------------
  |  Branch (184:31): [True: 0, False: 0]
  ------------------
  185|      0|                UA_DataType *type = &customTypes->types[i];
  186|      0|                UA_DataType_clear(type);
  187|      0|            }
  188|      0|            UA_free(customTypes->types);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  189|      0|            UA_free(customTypes);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  190|      0|        }
  191|      0|        customTypes = next;
  192|      0|    }
  193|     20|}
UA_STRING:
  220|    140|UA_STRING(char *chars) {
  221|    140|    UA_String s = {0, NULL};
  222|    140|    if(!chars)
  ------------------
  |  Branch (222:8): [True: 0, False: 140]
  ------------------
  223|      0|        return s;
  224|    140|    s.length = strlen(chars);
  225|    140|    s.data = (UA_Byte*)chars;
  226|    140|    return s;
  227|    140|}
UA_String_fromChars:
  230|     40|UA_String_fromChars(const char *src) {
  231|     40|    UA_String s; s.length = 0; s.data = NULL;
  232|     40|    if(!src)
  ------------------
  |  Branch (232:8): [True: 0, False: 40]
  ------------------
  233|      0|        return s;
  234|     40|    s.length = strlen(src);
  235|     40|    if(s.length > 0) {
  ------------------
  |  Branch (235:8): [True: 40, False: 0]
  ------------------
  236|     40|        s.data = (u8*)UA_malloc(s.length);
  ------------------
  |  |   18|     40|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  237|     40|        if(UA_UNLIKELY(!s.data)) {
  ------------------
  |  |  580|     40|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (580:25): [True: 0, False: 40]
  |  |  ------------------
  ------------------
  238|      0|            s.length = 0;
  239|      0|            return s;
  240|      0|        }
  241|     40|        memcpy(s.data, src, s.length);
  242|     40|    } else {
  243|      0|        s.data = (u8*)UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  756|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
  244|      0|    }
  245|     40|    return s;
  246|     40|}
UA_init:
 1926|     20|void UA_init(void *p, const UA_DataType *type) {
 1927|     20|    memset(p, 0, type->memSize);
 1928|     20|}
UA_copy:
 2097|     80|UA_copy(const void *src, void *dst, const UA_DataType *type) {
 2098|     80|    memset(dst, 0, type->memSize); /* init */
 2099|     80|    UA_StatusCode retval = copyJumpTable[type->typeKind](src, dst, type);
 2100|     80|    if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     80|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2100:8): [True: 0, False: 80]
  ------------------
 2101|      0|        UA_clear(dst, type);
 2102|     80|    return retval;
 2103|     80|}
UA_clear:
 2200|  1.06k|UA_clear(void *p, const UA_DataType *type) {
 2201|  1.06k|    clearJumpTable[type->typeKind](p, type);
 2202|  1.06k|    memset(p, 0, type->memSize); /* init */
 2203|  1.06k|}
UA_Array_copy:
 2698|     60|              void **dst, const UA_DataType *type) {
 2699|     60|    if(size == 0) {
  ------------------
  |  Branch (2699:8): [True: 0, False: 60]
  ------------------
 2700|      0|        if(src == NULL)
  ------------------
  |  Branch (2700:12): [True: 0, False: 0]
  ------------------
 2701|      0|            *dst = NULL;
 2702|      0|        else
 2703|      0|            *dst= UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  756|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
 2704|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2705|      0|    }
 2706|       |
 2707|       |    /* Check the array consistency -- defensive programming in case the user
 2708|       |     * manually created an inconsistent array */
 2709|     60|    if(UA_UNLIKELY(!type || !src))
  ------------------
  |  |  580|    120|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (580:25): [True: 0, False: 60]
  |  |  |  Branch (580:43): [True: 0, False: 60]
  |  |  |  Branch (580:43): [True: 0, False: 60]
  |  |  ------------------
  ------------------
 2710|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 2711|       |
 2712|       |    /* calloc, so we don't have to check retval in every iteration of copying */
 2713|     60|    *dst = UA_calloc(size, type->memSize);
  ------------------
  |  |   20|     60|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 2714|     60|    if(!*dst)
  ------------------
  |  Branch (2714:8): [True: 0, False: 60]
  ------------------
 2715|      0|        return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   32|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2716|       |
 2717|     60|    if(type->pointerFree) {
  ------------------
  |  Branch (2717:8): [True: 60, False: 0]
  ------------------
 2718|     60|        memcpy(*dst, src, type->memSize * size);
 2719|     60|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2720|     60|    }
 2721|       |
 2722|      0|    uintptr_t ptrs = (uintptr_t)src;
 2723|      0|    uintptr_t ptrd = (uintptr_t)*dst;
 2724|      0|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2725|      0|    for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2725:23): [True: 0, False: 0]
  ------------------
 2726|      0|        retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
 2727|      0|        ptrs += type->memSize;
 2728|      0|        ptrd += type->memSize;
 2729|      0|    }
 2730|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   17|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2730:8): [True: 0, False: 0]
  ------------------
 2731|      0|        UA_Array_delete(*dst, size, type);
 2732|       |        *dst = NULL;
 2733|      0|    }
 2734|      0|    return retval;
 2735|     60|}
UA_Array_delete:
 2826|  2.08k|UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
 2827|  2.08k|    if(!type->pointerFree) {
  ------------------
  |  Branch (2827:8): [True: 220, False: 1.86k]
  ------------------
 2828|    220|        uintptr_t ptr = (uintptr_t)p;
 2829|    260|        for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2829:27): [True: 40, False: 220]
  ------------------
 2830|     40|            UA_clear((void*)ptr, type);
 2831|     40|            ptr += type->memSize;
 2832|     40|        }
 2833|    220|    }
 2834|  2.08k|    UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
  ------------------
  |  |   19|  2.08k|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2835|  2.08k|}
UA_NamespaceMapping_clear:
 3030|     20|UA_NamespaceMapping_clear(UA_NamespaceMapping *nm) {
 3031|     20|    if(!nm)
  ------------------
  |  Branch (3031:8): [True: 20, False: 0]
  ------------------
 3032|     20|        return;
 3033|      0|    UA_Array_delete(nm->namespaceUris, nm->namespaceUrisSize, &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|      0|#define UA_TYPES_STRING 11
  ------------------
 3034|      0|    UA_Array_delete(nm->local2remote, nm->local2remoteSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 3035|      0|    UA_Array_delete(nm->remote2local, nm->remote2localSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 3036|      0|    nm->namespaceUris = NULL;
 3037|      0|    nm->local2remote = NULL;
 3038|       |    nm->remote2local = NULL;
 3039|      0|    nm->namespaceUrisSize = 0;
 3040|      0|    nm->local2remoteSize = 0;
 3041|      0|    nm->remote2localSize = 0;
 3042|      0|}
UA_NamespaceMapping_delete:
 3045|     20|UA_NamespaceMapping_delete(UA_NamespaceMapping *nm) {
 3046|     20|    UA_NamespaceMapping_clear(nm);
 3047|     20|    UA_free(nm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 3048|     20|}
ua_types.c:String_copy:
  281|     60|String_copy(const void *src, void *dst, const UA_DataType *_) {
  282|     60|    const UA_String *srcS = (const UA_String*)src;
  283|     60|    UA_String *dstS = (UA_String *)dst;
  284|     60|    UA_StatusCode res =
  285|     60|        UA_Array_copy(srcS->data, srcS->length, (void**)&dstS->data,
  286|     60|                      &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|     60|#define UA_TYPES_BYTE 2
  ------------------
  287|     60|    if(res == UA_STATUSCODE_GOOD)
  ------------------
  |  |   17|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (287:8): [True: 60, False: 0]
  ------------------
  288|     60|        dstS->length = srcS->length;
  289|     60|    return res;
  290|     60|}
ua_types.c:NodeId_copy:
  784|     20|NodeId_copy(const void *src, void *dst, const UA_DataType *_) {
  785|     20|    const UA_NodeId *srcN = (const UA_NodeId*)src;
  786|     20|    UA_NodeId *dstN = (UA_NodeId *)dst;
  787|     20|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  788|     20|    switch(srcN->identifierType) {
  789|     20|    case UA_NODEIDTYPE_NUMERIC:
  ------------------
  |  Branch (789:5): [True: 20, False: 0]
  ------------------
  790|     20|        *dstN = *srcN;
  791|     20|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   17|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  792|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (792:5): [True: 0, False: 20]
  ------------------
  793|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (793:5): [True: 0, False: 20]
  ------------------
  794|      0|        retval |= String_copy(&srcN->identifier.string,
  795|      0|                              &dstN->identifier.string, NULL);
  796|      0|        break;
  797|      0|    case UA_NODEIDTYPE_GUID:
  ------------------
  |  Branch (797:5): [True: 0, False: 20]
  ------------------
  798|      0|        dstN->identifier.guid = srcN->identifier.guid;
  799|      0|        break;
  800|      0|    default:
  ------------------
  |  Branch (800:5): [True: 0, False: 20]
  ------------------
  801|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   29|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  802|     20|    }
  803|      0|    dstN->namespaceIndex = srcN->namespaceIndex;
  804|      0|    dstN->identifierType = srcN->identifierType;
  805|      0|    return retval;
  806|     20|}
ua_types.c:nopClear:
 2162|    600|static void nopClear(void *p, const UA_DataType *type) { }
ua_types.c:String_clear:
  293|  1.86k|String_clear(void *p, const UA_DataType *_) {
  294|  1.86k|    UA_String *s = (UA_String*)p;
  295|  1.86k|    UA_Array_delete(s->data, s->length, &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|  1.86k|#define UA_TYPES_BYTE 2
  ------------------
  296|  1.86k|}
ua_types.c:NodeId_clear:
  772|    160|NodeId_clear(void *p, const UA_DataType *_) {
  773|    160|    UA_NodeId *id = (UA_NodeId*)p;
  774|    160|    switch(id->identifierType) {
  775|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (775:5): [True: 0, False: 160]
  ------------------
  776|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (776:5): [True: 0, False: 160]
  ------------------
  777|      0|        String_clear(&id->identifier.string, NULL);
  778|      0|        break;
  779|    160|    default: break;
  ------------------
  |  Branch (779:5): [True: 160, False: 0]
  ------------------
  780|    160|    }
  781|    160|}
ua_types.c:LocalizedText_clear:
 1834|    100|LocalizedText_clear(void *p, const UA_DataType *_) {
 1835|    100|    UA_LocalizedText *lt = (UA_LocalizedText *)p;
 1836|    100|    String_clear(&lt->locale, NULL);
 1837|       |    String_clear(&lt->text, NULL);
 1838|    100|}
ua_types.c:ExtensionObject_clear:
 1246|     60|ExtensionObject_clear(void *p, const UA_DataType *_) {
 1247|     60|    UA_ExtensionObject *eo = (UA_ExtensionObject *)p;
 1248|     60|    switch(eo->encoding) {
 1249|     60|    case UA_EXTENSIONOBJECT_ENCODED_NOBODY:
  ------------------
  |  Branch (1249:5): [True: 60, False: 0]
  ------------------
 1250|     60|    case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING:
  ------------------
  |  Branch (1250:5): [True: 0, False: 60]
  ------------------
 1251|     60|    case UA_EXTENSIONOBJECT_ENCODED_XML:
  ------------------
  |  Branch (1251:5): [True: 0, False: 60]
  ------------------
 1252|     60|    case UA_EXTENSIONOBJECT_ENCODED_JSON:
  ------------------
  |  Branch (1252:5): [True: 0, False: 60]
  ------------------
 1253|     60|        NodeId_clear(&eo->content.encoded.typeId, NULL);
 1254|     60|        String_clear(&eo->content.encoded.body, NULL);
 1255|     60|        break;
 1256|      0|    case UA_EXTENSIONOBJECT_DECODED:
  ------------------
  |  Branch (1256:5): [True: 0, False: 60]
  ------------------
 1257|      0|        if(eo->content.decoded.data)
  ------------------
  |  Branch (1257:12): [True: 0, False: 0]
  ------------------
 1258|      0|            UA_delete(eo->content.decoded.data, eo->content.decoded.type);
 1259|      0|        break;
 1260|      0|    default:
  ------------------
  |  Branch (1260:5): [True: 0, False: 60]
  ------------------
 1261|      0|        break;
 1262|     60|    }
 1263|     60|}
ua_types.c:DiagnosticInfo_clear:
 1881|     20|DiagnosticInfo_clear(void *p, const UA_DataType *_) {
 1882|     20|    UA_DiagnosticInfo *di = (UA_DiagnosticInfo *)p;
 1883|       |
 1884|     20|    String_clear(&di->additionalInfo, NULL);
 1885|     20|    if(di->hasInnerDiagnosticInfo && di->innerDiagnosticInfo) {
  ------------------
  |  Branch (1885:8): [True: 0, False: 20]
  |  Branch (1885:38): [True: 0, False: 0]
  ------------------
 1886|      0|        DiagnosticInfo_clear(di->innerDiagnosticInfo, NULL);
 1887|      0|        UA_free(di->innerDiagnosticInfo);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1888|      0|    }
 1889|     20|}
ua_types.c:clearStructure:
 2106|    320|clearStructure(void *p, const UA_DataType *type) {
 2107|    320|    uintptr_t ptr = (uintptr_t)p;
 2108|  2.24k|    for(size_t i = 0; i < type->membersSize; ++i) {
  ------------------
  |  Branch (2108:23): [True: 1.92k, False: 320]
  ------------------
 2109|  1.92k|        const UA_DataTypeMember *m = &type->members[i];
 2110|  1.92k|        const UA_DataType *mt = m->memberType;
 2111|  1.92k|        ptr += m->padding;
 2112|  1.92k|        if(!m->isOptional) {
  ------------------
  |  Branch (2112:12): [True: 1.92k, False: 0]
  ------------------
 2113|  1.92k|            if(!m->isArray) {
  ------------------
  |  Branch (2113:16): [True: 1.72k, False: 200]
  ------------------
 2114|  1.72k|                clearJumpTable[mt->typeKind]((void*)ptr, mt);
 2115|  1.72k|                ptr += mt->memSize;
 2116|  1.72k|            } else {
 2117|    200|                size_t length = *(size_t*)ptr;
 2118|    200|                ptr += sizeof(size_t);
 2119|    200|                UA_Array_delete(*(void**)ptr, length, mt);
 2120|    200|                ptr += sizeof(void*);
 2121|    200|            }
 2122|  1.92k|        } else { /* field is optional */
 2123|      0|            if(!m->isArray) {
  ------------------
  |  Branch (2123:16): [True: 0, False: 0]
  ------------------
 2124|       |                /* optional scalar field is contained */
 2125|      0|                if((*(void *const *)ptr != NULL))
  ------------------
  |  Branch (2125:20): [True: 0, False: 0]
  ------------------
 2126|      0|                    UA_Array_delete(*(void **)ptr, 1, mt);
 2127|      0|                ptr += sizeof(void *);
 2128|      0|            } else {
 2129|       |                /* optional array field is contained */
 2130|      0|                if((*(void *const *)(ptr + sizeof(size_t)) != NULL)) {
  ------------------
  |  Branch (2130:20): [True: 0, False: 0]
  ------------------
 2131|      0|                    size_t length = *(size_t *)ptr;
 2132|      0|                    ptr += sizeof(size_t);
 2133|      0|                    UA_Array_delete(*(void **)ptr, length, mt);
 2134|      0|                    ptr += sizeof(void *);
 2135|      0|                } else { /* optional array field not contained */
 2136|      0|                    ptr += sizeof(size_t);
 2137|      0|                    ptr += sizeof(void *);
 2138|      0|                }
 2139|      0|            }
 2140|      0|        }
 2141|  1.92k|    }
 2142|    320|}

UA_KeyValueMap_clear:
  550|     60|UA_KeyValueMap_clear(UA_KeyValueMap *map) {
  551|     60|    if(!map)
  ------------------
  |  Branch (551:8): [True: 0, False: 60]
  ------------------
  552|      0|        return;
  553|     60|    if(map->mapSize > 0) {
  ------------------
  |  Branch (553:8): [True: 0, False: 60]
  ------------------
  554|      0|        UA_Array_delete(map->map, map->mapSize, &UA_TYPES[UA_TYPES_KEYVALUEPAIR]);
  ------------------
  |  | 1247|      0|#define UA_TYPES_KEYVALUEPAIR 35
  ------------------
  555|      0|    }
  556|       |    map->map = NULL;
  557|     60|    map->mapSize = 0;
  558|     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:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ByteString_clear:
  244|    120|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ChannelSecurityToken_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_String_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_INIT:
  491|     20|UA_LOCK_INIT(UA_Lock *lock) {
  492|     20|    pthread_mutexattr_t mattr;
  493|     20|    pthread_mutexattr_init(&mattr);
  494|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  495|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  496|     20|    pthread_mutexattr_destroy(&mattr);
  497|     20|    lock->count = 0;
  498|     20|}
ua_client.c:UA_ApplicationDescription_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_String_clear:
  244|    140|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ExtensionObject_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_EndpointDescription_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_UserTokenPolicy_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ByteString_clear:
  244|    100|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_DESTROY:
  501|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  502|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (502:5): [True: 20, False: 0]
  ------------------
  503|     20|    pthread_mutex_destroy(&lock->mutex);
  504|     20|}
ua_client.c:UA_LOCK_ASSERT:
  519|     40|UA_LOCK_ASSERT(UA_Lock *lock) {
  520|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  400|     40|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (520:5): [True: 40, False: 0]
  ------------------
  521|     40|}
ua_client.c:UA_LOCK:
  507|     60|UA_LOCK(UA_Lock *lock) {
  508|     60|    pthread_mutex_lock(&lock->mutex);
  509|     60|    lock->count++;
  510|     60|}
ua_client.c:UA_UNLOCK:
  513|     60|UA_UNLOCK(UA_Lock *lock) {
  514|     60|    lock->count--;
  515|     60|    pthread_mutex_unlock(&lock->mutex);
  516|     60|}
ua_client_connect.c:UA_String_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_ByteString_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_EndpointDescription_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_NodeId_clear:
  244|     80|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionResponse_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_init:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_certificategroup_none.c:UA_NodeId_copy:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securitypolicy_none.c:UA_ByteString_clear:
  244|     80|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
timer.c:UA_LOCK_INIT:
  491|     20|UA_LOCK_INIT(UA_Lock *lock) {
  492|     20|    pthread_mutexattr_t mattr;
  493|     20|    pthread_mutexattr_init(&mattr);
  494|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  495|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  496|     20|    pthread_mutexattr_destroy(&mattr);
  497|     20|    lock->count = 0;
  498|     20|}
timer.c:UA_LOCK:
  507|     40|UA_LOCK(UA_Lock *lock) {
  508|     40|    pthread_mutex_lock(&lock->mutex);
  509|     40|    lock->count++;
  510|     40|}
timer.c:UA_UNLOCK:
  513|     40|UA_UNLOCK(UA_Lock *lock) {
  514|     40|    lock->count--;
  515|     40|    pthread_mutex_unlock(&lock->mutex);
  516|     40|}
timer.c:UA_LOCK_DESTROY:
  501|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  502|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (502:5): [True: 20, False: 0]
  ------------------
  503|     20|    pthread_mutex_destroy(&lock->mutex);
  504|     20|}
eventloop_posix.c:UA_LOCK:
  507|    200|UA_LOCK(UA_Lock *lock) {
  508|    200|    pthread_mutex_lock(&lock->mutex);
  509|    200|    lock->count++;
  510|    200|}
eventloop_posix.c:UA_UNLOCK:
  513|    200|UA_UNLOCK(UA_Lock *lock) {
  514|    200|    lock->count--;
  515|    200|    pthread_mutex_unlock(&lock->mutex);
  516|    200|}
eventloop_posix.c:UA_LOCK_ASSERT:
  519|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  520|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (520:5): [True: 20, False: 0]
  ------------------
  521|     20|}
eventloop_posix.c:UA_LOCK_INIT:
  491|     20|UA_LOCK_INIT(UA_Lock *lock) {
  492|     20|    pthread_mutexattr_t mattr;
  493|     20|    pthread_mutexattr_init(&mattr);
  494|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  495|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  496|     20|    pthread_mutexattr_destroy(&mattr);
  497|     20|    lock->count = 0;
  498|     20|}
eventloop_posix.c:UA_LOCK_DESTROY:
  501|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  502|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (502:5): [True: 20, False: 0]
  ------------------
  503|     20|    pthread_mutex_destroy(&lock->mutex);
  504|     20|}
eventloop_posix_tcp.c:UA_String_copy:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_String_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_ByteString_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_copy:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_ByteString_clear:
  244|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_String_copy:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_LOCK_ASSERT:
  519|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  520|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  400|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (520:5): [True: 20, False: 0]
  ------------------
  521|     20|}
eventloop_posix_interrupt.c:UA_String_clear:
  244|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl

