UA_Timer_init:
   47|     17|UA_Timer_init(UA_Timer *t) {
   48|     17|    memset(t, 0, sizeof(UA_Timer));
   49|     17|    UA_LOCK_INIT(&t->timerMutex);
   50|     17|}
UA_Timer_remove:
  221|     17|UA_Timer_remove(UA_Timer *t, UA_UInt64 callbackId) {
  222|     17|    UA_LOCK(&t->timerMutex);
  223|     17|    UA_TimerEntry *te = ZIP_FIND(UA_TimerIdTree, &t->idTree, &callbackId);
  ------------------
  |  |   73|     17|#define ZIP_FIND(name, head, key) name##_ZIP_FIND(head, key)
  ------------------
  224|     17|    if(!te) {
  ------------------
  |  Branch (224:8): [True: 17, False: 0]
  ------------------
  225|     17|        UA_UNLOCK(&t->timerMutex);
  226|     17|        return;
  227|     17|    }
  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);
  ------------------
  |  |  351|      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|     17|UA_Timer_clear(UA_Timer *t) {
  334|     17|    UA_LOCK(&t->timerMutex);
  335|       |
  336|     17|    ZIP_ITER(UA_TimerIdTree, &t->idTree, freeEntryCallback, NULL);
  ------------------
  |  |   94|     17|#define ZIP_ITER(name, head, cb, ctx) name##_ZIP_ITER(head, cb, ctx)
  ------------------
  337|     17|    t->tree.root = NULL;
  338|     17|    t->idTree.root = NULL;
  339|     17|    t->idCounter = 0;
  340|       |
  341|     17|    UA_UNLOCK(&t->timerMutex);
  342|       |
  343|     17|#if UA_MULTITHREADING >= 100
  344|     17|    UA_LOCK_DESTROY(&t->timerMutex);
  345|     17|#endif
  346|     17|}

UA_EventLoop_new_POSIX:
  552|     17|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|     17|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)
  565|     17|        UA_calloc(1, sizeof(UA_EventLoopPOSIX));
  ------------------
  |  |  352|     17|# define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  566|     17|    if(!el)
  ------------------
  |  Branch (566:8): [True: 0, False: 17]
  ------------------
  567|      0|        return NULL;
  568|       |
  569|     17|    UA_LOCK_INIT(&el->elMutex);
  570|     17|    UA_Timer_init(&el->timer);
  571|       |
  572|       |    /* Initialize the queue */
  573|     17|    el->delayedTail = &el->delayedHead1;
  574|     17|    el->delayedHead2 = (UA_DelayedCallback*)0x01; /* sentinel value */
  575|       |
  576|       |    /* Set the public EventLoop content */
  577|     17|    el->eventLoop.logger = logger;
  578|       |
  579|       |    /* Initialize the clock source to the default */
  580|     17|#if defined(UA_ARCHITECTURE_POSIX)
  581|     17|    el->clockSource = CLOCK_REALTIME;
  582|     17|# ifdef CLOCK_MONOTONIC_RAW
  583|     17|    el->clockSourceMonotonic = CLOCK_MONOTONIC_RAW;
  584|       |# else
  585|       |    el->clockSourceMonotonic = CLOCK_MONOTONIC;
  586|       |# endif
  587|     17|#endif
  588|       |
  589|       |    /* Set the method pointers for the interface */
  590|     17|    el->eventLoop.start = (UA_StatusCode (*)(UA_EventLoop*))UA_EventLoopPOSIX_start;
  591|     17|    el->eventLoop.stop = (void (*)(UA_EventLoop*))UA_EventLoopPOSIX_stop;
  592|     17|    el->eventLoop.free = (UA_StatusCode (*)(UA_EventLoop*))UA_EventLoopPOSIX_free;
  593|     17|    el->eventLoop.run = (UA_StatusCode (*)(UA_EventLoop*, UA_UInt32))UA_EventLoopPOSIX_run;
  594|     17|    el->eventLoop.cancel = (void (*)(UA_EventLoop*))UA_EventLoopPOSIX_cancel;
  595|       |
  596|     17|    el->eventLoop.dateTime_now = UA_EventLoopPOSIX_DateTime_now;
  597|     17|    el->eventLoop.dateTime_nowMonotonic =
  598|     17|        UA_EventLoopPOSIX_DateTime_nowMonotonic;
  599|     17|    el->eventLoop.dateTime_localTimeUtcOffset =
  600|     17|        UA_EventLoopPOSIX_DateTime_localTimeUtcOffset;
  601|       |
  602|     17|    el->eventLoop.nextTimer = UA_EventLoopPOSIX_nextTimer;
  603|     17|    el->eventLoop.addTimer = UA_EventLoopPOSIX_addTimer;
  604|     17|    el->eventLoop.modifyTimer = UA_EventLoopPOSIX_modifyTimer;
  605|     17|    el->eventLoop.removeTimer = UA_EventLoopPOSIX_removeTimer;
  606|     17|    el->eventLoop.addDelayedCallback = UA_EventLoopPOSIX_addDelayedCallback;
  607|     17|    el->eventLoop.removeDelayedCallback = UA_EventLoopPOSIX_removeDelayedCallback;
  608|       |
  609|     17|    el->eventLoop.registerEventSource =
  610|     17|        (UA_StatusCode (*)(UA_EventLoop*, UA_EventSource*))
  611|     17|        UA_EventLoopPOSIX_registerEventSource;
  612|     17|    el->eventLoop.deregisterEventSource =
  613|     17|        (UA_StatusCode (*)(UA_EventLoop*, UA_EventSource*))
  614|     17|        UA_EventLoopPOSIX_deregisterEventSource;
  615|       |
  616|     17|    el->eventLoop.lock = UA_EventLoopPOSIX_lock;
  617|     17|    el->eventLoop.unlock = UA_EventLoopPOSIX_unlock;
  618|       |
  619|     17|    return &el->eventLoop;
  620|     17|}
