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

UA_EventLoop_new_POSIX:
  552|     20|UA_EventLoop_new_POSIX(const UA_Logger *logger) {
  553|       |#ifdef UA_ARCHITECTURE_WIN32
  554|       |    /* Start the WSA networking subsystem on Windows */
  555|       |    WSADATA wsaData;
  556|       |    int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
  557|       |    if(iResult != 0) {
  558|       |        UA_LOG_ERROR(logger, UA_LOGCATEGORY_EVENTLOOP,
  559|       |                     "Initializing the WSA subsystem failed: %d", iResult);
  560|       |        return NULL;
  561|       |    }
  562|       |#endif
  563|       |
  564|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)
  565|     20|        UA_calloc(1, sizeof(UA_EventLoopPOSIX));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  566|     20|    if(!el)
  ------------------
  |  Branch (566:8): [True: 0, False: 20]
  ------------------
  567|      0|        return NULL;
  568|       |
  569|     20|    UA_LOCK_INIT(&el->elMutex);
  570|     20|    UA_Timer_init(&el->timer);
  571|       |
  572|       |    /* Initialize the queue */
  573|     20|    el->delayedTail = &el->delayedHead1;
  574|     20|    el->delayedHead2 = (UA_DelayedCallback*)0x01; /* sentinel value */
  575|       |
  576|       |    /* Set the public EventLoop content */
  577|     20|    el->eventLoop.logger = logger;
  578|       |
  579|       |    /* Initialize the clock source to the default */
  580|     20|#if defined(UA_ARCHITECTURE_POSIX)
  581|     20|    el->clockSource = CLOCK_REALTIME;
  582|     20|# ifdef CLOCK_MONOTONIC_RAW
  583|     20|    el->clockSourceMonotonic = CLOCK_MONOTONIC_RAW;
  584|       |# else
  585|       |    el->clockSourceMonotonic = CLOCK_MONOTONIC;
  586|       |# endif
  587|     20|#endif
  588|       |
  589|       |    /* Set the method pointers for the interface */
  590|     20|    el->eventLoop.start = (UA_StatusCode (*)(UA_EventLoop*))UA_EventLoopPOSIX_start;
  591|     20|    el->eventLoop.stop = (void (*)(UA_EventLoop*))UA_EventLoopPOSIX_stop;
  592|     20|    el->eventLoop.free = (UA_StatusCode (*)(UA_EventLoop*))UA_EventLoopPOSIX_free;
  593|     20|    el->eventLoop.run = (UA_StatusCode (*)(UA_EventLoop*, UA_UInt32))UA_EventLoopPOSIX_run;
  594|     20|    el->eventLoop.cancel = (void (*)(UA_EventLoop*))UA_EventLoopPOSIX_cancel;
  595|       |
  596|     20|    el->eventLoop.dateTime_now = UA_EventLoopPOSIX_DateTime_now;
  597|     20|    el->eventLoop.dateTime_nowMonotonic =
  598|     20|        UA_EventLoopPOSIX_DateTime_nowMonotonic;
  599|     20|    el->eventLoop.dateTime_localTimeUtcOffset =
  600|     20|        UA_EventLoopPOSIX_DateTime_localTimeUtcOffset;
  601|       |
  602|     20|    el->eventLoop.nextTimer = UA_EventLoopPOSIX_nextTimer;
  603|     20|    el->eventLoop.addTimer = UA_EventLoopPOSIX_addTimer;
  604|     20|    el->eventLoop.modifyTimer = UA_EventLoopPOSIX_modifyTimer;
  605|     20|    el->eventLoop.removeTimer = UA_EventLoopPOSIX_removeTimer;
  606|     20|    el->eventLoop.addDelayedCallback = UA_EventLoopPOSIX_addDelayedCallback;
  607|     20|    el->eventLoop.removeDelayedCallback = UA_EventLoopPOSIX_removeDelayedCallback;
  608|       |
  609|     20|    el->eventLoop.registerEventSource =
  610|     20|        (UA_StatusCode (*)(UA_EventLoop*, UA_EventSource*))
  611|     20|        UA_EventLoopPOSIX_registerEventSource;
  612|     20|    el->eventLoop.deregisterEventSource =
  613|     20|        (UA_StatusCode (*)(UA_EventLoop*, UA_EventSource*))
  614|     20|        UA_EventLoopPOSIX_deregisterEventSource;
  615|       |
  616|     20|    el->eventLoop.lock = UA_EventLoopPOSIX_lock;
  617|     20|    el->eventLoop.unlock = UA_EventLoopPOSIX_unlock;
  618|       |
  619|     20|    return &el->eventLoop;
  620|     20|}
eventloop_posix.c:UA_EventLoopPOSIX_free:
  503|     20|UA_EventLoopPOSIX_free(UA_EventLoopPOSIX *el) {
  504|     20|    UA_LOCK(&el->elMutex);
  505|       |
  506|       |    /* Check if the EventLoop can be deleted */
  507|     20|    if(el->eventLoop.state != UA_EVENTLOOPSTATE_STOPPED &&
  ------------------
  |  Branch (507:8): [True: 20, False: 0]
  ------------------
  508|     20|       el->eventLoop.state != UA_EVENTLOOPSTATE_FRESH) {
  ------------------
  |  Branch (508:8): [True: 0, False: 20]
  ------------------
  509|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  510|      0|                       "Cannot delete a running EventLoop");
  511|      0|        UA_UNLOCK(&el->elMutex);
  512|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  513|      0|    }
  514|       |
  515|       |    /* Deregister and delete all the EventSources */
  516|     80|    while(el->eventLoop.eventSources) {
  ------------------
  |  Branch (516:11): [True: 60, False: 20]
  ------------------
  517|     60|        UA_EventSource *es = el->eventLoop.eventSources;
  518|     60|        UA_EventLoopPOSIX_deregisterEventSource(el, es);
  519|     60|        es->free(es);
  520|     60|    }
  521|       |
  522|       |    /* Remove the repeated timed callbacks */
  523|     20|    UA_Timer_clear(&el->timer);
  524|       |
  525|       |    /* Process remaining delayed callbacks */
  526|     20|    processDelayed(el);
  527|       |
  528|       |#ifdef UA_ARCHITECTURE_WIN32
  529|       |    /* Stop the Windows networking subsystem */
  530|       |    WSACleanup();
  531|       |#endif
  532|       |
  533|     20|    UA_KeyValueMap_clear(&el->eventLoop.params);
  534|       |
  535|       |    /* Clean up */
  536|     20|    UA_UNLOCK(&el->elMutex);
  537|     20|    UA_LOCK_DESTROY(&el->elMutex);
  538|     20|    UA_free(el);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  539|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  540|     20|}
eventloop_posix.c:processDelayed:
  130|     20|processDelayed(UA_EventLoopPOSIX *el) {
  131|     20|    UA_LOG_TRACE(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  132|     20|                 "Process delayed callbacks");
  133|       |
  134|     20|    UA_LOCK_ASSERT(&el->elMutex);
  135|       |
  136|       |    /* Reset and get the old head and tail */
  137|     20|    UA_DelayedCallback *dc = NULL, *tail = NULL;
  138|     20|    resetDelayedQueue(el, &dc, &tail);
  139|       |
  140|       |    /* Loop until we reach the tail (or head and tail are both NULL) */
  141|     20|    UA_DelayedCallback *next;
  142|     20|    for(; dc; dc = next) {
  ------------------
  |  Branch (142:11): [True: 0, False: 20]
  ------------------
  143|      0|        next = dc->next;
  144|      0|        while(!next && dc != tail)
  ------------------
  |  Branch (144:15): [True: 0, False: 0]
  |  Branch (144:24): [True: 0, False: 0]
  ------------------
  145|      0|            next = (UA_DelayedCallback *)UA_atomic_load((void**)&dc->next);
  146|      0|        if(!dc->callback)
  ------------------
  |  Branch (146:12): [True: 0, False: 0]
  ------------------
  147|      0|            continue;
  148|      0|        dc->callback(dc->application, dc->context);
  149|      0|    }
  150|     20|}
eventloop_posix.c:resetDelayedQueue:
   79|     20|                  UA_DelayedCallback **oldTail) {
   80|     20|    if(el->delayedHead1 <= (UA_DelayedCallback *)0x01 &&
  ------------------
  |  Branch (80:8): [True: 20, False: 0]
  ------------------
   81|     20|       el->delayedHead2 <= (UA_DelayedCallback *)0x01)
  ------------------
  |  Branch (81:8): [True: 20, False: 0]
  ------------------
   82|     20|        return; /* The queue is empty */
   83|       |
   84|      0|    UA_Boolean active1 = (el->delayedHead1 != (UA_DelayedCallback*)0x01);
   85|      0|    UA_DelayedCallback **activeHead = (active1) ? &el->delayedHead1 : &el->delayedHead2;
  ------------------
  |  Branch (85:39): [True: 0, False: 0]
  ------------------
   86|      0|    UA_DelayedCallback **inactiveHead = (active1) ? &el->delayedHead2 : &el->delayedHead1;
  ------------------
  |  Branch (86:41): [True: 0, False: 0]
  ------------------
   87|       |
   88|       |    /* Switch active/inactive by resetting the sentinel values. The (old) active
   89|       |     * head points to an element which we return. Parallel threads continue to
   90|       |     * add elements to the queue "below" the first element. */
   91|      0|    UA_atomic_xchg((void**)inactiveHead, NULL);
   92|      0|    *oldHead = (UA_DelayedCallback *)
   93|      0|        UA_atomic_xchg((void**)activeHead, (void*)0x01);
   94|       |
   95|       |    /* Make the tail point to the (new) active head. Return the value of last
   96|       |     * tail. When iterating over the queue elements, we need to find this tail
   97|       |     * as the last element. If we find a NULL next-pointer before hitting the
   98|       |     * tail spinlock until the pointer updates (eventually consistent). */
   99|      0|    *oldTail = (UA_DelayedCallback*)
  100|      0|        UA_atomic_xchg((void**)&el->delayedTail, inactiveHead);
  101|      0|}
eventloop_posix.c:UA_EventLoopPOSIX_removeTimer:
   52|     20|                              UA_UInt64 callbackId) {
   53|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
   54|     20|    UA_Timer_remove(&el->timer, callbackId);
   55|     20|}
eventloop_posix.c:UA_EventLoopPOSIX_registerEventSource:
  398|     60|                                      UA_EventSource *es) {
  399|     60|    UA_LOCK(&el->elMutex);
  400|       |
  401|       |    /* Already registered? */
  402|     60|    if(es->state != UA_EVENTSOURCESTATE_FRESH) {
  ------------------
  |  Branch (402:8): [True: 0, False: 60]
  ------------------
  403|      0|        UA_LOG_ERROR(el->eventLoop.logger, UA_LOGCATEGORY_NETWORK,
  404|      0|                     "Cannot register the EventSource \"%.*s\": "
  405|      0|                     "already registered",
  406|      0|                     (int)es->name.length, (char*)es->name.data);
  407|      0|        UA_UNLOCK(&el->elMutex);
  408|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  409|      0|    }
  410|       |
  411|       |    /* Add to linked list */
  412|     60|    es->next = el->eventLoop.eventSources;
  413|     60|    el->eventLoop.eventSources = es;
  414|       |
  415|     60|    es->eventLoop = &el->eventLoop;
  416|     60|    es->state = UA_EVENTSOURCESTATE_STOPPED;
  417|       |
  418|       |    /* Start if the entire EventLoop is started */
  419|     60|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  420|     60|    if(el->eventLoop.state == UA_EVENTLOOPSTATE_STARTED)
  ------------------
  |  Branch (420:8): [True: 0, False: 60]
  ------------------
  421|      0|        res = es->start(es);
  422|       |
  423|     60|    UA_UNLOCK(&el->elMutex);
  424|     60|    return res;
  425|     60|}
eventloop_posix.c:UA_EventLoopPOSIX_deregisterEventSource:
  429|     60|                                        UA_EventSource *es) {
  430|     60|    UA_LOCK(&el->elMutex);
  431|       |
  432|     60|    if(es->state != UA_EVENTSOURCESTATE_STOPPED) {
  ------------------
  |  Branch (432:8): [True: 0, False: 60]
  ------------------
  433|      0|        UA_LOG_WARNING(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  434|      0|                       "Cannot deregister the EventSource %.*s: "
  435|      0|                       "Has to be stopped first",
  436|      0|                       (int)es->name.length, es->name.data);
  437|      0|        UA_UNLOCK(&el->elMutex);
  438|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  439|      0|    }
  440|       |
  441|       |    /* Remove from the linked list */
  442|     60|    UA_EventSource **s = &el->eventLoop.eventSources;
  443|     60|    while(*s) {
  ------------------
  |  Branch (443:11): [True: 60, False: 0]
  ------------------
  444|     60|        if(*s == es) {
  ------------------
  |  Branch (444:12): [True: 60, False: 0]
  ------------------
  445|     60|            *s = es->next;
  446|     60|            break;
  447|     60|        }
  448|      0|        s = &(*s)->next;
  449|      0|    }
  450|       |
  451|       |    /* Set the state to non-registered */
  452|     60|    es->state = UA_EVENTSOURCESTATE_FRESH;
  453|       |
  454|     60|    UA_UNLOCK(&el->elMutex);
  455|     60|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  456|     60|}
eventloop_posix.c:UA_EventLoopPOSIX_lock:
  543|     60|UA_EventLoopPOSIX_lock(UA_EventLoop *public_el) {
  544|     60|    UA_LOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  545|     60|}
eventloop_posix.c:UA_EventLoopPOSIX_unlock:
  547|     60|UA_EventLoopPOSIX_unlock(UA_EventLoop *public_el) {
  548|     60|    UA_UNLOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  549|     60|}