eventloop_posix.c:UA_EventLoopPOSIX_free:
  503|     17|UA_EventLoopPOSIX_free(UA_EventLoopPOSIX *el) {
  504|     17|    UA_LOCK(&el->elMutex);
  505|       |
  506|       |    /* Check if the EventLoop can be deleted */
  507|     17|    if(el->eventLoop.state != UA_EVENTLOOPSTATE_STOPPED &&
  ------------------
  |  Branch (507:8): [True: 17, False: 0]
  ------------------
  508|     17|       el->eventLoop.state != UA_EVENTLOOPSTATE_FRESH) {
  ------------------
  |  Branch (508:8): [True: 0, False: 17]
  ------------------
  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|     68|    while(el->eventLoop.eventSources) {
  ------------------
  |  Branch (516:11): [True: 51, False: 17]
  ------------------
  517|     51|        UA_EventSource *es = el->eventLoop.eventSources;
  518|     51|        UA_EventLoopPOSIX_deregisterEventSource(el, es);
  519|     51|        es->free(es);
  520|     51|    }
  521|       |
  522|       |    /* Remove the repeated timed callbacks */
  523|     17|    UA_Timer_clear(&el->timer);
  524|       |
  525|       |    /* Process remaining delayed callbacks */
  526|     17|    processDelayed(el);
  527|       |
  528|       |#ifdef UA_ARCHITECTURE_WIN32
  529|       |    /* Stop the Windows networking subsystem */
  530|       |    WSACleanup();
  531|       |#endif
  532|       |
  533|     17|    UA_KeyValueMap_clear(&el->eventLoop.params);
  534|       |
  535|       |    /* Clean up */
  536|     17|    UA_UNLOCK(&el->elMutex);
  537|     17|    UA_LOCK_DESTROY(&el->elMutex);
  538|     17|    UA_free(el);
  ------------------
  |  |  351|     17|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  539|     17|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     17|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  540|     17|}
eventloop_posix.c:processDelayed:
  130|     17|processDelayed(UA_EventLoopPOSIX *el) {
  131|     17|    UA_LOG_TRACE(el->eventLoop.logger, UA_LOGCATEGORY_EVENTLOOP,
  132|     17|                 "Process delayed callbacks");
  133|       |
  134|     17|    UA_LOCK_ASSERT(&el->elMutex);
  135|       |
  136|       |    /* Reset and get the old head and tail */
  137|     17|    UA_DelayedCallback *dc = NULL, *tail = NULL;
  138|     17|    resetDelayedQueue(el, &dc, &tail);
  139|       |
  140|       |    /* Loop until we reach the tail (or head and tail are both NULL) */
  141|     17|    UA_DelayedCallback *next;
  142|     17|    for(; dc; dc = next) {
  ------------------
  |  Branch (142:11): [True: 0, False: 17]
  ------------------
  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|     17|}
eventloop_posix.c:resetDelayedQueue:
   79|     17|                  UA_DelayedCallback **oldTail) {
   80|     17|    if(el->delayedHead1 <= (UA_DelayedCallback *)0x01 &&
  ------------------
  |  Branch (80:8): [True: 17, False: 0]
  ------------------
   81|     17|       el->delayedHead2 <= (UA_DelayedCallback *)0x01)
  ------------------
  |  Branch (81:8): [True: 17, False: 0]
  ------------------
   82|     17|        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|     17|                              UA_UInt64 callbackId) {
   53|     17|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX*)public_el;
   54|     17|    UA_Timer_remove(&el->timer, callbackId);
   55|     17|}