UA_InterruptManager_new_POSIX:
  633|     20|UA_InterruptManager_new_POSIX(const UA_String eventSourceName) {
  634|       |#ifndef UA_HAVE_EPOLL
  635|       |    /* There can be only one InterruptManager if epoll is not present */
  636|       |    if(singletonIM)
  637|       |        return NULL;
  638|       |#endif
  639|       |
  640|     20|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)
  641|     20|        UA_calloc(1, sizeof(UA_POSIXInterruptManager));
  ------------------
  |  |   20|     20|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  642|     20|    if(!pim)
  ------------------
  |  Branch (642:8): [True: 0, False: 20]
  ------------------
  643|      0|        return NULL;
  644|       |
  645|       |#ifndef UA_HAVE_EPOLL
  646|       |    singletonIM = pim; /* Register the singleton singleton pointer */
  647|       |#endif
  648|       |
  649|       |#if !defined(UA_HAVE_EPOLL) && !defined(UA_ARCHITECTURE_WIN32)
  650|       |    pim->rfd.fd = UA_INVALID_FD;
  651|       |    pim->rfd.es = &pim->im.eventSource;
  652|       |    pim->rfd.eventSourceCB = handlePOSIXInterruptEvent;
  653|       |    pim->rfd.listenEvents = UA_FDEVENT_IN;
  654|       |    pim->writefd = UA_INVALID_FD;
  655|       |#endif
  656|       |
  657|     20|    UA_InterruptManager *im = &pim->im;
  658|     20|    im->eventSource.eventSourceType = UA_EVENTSOURCETYPE_INTERRUPTMANAGER;
  659|     20|    UA_String_copy(&eventSourceName, &im->eventSource.name);
  660|     20|    im->eventSource.start = startPOSIXInterruptManager;
  661|     20|    im->eventSource.stop = stopPOSIXInterruptManager;
  662|     20|    im->eventSource.free = freePOSIXInterruptmanager;
  663|     20|    im->registerInterrupt = registerPOSIXInterrupt;
  664|     20|    im->deregisterInterrupt = deregisterPOSIXInterrupt;
  665|     20|    return im;
  666|     20|}
eventloop_posix_interrupt.c:freePOSIXInterruptmanager:
  601|     20|freePOSIXInterruptmanager(UA_EventSource *es) {
  602|     20|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)es->eventLoop;
  603|     20|    (void)el;
  604|     20|    UA_LOCK_ASSERT(&el->elMutex);
  605|       |
  606|     20|    if(es->state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (606:8): [True: 0, False: 20]
  ------------------
  607|      0|        UA_LOG_ERROR(es->eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
  608|      0|                     "Interrupt\t| The EventSource must be stopped "
  609|      0|                     "before it can be deleted");
  610|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  611|      0|    }
  612|       |
  613|       |    /* Deactivate and remove all registered signals */
  614|     20|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)es;
  615|     20|    UA_RegisteredSignal *rs, *rs_tmp;
  616|     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))
  ------------------
  617|      0|        deactivateSignal(rs);
  618|      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]
  |  |  ------------------
  ------------------
  619|      0|        UA_free(rs);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  620|      0|    }
  621|       |
  622|     20|    UA_String_clear(&es->name);
  623|     20|    UA_free(es);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  624|       |
  625|       |#ifndef UA_HAVE_EPOLL
  626|       |    singletonIM = NULL; /* Reset the global singleton pointer */
  627|       |#endif
  628|       |
  629|     20|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  630|     20|}

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

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

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

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

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

UA_mbedTLS_LoadLocalCertificate:
  666|     20|                                UA_ByteString *target) {
  667|     20|    UA_ByteString data = UA_mbedTLS_CopyDataFormatAware(certData);
  668|     20|    if(!data.data) {
  ------------------
  |  Branch (668:8): [True: 20, False: 0]
  ------------------
  669|     20|        UA_ByteString_init(target);
  670|     20|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|     20|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  671|     20|    }
  672|      0|    mbedtls_x509_crt cert;
  673|      0|    mbedtls_x509_crt_init(&cert);
  674|       |
  675|      0|    int mbedErr = mbedtls_x509_crt_parse(&cert, data.data, data.length);
  676|       |
  677|      0|    UA_StatusCode result = UA_STATUSCODE_BADINVALIDARGUMENT;
  ------------------
  |  |  730|      0|#define UA_STATUSCODE_BADINVALIDARGUMENT ((UA_StatusCode) 0x80AB0000)
  ------------------
  678|       |
  679|      0|    if (!mbedErr) {
  ------------------
  |  Branch (679:9): [True: 0, False: 0]
  ------------------
  680|      0|        UA_ByteString tmp;
  681|      0|        tmp.data = cert.raw.p;
  682|      0|        tmp.length = cert.raw.len;
  683|       |
  684|      0|        result = UA_ByteString_copy(&tmp, target);
  685|      0|    } else {
  686|      0|        UA_ByteString_init(target);
  687|      0|    }
  688|       |
  689|      0|    UA_ByteString_clear(&data);
  690|      0|    mbedtls_x509_crt_free(&cert);
  691|      0|    return result;
  692|     20|}
UA_mbedTLS_CopyDataFormatAware:
  697|     20|UA_mbedTLS_CopyDataFormatAware(const UA_ByteString *data) {
  698|     20|    UA_ByteString result;
  699|     20|    UA_ByteString_init(&result);
  700|       |
  701|     20|    if (!data->length)
  ------------------
  |  Branch (701:9): [True: 20, False: 0]
  ------------------
  702|     20|        return result;
  703|       |
  704|      0|    if (data->length && data->data[0] == '-') {
  ------------------
  |  Branch (704:9): [True: 0, False: 0]
  |  Branch (704:25): [True: 0, False: 0]
  ------------------
  705|      0|        UA_StatusCode res = UA_ByteString_allocBuffer(&result, data->length + 1);
  706|      0|        if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (706:12): [True: 0, False: 0]
  ------------------
  707|      0|            return result;
  708|      0|        memcpy(result.data, data->data, data->length);
  709|      0|        result.data[data->length] = '\0';
  710|      0|    } else {
  711|      0|        UA_ByteString_copy(data, &result);
  712|      0|    }
  713|       |
  714|      0|    return result;
  715|      0|}

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

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

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

UA_Log_Stdout_withLevel:
  109|     20|UA_Log_Stdout_withLevel(UA_LogLevel minlevel) {
  110|     20|    UA_Logger logger =
  111|       |        {UA_Log_Stdout_log, (void*)(uintptr_t)minlevel, NULL};
  112|     20|    return logger;
  113|     20|}
UA_Log_Stdout_new:
  116|     20|UA_Log_Stdout_new(UA_LogLevel minlevel) {
  117|     20|    UA_Logger *logger = (UA_Logger*)UA_malloc(sizeof(UA_Logger));
  ------------------
  |  |   18|     20|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  118|     20|    if(!logger)
  ------------------
  |  Branch (118:8): [True: 0, False: 20]
  ------------------
  119|      0|        return NULL;
  120|     20|    *logger = UA_Log_Stdout_withLevel(minlevel);
  121|     20|    logger->clear = UA_Log_Stdout_clear;
  122|     20|    return logger;
  123|     20|}
ua_log_stdout.c:UA_Log_Stdout_clear:
  101|     20|UA_Log_Stdout_clear(UA_Logger *logger) {
  102|     20|    UA_free(logger);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  103|     20|}

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

closeSecureChannel:
 2650|     40|closeSecureChannel(UA_Client *client) {
 2651|       |    /* If we close SecureChannel when the Session is still active, set to
 2652|       |     * created. Otherwise the Session would remain active until the connection
 2653|       |     * callback is called for the closing connection. */
 2654|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (2654:8): [True: 0, False: 40]
  ------------------
 2655|      0|        client->sessionState = UA_SESSIONSTATE_CREATED;
 2656|       |
 2657|       |    /* Prevent recursion */
 2658|     40|    if(client->channel.state == UA_SECURECHANNELSTATE_CLOSING ||
  ------------------
  |  Branch (2658:8): [True: 40, False: 0]
  ------------------
 2659|      0|       client->channel.state == UA_SECURECHANNELSTATE_CLOSED)
  ------------------
  |  Branch (2659:8): [True: 0, False: 0]
  ------------------
 2660|     40|        return;
 2661|       |
 2662|      0|    UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  387|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2663|      0|                         "Closing the channel");
 2664|       |
 2665|      0|    disconnectListenSockets(client);
 2666|       |
 2667|       |    /* Send CLO if the SecureChannel is open */
 2668|      0|    if(client->channel.state == UA_SECURECHANNELSTATE_OPEN) {
  ------------------
  |  Branch (2668:8): [True: 0, False: 0]
  ------------------
 2669|      0|        UA_LOG_DEBUG_CHANNEL(client->config.logging, &client->channel,
  ------------------
  |  |  387|      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]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2670|      0|                             "Sending the CLO message");
 2671|       |
 2672|      0|        UA_EventLoop *el = client->config.eventLoop;
 2673|       |
 2674|       |        /* Manually set up the header (otherwise done in sendRequest) */
 2675|      0|        UA_CloseSecureChannelRequest request;
 2676|      0|        UA_CloseSecureChannelRequest_init(&request);
 2677|      0|        request.requestHeader.requestHandle = ++client->requestHandle;
 2678|      0|        request.requestHeader.timestamp = el->dateTime_now(el);
 2679|      0|        request.requestHeader.timeoutHint = client->config.timeout;
 2680|      0|        request.requestHeader.authenticationToken = client->authenticationToken;
 2681|      0|        UA_SecureChannel_sendCLO(&client->channel, ++client->requestId, &request);
 2682|      0|    }
 2683|       |
 2684|       |    /* The connection is eventually closed in the next callback from the
 2685|       |     * ConnectionManager with the appropriate status code. Don't set the
 2686|       |     * connection closed right away! */
 2687|      0|    UA_SecureChannel_shutdown(&client->channel, UA_SHUTDOWNREASON_CLOSE);
 2688|      0|}
cleanupSession:
 2707|     40|cleanupSession(UA_Client *client) {
 2708|     40|    UA_NodeId_clear(&client->sessionId);
 2709|     40|    UA_NodeId_clear(&client->authenticationToken);
 2710|     40|    client->requestHandle = 0;
 2711|       |
 2712|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2713|       |    /* We need to clean up the subscriptions */
 2714|     40|    __Client_Subscriptions_clear(client);
 2715|     40|#endif
 2716|       |
 2717|       |    /* Delete outstanding async services */
 2718|     40|    __Client_AsyncService_removeAll(client, UA_STATUSCODE_BADSESSIONCLOSED);
  ------------------
  |  |  151|     40|#define UA_STATUSCODE_BADSESSIONCLOSED ((UA_StatusCode) 0x80260000)
  ------------------
 2719|       |
 2720|     40|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2721|     40|    client->currentlyOutStandingPublishRequests = 0;
 2722|     40|#endif
 2723|       |
 2724|     40|    client->sessionState = UA_SESSIONSTATE_CLOSED;
 2725|       |
 2726|       |    /* Clean the latest server's ephemeral public key */
 2727|     40|    UA_ByteString_clear(&client->serverEphemeralPubKey);
 2728|     40|    if(client->utpSp && client->utpSpContext) {
  ------------------
  |  Branch (2728:8): [True: 0, False: 40]
  |  Branch (2728:25): [True: 0, False: 0]
  ------------------
 2729|      0|        client->utpSp->deleteChannelContext(client->utpSp, client->utpSpContext);
 2730|      0|        client->utpSp = NULL;
 2731|       |        client->utpSpContext = NULL;
 2732|      0|    }
 2733|     40|}
UA_Client_disconnect:
 2786|     40|UA_Client_disconnect(UA_Client *client) {
 2787|     40|    lockClient(client);
 2788|     40|    if(client->sessionState == UA_SESSIONSTATE_ACTIVATED)
  ------------------
  |  Branch (2788:8): [True: 20, False: 20]
  ------------------
 2789|     20|        sendCloseSession(client);
 2790|     40|    cleanupSession(client);
 2791|     40|    disconnectSecureChannel(client, true);
 2792|     40|    unlockClient(client);
 2793|     40|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2794|     40|}
ua_client_connect.c:disconnectSecureChannel:
 2736|     40|disconnectSecureChannel(UA_Client *client, UA_Boolean sync) {
 2737|       |    /* Clean the DiscoveryUrl and endpoint description when the connection is
 2738|       |     * explicitly closed */
 2739|     40|    UA_String_clear(&client->discoveryUrl);
 2740|     40|    UA_EndpointDescription_clear(&client->endpoint);
 2741|       |
 2742|       |    /* Close the SecureChannel */
 2743|     40|    closeSecureChannel(client);
 2744|       |
 2745|       |    /* Manually set the status to closed to prevent an automatic reconnection.
 2746|       |     * Notify the client at the end. */
 2747|     40|    if(client->connectStatus == UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     40|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2747:8): [True: 20, False: 20]
  ------------------
 2748|     20|        client->connectStatus = UA_STATUSCODE_BADCONNECTIONCLOSED;
  ------------------
  |  |  739|     20|#define UA_STATUSCODE_BADCONNECTIONCLOSED ((UA_StatusCode) 0x80AE0000)
  ------------------
 2749|       |
 2750|       |    /* In the synchronous case, loop until the client has actually closed. */
 2751|     40|    UA_EventLoop *el = client->config.eventLoop;
 2752|     40|    if(sync && el &&
  ------------------
  |  Branch (2752:8): [True: 40, False: 0]
  |  Branch (2752:16): [True: 40, False: 0]
  ------------------
 2753|     40|       el->state != UA_EVENTLOOPSTATE_FRESH &&
  ------------------
  |  Branch (2753:8): [True: 0, False: 40]
  ------------------
 2754|      0|       el->state != UA_EVENTLOOPSTATE_STOPPED) {
  ------------------
  |  Branch (2754:8): [True: 0, False: 0]
  ------------------
 2755|      0|        while(client->channel.state != UA_SECURECHANNELSTATE_CLOSED) {
  ------------------
  |  Branch (2755:15): [True: 0, False: 0]
  ------------------
 2756|      0|            UA_StatusCode runStatus = el->run(el, 100);
 2757|      0|            if(runStatus != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2757:16): [True: 0, False: 0]
  ------------------
 2758|      0|                UA_LOG_DEBUG(client->config.logging, UA_LOGCATEGORY_CLIENT,
 2759|      0|                             "EventLoop run returned %s during synchronous disconnect, "
 2760|      0|                             "stopping wait loop", UA_StatusCode_name(runStatus));
 2761|      0|                break;
 2762|      0|            }
 2763|      0|        }
 2764|      0|    }
 2765|       |
 2766|     40|    notifyClientState(client);
 2767|     40|}