eventloop_posix.c:UA_EventLoopPOSIX_registerEventSource:
  398|     51|                                      UA_EventSource *es) {
  399|     51|    UA_LOCK(&el->elMutex);
  400|       |
  401|       |    /* Already registered? */
  402|     51|    if(es->state != UA_EVENTSOURCESTATE_FRESH) {
  ------------------
  |  Branch (402:8): [True: 0, False: 51]
  ------------------
  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|     51|    es->next = el->eventLoop.eventSources;
  413|     51|    el->eventLoop.eventSources = es;
  414|       |
  415|     51|    es->eventLoop = &el->eventLoop;
  416|     51|    es->state = UA_EVENTSOURCESTATE_STOPPED;
  417|       |
  418|       |    /* Start if the entire EventLoop is started */
  419|     51|    UA_StatusCode res = UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     51|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  420|     51|    if(el->eventLoop.state == UA_EVENTLOOPSTATE_STARTED)
  ------------------
  |  Branch (420:8): [True: 0, False: 51]
  ------------------
  421|      0|        res = es->start(es);
  422|       |
  423|     51|    UA_UNLOCK(&el->elMutex);
  424|     51|    return res;
  425|     51|}
eventloop_posix.c:UA_EventLoopPOSIX_deregisterEventSource:
  429|     51|                                        UA_EventSource *es) {
  430|     51|    UA_LOCK(&el->elMutex);
  431|       |
  432|     51|    if(es->state != UA_EVENTSOURCESTATE_STOPPED) {
  ------------------
  |  Branch (432:8): [True: 0, False: 51]
  ------------------
  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|     51|    UA_EventSource **s = &el->eventLoop.eventSources;
  443|     51|    while(*s) {
  ------------------
  |  Branch (443:11): [True: 51, False: 0]
  ------------------
  444|     51|        if(*s == es) {
  ------------------
  |  Branch (444:12): [True: 51, False: 0]
  ------------------
  445|     51|            *s = es->next;
  446|     51|            break;
  447|     51|        }
  448|      0|        s = &(*s)->next;
  449|      0|    }
  450|       |
  451|       |    /* Set the state to non-registered */
  452|     51|    es->state = UA_EVENTSOURCESTATE_FRESH;
  453|       |
  454|     51|    UA_UNLOCK(&el->elMutex);
  455|     51|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     51|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  456|     51|}
eventloop_posix.c:UA_EventLoopPOSIX_lock:
  543|     51|UA_EventLoopPOSIX_lock(UA_EventLoop *public_el) {
  544|     51|    UA_LOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  545|     51|}
eventloop_posix.c:UA_EventLoopPOSIX_unlock:
  547|     51|UA_EventLoopPOSIX_unlock(UA_EventLoop *public_el) {
  548|     51|    UA_UNLOCK(&((UA_EventLoopPOSIX*)public_el)->elMutex);
  549|     51|}

UA_InterruptManager_new_POSIX:
  426|     17|UA_InterruptManager_new_POSIX(const UA_String eventSourceName) {
  427|       |#ifndef UA_HAVE_EPOLL
  428|       |    /* There can be only one InterruptManager if epoll is not present */
  429|       |    if(singletonIM)
  430|       |        return NULL;
  431|       |#endif
  432|       |
  433|     17|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)
  434|     17|        UA_calloc(1, sizeof(UA_POSIXInterruptManager));
  ------------------
  |  |  352|     17|# define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
  435|     17|    if(!pim)
  ------------------
  |  Branch (435:8): [True: 0, False: 17]
  ------------------
  436|      0|        return NULL;
  437|       |
  438|       |#ifndef UA_HAVE_EPOLL
  439|       |    singletonIM = pim; /* Register the singleton singleton pointer */
  440|       |#endif
  441|       |
  442|     17|    UA_InterruptManager *im = &pim->im;
  443|     17|    im->eventSource.eventSourceType = UA_EVENTSOURCETYPE_INTERRUPTMANAGER;
  444|     17|    UA_String_copy(&eventSourceName, &im->eventSource.name);
  445|     17|    im->eventSource.start = startPOSIXInterruptManager;
  446|     17|    im->eventSource.stop = stopPOSIXInterruptManager;
  447|     17|    im->eventSource.free = freePOSIXInterruptmanager;
  448|     17|    im->registerInterrupt = registerPOSIXInterrupt;
  449|     17|    im->deregisterInterrupt = deregisterPOSIXInterrupt;
  450|     17|    return im;
  451|     17|}
eventloop_posix_interrupt.c:freePOSIXInterruptmanager:
  394|     17|freePOSIXInterruptmanager(UA_EventSource *es) {
  395|     17|    UA_EventLoopPOSIX *el = (UA_EventLoopPOSIX *)es->eventLoop;
  396|     17|    (void)el;
  397|     17|    UA_LOCK_ASSERT(&el->elMutex);
  398|       |
  399|     17|    if(es->state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (399:8): [True: 0, False: 17]
  ------------------
  400|      0|        UA_LOG_ERROR(es->eventLoop->logger, UA_LOGCATEGORY_EVENTLOOP,
  401|      0|                     "Interrupt\t| The EventSource must be stopped "
  402|      0|                     "before it can be deleted");
  403|      0|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|      0|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  404|      0|    }
  405|       |
  406|       |    /* Deactivate and remove all registered signals */
  407|     17|    UA_POSIXInterruptManager *pim = (UA_POSIXInterruptManager *)es;
  408|     17|    UA_RegisteredSignal *rs, *rs_tmp;
  409|     17|    LIST_FOREACH_SAFE(rs, &pim->signals, listPointers, rs_tmp) {
  ------------------
  |  |  195|     17|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     17|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     17|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 17]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     17|        (var) = (tvar))
  ------------------
  410|      0|        deactivateSignal(rs);
  411|      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]
  |  |  ------------------
  ------------------
  412|      0|        UA_free(rs);
  ------------------
  |  |  351|      0|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  413|      0|    }
  414|       |
  415|     17|    UA_String_clear(&es->name);
  416|     17|    UA_free(es);
  ------------------
  |  |  351|     17|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
  417|       |
  418|       |#ifndef UA_HAVE_EPOLL
  419|       |    singletonIM = NULL; /* Reset the global singleton pointer */
  420|       |#endif
  421|       |
  422|     17|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     17|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  423|     17|}

UA_ConnectionManager_new_POSIX_TCP:
 1247|     17|UA_ConnectionManager_new_POSIX_TCP(const UA_String eventSourceName) {
 1248|     17|    UA_POSIXConnectionManager *cm = (UA_POSIXConnectionManager*)
 1249|     17|        UA_calloc(1, sizeof(UA_POSIXConnectionManager));
  ------------------
  |  |  352|     17|# define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 1250|     17|    if(!cm)
  ------------------
  |  Branch (1250:8): [True: 0, False: 17]
  ------------------
 1251|      0|        return NULL;
 1252|       |
 1253|     17|    cm->cm.eventSource.eventSourceType = UA_EVENTSOURCETYPE_CONNECTIONMANAGER;
 1254|     17|    UA_String_copy(&eventSourceName, &cm->cm.eventSource.name);
 1255|     17|    cm->cm.eventSource.start = (UA_StatusCode (*)(UA_EventSource *))TCP_eventSourceStart;
 1256|     17|    cm->cm.eventSource.stop = (void (*)(UA_EventSource *))TCP_eventSourceStop;
 1257|     17|    cm->cm.eventSource.free = (UA_StatusCode (*)(UA_EventSource *))TCP_eventSourceDelete;
 1258|     17|    cm->cm.protocol = UA_STRING((char*)(uintptr_t)tcpName);
 1259|     17|    cm->cm.openConnection = TCP_openConnection;
 1260|     17|    cm->cm.allocNetworkBuffer = UA_EventLoopPOSIX_allocNetworkBuffer;
 1261|     17|    cm->cm.freeNetworkBuffer = UA_EventLoopPOSIX_freeNetworkBuffer;
 1262|     17|    cm->cm.sendWithConnection = TCP_sendWithConnection;
 1263|     17|    cm->cm.closeConnection = TCP_shutdownConnection;
 1264|     17|    return &cm->cm;
 1265|     17|}