ua_client_connect.c:sendCloseSession:
 2691|     20|sendCloseSession(UA_Client *client) {
 2692|     20|    UA_CloseSessionRequest request;
 2693|     20|    UA_CloseSessionRequest_init(&request);
 2694|     20|    request.deleteSubscriptions = true;
 2695|     20|    UA_CloseSessionResponse response;
 2696|     20|    __Client_Service(client, &request, &UA_TYPES[UA_TYPES_CLOSESESSIONREQUEST],
  ------------------
  |  | 7322|     20|#define UA_TYPES_CLOSESESSIONREQUEST 181
  ------------------
 2697|     20|                        &response, &UA_TYPES[UA_TYPES_CLOSESESSIONRESPONSE]);
  ------------------
  |  | 7360|     20|#define UA_TYPES_CLOSESESSIONRESPONSE 182
  ------------------
 2698|     20|    UA_CloseSessionRequest_clear(&request);
 2699|     20|    UA_CloseSessionResponse_clear(&response);
 2700|       |
 2701|       |    /* Set after sending the message to prevent immediate reoping during the
 2702|       |     * service call */
 2703|     20|    client->sessionState = UA_SESSIONSTATE_CLOSING;
 2704|     20|}

__Client_Subscriptions_clear:
 1597|     60|__Client_Subscriptions_clear(UA_Client *client) {
 1598|     60|    UA_Client_NotificationsAckNumber *n;
 1599|     60|    UA_Client_NotificationsAckNumber *tmp;
 1600|     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))
  ------------------
 1601|      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]
  |  |  ------------------
  ------------------
 1602|      0|        UA_free(n);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1603|      0|    }
 1604|       |
 1605|     60|    UA_Client_Subscription *sub;
 1606|     60|    UA_Client_Subscription *tmps;
 1607|     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))
  ------------------
 1608|      0|        __Client_Subscription_deleteInternal(client, sub); /* force local removal */
 1609|       |
 1610|     60|    client->monitoredItemHandles = 0;
 1611|     60|}

UA_SecureChannel_init:
   30|     20|UA_SecureChannel_init(UA_SecureChannel *channel) {
   31|       |    /* Normal linked lists are initialized by zeroing out */
   32|     20|    memset(channel, 0, sizeof(UA_SecureChannel));
   33|       |    TAILQ_INIT(&channel->chunks);
  ------------------
  |  |  457|     20|#define	TAILQ_INIT(head) do {						\
  |  |  458|     20|    (head)->tqh_first = NULL;					\
  |  |  459|     20|    (head)->tqh_last = &(head)->tqh_first;				\
  |  |  460|     20|} while (0)
  |  |  ------------------
  |  |  |  Branch (460:10): [Folded, False: 20]
  |  |  ------------------
  ------------------
   34|     20|}
UA_SecureChannel_isConnected:
  115|     20|UA_SecureChannel_isConnected(UA_SecureChannel *channel) {
  116|     20|    return (channel->state > UA_SECURECHANNELSTATE_CLOSED &&
  ------------------
  |  Branch (116:13): [True: 20, False: 0]
  ------------------
  117|     20|            channel->state < UA_SECURECHANNELSTATE_CLOSING);
  ------------------
  |  Branch (117:13): [True: 20, False: 0]
  ------------------
  118|     20|}
UA_SecureChannel_deleteBuffered:
  173|     20|UA_SecureChannel_deleteBuffered(UA_SecureChannel *channel) {
  174|     20|    deleteChunks(channel);
  175|     20|    if(channel->unprocessedCopied)
  ------------------
  |  Branch (175:8): [True: 0, False: 20]
  ------------------
  176|      0|        UA_ByteString_clear(&channel->unprocessed);
  177|     20|}
UA_SecureChannel_clear:
  196|     20|UA_SecureChannel_clear(UA_SecureChannel *channel) {
  197|       |    /* No sessions must be attached to this any longer */
  198|     20|    UA_assert(channel->sessions == NULL);
  ------------------
  |  |  385|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (198:5): [True: 20, False: 0]
  ------------------
  199|       |
  200|       |    /* Delete the channel context for the security policy */
  201|     20|    UA_SecurityPolicy *sp = channel->securityPolicy;
  202|     20|    if(sp) {
  ------------------
  |  Branch (202:8): [True: 0, False: 20]
  ------------------
  203|      0|        sp->deleteChannelContext(sp, channel->channelContext);
  204|      0|        channel->securityPolicy = NULL;
  205|      0|        channel->channelContext = NULL;
  206|      0|    }
  207|       |
  208|       |    /* Remove remaining delayed callback */
  209|     20|    if(channel->connectionManager &&
  ------------------
  |  Branch (209:8): [True: 0, False: 20]
  ------------------
  210|      0|       channel->connectionManager->eventSource.eventLoop) {
  ------------------
  |  Branch (210:8): [True: 0, False: 0]
  ------------------
  211|      0|        UA_EventLoop *el = channel->connectionManager->eventSource.eventLoop;
  212|      0|        el->removeDelayedCallback(el, &channel->unprocessedDelayed);
  213|      0|    }
  214|       |
  215|       |    /* The EventLoop connection is no longer valid */
  216|     20|    channel->connectionId = 0;
  217|     20|    channel->connectionManager = NULL;
  218|       |
  219|       |    /* Clean up the SecurityToken */
  220|     20|    UA_ChannelSecurityToken_clear(&channel->securityToken);
  221|     20|    UA_ChannelSecurityToken_clear(&channel->altSecurityToken);
  222|       |
  223|       |    /* Clean up certificate and nonces */
  224|     20|    UA_ByteString_clear(&channel->remoteCertificate);
  225|     20|    UA_ByteString_clear(&channel->localNonce);
  226|     20|    UA_ByteString_clear(&channel->remoteNonce);
  227|       |
  228|       |    /* Clean up endpointUrl and remoteAddress */
  229|     20|    UA_String_clear(&channel->endpointUrl);
  230|     20|    UA_String_clear(&channel->remoteAddress);
  231|       |
  232|       |    /* Delete remaining chunks */
  233|     20|    UA_SecureChannel_deleteBuffered(channel);
  234|       |
  235|       |    /* Clean up namespace mapping */
  236|     20|    UA_NamespaceMapping_delete(channel->namespaceMapping);
  237|     20|    channel->namespaceMapping = NULL;
  238|       |
  239|       |    /* Reset the SecureChannel for reuse (in the client) */
  240|     20|    channel->securityMode = UA_MESSAGESECURITYMODE_INVALID;
  241|     20|    channel->shutdownReason = UA_SHUTDOWNREASON_CLOSE;
  242|     20|    memset(&channel->config, 0, sizeof(UA_ConnectionConfig));
  243|     20|    channel->receiveSequenceNumber = 0;
  244|     20|    channel->sendSequenceNumber = 0;
  245|       |
  246|       |    /* Set the state to closed */
  247|     20|    channel->state = UA_SECURECHANNELSTATE_CLOSED;
  248|     20|    channel->renewState = UA_SECURECHANNELRENEWSTATE_NORMAL;
  249|     20|}
ua_securechannel.c:deleteChunks:
  162|     20|deleteChunks(UA_SecureChannel *channel) {
  163|     20|    UA_Chunk *chunk, *chunk_tmp;
  164|     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))
  ------------------
  165|       |        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]
  |  |  ------------------
  ------------------
  166|      0|        UA_Chunk_delete(chunk);
  167|      0|    }
  168|     20|    channel->chunksCount = 0;
  169|     20|    channel->chunksLength = 0;
  170|     20|}