eventloop_posix_tcp.c:TCP_eventSourceDelete:
 1227|     17|TCP_eventSourceDelete(UA_ConnectionManager *cm) {
 1228|     17|    UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
 1229|     17|    if(cm->eventSource.state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (1229:8): [True: 0, False: 17]
  ------------------
 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|     17|    UA_ByteString_clear(&pcm->rxBuffer);
 1236|     17|    UA_ByteString_clear(&pcm->txBuffer);
 1237|     17|    UA_KeyValueMap_clear(&cm->eventSource.params);
 1238|     17|    UA_String_clear(&cm->eventSource.name);
 1239|     17|    UA_free(cm);
  ------------------
  |  |  351|     17|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1240|       |
 1241|     17|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     17|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 1242|     17|}

UA_ConnectionManager_new_POSIX_UDP:
 1447|     17|UA_ConnectionManager_new_POSIX_UDP(const UA_String eventSourceName) {
 1448|     17|    UA_POSIXConnectionManager *cm = (UA_POSIXConnectionManager*)
 1449|     17|        UA_calloc(1, sizeof(UA_POSIXConnectionManager));
  ------------------
  |  |  352|     17|# define UA_calloc(num, size) UA_callocSingleton(num, size)
  ------------------
 1450|     17|    if(!cm)
  ------------------
  |  Branch (1450:8): [True: 0, False: 17]
  ------------------
 1451|      0|        return NULL;
 1452|       |
 1453|     17|    cm->cm.eventSource.eventSourceType = UA_EVENTSOURCETYPE_CONNECTIONMANAGER;
 1454|     17|    UA_String_copy(&eventSourceName, &cm->cm.eventSource.name);
 1455|     17|    cm->cm.eventSource.start = (UA_StatusCode (*)(UA_EventSource *))UDP_eventSourceStart;
 1456|     17|    cm->cm.eventSource.stop = (void (*)(UA_EventSource *))UDP_eventSourceStop;
 1457|     17|    cm->cm.eventSource.free = (UA_StatusCode (*)(UA_EventSource *))UDP_eventSourceDelete;
 1458|     17|    cm->cm.protocol = UA_STRING((char*)(uintptr_t)udpName);
 1459|     17|    cm->cm.openConnection = UDP_openConnection;
 1460|     17|    cm->cm.allocNetworkBuffer = UA_EventLoopPOSIX_allocNetworkBuffer;
 1461|     17|    cm->cm.freeNetworkBuffer = UA_EventLoopPOSIX_freeNetworkBuffer;
 1462|     17|    cm->cm.sendWithConnection = UDP_sendWithConnection;
 1463|     17|    cm->cm.closeConnection = UDP_shutdownConnection;
 1464|     17|    return &cm->cm;
 1465|     17|}
eventloop_posix_udp.c:UDP_eventSourceDelete:
 1427|     17|UDP_eventSourceDelete(UA_ConnectionManager *cm) {
 1428|     17|    UA_POSIXConnectionManager *pcm = (UA_POSIXConnectionManager*)cm;
 1429|     17|    if(cm->eventSource.state >= UA_EVENTSOURCESTATE_STARTING) {
  ------------------
  |  Branch (1429:8): [True: 0, False: 17]
  ------------------
 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|     17|    UA_ByteString_clear(&pcm->rxBuffer);
 1436|     17|    UA_ByteString_clear(&pcm->txBuffer);
 1437|     17|    UA_KeyValueMap_clear(&cm->eventSource.params);
 1438|     17|    UA_String_clear(&cm->eventSource.name);
 1439|     17|    UA_free(cm);
  ------------------
  |  |  351|     17|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1440|       |
 1441|     17|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     17|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 1442|     17|}

__ZIP_ITER:
  197|     17|           void *context, void *elm) {
  198|     17|    if(!elm)
  ------------------
  |  Branch (198:8): [True: 17, False: 0]
  ------------------
  199|     17|        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|     17|name##_ZIP_FIND(struct name *head, const keytype *key) {                \
  118|     17|    struct type *cur = ZIP_ROOT(head);                                  \
  ------------------
  |  |   69|     17|#define ZIP_ROOT(head) (head)->root
  ------------------
  119|     17|    while(cur) {                                                        \
  ------------------
  |  Branch (119:11): [True: 0, False: 17]
  ------------------
  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|     17|    return cur;                                                         \
  129|     17|}                                                                       \

eventloop_posix.c:UA_LOG_TRACE:
   75|     17|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|     17|    (void) logger;
   84|     17|    (void) category;
   85|     17|    (void) msg;
   86|     17|#endif
   87|     17|}

UA_mbedTLS_LoadLocalCertificate:
  666|     17|                                UA_ByteString *target) {
  667|     17|    UA_ByteString data = UA_mbedTLS_CopyDataFormatAware(certData);
  668|     17|    if(!data.data) {
  ------------------
  |  Branch (668:8): [True: 17, False: 0]
  ------------------
  669|     17|        UA_ByteString_init(target);
  670|     17|        return UA_STATUSCODE_BADINTERNALERROR;
  ------------------
  |  |   28|     17|#define UA_STATUSCODE_BADINTERNALERROR ((UA_StatusCode) 0x80020000)
  ------------------
  671|     17|    }
  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|     17|}
UA_mbedTLS_CopyDataFormatAware:
  697|     17|UA_mbedTLS_CopyDataFormatAware(const UA_ByteString *data) {
  698|     17|    UA_ByteString result;
  699|     17|    UA_ByteString_init(&result);
  700|       |
  701|     17|    if (!data->length)
  ------------------
  |  Branch (701:9): [True: 17, False: 0]
  ------------------
  702|     17|        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|     17|void UA_CertificateGroup_AcceptAll(UA_CertificateGroup *certGroup) {
   24|       |    /* Clear the structure, as it may have already been initialized. */
   25|     17|    UA_NodeId groupId = certGroup->certificateGroupId;
   26|     17|    if(certGroup->clear)
  ------------------
  |  Branch (26:8): [True: 0, False: 17]
  ------------------
   27|      0|        certGroup->clear(certGroup);
   28|     17|    UA_NodeId_copy(&groupId, &certGroup->certificateGroupId);
   29|     17|    certGroup->verifyCertificate = verifyCertificateAllowAll;
   30|     17|    certGroup->clear = clearVerifyAllowAll;
   31|     17|    certGroup->getTrustList = NULL;
   32|     17|    certGroup->setTrustList = NULL;
   33|     17|    certGroup->addToTrustList = NULL;
   34|     17|    certGroup->removeFromTrustList = NULL;
   35|     17|    certGroup->getRejectedList = NULL;
   36|       |    certGroup->getCertificateCrls = NULL;
   37|     17|}
ua_certificategroup_none.c:clearVerifyAllowAll:
   19|     17|clearVerifyAllowAll(UA_CertificateGroup *certGroup) {
   20|       |
   21|     17|}

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

UA_Client_new:
 1980|     17|UA_Client * UA_Client_new(void) {
 1981|     17|    UA_ClientConfig config;
 1982|     17|    memset(&config, 0, sizeof(UA_ClientConfig));
 1983|       |    /* Set up basic usable config including logger and event loop */
 1984|     17|    UA_StatusCode res = UA_ClientConfig_setDefault(&config);
 1985|     17|    if(res != UA_STATUSCODE_GOOD)
  ------------------
  |  |   16|     17|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (1985:8): [True: 0, False: 17]
  ------------------
 1986|      0|        return NULL;
 1987|     17|    return UA_Client_newWithConfig(&config);
 1988|     17|}
UA_ClientConfig_setDefault:
 2058|     34|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|     34|    if(config->timeout == 0)
  ------------------
  |  Branch (2075:8): [True: 17, False: 17]
  ------------------
 2076|     17|        config->timeout = 5 * 1000; /* 5 seconds */
 2077|     34|    if(config->secureChannelLifeTime == 0)
  ------------------
  |  Branch (2077:8): [True: 17, False: 17]
  ------------------
 2078|     17|        config->secureChannelLifeTime = 10 * 60 * 1000; /* 10 minutes */
 2079|       |
 2080|     34|    if(config->logging == NULL)
  ------------------
  |  Branch (2080:8): [True: 17, False: 17]
  ------------------
 2081|     17|        config->logging = UA_Log_Stdout_new(UA_LOGLEVEL_INFO);
 2082|       |
 2083|       |    /* EventLoop */
 2084|     34|    if(config->eventLoop == NULL) {
  ------------------
  |  Branch (2084:8): [True: 17, False: 17]
  ------------------
 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|     17|        config->eventLoop = UA_EventLoop_new_POSIX(config->logging);
 2091|     17|#endif
 2092|     17|        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|     17|        UA_ConnectionManager *tcpCM =
 2103|     17|            UA_ConnectionManager_new_POSIX_TCP(UA_STRING("tcp connection manager"));
 2104|     17|#endif
 2105|     17|        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|     17|        UA_ConnectionManager *udpCM =
 2115|     17|            UA_ConnectionManager_new_POSIX_UDP(UA_STRING("udp connection manager"));
 2116|     17|        config->eventLoop->registerEventSource(config->eventLoop, (UA_EventSource *)udpCM);
 2117|     17|#endif
 2118|       |
 2119|     17|#if !defined(UA_ARCHITECTURE_ZEPHYR) && !defined(UA_ARCHITECTURE_LWIP)
 2120|       |        /* Add the interrupt manager */
 2121|     17|        UA_InterruptManager *im = UA_InterruptManager_new_POSIX(UA_STRING("interrupt manager"));
 2122|     17|        if(im) {
  ------------------
  |  Branch (2122:12): [True: 17, False: 0]
  ------------------
 2123|     17|            config->eventLoop->registerEventSource(config->eventLoop, &im->eventSource);
 2124|     17|        } 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|     17|#endif
 2129|     17|    }
 2130|       |
 2131|     34|    if(config->localConnectionConfig.recvBufferSize == 0)
  ------------------
  |  Branch (2131:8): [True: 17, False: 17]
  ------------------
 2132|     17|        config->localConnectionConfig = UA_ConnectionConfig_default;
 2133|       |
 2134|     34|    if(!config->certificateVerification.logging) {
  ------------------
  |  Branch (2134:8): [True: 17, False: 17]
  ------------------
 2135|     17|        config->certificateVerification.logging = config->logging;
 2136|     17|    }
 2137|       |
 2138|     34|#ifdef UA_ENABLE_ENCRYPTION
 2139|       |    /* Limits for TrustList */
 2140|     34|    config->maxTrustListSize = 0;
 2141|     34|    config->maxRejectedListSize = 0;
 2142|     34|#endif
 2143|       |
 2144|     34|    if(!config->certificateVerification.verifyCertificate) {
  ------------------
  |  Branch (2144:8): [True: 17, False: 17]
  ------------------
 2145|       |        /* Certificate Verification that accepts every certificate. Can be
 2146|       |         * overwritten when the policy is specialized. */
 2147|     17|        UA_CertificateGroup_AcceptAll(&config->certificateVerification);
 2148|     17|    }
 2149|       |
 2150|       |    /* With encryption enabled, the applicationUri needs to match the URI from
 2151|       |     * the certificate */
 2152|     34|    if(!config->clientDescription.applicationUri.data)
  ------------------
  |  Branch (2152:8): [True: 17, False: 17]
  ------------------
 2153|     17|        config->clientDescription.applicationUri = UA_STRING_ALLOC(APPLICATION_URI);
  ------------------
  |  |  220|     17|#define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
  ------------------
 2154|     34|    if(config->clientDescription.applicationType == 0)
  ------------------
  |  Branch (2154:8): [True: 17, False: 17]
  ------------------
 2155|     17|        config->clientDescription.applicationType = UA_APPLICATIONTYPE_CLIENT;
 2156|       |
 2157|     34|    if(config->securityPoliciesSize == 0) {
  ------------------
  |  Branch (2157:8): [True: 17, False: 17]
  ------------------
 2158|     17|        config->securityPolicies = (UA_SecurityPolicy*)UA_malloc(sizeof(UA_SecurityPolicy));
  ------------------
  |  |  350|     17|# define UA_malloc(size) UA_mallocSingleton(size)
  ------------------
 2159|     17|        if(!config->securityPolicies)
  ------------------
  |  Branch (2159:12): [True: 0, False: 17]
  ------------------
 2160|      0|            return UA_STATUSCODE_BADOUTOFMEMORY;
  ------------------
  |  |   31|      0|#define UA_STATUSCODE_BADOUTOFMEMORY ((UA_StatusCode) 0x80030000)
  ------------------
 2161|     17|        UA_StatusCode retval = UA_SecurityPolicy_None(config->securityPolicies,
 2162|     17|                                                      UA_BYTESTRING_NULL, config->logging);
 2163|     17|        if(retval != UA_STATUSCODE_GOOD) {
  ------------------
  |  |   16|     17|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
  |  Branch (2163:12): [True: 0, False: 17]
  ------------------
 2164|      0|            UA_free(config->securityPolicies);
  ------------------
  |  |  351|      0|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 2165|      0|            config->securityPolicies = NULL;
 2166|      0|            return retval;
 2167|      0|        }
 2168|     17|        config->securityPoliciesSize = 1;
 2169|     17|    }
 2170|       |
 2171|     34|    if(config->requestedSessionTimeout == 0)
  ------------------
  |  Branch (2171:8): [True: 17, False: 17]
  ------------------
 2172|     17|        config->requestedSessionTimeout = 1200000;
 2173|       |
 2174|     34|#ifdef UA_ENABLE_SUBSCRIPTIONS
 2175|     34|    if(config->outStandingPublishRequests == 0)
  ------------------
  |  Branch (2175:8): [True: 17, False: 17]
  ------------------
 2176|     17|        config->outStandingPublishRequests = 10;
 2177|     34|#endif
 2178|       |
 2179|     34|    return UA_STATUSCODE_GOOD;
  ------------------
  |  |   16|     34|#define UA_STATUSCODE_GOOD ((UA_StatusCode) 0x00000000)
  ------------------
 2180|     34|}

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

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

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

__Client_Subscriptions_clear:
 1597|     51|__Client_Subscriptions_clear(UA_Client *client) {
 1598|     51|    UA_Client_NotificationsAckNumber *n;
 1599|     51|    UA_Client_NotificationsAckNumber *tmp;
 1600|     51|    LIST_FOREACH_SAFE(n, &client->pendingNotificationsAcks, listEntry, tmp) {
  ------------------
  |  |  195|     51|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     51|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     51|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 51]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     51|        (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);
  ------------------
  |  |  351|      0|# define UA_free(ptr) UA_freeSingleton(ptr)
  ------------------
 1603|      0|    }
 1604|       |
 1605|     51|    UA_Client_Subscription *sub;
 1606|     51|    UA_Client_Subscription *tmps;
 1607|     51|    LIST_FOREACH_SAFE(sub, &client->subscriptions, listEntry, tmps)
  ------------------
  |  |  195|     51|    for ((var) = LIST_FIRST(head);				\
  |  |  ------------------
  |  |  |  |  184|     51|#define	LIST_FIRST(head)		((head)->lh_first)
  |  |  ------------------
  |  |  196|     51|        (var) && ((tvar) = LIST_NEXT(var, field), 1);		\
  |  |  ------------------
  |  |  |  |  187|      0|#define	LIST_NEXT(elm, field)		((elm)->field.le_next)
  |  |  ------------------
  |  |  |  Branch (196:9): [True: 0, False: 51]
  |  |  |  Branch (196:18): [True: 0, False: 0]
  |  |  ------------------
  |  |  197|     51|        (var) = (tvar))
  ------------------
 1608|      0|        __Client_Subscription_deleteInternal(client, sub); /* force local removal */
 1609|       |
 1610|     51|    client->monitoredItemHandles = 0;
 1611|     51|}

UA_SecureChannel_init:
   30|     17|UA_SecureChannel_init(UA_SecureChannel *channel) {
   31|       |    /* Normal linked lists are initialized by zeroing out */
   32|     17|    memset(channel, 0, sizeof(UA_SecureChannel));
   33|       |    TAILQ_INIT(&channel->chunks);
  ------------------
  |  |  457|     17|#define	TAILQ_INIT(head) do {						\
  |  |  458|     17|    (head)->tqh_first = NULL;					\
  |  |  459|     17|    (head)->tqh_last = &(head)->tqh_first;				\
  |  |  460|     17|} while (0)
  |  |  ------------------
  |  |  |  Branch (460:10): [Folded, False: 17]
  |  |  ------------------
  ------------------
   34|     17|}
UA_SecureChannel_isConnected:
  115|     17|UA_SecureChannel_isConnected(UA_SecureChannel *channel) {
  116|     17|    return (channel->state > UA_SECURECHANNELSTATE_CLOSED &&
  ------------------
  |  Branch (116:13): [True: 17, False: 0]
  ------------------
  117|     17|            channel->state < UA_SECURECHANNELSTATE_CLOSING);
  ------------------
  |  Branch (117:13): [True: 17, False: 0]
  ------------------
  118|     17|}
UA_SecureChannel_deleteBuffered:
  173|     17|UA_SecureChannel_deleteBuffered(UA_SecureChannel *channel) {
  174|     17|    deleteChunks(channel);
  175|     17|    if(channel->unprocessedCopied)
  ------------------
  |  Branch (175:8): [True: 0, False: 17]
  ------------------
  176|      0|        UA_ByteString_clear(&channel->unprocessed);
  177|     17|}
UA_SecureChannel_clear:
  196|     17|UA_SecureChannel_clear(UA_SecureChannel *channel) {
  197|       |    /* No sessions must be attached to this any longer */
  198|     17|    UA_assert(channel->sessions == NULL);
  ------------------
  |  |  411|     17|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (198:5): [True: 17, False: 0]
  ------------------
  199|       |
  200|       |    /* Delete the channel context for the security policy */
  201|     17|    UA_SecurityPolicy *sp = channel->securityPolicy;
  202|     17|    if(sp) {
  ------------------
  |  Branch (202:8): [True: 0, False: 17]
  ------------------
  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|     17|    if(channel->connectionManager &&
  ------------------
  |  Branch (209:8): [True: 0, False: 17]
  ------------------
  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|     17|    channel->connectionId = 0;
  217|     17|    channel->connectionManager = NULL;
  218|       |
  219|       |    /* Clean up the SecurityToken */
  220|     17|    UA_ChannelSecurityToken_clear(&channel->securityToken);
  221|     17|    UA_ChannelSecurityToken_clear(&channel->altSecurityToken);
  222|       |
  223|       |    /* Clean up certificate and nonces */
  224|     17|    UA_ByteString_clear(&channel->remoteCertificate);
  225|     17|    UA_ByteString_clear(&channel->localNonce);
  226|     17|    UA_ByteString_clear(&channel->remoteNonce);
  227|       |
  228|       |    /* Clean up endpointUrl and remoteAddress */
  229|     17|    UA_String_clear(&channel->endpointUrl);
  230|     17|    UA_String_clear(&channel->remoteAddress);
  231|       |
  232|       |    /* Delete remaining chunks */
  233|     17|    UA_SecureChannel_deleteBuffered(channel);
  234|       |
  235|       |    /* Clean up namespace mapping */
  236|     17|    UA_NamespaceMapping_delete(channel->namespaceMapping);
  237|     17|    channel->namespaceMapping = NULL;
  238|       |
  239|       |    /* Reset the SecureChannel for reuse (in the client) */
  240|     17|    channel->securityMode = UA_MESSAGESECURITYMODE_INVALID;
  241|     17|    channel->shutdownReason = UA_SHUTDOWNREASON_CLOSE;
  242|     17|    memset(&channel->config, 0, sizeof(UA_ConnectionConfig));
  243|     17|    channel->receiveSequenceNumber = 0;
  244|     17|    channel->sendSequenceNumber = 0;
  245|       |
  246|       |    /* Set the state to closed */
  247|     17|    channel->state = UA_SECURECHANNELSTATE_CLOSED;
  248|     17|    channel->renewState = UA_SECURECHANNELRENEWSTATE_NORMAL;
  249|     17|}
ua_securechannel.c:deleteChunks:
  162|     17|deleteChunks(UA_SecureChannel *channel) {
  163|     17|    UA_Chunk *chunk, *chunk_tmp;
  164|     17|    TAILQ_FOREACH_SAFE(chunk, &channel->chunks, pointers, chunk_tmp) {
  ------------------
  |  |  437|     17|    for ((var) = TAILQ_FIRST(head);					\
  |  |  ------------------
  |  |  |  |  420|     17|#define	TAILQ_FIRST(head)		((head)->tqh_first)
  |  |  ------------------
  |  |  438|     17|        (var) != TAILQ_END(head) &&					\
  |  |  ------------------
  |  |  |  |  421|     34|#define	TAILQ_END(head)			NULL
  |  |  ------------------
  |  |  |  Branch (438:9): [True: 0, False: 17]
  |  |  ------------------
  |  |  439|     17|        ((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|     17|        (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|     17|    channel->chunksCount = 0;
  169|     17|    channel->chunksLength = 0;
  170|     17|}

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

UA_KeyValueMap_clear:
  546|     51|UA_KeyValueMap_clear(UA_KeyValueMap *map) {
  547|     51|    if(!map)
  ------------------
  |  Branch (547:8): [True: 0, False: 51]
  ------------------
  548|      0|        return;
  549|     51|    if(map->mapSize > 0) {
  ------------------
  |  Branch (549:8): [True: 0, False: 51]
  ------------------
  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|     51|}

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

fuzz_client.cc:_ZL19UA_ByteString_clearP9UA_String:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ByteString_clear:
  222|     51|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_ChannelSecurityToken_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securechannel.c:UA_String_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_INIT:
  502|     17|UA_LOCK_INIT(UA_Lock *lock) {
  503|     17|    pthread_mutexattr_t mattr;
  504|     17|    pthread_mutexattr_init(&mattr);
  505|     17|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  506|     17|    pthread_mutex_init(&lock->mutex, &mattr);
  507|     17|    pthread_mutexattr_destroy(&mattr);
  508|     17|    lock->count = 0;
  509|     17|}
ua_client.c:UA_ApplicationDescription_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_String_clear:
  222|    102|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ExtensionObject_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_EndpointDescription_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_UserTokenPolicy_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_ByteString_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client.c:UA_LOCK_DESTROY:
  512|     17|UA_LOCK_DESTROY(UA_Lock *lock) {
  513|     17|    UA_assert(lock->count == 0);
  ------------------
  |  |  411|     17|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (513:5): [True: 17, False: 0]
  ------------------
  514|     17|    pthread_mutex_destroy(&lock->mutex);
  515|     17|}
ua_client.c:UA_LOCK_ASSERT:
  530|     34|UA_LOCK_ASSERT(UA_Lock *lock) {
  531|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  411|     34|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (531:5): [True: 34, False: 0]
  ------------------
  532|     34|}
ua_client.c:UA_LOCK:
  518|     51|UA_LOCK(UA_Lock *lock) {
  519|     51|    pthread_mutex_lock(&lock->mutex);
  520|     51|    lock->count++;
  521|     51|}
ua_client.c:UA_UNLOCK:
  524|     51|UA_UNLOCK(UA_Lock *lock) {
  525|     51|    lock->count--;
  526|     51|    pthread_mutex_unlock(&lock->mutex);
  527|     51|}
ua_client_connect.c:UA_String_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_NodeId_clear:
  222|     68|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_ByteString_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_EndpointDescription_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionResponse_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_client_connect.c:UA_CloseSessionRequest_init:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_certificategroup_none.c:UA_NodeId_copy:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
ua_securitypolicy_none.c:UA_ByteString_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
timer.c:UA_LOCK_INIT:
  502|     17|UA_LOCK_INIT(UA_Lock *lock) {
  503|     17|    pthread_mutexattr_t mattr;
  504|     17|    pthread_mutexattr_init(&mattr);
  505|     17|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  506|     17|    pthread_mutex_init(&lock->mutex, &mattr);
  507|     17|    pthread_mutexattr_destroy(&mattr);
  508|     17|    lock->count = 0;
  509|     17|}
timer.c:UA_LOCK:
  518|     34|UA_LOCK(UA_Lock *lock) {
  519|     34|    pthread_mutex_lock(&lock->mutex);
  520|     34|    lock->count++;
  521|     34|}
timer.c:UA_UNLOCK:
  524|     34|UA_UNLOCK(UA_Lock *lock) {
  525|     34|    lock->count--;
  526|     34|    pthread_mutex_unlock(&lock->mutex);
  527|     34|}
timer.c:UA_LOCK_DESTROY:
  512|     17|UA_LOCK_DESTROY(UA_Lock *lock) {
  513|     17|    UA_assert(lock->count == 0);
  ------------------
  |  |  411|     17|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (513:5): [True: 17, False: 0]
  ------------------
  514|     17|    pthread_mutex_destroy(&lock->mutex);
  515|     17|}
eventloop_posix.c:UA_LOCK_INIT:
  502|     17|UA_LOCK_INIT(UA_Lock *lock) {
  503|     17|    pthread_mutexattr_t mattr;
  504|     17|    pthread_mutexattr_init(&mattr);
  505|     17|    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
  506|     17|    pthread_mutex_init(&lock->mutex, &mattr);
  507|     17|    pthread_mutexattr_destroy(&mattr);
  508|     17|    lock->count = 0;
  509|     17|}
eventloop_posix.c:UA_LOCK_ASSERT:
  530|     17|UA_LOCK_ASSERT(UA_Lock *lock) {
  531|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  411|     17|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (531:5): [True: 17, False: 0]
  ------------------
  532|     17|}
eventloop_posix.c:UA_LOCK_DESTROY:
  512|     17|UA_LOCK_DESTROY(UA_Lock *lock) {
  513|     17|    UA_assert(lock->count == 0);
  ------------------
  |  |  411|     17|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (513:5): [True: 17, False: 0]
  ------------------
  514|     17|    pthread_mutex_destroy(&lock->mutex);
  515|     17|}
eventloop_posix.c:UA_UNLOCK:
  524|    170|UA_UNLOCK(UA_Lock *lock) {
  525|    170|    lock->count--;
  526|    170|    pthread_mutex_unlock(&lock->mutex);
  527|    170|}
eventloop_posix.c:UA_LOCK:
  518|    170|UA_LOCK(UA_Lock *lock) {
  519|    170|    pthread_mutex_lock(&lock->mutex);
  520|    170|    lock->count++;
  521|    170|}
eventloop_posix_tcp.c:UA_String_copy:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_String_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_tcp.c:UA_ByteString_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_copy:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_ByteString_clear:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_udp.c:UA_String_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_String_copy:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
eventloop_posix_interrupt.c:UA_LOCK_ASSERT:
  530|     17|UA_LOCK_ASSERT(UA_Lock *lock) {
  531|       |    UA_assert(lock->count > 0);
  ------------------
  |  |  411|     17|# define UA_assert(ignore) assert(ignore)
  ------------------
  |  Branch (531:5): [True: 17, False: 0]
  ------------------
  532|     17|}
eventloop_posix_interrupt.c:UA_String_clear:
  222|     17|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl
securitypolicy_common.c:UA_ByteString_init:
  222|     34|# define UA_INLINABLE(decl, impl) static UA_INLINE decl impl