UA_cleanupDataTypeWithCustom:
  180|     20|UA_cleanupDataTypeWithCustom(UA_DataTypeArray *customTypes) {
  181|     20|    while(customTypes) {
  ------------------
  |  Branch (181:11): [True: 0, False: 20]
  ------------------
  182|      0|        UA_DataTypeArray *next = customTypes->next;
  183|      0|        if(customTypes->cleanup) {
  ------------------
  |  Branch (183:12): [True: 0, False: 0]
  ------------------
  184|      0|            for(size_t i = 0; i < customTypes->typesSize; ++i) {
  ------------------
  |  Branch (184:31): [True: 0, False: 0]
  ------------------
  185|      0|                UA_DataType *type = &customTypes->types[i];
  186|      0|                UA_DataType_clear(type);
  187|      0|            }
  188|      0|            UA_free(customTypes->types);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  189|      0|            UA_free(customTypes);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  190|      0|        }
  191|      0|        customTypes = next;
  192|      0|    }
  193|     20|}
UA_STRING:
  220|    120|UA_STRING(char *chars) {
  221|    120|    UA_String s = {0, NULL};
  222|    120|    if(!chars)
  ------------------
  |  Branch (222:8): [True: 0, False: 120]
  ------------------
  223|      0|        return s;
  224|    120|    s.length = strlen(chars);
  225|    120|    s.data = (UA_Byte*)chars;
  226|    120|    return s;
  227|    120|}
UA_String_fromChars:
  230|     40|UA_String_fromChars(const char *src) {
  231|     40|    UA_String s; s.length = 0; s.data = NULL;
  232|     40|    if(!src)
  ------------------
  |  Branch (232:8): [True: 0, False: 40]
  ------------------
  233|      0|        return s;
  234|     40|    s.length = strlen(src);
  235|     40|    if(s.length > 0) {
  ------------------
  |  Branch (235:8): [True: 40, False: 0]
  ------------------
  236|     40|        s.data = (u8*)UA_malloc(s.length);
  ------------------
  |  |   18|     40|#define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
  237|     40|        if(UA_UNLIKELY(!s.data)) {
  ------------------
  |  |  565|     40|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (565:25): [True: 0, False: 40]
  |  |  ------------------
  ------------------
  238|      0|            s.length = 0;
  239|      0|            return s;
  240|      0|        }
  241|     40|        memcpy(s.data, src, s.length);
  242|     40|    } else {
  243|      0|        s.data = (u8*)UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  755|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
  244|      0|    }
  245|     40|    return s;
  246|     40|}
UA_init:
 1898|     20|void UA_init(void *p, const UA_DataType *type) {
 1899|     20|    memset(p, 0, type->memSize);
 1900|     20|}
UA_copy:
 2059|     80|UA_copy(const void *src, void *dst, const UA_DataType *type) {
 2060|     80|    memset(dst, 0, type->memSize); /* init */
 2061|     80|    UA_StatusCode retval = copyJumpTable[type->typeKind](src, dst, type);
 2062|     80|    if(retval != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     80|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2062:8): [True: 0, False: 80]
  ------------------
 2063|      0|        UA_clear(dst, type);
 2064|     80|    return retval;
 2065|     80|}
UA_clear:
 2162|    860|UA_clear(void *p, const UA_DataType *type) {
 2163|    860|    clearJumpTable[type->typeKind](p, type);
 2164|    860|    memset(p, 0, type->memSize); /* init */
 2165|    860|}
UA_Array_copy:
 2640|     60|              void **dst, const UA_DataType *type) {
 2641|     60|    if(size == 0) {
  ------------------
  |  Branch (2641:8): [True: 0, False: 60]
  ------------------
 2642|      0|        if(src == NULL)
  ------------------
  |  Branch (2642:12): [True: 0, False: 0]
  ------------------
 2643|      0|            *dst = NULL;
 2644|      0|        else
 2645|      0|            *dst= UA_EMPTY_ARRAY_SENTINEL;
  ------------------
  |  |  755|      0|#define UA_EMPTY_ARRAY_SENTINEL ((void*)0x01)
  ------------------
 2646|      0|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2647|      0|    }
 2648|       |
 2649|       |    /* Check the array consistency -- defensive programming in case the user
 2650|       |     * manually created an inconsistent array */
 2651|     60|    if(UA_UNLIKELY(!type || !src))
  ------------------
  |  |  565|    120|# define UA_UNLIKELY(x) __builtin_expect((x), 0)
  |  |  ------------------
  |  |  |  Branch (565:25): [True: 0, False: 60]
  |  |  |  Branch (565:43): [True: 0, False: 60]
  |  |  |  Branch (565:43): [True: 0, False: 60]
  |  |  ------------------
  ------------------
 2652|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
 2653|       |
 2654|       |    /* calloc, so we don't have to check retval in every iteration of copying */
 2655|     60|    *dst = UA_calloc(size, type->memSize);
  ------------------
  |  |   20|     60|#define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 2656|     60|    if(!*dst)
  ------------------
  |  Branch (2656:8): [True: 0, False: 60]
  ------------------
 2657|      0|        return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   31|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2658|       |
 2659|     60|    if(type->pointerFree) {
  ------------------
  |  Branch (2659:8): [True: 60, False: 0]
  ------------------
 2660|     60|        memcpy(*dst, src, type->memSize * size);
 2661|     60|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2662|     60|    }
 2663|       |
 2664|      0|    uintptr_t ptrs = (uintptr_t)src;
 2665|      0|    uintptr_t ptrd = (uintptr_t)*dst;
 2666|      0|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2667|      0|    for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2667:23): [True: 0, False: 0]
  ------------------
 2668|      0|        retval |= UA_copy((void*)ptrs, (void*)ptrd, type);
 2669|      0|        ptrs += type->memSize;
 2670|      0|        ptrd += type->memSize;
 2671|      0|    }
 2672|      0|    if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|      0|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2672:8): [True: 0, False: 0]
  ------------------
 2673|      0|        UA_Array_delete(*dst, size, type);
 2674|       |        *dst = NULL;
 2675|      0|    }
 2676|      0|    return retval;
 2677|     60|}
UA_Array_delete:
 2768|  1.88k|UA_Array_delete(void *p, size_t size, const UA_DataType *type) {
 2769|  1.88k|    if(!type->pointerFree) {
  ------------------
  |  Branch (2769:8): [True: 220, False: 1.66k]
  ------------------
 2770|    220|        uintptr_t ptr = (uintptr_t)p;
 2771|    260|        for(size_t i = 0; i < size; ++i) {
  ------------------
  |  Branch (2771:27): [True: 40, False: 220]
  ------------------
 2772|     40|            UA_clear((void*)ptr, type);
 2773|     40|            ptr += type->memSize;
 2774|     40|        }
 2775|    220|    }
 2776|  1.88k|    UA_free((void*)((uintptr_t)p & ~(uintptr_t)UA_EMPTY_ARRAY_SENTINEL));
  ------------------
  |  |   19|  1.88k|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2777|  1.88k|}
UA_NamespaceMapping_clear:
 2972|     20|UA_NamespaceMapping_clear(UA_NamespaceMapping *nm) {
 2973|     20|    if(!nm)
  ------------------
  |  Branch (2973:8): [True: 20, False: 0]
  ------------------
 2974|     20|        return;
 2975|      0|    UA_Array_delete(nm->namespaceUris, nm->namespaceUrisSize, &UA_TYPES[UA_TYPES_STRING]);
  ------------------
  |  |  395|      0|#define UA_TYPES_STRING 11
  ------------------
 2976|      0|    UA_Array_delete(nm->local2remote, nm->local2remoteSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 2977|      0|    UA_Array_delete(nm->remote2local, nm->remote2localSize, &UA_TYPES[UA_TYPES_UINT16]);
  ------------------
  |  |  157|      0|#define UA_TYPES_UINT16 4
  ------------------
 2978|      0|}
UA_NamespaceMapping_delete:
 2981|     20|UA_NamespaceMapping_delete(UA_NamespaceMapping *nm) {
 2982|     20|    UA_NamespaceMapping_clear(nm);
 2983|     20|    UA_free(nm);
  ------------------
  |  |   19|     20|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2984|     20|}
ua_types.c:String_copy:
  281|     60|String_copy(UA_String const *src, UA_String *dst, const UA_DataType *_) {
  282|     60|    UA_StatusCode res =
  283|     60|        UA_Array_copy(src->data, src->length, (void**)&dst->data,
  284|     60|                      &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|     60|#define UA_TYPES_BYTE 2
  ------------------
  285|     60|    if(res == UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     60|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (285:8): [True: 60, False: 0]
  ------------------
  286|     60|        dst->length = src->length;
  287|     60|    return res;
  288|     60|}
ua_types.c:NodeId_copy:
  784|     20|NodeId_copy(UA_NodeId const *src, UA_NodeId *dst, const UA_DataType *_) {
  785|     20|    UA_StatusCode retval = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  786|     20|    switch(src->identifierType) {
  787|     20|    case UA_NODEIDTYPE_NUMERIC:
  ------------------
  |  Branch (787:5): [True: 20, False: 0]
  ------------------
  788|     20|        *dst = *src;
  789|     20|        return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     20|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  790|      0|    case UA_NODEIDTYPE_STRING:
  ------------------
  |  Branch (790:5): [True: 0, False: 20]
  ------------------
  791|      0|    case UA_NODEIDTYPE_BYTESTRING:
  ------------------
  |  Branch (791:5): [True: 0, False: 20]
  ------------------
  792|      0|        retval |= String_copy(&src->identifier.string,
  793|      0|                              &dst->identifier.string, NULL);
  794|      0|        break;
  795|      0|    case UA_NODEIDTYPE_GUID:
  ------------------
  |  Branch (795:5): [True: 0, False: 20]
  ------------------
  796|      0|        dst->identifier.guid = src->identifier.guid;
  797|      0|        break;
  798|      0|    default:
  ------------------
  |  Branch (798:5): [True: 0, False: 20]
  ------------------
  799|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  800|     20|    }
  801|      0|    dst->namespaceIndex = src->namespaceIndex;
  802|      0|    dst->identifierType = src->identifierType;
  803|      0|    return retval;
  804|     20|}
ua_types.c:nopClear:
 2124|    600|static void nopClear(void *p, const UA_DataType *type) { }
ua_types.c:String_clear:
  291|  1.66k|String_clear(UA_String *s, const UA_DataType *_) {
  292|  1.66k|    UA_Array_delete(s->data, s->length, &UA_TYPES[UA_TYPES_BYTE]);
  ------------------
  |  |   89|  1.66k|#define UA_TYPES_BYTE 2
  ------------------
  293|  1.66k|}
ua_types.c:NodeId_clear:
  773|    160|NodeId_clear(UA_NodeId *p, const UA_DataType *_) {
  774|    160|    switch(p->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(&p->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:
 1813|    100|LocalizedText_clear(UA_LocalizedText *p, const UA_DataType *_) {
 1814|    100|    String_clear(&p->locale, NULL);
 1815|       |    String_clear(&p->text, NULL);
 1816|    100|}
ua_types.c:ExtensionObject_clear:
 1242|     60|ExtensionObject_clear(UA_ExtensionObject *p, const UA_DataType *_) {
 1243|     60|    switch(p->encoding) {
 1244|     60|    case UA_EXTENSIONOBJECT_ENCODED_NOBODY:
  ------------------
  |  Branch (1244:5): [True: 60, False: 0]
  ------------------
 1245|     60|    case UA_EXTENSIONOBJECT_ENCODED_BYTESTRING:
  ------------------
  |  Branch (1245:5): [True: 0, False: 60]
  ------------------
 1246|     60|    case UA_EXTENSIONOBJECT_ENCODED_XML:
  ------------------
  |  Branch (1246:5): [True: 0, False: 60]
  ------------------
 1247|     60|        NodeId_clear(&p->content.encoded.typeId, NULL);
 1248|     60|        String_clear(&p->content.encoded.body, NULL);
 1249|     60|        break;
 1250|      0|    case UA_EXTENSIONOBJECT_DECODED:
  ------------------
  |  Branch (1250:5): [True: 0, False: 60]
  ------------------
 1251|      0|        if(p->content.decoded.data)
  ------------------
  |  Branch (1251:12): [True: 0, False: 0]
  ------------------
 1252|      0|            UA_delete(p->content.decoded.data, p->content.decoded.type);
 1253|      0|        break;
 1254|      0|    default:
  ------------------
  |  Branch (1254:5): [True: 0, False: 60]
  ------------------
 1255|      0|        break;
 1256|     60|    }
 1257|     60|}
ua_types.c:DiagnosticInfo_clear:
 1856|     20|DiagnosticInfo_clear(UA_DiagnosticInfo *p, const UA_DataType *_) {
 1857|     20|    String_clear(&p->additionalInfo, NULL);
 1858|     20|    if(p->hasInnerDiagnosticInfo && p->innerDiagnosticInfo) {
  ------------------
  |  Branch (1858:8): [True: 0, False: 20]
  |  Branch (1858:37): [True: 0, False: 0]
  ------------------
 1859|      0|        DiagnosticInfo_clear(p->innerDiagnosticInfo, NULL);
 1860|      0|        UA_free(p->innerDiagnosticInfo);
  ------------------
  |  |   19|      0|#define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1861|      0|    }
 1862|     20|}
ua_types.c:clearStructure:
 2068|    320|clearStructure(void *p, const UA_DataType *type) {
 2069|    320|    uintptr_t ptr = (uintptr_t)p;
 2070|  2.24k|    for(size_t i = 0; i < type->membersSize; ++i) {
  ------------------
  |  Branch (2070:23): [True: 1.92k, False: 320]
  ------------------
 2071|  1.92k|        const UA_DataTypeMember *m = &type->members[i];
 2072|  1.92k|        const UA_DataType *mt = m->memberType;
 2073|  1.92k|        ptr += m->padding;
 2074|  1.92k|        if(!m->isOptional) {
  ------------------
  |  Branch (2074:12): [True: 1.92k, False: 0]
  ------------------
 2075|  1.92k|            if(!m->isArray) {
  ------------------
  |  Branch (2075:16): [True: 1.72k, False: 200]
  ------------------
 2076|  1.72k|                clearJumpTable[mt->typeKind]((void*)ptr, mt);
 2077|  1.72k|                ptr += mt->memSize;
 2078|  1.72k|            } else {
 2079|    200|                size_t length = *(size_t*)ptr;
 2080|    200|                ptr += sizeof(size_t);
 2081|    200|                UA_Array_delete(*(void**)ptr, length, mt);
 2082|    200|                ptr += sizeof(void*);
 2083|    200|            }
 2084|  1.92k|        } else { /* field is optional */
 2085|      0|            if(!m->isArray) {
  ------------------
  |  Branch (2085:16): [True: 0, False: 0]
  ------------------
 2086|       |                /* optional scalar field is contained */
 2087|      0|                if((*(void *const *)ptr != NULL))
  ------------------
  |  Branch (2087:20): [True: 0, False: 0]
  ------------------
 2088|      0|                    UA_Array_delete(*(void **)ptr, 1, mt);
 2089|      0|                ptr += sizeof(void *);
 2090|      0|            } else {
 2091|       |                /* optional array field is contained */
 2092|      0|                if((*(void *const *)(ptr + sizeof(size_t)) != NULL)) {
  ------------------
  |  Branch (2092:20): [True: 0, False: 0]
  ------------------
 2093|      0|                    size_t length = *(size_t *)ptr;
 2094|      0|                    ptr += sizeof(size_t);
 2095|      0|                    UA_Array_delete(*(void **)ptr, length, mt);
 2096|      0|                    ptr += sizeof(void *);
 2097|      0|                } else { /* optional array field not contained */
 2098|      0|                    ptr += sizeof(size_t);
 2099|      0|                    ptr += sizeof(void *);
 2100|      0|                }
 2101|      0|            }
 2102|      0|        }
 2103|  1.92k|    }
 2104|    320|}

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

LLVMFuzzerTestOneInput:
   13|     26|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   14|     26|    if(size < 10)
  ------------------
  |  Branch (14:8): [True: 6, False: 20]
  ------------------
   15|      6|        return 0;
   16|       |
   17|     20|    UA_Client *client = UA_Client_new();
   18|     20|    if(!client)
  ------------------
  |  Branch (18:8): [True: 0, False: 20]
  ------------------
   19|      0|        return 0;
   20|       |    
   21|     20|    UA_ClientConfig *config = UA_Client_getConfig(client);
   22|     20|    UA_ClientConfig_setDefault(config);
   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|}

fuzz_client.cc:_ZL19UA_ByteString_clearP9UA_String:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ByteString_clear:
  224|     60|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ChannelSecurityToken_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_String_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_INIT:
  476|     20|UA_LOCK_INIT(UA_Lock *lock) {
  477|     20|    pthread_mutexattr_t mattr;
  478|     20|    pthread_mutexattr_init(&mattr);
  479|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  480|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  481|     20|    pthread_mutexattr_destroy(&mattr);
  482|     20|    lock->count = 0;
  483|     20|}
ua_client.c:UA_ApplicationDescription_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_String_clear:
  224|    120|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ExtensionObject_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_EndpointDescription_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_UserTokenPolicy_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ByteString_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_DESTROY:
  486|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  487|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  385|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (487:5): [True: 20, False: 0]
  ------------------
  488|     20|    pthread_mutex_destroy(&lock->mutex);
  489|     20|}
ua_client.c:UA_LOCK_ASSERT:
  504|     40|UA_LOCK_ASSERT(UA_Lock *lock) {
  505|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  385|     40|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (505:5): [True: 40, False: 0]
  ------------------
  506|     40|}
ua_client.c:UA_LOCK:
  492|     60|UA_LOCK(UA_Lock *lock) {
  493|     60|    pthread_mutex_lock(&lock->mutex);
  494|     60|    lock->count++;
  495|     60|}
ua_client.c:UA_UNLOCK:
  498|     60|UA_UNLOCK(UA_Lock *lock) {
  499|     60|    lock->count--;
  500|     60|    pthread_mutex_unlock(&lock->mutex);
  501|     60|}
ua_client_connect.c:UA_String_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_ByteString_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_EndpointDescription_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_NodeId_clear:
  224|     80|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionResponse_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_init:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_certificategroup_none.c:UA_NodeId_copy:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securitypolicy_none.c:UA_ByteString_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
timer.c:UA_LOCK_INIT:
  476|     20|UA_LOCK_INIT(UA_Lock *lock) {
  477|     20|    pthread_mutexattr_t mattr;
  478|     20|    pthread_mutexattr_init(&mattr);
  479|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  480|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  481|     20|    pthread_mutexattr_destroy(&mattr);
  482|     20|    lock->count = 0;
  483|     20|}
timer.c:UA_LOCK:
  492|     40|UA_LOCK(UA_Lock *lock) {
  493|     40|    pthread_mutex_lock(&lock->mutex);
  494|     40|    lock->count++;
  495|     40|}
timer.c:UA_UNLOCK:
  498|     40|UA_UNLOCK(UA_Lock *lock) {
  499|     40|    lock->count--;
  500|     40|    pthread_mutex_unlock(&lock->mutex);
  501|     40|}
timer.c:UA_LOCK_DESTROY:
  486|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  487|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  385|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (487:5): [True: 20, False: 0]
  ------------------
  488|     20|    pthread_mutex_destroy(&lock->mutex);
  489|     20|}
eventloop_posix.c:UA_LOCK_INIT:
  476|     20|UA_LOCK_INIT(UA_Lock *lock) {
  477|     20|    pthread_mutexattr_t mattr;
  478|     20|    pthread_mutexattr_init(&mattr);
  479|     20|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  480|     20|    pthread_mutex_init(&lock->mutex, &mattr);
  481|     20|    pthread_mutexattr_destroy(&mattr);
  482|     20|    lock->count = 0;
  483|     20|}
eventloop_posix.c:UA_LOCK_ASSERT:
  504|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  505|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  385|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (505:5): [True: 20, False: 0]
  ------------------
  506|     20|}
eventloop_posix.c:UA_LOCK_DESTROY:
  486|     20|UA_LOCK_DESTROY(UA_Lock *lock) {
  487|     20|    UA_assert(lock->count == 0);
  ------------------
  |  |  385|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (487:5): [True: 20, False: 0]
  ------------------
  488|     20|    pthread_mutex_destroy(&lock->mutex);
  489|     20|}
eventloop_posix.c:UA_UNLOCK:
  498|    200|UA_UNLOCK(UA_Lock *lock) {
  499|    200|    lock->count--;
  500|    200|    pthread_mutex_unlock(&lock->mutex);
  501|    200|}
eventloop_posix.c:UA_LOCK:
  492|    200|UA_LOCK(UA_Lock *lock) {
  493|    200|    pthread_mutex_lock(&lock->mutex);
  494|    200|    lock->count++;
  495|    200|}
eventloop_posix_tcp.c:UA_String_copy:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_String_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_ByteString_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_copy:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_ByteString_clear:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_String_copy:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_LOCK_ASSERT:
  504|     20|UA_LOCK_ASSERT(UA_Lock *lock) {
  505|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  385|     20|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (505:5): [True: 20, False: 0]
  ------------------
  506|     20|}
eventloop_posix_interrupt.c:UA_String_clear:
  224|     20|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
securitypolicy_common.c:UA_ByteString_init:
  224|     40|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl

